FA-95366 / Shipping rate zone lookup / Open access
Zone chart: garbage after ZIP3 accepted · case 01
Codes like "123AB" are rated as if they were valid ZIPs.
ROOT CAUSE
Validation only checks that the first three characters are digits.
VERIFIED REPAIR
Require all five characters to be decimal digits.
Unsuccessful approach: An alphanumeric test accepts letters in any position.
Case contract
dest is a ZIP string with optional surrounding whitespace, optionally ZIP+4 ("12345-6789"), or a 4-digit ZIP whose leading zero was lost (left-pad one zero). chart [[lo3, hi3, zone]] inclusive ZIP3 ranges; the narrowest matching range wins, earliest listed on equal width. Malformed -> "INVALID"; no match -> "NO_ZONE".
Why this case matters
Carrier zone charts map origin to destination ZIP3 ranges, the first step of rating.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(dest, chart):
z = dest.strip()
if len(z) == 10 and z[5] == '-' and z[6:].isdecimal():
z = z[:5]
if len(z) == 4 and z.isdecimal():
z = '0' + z
if len(z) != 5 or not z[:3].isdecimal():
return 'INVALID'
p = int(z[:3])
best = None
for lo, hi, zone in chart:
if lo <= p <= hi:
if best is None or (hi - lo) < (best[1] - best[0]):
best = (lo, hi, zone)
return best[2] if best else 'NO_ZONE'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['equal width first listed', ['21500', [[210, 219, 2], [215, 224, 9]]], 2], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['lost leading zero', ['2134', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 4', ['10001-12a4', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID']], [['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['nested narrowest', ['21700', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 6], ['equal width higher zone first', ['21600', [[210, 219, 9], [215, 224, 2]]], 9], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['generated mix 7', ['09999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 16', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE']], [['generated mix 30', ['999x1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['generated mix 17', ['16000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['generated mix 25', ['15999-123', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 34', ['15000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4]], [['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['equal width first listed', ['21500', [[210, 219, 2], [215, 224, 9]]], 2], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['generated mix 30', ['999x1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 38', ['9999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8]], [['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['nested narrowest', ['21700', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 6], ['equal width higher zone first', ['21600', [[210, 219, 9], [215, 224, 2]]], 9], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['generated mix 41', ['00501', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 49', ['10001', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5]]]
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 |
|---|---|---|---|
| letters | 5 | INVALID | Failed |
| generated mix 9 | 8 | INVALID | Failed |
| zip plus four | 4 | 4 | Passed |
| range upper edge | 5 | 5 | Passed |
| equal width first listed | 2 | 2 | Passed |
| equal width plus four | 7 | 7 | Passed |
| lost leading zero | 8 | 8 | Passed |
| generated mix 4 | INVALID | INVALID | Passed |
SHA-256 / cc86718dff2b028dcbdebb77b443fe441c21cdffe181791021e270cd28ee965d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(dest, chart):
z = dest.strip()
if len(z) == 10 and z[5] == '-' and z[6:].isdecimal():
z = z[:5]
if len(z) == 4 and z.isdecimal():
z = '0' + z
if len(z) != 5 or not z.replace(' ', '').isalnum():
return 'INVALID'
p = int(z[:3])
best = None
for lo, hi, zone in chart:
if lo <= p <= hi:
if best is None or (hi - lo) < (best[1] - best[0]):
best = (lo, hi, zone)
return best[2] if best else 'NO_ZONE'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['equal width first listed', ['21500', [[210, 219, 2], [215, 224, 9]]], 2], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['lost leading zero', ['2134', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 4', ['10001-12a4', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID']], [['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['nested narrowest', ['21700', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 6], ['equal width higher zone first', ['21600', [[210, 219, 9], [215, 224, 2]]], 9], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['generated mix 7', ['09999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 16', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE']], [['generated mix 30', ['999x1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['generated mix 17', ['16000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['generated mix 25', ['15999-123', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 34', ['15000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4]], [['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['equal width first listed', ['21500', [[210, 219, 2], [215, 224, 9]]], 2], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['generated mix 30', ['999x1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 38', ['9999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8]], [['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['nested narrowest', ['21700', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 6], ['equal width higher zone first', ['21600', [[210, 219, 9], [215, 224, 2]]], 9], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['generated mix 41', ['00501', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 49', ['10001', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5]]]
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 |
|---|---|---|---|
| letters | 5 | INVALID | Failed |
| generated mix 9 | 8 | INVALID | Failed |
| zip plus four | 4 | 4 | Passed |
| range upper edge | 5 | 5 | Passed |
| equal width first listed | 2 | 2 | Passed |
| equal width plus four | 7 | 7 | Passed |
| lost leading zero | 8 | 8 | Passed |
| generated mix 4 | INVALID | INVALID | Passed |
SHA-256 / d14fdfcf1657dec3c3d07a97c952a0ae03399c6e465f6abc540a87e0007338d4
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(dest, chart):
z = dest.strip()
if len(z) == 10 and z[5] == '-' and z[6:].isdecimal():
z = z[:5]
if len(z) == 4 and z.isdecimal():
z = '0' + z
if len(z) != 5 or not z.isdecimal():
return 'INVALID'
p = int(z[:3])
best = None
for lo, hi, zone in chart:
if lo <= p <= hi:
if best is None or (hi - lo) < (best[1] - best[0]):
best = (lo, hi, zone)
return best[2] if best else 'NO_ZONE'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['equal width first listed', ['21500', [[210, 219, 2], [215, 224, 9]]], 2], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['lost leading zero', ['2134', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 4', ['10001-12a4', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID']], [['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['nested narrowest', ['21700', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 6], ['equal width higher zone first', ['21600', [[210, 219, 9], [215, 224, 2]]], 9], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['generated mix 7', ['09999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 16', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE']], [['generated mix 30', ['999x1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['generated mix 17', ['16000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['generated mix 25', ['15999-123', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 34', ['15000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4]], [['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['range upper edge', ['19999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5], ['equal width first listed', ['21500', [[210, 219, 2], [215, 224, 9]]], 2], ['equal width plus four', ['21999-0001', [[200, 299, 1], [210, 219, 7], [215, 224, 3]]], 7], ['generated mix 30', ['999x1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['generated mix 38', ['9999', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8]], [['generated mix 9', ['021 1', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['letters', ['123AB', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'INVALID'], ['nested narrowest', ['21700', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 6], ['equal width higher zone first', ['21600', [[210, 219, 9], [215, 224, 2]]], 9], ['outside chart', ['40000', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 'NO_ZONE'], ['zip plus four', ['15012-3456', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 4], ['generated mix 41', ['00501', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 8], ['generated mix 49', ['10001', [[5, 99, 8], [100, 199, 5], [150, 159, 4], [200, 299, 3], [210, 219, 2], [215, 219, 6], [300, 399, 7]]], 5]]]
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 |
|---|---|---|---|
| letters | INVALID | INVALID | Passed |
| generated mix 9 | INVALID | INVALID | Passed |
| zip plus four | 4 | 4 | Passed |
| range upper edge | 5 | 5 | Passed |
| equal width first listed | 2 | 2 | Passed |
| equal width plus four | 7 | 7 | Passed |
| lost leading zero | 8 | 8 | Passed |
| generated mix 4 | INVALID | INVALID | Passed |
SHA-256 / 0de14d232406efd0978d9a3e7394a7faa17375058f0e8a59cdbe08588595a84c
Verification & scope
Stipulated chart rows and input normalization; not a carrier-published chart. 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:12.998422+00:00.
Case digest / 9679b613445b6a9c6af66b98f14a6466dba21187d9c73534be7bb7dbc97009f4