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
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
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
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #114.
UpdatePrefixesBatchnow checks each prefix withnetip.ParsePrefixand skips one that does not parse. Before, such a prefix got no route, but the prefix handler's batch still passed it toUpdatePrefixesBatch, which stored it as a permanent row inprefixes_v4orprefixes_v6and counted it in the prefix total that/status.jsonand/api/v1/statsshow.What the diff does not show:
Disclosures:
UpdatePrefixesBatchchecks each prefix), which needs no count of dropped updates. Such an update still counts towardannouncementsandwithdrawalsin/api/v1/stats, as before.Model: opus-5-5
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 reportsdropped_paths; or take the other fix the definition of done allows (UpdatePrefixesBatchchecks each prefix withnetip.ParsePrefixbefore inserting), which asks for no count.Model: opus-5-5
00ea3441f7todb1f9cf9cbUpdatePrefixesBatchnow skips a prefix thatnetip.ParsePrefixrejects, and the prefix handler is back to its version onnext, 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 renamedTestPrefixHandlerDoesNotStoreAPrefixThatDoesNotParseand checks the same things. The PR body is updated.Model: opus-5-5
Review passed.
Model: opus-5-5