{"abstract":"Lowercase or padded country codes from web checkout fall into the wrong group.","category":"Shipping rate zone lookup","checks":8,"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>\".","contract_signature":"country, service","evaluation_group":"w2-shipping-zone-intl-groups","failed_approach":"Upper-casing without trimming still misroutes padded codes.","family":"w2-shipping-zone-intl-groups-code-normalization","id":"FA-95516","implementations":{"attempt":{"sha256":"bd5275ba9e14c262b817be4f9c22103e27f27b5af7f092d881a5e8be3887cdba","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(country, service):\n    GROUPS = {'CA': 1, 'MX': 2, 'GB': 3, 'DE': 3, 'FR': 3, 'IE': 3, 'NL': 3, 'JP': 4, 'AU': 5, 'BR': 6}\n    DOMESTIC = {'US', 'PR', 'GU', 'VI', 'AS', 'MP'}\n    EMBARGO = {'CU', 'KP', 'IR', 'SY'}\n    code = country.upper()\n    if code == 'UK':\n        code = 'GB'\n    if code in DOMESTIC:\n        return 'DOMESTIC'\n    if code in EMBARGO:\n        return 'BLOCKED'\n    zone = GROUPS.get(code)\n    if zone is None:\n        if len(code) == 2 and code.isalpha():\n            zone = 9\n        else:\n            return 'INVALID'\n    if service == 'ECON' and zone == 9:\n        return 'NO_SERVICE'\n    return 'Z%d' % zone\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['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']]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"62fdbbbb1c0dac76fb8b7e726490e5873094e1545c515055d0df050da6155d36","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(country, service):\n    GROUPS = {'CA': 1, 'MX': 2, 'GB': 3, 'DE': 3, 'FR': 3, 'IE': 3, 'NL': 3, 'JP': 4, 'AU': 5, 'BR': 6}\n    DOMESTIC = {'US', 'PR', 'GU', 'VI', 'AS', 'MP'}\n    EMBARGO = {'CU', 'KP', 'IR', 'SY'}\n    code = country\n    if code == 'UK':\n        code = 'GB'\n    if code in DOMESTIC:\n        return 'DOMESTIC'\n    if code in EMBARGO:\n        return 'BLOCKED'\n    zone = GROUPS.get(code)\n    if zone is None:\n        if len(code) == 2 and code.isalpha():\n            zone = 9\n        else:\n            return 'INVALID'\n    if service == 'ECON' and zone == 9:\n        return 'NO_SERVICE'\n    return 'Z%d' % zone\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['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']]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-shipping-zone-intl-groups-code-normalization","generated_at":"2026-09-29T14:52:14.354519+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"International rating maps destination countries to zone groups.","root_cause":"The country code is neither trimmed nor upper-cased before lookup.","sha256":"47db08685ba25ca1e15d5127921735c86811c69a247a02c24e95b2634abaa376","title":"International zones: raw country code used · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":41.553,"exit_code":1,"observations":[{"actual":"INVALID","check":"padded lowercase","expected":"Z3","passed":false},{"actual":"INVALID","check":"generated mix 1","expected":"Z3","passed":false},{"actual":"Z3","check":"uk alias","expected":"Z3","passed":true},{"actual":"DOMESTIC","check":"pacific territory","expected":"DOMESTIC","passed":true},{"actual":"Z9","check":"priority rest of world","expected":"Z9","passed":true},{"actual":"INVALID","check":"digits invalid","expected":"INVALID","passed":true},{"actual":"DOMESTIC","check":"territory","expected":"DOMESTIC","passed":true},{"actual":"INVALID","check":"generated mix 5","expected":"BLOCKED","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"padded lowercase\", \"actual\": \"INVALID\", \"expected\": \"Z3\", \"passed\": false}, {\"check\": \"generated mix 1\", \"actual\": \"INVALID\", \"expected\": \"Z3\", \"passed\": false}, {\"check\": \"uk alias\", \"actual\": \"Z3\", \"expected\": \"Z3\", \"passed\": true}, {\"check\": \"pacific territory\", \"actual\": \"DOMESTIC\", \"expected\": \"DOMESTIC\", \"passed\": true}, {\"check\": \"priority rest of world\", \"actual\": \"Z9\", \"expected\": \"Z9\", \"passed\": true}, {\"check\": \"digits invalid\", \"actual\": \"INVALID\", \"expected\": \"INVALID\", \"passed\": true}, {\"check\": \"territory\", \"actual\": \"DOMESTIC\", \"expected\": \"DOMESTIC\", \"passed\": true}, {\"check\": \"generated mix 5\", \"actual\": \"INVALID\", \"expected\": \"BLOCKED\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.822,"exit_code":1,"observations":[{"actual":"INVALID","check":"padded lowercase","expected":"Z3","passed":false},{"actual":"INVALID","check":"generated mix 1","expected":"Z3","passed":false},{"actual":"NO_SERVICE","check":"uk alias","expected":"Z3","passed":false},{"actual":"DOMESTIC","check":"pacific territory","expected":"DOMESTIC","passed":true},{"actual":"Z9","check":"priority rest of world","expected":"Z9","passed":true},{"actual":"INVALID","check":"digits invalid","expected":"INVALID","passed":true},{"actual":"DOMESTIC","check":"territory","expected":"DOMESTIC","passed":true},{"actual":"INVALID","check":"generated mix 5","expected":"BLOCKED","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"padded lowercase\", \"actual\": \"INVALID\", \"expected\": \"Z3\", \"passed\": false}, {\"check\": \"generated mix 1\", \"actual\": \"INVALID\", \"expected\": \"Z3\", \"passed\": false}, {\"check\": \"uk alias\", \"actual\": \"NO_SERVICE\", \"expected\": \"Z3\", \"passed\": false}, {\"check\": \"pacific territory\", \"actual\": \"DOMESTIC\", \"expected\": \"DOMESTIC\", \"passed\": true}, {\"check\": \"priority rest of world\", \"actual\": \"Z9\", \"expected\": \"Z9\", \"passed\": true}, {\"check\": \"digits invalid\", \"actual\": \"INVALID\", \"expected\": \"INVALID\", \"passed\": true}, {\"check\": \"territory\", \"actual\": \"DOMESTIC\", \"expected\": \"DOMESTIC\", \"passed\": true}, {\"check\": \"generated mix 5\", \"actual\": \"INVALID\", \"expected\": \"BLOCKED\", \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}