List an AS's prefixes by mask length, shortest first (closes #153) #181

Merged
clawbot merged 1 commits from issue-153-prefix-length-order into next 2026-10-27 04:37:18 +01:00
Collaborator

The AS page now lists its IPv4 prefixes and its IPv6 prefixes by mask length, shortest first, so a /16 comes before a /24. Prefixes with the same mask length are listed by network address. Before, both lists were sorted by network address, then by mask length.

The sort function in internal/server/handlers.go is renamed from sortRoutesByNetwork to sortRoutesByMaskLength. A new test sorts a mixed IPv4 list and a mixed IPv6 list.

  • Judgement call: the JSON answer of /api/v1/as/{asn} is unchanged. Its handler does not sort, so its lists keep the order the database reads them in. The page and the API list prefixes in different orders.
  • The README states no order for the AS page, so it is unchanged.
  • A prefix that does not parse sorts before the others instead of failing the page. Stored prefixes always parse.

Closes #153

Model: opus-5-5

The AS page now lists its IPv4 prefixes and its IPv6 prefixes by mask length, shortest first, so a /16 comes before a /24. Prefixes with the same mask length are listed by network address. Before, both lists were sorted by network address, then by mask length. The sort function in `internal/server/handlers.go` is renamed from `sortRoutesByNetwork` to `sortRoutesByMaskLength`. A new test sorts a mixed IPv4 list and a mixed IPv6 list. - Judgement call: the JSON answer of `/api/v1/as/{asn}` is unchanged. Its handler does not sort, so its lists keep the order the database reads them in. The page and the API list prefixes in different orders. - The README states no order for the AS page, so it is unchanged. - A prefix that does not parse sorts before the others instead of failing the page. Stored prefixes always parse. Closes https://git.eeqj.de/sneak/routewatch/issues/153 Model: opus-5-5
clawbot added the needs-review label 2026-10-27 04:29:41 +01:00
clawbot self-assigned this 2026-10-27 04:29:41 +01:00
clawbot added 1 commit 2026-10-27 04:29:41 +01:00
The AS page sorted its IPv4 and IPv6 prefix lists by network address,
then by mask length. It now sorts them by mask length, shortest first,
and by network address within one mask length, so a /16 comes before a
/24. The sort function is renamed from sortRoutesByNetwork to
sortRoutesByMaskLength to say so.

The handler of /api/v1/as/{asn} does not sort its lists, so it is
unchanged.

Model: opus-5-5
Author
Collaborator

PASS: the AS page now lists its IPv4 and IPv6 prefixes by mask length, shortest first, and by numeric network address within one mask length, as #153 asks.

  • Judgement call: the new test checks the sort function, not the AS page itself. I accepted that because the page's call to the function changed only its name.

Model: opus-5-5

PASS: the AS page now lists its IPv4 and IPv6 prefixes by mask length, shortest first, and by numeric network address within one mask length, as https://git.eeqj.de/sneak/routewatch/issues/153 asks. - Judgement call: the new test checks the sort function, not the AS page itself. I accepted that because the page's call to the function changed only its name. Model: opus-5-5
clawbot merged commit 2375480e2e into next 2026-10-27 04:37:18 +01:00
clawbot deleted branch issue-153-prefix-length-order 2026-10-27 04:37:19 +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#181