{"abstract":"Longest prefix route wins over first matching route.","category":"Network routing","checks":4,"contract":"Bounded offline decision model: longest prefix route wins over first matching route. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.","evaluation_group":"xh-longest-prefix-route-wins-over-first-matching-route","failed_approach":"The attempted repair uses `max(routes,key=lambda r:ipaddress.ip_network(r).prefixlen) if routes else None` and still violates a separate fixture.","family":"xh-longest-prefix-route-wins-over-first-matching-route","id":"FA-7081","implementations":{"attempt":{"sha256":"1501e8e5560b3771d344d1a5365e4b35bc2458da3b968f4443cd575ad7faf454","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport ipaddress\nimport re\nfrom urllib.parse import urlsplit, urljoin\nN = 1\nobservations = []\ndef solve(address, routes):\n    return max(routes,key=lambda r:ipaddress.ip_network(r).prefixlen) if routes else None\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_fixtures = [\"check('fixture 1', solve('10.1.2.3', ['0.0.0.0/0', '10.0.0.0/8']), '10.0.0.0/8')\", \"check('fixture 2', solve('192.0.2.1', ['10.0.0.0/8']), None)\", \"check('fixture 3', solve('10.1.2.3', []), None)\", \"check('fixture 4', solve('10.1.2.3', ['10.0.0.0/8']), '10.0.0.0/8')\"]\nfor _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:\n    exec(_line)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"32fc2d78b43a6efe923907267abc42fb18c64e4cb8bc4b5cdf6088da3a99b464","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport ipaddress\nimport re\nfrom urllib.parse import urlsplit, urljoin\nN = 1\nobservations = []\ndef solve(address, routes):\n    return next((r for r in routes if ipaddress.ip_address(address) in ipaddress.ip_network(r)),None)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_fixtures = [\"check('fixture 1', solve('10.1.2.3', ['0.0.0.0/0', '10.0.0.0/8']), '10.0.0.0/8')\", \"check('fixture 2', solve('192.0.2.1', ['10.0.0.0/8']), None)\", \"check('fixture 3', solve('10.1.2.3', []), None)\", \"check('fixture 4', solve('10.1.2.3', ['10.0.0.0/8']), '10.0.0.0/8')\"]\nfor _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:\n    exec(_line)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"ab427c182d93a30860ff39422844de6c5dd8244b3adb043dc2c29ba63a2cffb9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport ipaddress\nimport re\nfrom urllib.parse import urlsplit, urljoin\nN = 1\nobservations = []\ndef solve(address, routes):\n    return max((r for r in routes if ipaddress.ip_address(address) in ipaddress.ip_network(r)), key=lambda r:ipaddress.ip_network(r).prefixlen, default=None)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_fixtures = [\"check('fixture 1', solve('10.1.2.3', ['0.0.0.0/0', '10.0.0.0/8']), '10.0.0.0/8')\", \"check('fixture 2', solve('192.0.2.1', ['10.0.0.0/8']), None)\", \"check('fixture 3', solve('10.1.2.3', []), None)\", \"check('fixture 4', solve('10.1.2.3', ['10.0.0.0/8']), '10.0.0.0/8')\"]\nfor _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:\n    exec(_line)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Bounded deterministic policy model over validated inputs; not a complete protocol stack or an interoperability claim. The five variants rotate the same explicit fixture set. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"xh-longest-prefix-route-wins-over-first-matching-route","generated_at":"2026-09-29T14:38:08.102411+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"This deterministic network routing model isolates the longest-prefix-route-wins-over-first-matching-route policy at a network component boundary.","repair":"Apply the explicit longest-prefix-route-wins-over-first-matching-route contract, including the tested boundary and negative cases.","root_cause":"The faulty implementation uses `next((r for r in routes if ipaddress.ip_address(address) in ipaddress.ip_network(r)),None)` for the longest-prefix-route-wins-over-first-matching-route decision.","sha256":"fd87177df7608b88e2856ea10dfc427fc871ae99e6a2fe4656bc584474168d92","title":"Longest prefix route wins over first matching route · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":35.528,"exit_code":1,"observations":[{"actual":"10.0.0.0/8","check":"fixture 2","expected":null,"passed":false},{"actual":null,"check":"fixture 3","expected":null,"passed":true},{"actual":"10.0.0.0/8","check":"fixture 4","expected":"10.0.0.0/8","passed":true},{"actual":"10.0.0.0/8","check":"fixture 1","expected":"10.0.0.0/8","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 2\", \"actual\": \"10.0.0.0/8\", \"expected\": null, \"passed\": false}, {\"check\": \"fixture 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"fixture 4\", \"actual\": \"10.0.0.0/8\", \"expected\": \"10.0.0.0/8\", \"passed\": true}, {\"check\": \"fixture 1\", \"actual\": \"10.0.0.0/8\", \"expected\": \"10.0.0.0/8\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":33.741,"exit_code":1,"observations":[{"actual":null,"check":"fixture 2","expected":null,"passed":true},{"actual":null,"check":"fixture 3","expected":null,"passed":true},{"actual":"10.0.0.0/8","check":"fixture 4","expected":"10.0.0.0/8","passed":true},{"actual":"0.0.0.0/0","check":"fixture 1","expected":"10.0.0.0/8","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 2\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"fixture 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"fixture 4\", \"actual\": \"10.0.0.0/8\", \"expected\": \"10.0.0.0/8\", \"passed\": true}, {\"check\": \"fixture 1\", \"actual\": \"0.0.0.0/0\", \"expected\": \"10.0.0.0/8\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.933,"exit_code":0,"observations":[{"actual":null,"check":"fixture 2","expected":null,"passed":true},{"actual":null,"check":"fixture 3","expected":null,"passed":true},{"actual":"10.0.0.0/8","check":"fixture 4","expected":"10.0.0.0/8","passed":true},{"actual":"10.0.0.0/8","check":"fixture 1","expected":"10.0.0.0/8","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 2\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"fixture 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"fixture 4\", \"actual\": \"10.0.0.0/8\", \"expected\": \"10.0.0.0/8\", \"passed\": true}, {\"check\": \"fixture 1\", \"actual\": \"10.0.0.0/8\", \"expected\": \"10.0.0.0/8\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}