FA-95526 / Shipping rate zone lookup / Open access
International zones: territories rated as foreign · case 01
Packages to US territories are sent through international rating and customs.
ROOT CAUSE
Only US itself is treated as domestic.
THE FAILURE
Only US itself is treated as domestic.
Unsuccessful approach: Adding only Puerto Rico still leaves Guam and the other territories international.
Case contract
country is an ISO alpha-2 code in any case with optional whitespace; "UK" is an alias of GB. US territories (US, PR, GU, VI, AS, MP) are DOMESTIC; embargoed CU, KP, IR, SY are BLOCKED. Listed countries map to groups 1-6; any other two-letter code is group 9; anything else INVALID. ECON is not offered to group 9 (NO_SERVICE). Return "Z<group>".
Why this case matters
International rating maps destination countries to zone groups.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(country, service):
GROUPS = {'CA': 1, 'MX': 2, 'GB': 3, 'DE': 3, 'FR': 3, 'IE': 3, 'NL': 3, 'JP': 4, 'AU': 5, 'BR': 6}
DOMESTIC = {'US'}
EMBARGO = {'CU', 'KP', 'IR', 'SY'}
code = country.strip().upper()
if code == 'UK':
code = 'GB'
if code in DOMESTIC:
return 'DOMESTIC'
if code in EMBARGO:
return 'BLOCKED'
zone = GROUPS.get(code)
if zone is None:
if len(code) == 2 and code.isalpha():
zone = 9
else:
return 'INVALID'
if service == 'ECON' and zone == 9:
return 'NO_SERVICE'
return 'Z%d' % zone
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['territory', ['PR', 'ECON'], 'DOMESTIC'], ['generated mix 2', [' AS ', 'ECON'], 'DOMESTIC'], ['padded lowercase', [' gb ', 'PRIORITY'], 'Z3'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['digits invalid', ['12', 'PRIORITY'], 'INVALID'], ['uk alias', ['uk', 'ECON'], 'Z3'], ['generated mix 5', ['\tcu ', 'ECON'], 'BLOCKED']], [['generated mix 25', ['\tVI', 'PRIORITY'], 'DOMESTIC'], ['generated mix 31', [' gu', 'PRIORITY'], 'DOMESTIC'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['digits invalid', ['12', 'PRIORITY'], 'INVALID'], ['canada econ', ['CA', 'ECON'], 'Z1'], ['generated mix 6', ['\tUK', 'PRIORITY'], 'Z3'], ['generated mix 14', [' Uk\n', 'ECON'], 'Z3']], [['generated mix 60', ['\tAS ', 'ECON'], 'DOMESTIC'], ['generated mix 70', ['\tgu', 'ECON'], 'DOMESTIC'], ['alpha3 invalid', ['USA', 'PRIORITY'], 'INVALID'], ['embargo lowercase', ['cu', 'PRIORITY'], 'BLOCKED'], ['padded lowercase', [' gb ', 'PRIORITY'], 'Z3'], ['territory', ['PR', 'ECON'], 'DOMESTIC'], ['generated mix 17', [' Uk', 'PRIORITY'], 'Z3'], ['generated mix 25', ['\tVI', 'PRIORITY'], 'DOMESTIC']], [['generated mix 2', [' AS ', 'ECON'], 'DOMESTIC'], ['canada econ', ['CA', 'ECON'], 'Z1'], ['uk alias', ['uk', 'ECON'], 'Z3'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['generated mix 29', ['ca\n', 'PRIORITY'], 'Z1'], ['generated mix 37', ['UK\n', 'ECON'], 'Z3'], ['generated mix 45', [' BR', 'ECON'], 'Z6']], [['generated mix 36', ['PR ', 'PRIORITY'], 'DOMESTIC'], ['generated mix 31', [' gu', 'PRIORITY'], 'DOMESTIC'], ['territory', ['PR', 'ECON'], 'DOMESTIC'], ['econ rest of world', ['ZA', 'ECON'], 'NO_SERVICE'], ['alpha3 invalid', ['USA', 'PRIORITY'], 'INVALID'], ['embargo lowercase', ['cu', 'PRIORITY'], 'BLOCKED'], ['generated mix 41', [' ZA ', 'PRIORITY'], 'Z9'], ['generated mix 49', [' de', 'ECON'], 'Z3']]]
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 |
|---|---|---|---|
| territory | NO_SERVICE | DOMESTIC | Failed |
| generated mix 2 | NO_SERVICE | DOMESTIC | Failed |
| padded lowercase | Z3 | Z3 | Passed |
| pacific territory | Z9 | DOMESTIC | Failed |
| priority rest of world | Z9 | Z9 | Passed |
| digits invalid | INVALID | INVALID | Passed |
| uk alias | Z3 | Z3 | Passed |
| generated mix 5 | BLOCKED | BLOCKED | Passed |
SHA-256 / 7454d685360862c544f83c8027efc89848b539bc56d819a155a517fa4956066a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(country, service):
GROUPS = {'CA': 1, 'MX': 2, 'GB': 3, 'DE': 3, 'FR': 3, 'IE': 3, 'NL': 3, 'JP': 4, 'AU': 5, 'BR': 6}
DOMESTIC = {'US', 'PR'}
EMBARGO = {'CU', 'KP', 'IR', 'SY'}
code = country.strip().upper()
if code == 'UK':
code = 'GB'
if code in DOMESTIC:
return 'DOMESTIC'
if code in EMBARGO:
return 'BLOCKED'
zone = GROUPS.get(code)
if zone is None:
if len(code) == 2 and code.isalpha():
zone = 9
else:
return 'INVALID'
if service == 'ECON' and zone == 9:
return 'NO_SERVICE'
return 'Z%d' % zone
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['territory', ['PR', 'ECON'], 'DOMESTIC'], ['generated mix 2', [' AS ', 'ECON'], 'DOMESTIC'], ['padded lowercase', [' gb ', 'PRIORITY'], 'Z3'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['digits invalid', ['12', 'PRIORITY'], 'INVALID'], ['uk alias', ['uk', 'ECON'], 'Z3'], ['generated mix 5', ['\tcu ', 'ECON'], 'BLOCKED']], [['generated mix 25', ['\tVI', 'PRIORITY'], 'DOMESTIC'], ['generated mix 31', [' gu', 'PRIORITY'], 'DOMESTIC'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['digits invalid', ['12', 'PRIORITY'], 'INVALID'], ['canada econ', ['CA', 'ECON'], 'Z1'], ['generated mix 6', ['\tUK', 'PRIORITY'], 'Z3'], ['generated mix 14', [' Uk\n', 'ECON'], 'Z3']], [['generated mix 60', ['\tAS ', 'ECON'], 'DOMESTIC'], ['generated mix 70', ['\tgu', 'ECON'], 'DOMESTIC'], ['alpha3 invalid', ['USA', 'PRIORITY'], 'INVALID'], ['embargo lowercase', ['cu', 'PRIORITY'], 'BLOCKED'], ['padded lowercase', [' gb ', 'PRIORITY'], 'Z3'], ['territory', ['PR', 'ECON'], 'DOMESTIC'], ['generated mix 17', [' Uk', 'PRIORITY'], 'Z3'], ['generated mix 25', ['\tVI', 'PRIORITY'], 'DOMESTIC']], [['generated mix 2', [' AS ', 'ECON'], 'DOMESTIC'], ['canada econ', ['CA', 'ECON'], 'Z1'], ['uk alias', ['uk', 'ECON'], 'Z3'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['generated mix 29', ['ca\n', 'PRIORITY'], 'Z1'], ['generated mix 37', ['UK\n', 'ECON'], 'Z3'], ['generated mix 45', [' BR', 'ECON'], 'Z6']], [['generated mix 36', ['PR ', 'PRIORITY'], 'DOMESTIC'], ['generated mix 31', [' gu', 'PRIORITY'], 'DOMESTIC'], ['territory', ['PR', 'ECON'], 'DOMESTIC'], ['econ rest of world', ['ZA', 'ECON'], 'NO_SERVICE'], ['alpha3 invalid', ['USA', 'PRIORITY'], 'INVALID'], ['embargo lowercase', ['cu', 'PRIORITY'], 'BLOCKED'], ['generated mix 41', [' ZA ', 'PRIORITY'], 'Z9'], ['generated mix 49', [' de', 'ECON'], 'Z3']]]
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 |
|---|---|---|---|
| territory | DOMESTIC | DOMESTIC | Passed |
| generated mix 2 | NO_SERVICE | DOMESTIC | Failed |
| padded lowercase | Z3 | Z3 | Passed |
| pacific territory | Z9 | DOMESTIC | Failed |
| priority rest of world | Z9 | Z9 | Passed |
| digits invalid | INVALID | INVALID | Passed |
| uk alias | Z3 | Z3 | Passed |
| generated mix 5 | BLOCKED | BLOCKED | Passed |
SHA-256 / 167f6dc35e53de15072930c15c10a4f6d40e63e026f84f4e7547a099028378bc
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
Stipulated country table; not a sanctions or carrier coverage list. 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:14.440451+00:00.
Case digest / d7cc9b3a4f2b648e5e9a9562d97840624fca0035a49e9c0be714706f1946e480