FA-7156 / Network routing / Open access
Route rewrite removes only the matched leading prefix · case 01
Route rewrite removes only the matched leading prefix.
ROOT CAUSE
The faulty implementation uses `path.replace(prefix,"") or "/"` for the route-rewrite-removes-only-the-matched-leading-prefix decision.
VERIFIED REPAIR
Apply the explicit route-rewrite-removes-only-the-matched-leading-prefix contract, including the tested boundary and negative cases.
Unsuccessful approach: The attempted repair uses `path.strip(prefix) or "/"` and still violates a separate fixture.
Case contract
Bounded offline decision model: route rewrite removes only the matched leading prefix. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.
Why this case matters
This deterministic network routing model isolates the route-rewrite-removes-only-the-matched-leading-prefix policy at a network component boundary.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(path, prefix):
return path.replace(prefix,"") or "/"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('/api/x/api', '/api'), '/x/api')", "check('fixture 2', solve('/api', '/api'), '/')", "check('fixture 3', solve('/api/a', '/api'), '/a')", "check('fixture 4', solve('/api/', '/api'), '/')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | / | / | Passed |
| fixture 3 | /a | /a | Passed |
| fixture 4 | / | / | Passed |
| fixture 1 | /x | /x/api | Failed |
SHA-256 / 528c630f44794366f2eb73cfd32d662ac2868e40bb2902bbed366a5bcbb65496
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(path, prefix):
return path.strip(prefix) or "/"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('/api/x/api', '/api'), '/x/api')", "check('fixture 2', solve('/api', '/api'), '/')", "check('fixture 3', solve('/api/a', '/api'), '/a')", "check('fixture 4', solve('/api/', '/api'), '/')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | / | / | Passed |
| fixture 3 | / | /a | Failed |
| fixture 4 | / | / | Passed |
| fixture 1 | x | /x/api | Failed |
SHA-256 / 7002b55eadd89d258532ad44cffb10420ab57a76ddf1ea71857b4ce6beaa8e89
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(path, prefix):
return path[len(prefix):] or "/"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('/api/x/api', '/api'), '/x/api')", "check('fixture 2', solve('/api', '/api'), '/')", "check('fixture 3', solve('/api/a', '/api'), '/a')", "check('fixture 4', solve('/api/', '/api'), '/')"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
exec(_line)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | / | / | Passed |
| fixture 3 | /a | /a | Passed |
| fixture 4 | / | / | Passed |
| fixture 1 | /x/api | /x/api | Passed |
SHA-256 / aedf94c9e0f7480c83921edc20aa8dd6f3c306d04e3bbd6946b10461bca50b65
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:38:08.911201+00:00.
Case digest / 14c9a9db9ef374f85d9265a66db3656887f2f633995c78b27f20948c4bf32ef2