FA-95516 / Shipping rate zone lookup / Open access
International zones: raw country code used · case 01
Lowercase or padded country codes from web checkout fall into the wrong group.
ROOT CAUSE
The country code is neither trimmed nor upper-cased before lookup.
THE FAILURE
The country code is neither trimmed nor upper-cased before lookup.
Unsuccessful approach: Upper-casing without trimming still misroutes padded codes.
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', 'PR', 'GU', 'VI', 'AS', 'MP'}
EMBARGO = {'CU', 'KP', 'IR', 'SY'}
code = country
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 = [[['padded lowercase', [' gb ', 'PRIORITY'], 'Z3'], ['generated mix 1', [' UK', 'PRIORITY'], 'Z3'], ['uk alias', ['uk', 'ECON'], 'Z3'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['digits invalid', ['12', 'PRIORITY'], 'INVALID'], ['territory', ['PR', 'ECON'], 'DOMESTIC'], ['generated mix 5', ['\tcu ', 'ECON'], 'BLOCKED']], [['generated mix 6', ['\tUK', 'PRIORITY'], 'Z3'], ['generated mix 7', ['uk\n', 'ECON'], 'Z3'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['digits invalid', ['12', 'PRIORITY'], 'INVALID'], ['canada econ', ['CA', 'ECON'], 'Z1'], ['generated mix 8', [' nz ', 'ECON'], 'NO_SERVICE'], ['generated mix 16', ['cu', 'PRIORITY'], 'BLOCKED']], [['generated mix 14', [' Uk\n', 'ECON'], 'Z3'], ['generated mix 13', [' VI ', 'ECON'], 'DOMESTIC'], ['alpha3 invalid', ['USA', 'PRIORITY'], 'INVALID'], ['embargo lowercase', ['cu', 'PRIORITY'], 'BLOCKED'], ['padded lowercase', [' gb ', 'PRIORITY'], 'Z3'], ['territory', ['PR', 'ECON'], 'DOMESTIC'], ['generated mix 19', ['\tus ', 'ECON'], 'DOMESTIC'], ['generated mix 27', ['IE\n', 'PRIORITY'], 'Z3']], [['generated mix 22', ['\tKP', 'ECON'], 'BLOCKED'], ['generated mix 19', ['\tus ', '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 30', ['JP\n', 'PRIORITY'], 'Z4'], ['generated mix 38', ['\tBR\n', 'PRIORITY'], 'Z6']], [['generated mix 31', [' gu', 'PRIORITY'], 'DOMESTIC'], ['generated mix 27', ['IE\n', 'PRIORITY'], 'Z3'], ['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 |
|---|---|---|---|
| padded lowercase | INVALID | Z3 | Failed |
| generated mix 1 | INVALID | Z3 | Failed |
| uk alias | NO_SERVICE | Z3 | Failed |
| pacific territory | DOMESTIC | DOMESTIC | Passed |
| priority rest of world | Z9 | Z9 | Passed |
| digits invalid | INVALID | INVALID | Passed |
| territory | DOMESTIC | DOMESTIC | Passed |
| generated mix 5 | INVALID | BLOCKED | Failed |
SHA-256 / 62fdbbbb1c0dac76fb8b7e726490e5873094e1545c515055d0df050da6155d36
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', 'GU', 'VI', 'AS', 'MP'}
EMBARGO = {'CU', 'KP', 'IR', 'SY'}
code = country.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 = [[['padded lowercase', [' gb ', 'PRIORITY'], 'Z3'], ['generated mix 1', [' UK', 'PRIORITY'], 'Z3'], ['uk alias', ['uk', 'ECON'], 'Z3'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['digits invalid', ['12', 'PRIORITY'], 'INVALID'], ['territory', ['PR', 'ECON'], 'DOMESTIC'], ['generated mix 5', ['\tcu ', 'ECON'], 'BLOCKED']], [['generated mix 6', ['\tUK', 'PRIORITY'], 'Z3'], ['generated mix 7', ['uk\n', 'ECON'], 'Z3'], ['pacific territory', ['GU', 'PRIORITY'], 'DOMESTIC'], ['priority rest of world', ['ZA', 'PRIORITY'], 'Z9'], ['digits invalid', ['12', 'PRIORITY'], 'INVALID'], ['canada econ', ['CA', 'ECON'], 'Z1'], ['generated mix 8', [' nz ', 'ECON'], 'NO_SERVICE'], ['generated mix 16', ['cu', 'PRIORITY'], 'BLOCKED']], [['generated mix 14', [' Uk\n', 'ECON'], 'Z3'], ['generated mix 13', [' VI ', 'ECON'], 'DOMESTIC'], ['alpha3 invalid', ['USA', 'PRIORITY'], 'INVALID'], ['embargo lowercase', ['cu', 'PRIORITY'], 'BLOCKED'], ['padded lowercase', [' gb ', 'PRIORITY'], 'Z3'], ['territory', ['PR', 'ECON'], 'DOMESTIC'], ['generated mix 19', ['\tus ', 'ECON'], 'DOMESTIC'], ['generated mix 27', ['IE\n', 'PRIORITY'], 'Z3']], [['generated mix 22', ['\tKP', 'ECON'], 'BLOCKED'], ['generated mix 19', ['\tus ', '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 30', ['JP\n', 'PRIORITY'], 'Z4'], ['generated mix 38', ['\tBR\n', 'PRIORITY'], 'Z6']], [['generated mix 31', [' gu', 'PRIORITY'], 'DOMESTIC'], ['generated mix 27', ['IE\n', 'PRIORITY'], 'Z3'], ['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 |
|---|---|---|---|
| padded lowercase | INVALID | Z3 | Failed |
| generated mix 1 | INVALID | Z3 | Failed |
| uk alias | Z3 | Z3 | Passed |
| pacific territory | DOMESTIC | DOMESTIC | Passed |
| priority rest of world | Z9 | Z9 | Passed |
| digits invalid | INVALID | INVALID | Passed |
| territory | DOMESTIC | DOMESTIC | Passed |
| generated mix 5 | INVALID | BLOCKED | Failed |
SHA-256 / bd5275ba9e14c262b817be4f9c22103e27f27b5af7f092d881a5e8be3887cdba
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.354519+00:00.
Case digest / 47db08685ba25ca1e15d5127921735c86811c69a247a02c24e95b2634abaa376