The Route Preview That Sent Traffic to the Default Gateway
### P2 · The preview chose the wrong egress The offline route preview sends destination 10.42.7.19 toward internet-edge, even though the table contains its service-network route.
Your task: Fix only select_route() in router.py. Choose the longest matching IPv4 CIDR prefix, then the lowest metric and lexicographically smallest route ID. Preserve full-table validation and do not mutate input.
Investigate: Run python monitor.py and python -m unittest -v. The authored replay must select service / service-net. Check non-octet prefixes, /0, /32, boundaries, ties, no match and invalid trailing rows. Open a PR against main explaining why table order cannot change the answer.
This is a deterministic backend routing-preview exercise, not a live router. No packets or OS network changes occur. BGP, ECMP, administrative distance and real reachability are out of scope.
Skills you'll prove
Interview Tip
I separated membership from ranking: a route must cover the IPv4 destination, then prefix length outranks metric and a stable ID tie-break. I validated every row before selecting and tested non-octet boundaries and shuffled tables. Selection scans n routes in O(n) time; the supplied validator uses O(n) space.