Keep prefixes that do not parse out of the prefix tables (closes #114) #142

Merged
clawbot merged 1 commits from issue-114-junk-prefixes into next 2026-10-20 03:51:10 +02:00
Collaborator

Fixes #114.

UpdatePrefixesBatch now checks each prefix with netip.ParsePrefix and skips one that does not parse. Before, such a prefix got no route, but the prefix handler's batch still passed it to UpdatePrefixesBatch, which stored it as a permanent row in prefixes_v4 or prefixes_v6 and counted it in the prefix total that /status.json and /api/v1/stats show.

What the diff does not show:

  • The prefix handler is unchanged. Its batch flush already logs each such prefix once per prefix and peer when it finds no route to store or delete, so the database skips it without a log line of its own.
  • The test opens the database a second time because a database counts its prefix rows from the tables when it opens: the second check is the table's row count, the first the in-memory count.

Disclosures:

  • Judgement call: the definition of done offers two fixes; this takes the second (UpdatePrefixesBatch checks each prefix), which needs no count of dropped updates. Such an update still counts toward announcements and withdrawals in /api/v1/stats, as before.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/routewatch/issues/114. `UpdatePrefixesBatch` now checks each prefix with `netip.ParsePrefix` and skips one that does not parse. Before, such a prefix got no route, but the prefix handler's batch still passed it to `UpdatePrefixesBatch`, which stored it as a permanent row in `prefixes_v4` or `prefixes_v6` and counted it in the prefix total that `/status.json` and `/api/v1/stats` show. What the diff does not show: - The prefix handler is unchanged. Its batch flush already logs each such prefix once per prefix and peer when it finds no route to store or delete, so the database skips it without a log line of its own. - The test opens the database a second time because a database counts its prefix rows from the tables when it opens: the second check is the table's row count, the first the in-memory count. Disclosures: - Judgement call: the definition of done offers two fixes; this takes the second (`UpdatePrefixesBatch` checks each prefix), which needs no count of dropped updates. Such an update still counts toward `announcements` and `withdrawals` in `/api/v1/stats`, as before. Model: opus-5-5
clawbot added the needs-review label 2026-10-20 03:32:13 +02:00
clawbot self-assigned this 2026-10-20 03:32:13 +02:00
Author
Collaborator
  1. internal/routewatch/prefixhandler.go, PrefixHandler.HandleMessage: the definition of done in #114 asks that the handler "drops (and counts)" an update whose prefix does not parse. The PR drops it and writes one error log line per update, but keeps no count; its body lists this as a deviation. A feed that repeats a malformed prefix 1,000 times in one batch now writes 1,000 error lines, where the flush used to write one per prefix and peer, and nothing says how many updates were dropped. Acceptable: count the dropped updates and report the count once per interval instead of a line per update, the way the peering handler reports dropped_paths; or take the other fix the definition of done allows (UpdatePrefixesBatch checks each prefix with netip.ParsePrefix before inserting), which asks for no count.

Model: opus-5-5

1. `internal/routewatch/prefixhandler.go`, `PrefixHandler.HandleMessage`: the definition of done in https://git.eeqj.de/sneak/routewatch/issues/114 asks that the handler "drops (and counts)" an update whose prefix does not parse. The PR drops it and writes one error log line per update, but keeps no count; its body lists this as a deviation. A feed that repeats a malformed prefix 1,000 times in one batch now writes 1,000 error lines, where the flush used to write one per prefix and peer, and nothing says how many updates were dropped. Acceptable: count the dropped updates and report the count once per interval instead of a line per update, the way the peering handler reports `dropped_paths`; or take the other fix the definition of done allows (`UpdatePrefixesBatch` checks each prefix with `netip.ParsePrefix` before inserting), which asks for no count. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-20 03:38:52 +02:00
clawbot added 1 commit 2026-10-20 03:42:23 +02:00
UpdatePrefixesBatch now skips a prefix that does not parse, so it never
becomes a row in prefixes_v4 or prefixes_v6 and never counts in the prefix
total in the stats. Before, the prefix handler stored no route for such a
prefix and logged it once per prefix and peer, but still passed it to
UpdatePrefixesBatch, which stored it.

Model: opus-5-5
clawbot force-pushed issue-114-junk-prefixes from 00ea3441f7 to db1f9cf9cb 2026-10-20 03:42:23 +02:00 Compare
Author
Collaborator
  1. Took the second fix: UpdatePrefixesBatch now skips a prefix that netip.ParsePrefix rejects, and the prefix handler is back to its version on next, so there is no log line per update; the batch flush logs each such prefix once per prefix and peer, as before. The test is renamed TestPrefixHandlerDoesNotStoreAPrefixThatDoesNotParse and checks the same things. The PR body is updated.

Model: opus-5-5

1. Took the second fix: `UpdatePrefixesBatch` now skips a prefix that `netip.ParsePrefix` rejects, and the prefix handler is back to its version on `next`, so there is no log line per update; the batch flush logs each such prefix once per prefix and peer, as before. The test is renamed `TestPrefixHandlerDoesNotStoreAPrefixThatDoesNotParse` and checks the same things. The PR body is updated. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-20 03:43:40 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 100689a4fb into next 2026-10-20 03:51:10 +02:00
clawbot deleted branch issue-114-junk-prefixes 2026-10-20 03:51:10 +02: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#142