FA-96311 / Postal address normalization / Open access
Address completeness checker: duplicate second lines differing in case are missed · case 01
"21 FAKE RD" as line2 under "21 Fake Rd" is not reported.
ROOT CAUSE
The lines are compared case-sensitively.
THE FAILURE
The lines are compared case-sensitively.
Unsuccessful approach: Uppercasing only line2 still misses mixed-case line1.
Case contract
Input a dict. Unknown country (not AA, BB, CC) returns ["country_unknown"]. Values are stripped of all whitespace (None counts as blank). Issues, in order: line1_missing; line2_duplicate when a non-blank line2 equals line1 ignoring case; city_missing; for AA region_missing or region_invalid (not two letters); for AA and BB postal_missing or postal_invalid (AA 5 digits, BB 4 digits); for CC postal_unexpected when a non-blank code is given.
Why this case matters
Completeness checks gate address entry; false positives block valid orders and false negatives let undeliverable addresses through.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
c = x.get('country', '')
if c not in ('AA', 'BB', 'CC'):
return ['country_unknown']
g = lambda k: (x.get(k) or '').strip()
issues = []
if not g('line1'):
issues.append('line1_missing')
if g('line2') and g('line2') == g('line1'):
issues.append('line2_duplicate')
if not g('city'):
issues.append('city_missing')
if c == 'AA':
if not g('region'):
issues.append('region_missing')
elif not (len(g('region')) == 2 and g('region').isalpha()):
issues.append('region_invalid')
if c in ('AA', 'BB'):
need = 5 if c == 'AA' else 4
if not g('postal'):
issues.append('postal_missing')
elif not (len(g('postal')) == need and g('postal').isdigit()):
issues.append('postal_invalid')
elif g('postal'):
issues.append('postal_unexpected')
return issues
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['complete domestic address', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '21 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '11345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '21 Fake Rd', 'line2': '21 FAKE RD', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '21 Fake Rd', 'city': 'Faketown', 'postal': '1234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '21 Fake Rd', 'city': 'Faketown', 'postal': '1234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'Z9', 'postal': '11345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZZ', 'postal': '11345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '21 Fake Rd', 'city': 'Faketown', 'country': 'CC', 'postal': '9919'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '21 Fake Rd', 'city': 'Faketown', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'DD'}, ['country_unknown']]], [['complete domestic address', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '22 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '12345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '22 Fake Rd', 'line2': '22 FAKE RD', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '22 Fake Rd', 'city': 'Nowhereville', 'postal': '2234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '22 Fake Rd', 'city': 'Nowhereville', 'postal': '2234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'Z9', 'postal': '12345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZZ', 'postal': '12345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '22 Fake Rd', 'city': 'Nowhereville', 'country': 'CC', 'postal': '9929'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '22 Fake Rd', 'city': 'Nowhereville', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'DD'}, ['country_unknown']]], [['complete domestic address', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '23 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '13345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '23 Fake Rd', 'line2': '23 FAKE RD', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '23 Fake Rd', 'city': 'Zorbleton', 'postal': '3234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '23 Fake Rd', 'city': 'Zorbleton', 'postal': '3234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'Z9', 'postal': '13345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZZ', 'postal': '13345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '23 Fake Rd', 'city': 'Zorbleton', 'country': 'CC', 'postal': '9939'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '23 Fake Rd', 'city': 'Zorbleton', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'DD'}, ['country_unknown']]], [['complete domestic address', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '24 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '14345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '24 Fake Rd', 'line2': '24 FAKE RD', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '24 Fake Rd', 'city': 'Quillby', 'postal': '4234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '24 Fake Rd', 'city': 'Quillby', 'postal': '4234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'Z9', 'postal': '14345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZZ', 'postal': '14345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '24 Fake Rd', 'city': 'Quillby', 'country': 'CC', 'postal': '9949'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '24 Fake Rd', 'city': 'Quillby', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'DD'}, ['country_unknown']]], [['complete domestic address', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '25 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '15345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '25 Fake Rd', 'line2': '25 FAKE RD', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '25 Fake Rd', 'city': 'Spraxham', 'postal': '5234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '25 Fake Rd', 'city': 'Spraxham', 'postal': '5234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'Z9', 'postal': '15345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZZ', 'postal': '15345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '25 Fake Rd', 'city': 'Spraxham', 'country': 'CC', 'postal': '9959'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '25 Fake Rd', 'city': 'Spraxham', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'DD'}, ['country_unknown']]]]
for label, arg, expected in fixtures[N - 1]:
check(label, solve(arg), 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 |
|---|---|---|---|
| complete domestic address | [] | [] | Passed |
| tab-only city is missing | ['city_missing'] | ['city_missing'] | Passed |
| second line repeats the first in capitals | [] | ['line2_duplicate'] | Failed |
| region not needed for BB | [] | [] | Passed |
| region ignored for BB | [] | [] | Passed |
| region with a digit | ['region_invalid'] | ['region_invalid'] | Passed |
| three-letter region | ['region_invalid'] | ['region_invalid'] | Passed |
| four-digit AA code | ['postal_invalid'] | ['postal_invalid'] | Passed |
| code given where none is used | ['postal_unexpected'] | ['postal_unexpected'] | Passed |
| blank code where none is used | [] | [] | Passed |
| blank required code | ['postal_missing'] | ['postal_missing'] | Passed |
| unknown country | ['country_unknown'] | ['country_unknown'] | Passed |
SHA-256 / 338c1a0a7671d3011db64767fad5669e8414b430ff2f29c65a748fd5cf6d2715
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
c = x.get('country', '')
if c not in ('AA', 'BB', 'CC'):
return ['country_unknown']
g = lambda k: (x.get(k) or '').strip()
issues = []
if not g('line1'):
issues.append('line1_missing')
if g('line2') and g('line2').upper() == g('line1'):
issues.append('line2_duplicate')
if not g('city'):
issues.append('city_missing')
if c == 'AA':
if not g('region'):
issues.append('region_missing')
elif not (len(g('region')) == 2 and g('region').isalpha()):
issues.append('region_invalid')
if c in ('AA', 'BB'):
need = 5 if c == 'AA' else 4
if not g('postal'):
issues.append('postal_missing')
elif not (len(g('postal')) == need and g('postal').isdigit()):
issues.append('postal_invalid')
elif g('postal'):
issues.append('postal_unexpected')
return issues
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['complete domestic address', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '21 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '11345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '21 Fake Rd', 'line2': '21 FAKE RD', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '21 Fake Rd', 'city': 'Faketown', 'postal': '1234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '21 Fake Rd', 'city': 'Faketown', 'postal': '1234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'Z9', 'postal': '11345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZZ', 'postal': '11345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '21 Fake Rd', 'city': 'Faketown', 'country': 'CC', 'postal': '9919'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '21 Fake Rd', 'city': 'Faketown', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '21 Fake Rd', 'line2': '', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'DD'}, ['country_unknown']]], [['complete domestic address', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '22 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '12345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '22 Fake Rd', 'line2': '22 FAKE RD', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '22 Fake Rd', 'city': 'Nowhereville', 'postal': '2234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '22 Fake Rd', 'city': 'Nowhereville', 'postal': '2234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'Z9', 'postal': '12345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZZ', 'postal': '12345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '22 Fake Rd', 'city': 'Nowhereville', 'country': 'CC', 'postal': '9929'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '22 Fake Rd', 'city': 'Nowhereville', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '22 Fake Rd', 'line2': '', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'DD'}, ['country_unknown']]], [['complete domestic address', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '23 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '13345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '23 Fake Rd', 'line2': '23 FAKE RD', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '23 Fake Rd', 'city': 'Zorbleton', 'postal': '3234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '23 Fake Rd', 'city': 'Zorbleton', 'postal': '3234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'Z9', 'postal': '13345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZZ', 'postal': '13345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '23 Fake Rd', 'city': 'Zorbleton', 'country': 'CC', 'postal': '9939'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '23 Fake Rd', 'city': 'Zorbleton', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '23 Fake Rd', 'line2': '', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'DD'}, ['country_unknown']]], [['complete domestic address', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '24 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '14345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '24 Fake Rd', 'line2': '24 FAKE RD', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '24 Fake Rd', 'city': 'Quillby', 'postal': '4234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '24 Fake Rd', 'city': 'Quillby', 'postal': '4234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'Z9', 'postal': '14345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZZ', 'postal': '14345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '24 Fake Rd', 'city': 'Quillby', 'country': 'CC', 'postal': '9949'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '24 Fake Rd', 'city': 'Quillby', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '24 Fake Rd', 'line2': '', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'DD'}, ['country_unknown']]], [['complete domestic address', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA'}, []], ['tab-only city is missing', {'line1': '25 Fake Rd', 'line2': '', 'city': '\t', 'region': 'ZZ', 'postal': '15345', 'country': 'AA'}, ['city_missing']], ['second line repeats the first in capitals', {'line1': '25 Fake Rd', 'line2': '25 FAKE RD', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA'}, ['line2_duplicate']], ['region not needed for BB', {'line1': '25 Fake Rd', 'city': 'Spraxham', 'postal': '5234', 'country': 'BB'}, []], ['region ignored for BB', {'line1': '25 Fake Rd', 'city': 'Spraxham', 'postal': '5234', 'country': 'BB', 'region': 'Q1'}, []], ['region with a digit', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'Z9', 'postal': '15345', 'country': 'AA'}, ['region_invalid']], ['three-letter region', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZZ', 'postal': '15345', 'country': 'AA'}, ['region_invalid']], ['four-digit AA code', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '1234', 'country': 'AA'}, ['postal_invalid']], ['code given where none is used', {'line1': '25 Fake Rd', 'city': 'Spraxham', 'country': 'CC', 'postal': '9959'}, ['postal_unexpected']], ['blank code where none is used', {'line1': '25 Fake Rd', 'city': 'Spraxham', 'country': 'CC', 'postal': ''}, []], ['blank required code', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '', 'country': 'AA'}, ['postal_missing']], ['unknown country', {'line1': '25 Fake Rd', 'line2': '', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'DD'}, ['country_unknown']]]]
for label, arg, expected in fixtures[N - 1]:
check(label, solve(arg), 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 |
|---|---|---|---|
| complete domestic address | [] | [] | Passed |
| tab-only city is missing | ['city_missing'] | ['city_missing'] | Passed |
| second line repeats the first in capitals | [] | ['line2_duplicate'] | Failed |
| region not needed for BB | [] | [] | Passed |
| region ignored for BB | [] | [] | Passed |
| region with a digit | ['region_invalid'] | ['region_invalid'] | Passed |
| three-letter region | ['region_invalid'] | ['region_invalid'] | Passed |
| four-digit AA code | ['postal_invalid'] | ['postal_invalid'] | Passed |
| code given where none is used | ['postal_unexpected'] | ['postal_unexpected'] | Passed |
| blank code where none is used | [] | [] | Passed |
| blank required code | ['postal_missing'] | ['postal_missing'] | Passed |
| unknown country | ['country_unknown'] | ['country_unknown'] | Passed |
SHA-256 / 3a9e9df005d6c7c6d84b4b6c5ea24480de03918c62402de6b28187c9049df34f
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 12 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
A deterministic toy contract over synthetic, obviously fictitious addresses. The rules are stipulated for this model only and make no claim of conformance with any postal authority standard. 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:21.872161+00:00.
Case digest / 2513bab7c848683e1ececce2aceb0e403c408df9e738126fa19d2341bf50c2fa