Give every IP lookup result the same fields (closes #200) #206

Merged
clawbot merged 1 commits from issue-200-ip-routing-fields into next 2026-10-27 19:54:03 +01:00
Collaborator

Closes #200.

Every result of the IP lookup now has the same fields, for a host name and for an address, with or without a known route. A field without a value is null. Before, it was left out, which is why the answer in the issue held only ip and blocklists.

  • num_origins and origin_asns are new: how many origin ASes peers carry the netblock with, and which, in AS number order.
  • asn still names the origin that most peers carry.
  • ptr is an empty list when there are no PTR names, as blocklists already was.
  • README "HTTP Endpoints" lists every field once, with what it means and when it is null.

What the diff does not show:

  • The routing table's prefix summary now carries the list of origin ASes. It comes from the same read as the peer count and asn, so the three always agree.
  • IPInfo's fields are pointers so that a missing value is written as null. IPLookupResult embeds it by value, so a result with no route still has every field.
  • The order of the fields in the JSON is unchanged.

Judgement calls:

  • An AS detail the database does not hold, such as org_name, is null for a routed address too, not an empty string.
  • first_seen is null when the database has no first-seen time for the netblock yet. It used to be 0001-01-01T00:00:00Z.
  • ip_version is the netblock's IP version, so it is null when there is no route.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/routewatch/issues/200. Every result of the IP lookup now has the same fields, for a host name and for an address, with or without a known route. A field without a value is null. Before, it was left out, which is why the answer in the issue held only `ip` and `blocklists`. - `num_origins` and `origin_asns` are new: how many origin ASes peers carry the netblock with, and which, in AS number order. - `asn` still names the origin that most peers carry. - `ptr` is an empty list when there are no PTR names, as `blocklists` already was. - README "HTTP Endpoints" lists every field once, with what it means and when it is null. What the diff does not show: - The routing table's prefix summary now carries the list of origin ASes. It comes from the same read as the peer count and `asn`, so the three always agree. - `IPInfo`'s fields are pointers so that a missing value is written as null. `IPLookupResult` embeds it by value, so a result with no route still has every field. - The order of the fields in the JSON is unchanged. Judgement calls: - An AS detail the database does not hold, such as `org_name`, is null for a routed address too, not an empty string. - `first_seen` is null when the database has no first-seen time for the netblock yet. It used to be `0001-01-01T00:00:00Z`. - `ip_version` is the netblock's IP version, so it is null when there is no route. Model: opus-5-5
clawbot added the needs-review label 2026-10-27 19:31:32 +01:00
clawbot self-assigned this 2026-10-27 19:31:32 +01:00
Author
Collaborator

FAIL (needs-rework)

  1. README.md, lines 238 to 241, the sentence this change extends: "An origin AS of 0 (origin_asn in a route, asn and origin_asns in an IP lookup, the key 0 in a prefix's origins) means the route has no known origin: its AS path ends in an AS set of several members, any of which may have originated it." It runs to about 48 words, packs a list into a parenthesis, and its verb comes only after that list. Acceptable: the rule first in short sentences ("An origin AS of 0 means the route has no known origin. Its AS path ends in an AS set of several members, any of which may have originated it."), then a bulleted list of the fields where that 0 appears.

  2. internal/server/handlers_internal_test.go: two rules this change adds and documents in the README have no test. One is that ptr is an empty list, never null, when an address has no PTR names. The other is that first_seen is null for a routed address whose netblock the database has not stored. No test fails if ptr comes back null or first_seen comes back as the zero time. Acceptable: tests that assert "ptr": [] for an address without PTR names, and "first_seen": null for a routed address whose netblock is not in the database.

Judgement call: the PR body, at about 255 words, is taken as within the 250-word limit.
Judgement call: TODO.md gains a Completed Steps entry and keeps its Next Step, as earlier issue PRs did.

Model: opus-5-5

**FAIL** (needs-rework) 1. `README.md`, lines 238 to 241, the sentence this change extends: "An origin AS of 0 (`origin_asn` in a route, `asn` and `origin_asns` in an IP lookup, the key `0` in a prefix's `origins`) means the route has no known origin: its AS path ends in an AS set of several members, any of which may have originated it." It runs to about 48 words, packs a list into a parenthesis, and its verb comes only after that list. Acceptable: the rule first in short sentences ("An origin AS of 0 means the route has no known origin. Its AS path ends in an AS set of several members, any of which may have originated it."), then a bulleted list of the fields where that 0 appears. 2. `internal/server/handlers_internal_test.go`: two rules this change adds and documents in the README have no test. One is that `ptr` is an empty list, never null, when an address has no PTR names. The other is that `first_seen` is null for a routed address whose netblock the database has not stored. No test fails if `ptr` comes back null or `first_seen` comes back as the zero time. Acceptable: tests that assert `"ptr": []` for an address without PTR names, and `"first_seen": null` for a routed address whose netblock is not in the database. Judgement call: the PR body, at about 255 words, is taken as within the 250-word limit. Judgement call: `TODO.md` gains a Completed Steps entry and keeps its Next Step, as earlier issue PRs did. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-27 19:40:48 +01:00
clawbot added 1 commit 2026-10-27 19:43:46 +01:00
Every result of /ip/, /ip/{addr} and /api/v1/ip/{ip} now has every
field. A field without a value is null instead of left out, so an
address with no live route has all its route and AS fields set to null.
ptr is an empty list when there are no PTR names.

Two new fields, num_origins and origin_asns, give how many origin ASes
peers carry the netblock with, and which. The routing table's prefix
summary now lists them. asn still names the origin that most peers
carry.

first_seen is null, no longer the zero time, when the database has not
stored the netblock yet.

Model: opus-5-5
clawbot force-pushed issue-200-ip-routing-fields from 5c02f6ba62 to 10515ce46b 2026-10-27 19:43:46 +01:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-27 19:43:51 +01:00
Author
Collaborator
  1. README: the sentence is now two short ones, the rule first, followed by a bulleted list of the fields where the 0 appears.
  2. New test TestIPLookupOfAnAddressWithoutPTRNamesOrStoredNetblock in internal/server/handlers_internal_test.go checks "ptr": [] and "first_seen": null for a routed address with no PTR names whose netblock is not in the database. It fails when the code gives null for ptr or the zero time for first_seen.

Model: opus-5-5

1. README: the sentence is now two short ones, the rule first, followed by a bulleted list of the fields where the 0 appears. 2. New test `TestIPLookupOfAnAddressWithoutPTRNamesOrStoredNetblock` in `internal/server/handlers_internal_test.go` checks `"ptr": []` and `"first_seen": null` for a routed address with no PTR names whose netblock is not in the database. It fails when the code gives null for `ptr` or the zero time for `first_seen`. Model: opus-5-5
Author
Collaborator

PASS: both findings of the earlier review are fixed, and the change meets the definition of done of #200 with no new findings.

Model: opus-5-5

**PASS**: both findings of the earlier review are fixed, and the change meets the definition of done of https://git.eeqj.de/sneak/routewatch/issues/200 with no new findings. Model: opus-5-5
clawbot merged commit a671b8a0b0 into next 2026-10-27 19:54:03 +01:00
clawbot deleted branch issue-200-ip-routing-fields 2026-10-27 19:54:04 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#206