Repository navigation
feat(peeringdb): add as_set endpoint (13th table) - #49
Merged
Merged
Conversation
PeeringDB publishes `/api/as_set` as a single `{asn: name}` map rather than
a list of records, so it needs its own parser; it was the one table the
module did not mirror yet. `Peeringdb::as_set` keeps the published strings
verbatim (a value may hold several space-separated names) and `get_as_set`
resolves one ASN. A response that is not one object with integer keys and
string values fails as a PeeringDB data-source error instead of parsing to
an empty table.
`pg_inserter` publishes the map as `peeringdb.as_set` (asn primary key, one
text column, the usual `data_as_of`/`source_revision` provenance) inside the
existing atomic family refresh. It is the one table without `id`/`record`
columns because the string value is the payload. `Peeringdb::new()` now
issues one more API call; `new_networks_only()` is unchanged.
Verified: cargo fmt --check; cargo clippy --all-features -- -D warnings;
cargo test --all-features; cargo test --no-default-features --features
pg-inserter-cli --bin pg_inserter; cargo build --no-default-features
--features peeringdb; and the ignored live check `test_peeringdb_as_set`
against the real endpoint.
digizeph
requested
a balanced review from Copilot
and removed request for
Copilot
October 5, 2026 16:06
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Documentation incorrectly claims complete API and export coverage despite /api/poc being omitted and PeeringDB export remaining unimplemented.
Review effort: Balanced
Findings: 7
Open (7)
API mirror is incomplete without /api/poc support · New “All 13 endpoints” claim omits /api/poc · New Documented export layout lacks an implemented exporter · New Avoid claiming coverage of every PeeringDB endpoint · New Help text overpromises complete PeeringDB endpoint coverage · New Full API mirror claim omits the /api/poc endpoint · New PeeringDB endpoint coverage incorrectly excludes /api/poc · New
What changed in this PR
Adds support for PeeringDB’s /api/as_set map in the library and PostgreSQL loader.
Changes:
- Adds strict AS-set parsing, storage, access, and tests.
- Adds the
peeringdb.as_setsnapshot table. - Updates endpoint-count documentation.
| File | Description |
|---|---|
src/peeringdb/mod.rs |
Implements AS-set loading and access. |
src/peeringdb/client.rs |
Defines the endpoint URL. |
src/lib.rs |
Updates crate documentation. |
src/bin/pg_inserter/peeringdb.rs |
Adds PostgreSQL table and serialization. |
src/bin/pg_inserter/main.rs |
Updates command documentation. |
README.md |
Updates endpoint and export documentation. |
CHANGELOG.md |
Records the new endpoint support. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
PeeringDB also exposes /api/poc, and the peeringdb/irr/rpki exporters are not yet implemented, so scope every coverage claim to the 13 supported endpoints.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation and tests are comprehensive; only a nonblocking documentation wording inconsistency remains.
Review effort: Balanced
Findings: 1
Resolved since last review (7)
PeeringDB endpoint coverage incorrectly excludes /api/poc Full API mirror claim omits the /api/poc endpoint Help text overpromises complete PeeringDB endpoint coverage Avoid claiming coverage of every PeeringDB endpoint Documented export layout lacks an implemented exporter “All 13 endpoints” claim omits /api/poc API mirror is incomplete without /api/poc support
| │ ├── countries/ # Country code mappings | ||
| │ ├── mrt_collectors/ # BGP collector metadata | ||
| │ ├── peeringdb/ # PeeringDB API data (all 12 endpoints) | ||
| │ ├── peeringdb/ # PeeringDB API data (all 13 endpoints) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PeeringDB publishes
/api/as_setas a single{asn: name}map rather than a list of records, so it cannot ride the shared record-list loader; it was the one table the mirror did not cover. This adds it as the thirteenth table, in the library module and in thepg_inserterloader.peeringdbmodule:Peeringdb::as_setkeeps the published strings verbatim (a value may hold several space-separated names), withget_as_set(asn)to resolve one ASN;Peeringdb::new()now fetches the extra endpoint,new_networks_only()is unchanged.datawith integer keys and string values; anything else (empty or multi-elementdata, non-numeric key, non-string value) fails as a PeeringDB data-source error naming the endpoint, so a changed upstream shape fails loudly instead of parsing to an empty table.Loader (
pg_inserter):peeringdb.as_settable (asn primary key, one text column,data_as_of/source_revisionprovenance) inside the existing atomic family refresh. It is the one table withoutid/recordcolumns because the string value is the payload.README, crate docs,CHANGELOG) updated to the 13-endpoint count.Verified locally (cargo 1.97.1):
cargo fmt --check;cargo clippy --all-features -- -D warnings;cargo test --all-features;cargo test --no-default-features --features pg-inserter-cli --bin pg_inserter;cargo build --no-default-features --features peeringdb; and the ignored live checktest_peeringdb_as_setagainst the real endpoint (it loads only/as_set).