FA-95596 / Shipping rate zone lookup / Open access
Injection zone: equal hubs resolved by list order · case 01
Two hubs with the same zone and linehaul are chosen by input order.
ROOT CAUSE
The ranking key omits the hub name.
VERIFIED REPAIR
Break zone and linehaul ties by hub name.
Unsuccessful approach: Keeping the name out of the key and replacing on equality lets the last listed hub win.
Case contract
dest [x, y] and points [[name, x, y, linehaul_cents]] on a mile grid. Distance = straight line rounded up to a whole mile. Zone bands (miles, inclusive upper): 50, 150, 300, 600, 1000, 1400, 1800 -> zones 1-7, beyond -> 8. Choose the point with the lowest zone, then linehaul, then name. Return [name, zone, miles] or None.
Why this case matters
Zone skipping injects parcels at the hub that minimizes delivery zone and linehaul.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(dest, points):
BANDS = [50, 150, 300, 600, 1000, 1400, 1800]
def zone_for(m):
for i, lim in enumerate(BANDS):
if m <= lim:
return i + 1
return 8
best = None
for name, x, y, lh in points:
sq = (x - dest[0]) ** 2 + (y - dest[1]) ** 2
s = math.isqrt(sq)
miles = s + (1 if s * s < sq else 0)
z = zone_for(miles)
key = (z, lh)
if best is None or key < best[0]:
best = (key, [name, z, miles])
return best[1] if best else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 6', [[0, 0], [['PA', 2000, 150, 100], ['OH', 40, 400, 300], ['IL', 290, 40, 300]]], ['IL', 3, 293]], ['generated mix 14', [[0, 3], [['OH', 100, 41, 300], ['NJ', 290, 40, 900], ['TX', 100, 41, 300], ['IL', 100, 1, 100]]], ['IL', 2, 101]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 23', [[0, 0], [['OH', 120, 0, 300], ['OH', 290, 41, 100], ['TX', 30, 41, 300]]], ['OH', 2, 120]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 9', [[-10, 3], [['PA', 120, 1, 900], ['IL', 301, 0, 100], ['IL', 100, 41, 100], ['IL', 0, 0, 900]]], ['IL', 1, 11]], ['generated mix 17', [[5, 3], [['NJ', 301, 0, 900], ['GA', 590, 150, 100], ['PA', 1000, 1, 100], ['TX', 120, 40, 300]]], ['TX', 2, 121]], ['generated mix 26', [[-10, 3], [['PA', 1000, 400, 300], ['PA', 300, 400, 300], ['OH', 300, 400, 100], ['OH', 100, 0, 300]]], ['OH', 2, 111]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 20', [[5, 3], [['GA', 0, 1, 900], ['PA', 120, 400, 300], ['OH', 590, 41, 300], ['OH', 30, 1, 300]]], ['OH', 1, 26]], ['generated mix 28', [[0, 3], [['NJ', 1500, 150, 300]]], ['NJ', 7, 1508]], ['generated mix 36', [[0, 3], [['TX', 1000, 150, 900]]], ['TX', 6, 1011]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 23', [[0, 0], [['OH', 120, 0, 300], ['OH', 290, 41, 100], ['TX', 30, 41, 300]]], ['OH', 2, 120]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 32', [[-10, 0], [['TX', 0, 1, 300], ['TX', 120, 40, 100], ['GA', 40, 400, 900]]], ['TX', 1, 11]], ['generated mix 40', [[-10, 3], [['PA', 300, 1, 300], ['PA', 120, 150, 900]]], ['PA', 3, 197]], ['generated mix 48', [[5, 3], [['PA', 1500, 150, 100], ['PA', 0, 41, 300], ['IL', 2000, 41, 900]]], ['PA', 1, 39]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 42', [[-10, 3], [['GA', 40, 400, 300]]], ['GA', 4, 401]], ['generated mix 51', [[-10, 0], [['NJ', 100, 40, 300], ['IL', 120, 400, 300]]], ['NJ', 2, 118]], ['generated mix 59', [[-10, 0], [['PA', 100, 1, 100], ['OH', 1500, 400, 100]]], ['PA', 2, 111]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| name tiebreak | ['Z', 1, 10] | ['M', 1, 10] | Failed |
| generated mix 50 | ['GA', 3, 286] | ['GA', 3, 286] | Passed |
| exact 50 miles | ['A', 1, 50] | ['A', 1, 50] | Passed |
| linehaul tiebreak | ['B', 2, 120] | ['B', 2, 120] | Passed |
| far | ['A', 8, 2000] | ['A', 8, 2000] | Passed |
| just over | ['A', 2, 51] | ['A', 2, 51] | Passed |
| generated mix 6 | ['IL', 3, 293] | ['IL', 3, 293] | Passed |
| generated mix 14 | ['IL', 2, 101] | ['IL', 2, 101] | Passed |
SHA-256 / 0432ac03822bd07d1ec5d8b7bfd63077e2559201d4e4cf8c6fb1dbf7af674d14
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(dest, points):
BANDS = [50, 150, 300, 600, 1000, 1400, 1800]
def zone_for(m):
for i, lim in enumerate(BANDS):
if m <= lim:
return i + 1
return 8
best = None
for name, x, y, lh in points:
sq = (x - dest[0]) ** 2 + (y - dest[1]) ** 2
s = math.isqrt(sq)
miles = s + (1 if s * s < sq else 0)
z = zone_for(miles)
key = (z, lh)
if best is None or key <= best[0]:
best = (key, [name, z, miles])
return best[1] if best else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 6', [[0, 0], [['PA', 2000, 150, 100], ['OH', 40, 400, 300], ['IL', 290, 40, 300]]], ['IL', 3, 293]], ['generated mix 14', [[0, 3], [['OH', 100, 41, 300], ['NJ', 290, 40, 900], ['TX', 100, 41, 300], ['IL', 100, 1, 100]]], ['IL', 2, 101]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 23', [[0, 0], [['OH', 120, 0, 300], ['OH', 290, 41, 100], ['TX', 30, 41, 300]]], ['OH', 2, 120]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 9', [[-10, 3], [['PA', 120, 1, 900], ['IL', 301, 0, 100], ['IL', 100, 41, 100], ['IL', 0, 0, 900]]], ['IL', 1, 11]], ['generated mix 17', [[5, 3], [['NJ', 301, 0, 900], ['GA', 590, 150, 100], ['PA', 1000, 1, 100], ['TX', 120, 40, 300]]], ['TX', 2, 121]], ['generated mix 26', [[-10, 3], [['PA', 1000, 400, 300], ['PA', 300, 400, 300], ['OH', 300, 400, 100], ['OH', 100, 0, 300]]], ['OH', 2, 111]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 20', [[5, 3], [['GA', 0, 1, 900], ['PA', 120, 400, 300], ['OH', 590, 41, 300], ['OH', 30, 1, 300]]], ['OH', 1, 26]], ['generated mix 28', [[0, 3], [['NJ', 1500, 150, 300]]], ['NJ', 7, 1508]], ['generated mix 36', [[0, 3], [['TX', 1000, 150, 900]]], ['TX', 6, 1011]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 23', [[0, 0], [['OH', 120, 0, 300], ['OH', 290, 41, 100], ['TX', 30, 41, 300]]], ['OH', 2, 120]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 32', [[-10, 0], [['TX', 0, 1, 300], ['TX', 120, 40, 100], ['GA', 40, 400, 900]]], ['TX', 1, 11]], ['generated mix 40', [[-10, 3], [['PA', 300, 1, 300], ['PA', 120, 150, 900]]], ['PA', 3, 197]], ['generated mix 48', [[5, 3], [['PA', 1500, 150, 100], ['PA', 0, 41, 300], ['IL', 2000, 41, 900]]], ['PA', 1, 39]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 42', [[-10, 3], [['GA', 40, 400, 300]]], ['GA', 4, 401]], ['generated mix 51', [[-10, 0], [['NJ', 100, 40, 300], ['IL', 120, 400, 300]]], ['NJ', 2, 118]], ['generated mix 59', [[-10, 0], [['PA', 100, 1, 100], ['OH', 1500, 400, 100]]], ['PA', 2, 111]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| name tiebreak | ['M', 1, 10] | ['M', 1, 10] | Passed |
| generated mix 50 | ['OH', 3, 286] | ['GA', 3, 286] | Failed |
| exact 50 miles | ['A', 1, 50] | ['A', 1, 50] | Passed |
| linehaul tiebreak | ['B', 2, 120] | ['B', 2, 120] | Passed |
| far | ['A', 8, 2000] | ['A', 8, 2000] | Passed |
| just over | ['A', 2, 51] | ['A', 2, 51] | Passed |
| generated mix 6 | ['IL', 3, 293] | ['IL', 3, 293] | Passed |
| generated mix 14 | ['IL', 2, 101] | ['IL', 2, 101] | Passed |
SHA-256 / 8317207b83c8d16a39c09e417c18f7d44a01aad60dd674ab45175aab4cd3485a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(dest, points):
BANDS = [50, 150, 300, 600, 1000, 1400, 1800]
def zone_for(m):
for i, lim in enumerate(BANDS):
if m <= lim:
return i + 1
return 8
best = None
for name, x, y, lh in points:
sq = (x - dest[0]) ** 2 + (y - dest[1]) ** 2
s = math.isqrt(sq)
miles = s + (1 if s * s < sq else 0)
z = zone_for(miles)
key = (z, lh, name)
if best is None or key < best[0]:
best = (key, [name, z, miles])
return best[1] if best else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 6', [[0, 0], [['PA', 2000, 150, 100], ['OH', 40, 400, 300], ['IL', 290, 40, 300]]], ['IL', 3, 293]], ['generated mix 14', [[0, 3], [['OH', 100, 41, 300], ['NJ', 290, 40, 900], ['TX', 100, 41, 300], ['IL', 100, 1, 100]]], ['IL', 2, 101]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 23', [[0, 0], [['OH', 120, 0, 300], ['OH', 290, 41, 100], ['TX', 30, 41, 300]]], ['OH', 2, 120]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 9', [[-10, 3], [['PA', 120, 1, 900], ['IL', 301, 0, 100], ['IL', 100, 41, 100], ['IL', 0, 0, 900]]], ['IL', 1, 11]], ['generated mix 17', [[5, 3], [['NJ', 301, 0, 900], ['GA', 590, 150, 100], ['PA', 1000, 1, 100], ['TX', 120, 40, 300]]], ['TX', 2, 121]], ['generated mix 26', [[-10, 3], [['PA', 1000, 400, 300], ['PA', 300, 400, 300], ['OH', 300, 400, 100], ['OH', 100, 0, 300]]], ['OH', 2, 111]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 20', [[5, 3], [['GA', 0, 1, 900], ['PA', 120, 400, 300], ['OH', 590, 41, 300], ['OH', 30, 1, 300]]], ['OH', 1, 26]], ['generated mix 28', [[0, 3], [['NJ', 1500, 150, 300]]], ['NJ', 7, 1508]], ['generated mix 36', [[0, 3], [['TX', 1000, 150, 900]]], ['TX', 6, 1011]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 23', [[0, 0], [['OH', 120, 0, 300], ['OH', 290, 41, 100], ['TX', 30, 41, 300]]], ['OH', 2, 120]], ['zone beats linehaul', [[0, 0], [['A', 40, 0, 900], ['B', 0, 120, 300]]], ['A', 1, 40]], ['no points', [[0, 0], []], None], ['just over', [[0, 0], [['A', 30, 41, 500]]], ['A', 2, 51]], ['generated mix 32', [[-10, 0], [['TX', 0, 1, 300], ['TX', 120, 40, 100], ['GA', 40, 400, 900]]], ['TX', 1, 11]], ['generated mix 40', [[-10, 3], [['PA', 300, 1, 300], ['PA', 120, 150, 900]]], ['PA', 3, 197]], ['generated mix 48', [[5, 3], [['PA', 1500, 150, 100], ['PA', 0, 41, 300], ['IL', 2000, 41, 900]]], ['PA', 1, 39]]], [['name tiebreak', [[0, 0], [['Z', 10, 0, 100], ['M', 0, 10, 100]]], ['M', 1, 10]], ['generated mix 50', [[5, 3], [['GA', 290, 0, 100], ['NJ', 1000, 1, 300], ['OH', 290, 0, 100]]], ['GA', 3, 286]], ['exact 50 miles', [[0, 0], [['A', 30, 40, 500]]], ['A', 1, 50]], ['linehaul tiebreak', [[0, 0], [['A', 100, 0, 900], ['B', 0, 120, 300]]], ['B', 2, 120]], ['far', [[0, 0], [['A', 2000, 0, 1]]], ['A', 8, 2000]], ['generated mix 42', [[-10, 3], [['GA', 40, 400, 300]]], ['GA', 4, 401]], ['generated mix 51', [[-10, 0], [['NJ', 100, 40, 300], ['IL', 120, 400, 300]]], ['NJ', 2, 118]], ['generated mix 59', [[-10, 0], [['PA', 100, 1, 100], ['OH', 1500, 400, 100]]], ['PA', 2, 111]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
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 |
|---|---|---|---|
| name tiebreak | ['M', 1, 10] | ['M', 1, 10] | Passed |
| generated mix 50 | ['GA', 3, 286] | ['GA', 3, 286] | Passed |
| exact 50 miles | ['A', 1, 50] | ['A', 1, 50] | Passed |
| linehaul tiebreak | ['B', 2, 120] | ['B', 2, 120] | Passed |
| far | ['A', 8, 2000] | ['A', 8, 2000] | Passed |
| just over | ['A', 2, 51] | ['A', 2, 51] | Passed |
| generated mix 6 | ['IL', 3, 293] | ['IL', 3, 293] | Passed |
| generated mix 14 | ['IL', 2, 101] | ['IL', 2, 101] | Passed |
SHA-256 / 05bca2d1bd258e87623bb29aa5c6bc5bfc9d46c44ef9f611cf78d89b67ed0fd1
Verification & scope
Grid distance stand-in; not geodesic distances. 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:52:15.084506+00:00.
Case digest / 2ea10840340c26e062b5151b382259a24537f2510f45d70db039382695057ef4