FAILURE MAP
← Case archive

FA-96336 / Postal address normalization / Open access

Address completeness checker: a blank code is reported both missing and invalid · case 01

A blank AA code yields postal_missing and postal_invalid.

Verified by executionVariant 1 · 12 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The invalid test is a separate if instead of an elif.

THE FAILURE

The invalid test is a separate if instead of an elif.

Unsuccessful approach: Deciding "missing" by key absence reports a blank string as invalid instead of missing.

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').upper() == g('line1').upper():
        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')
        if 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 fixtureActualExpectedOutcome
complete domestic address[][]Passed
tab-only city is missing['city_missing']['city_missing']Passed
second line repeats the first in capitals['line2_duplicate']['line2_duplicate']Passed
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_invalid']['postal_missing']Failed
unknown country['country_unknown']['country_unknown']Passed

SHA-256 / cacc7662feed375c35e7ba2545481e6500f634c50831f63ffb108678437e9f79

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').upper():
        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 x.get('postal') is None:
            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 fixtureActualExpectedOutcome
complete domestic address[][]Passed
tab-only city is missing['city_missing']['city_missing']Passed
second line repeats the first in capitals['line2_duplicate']['line2_duplicate']Passed
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_invalid']['postal_missing']Failed
unknown country['country_unknown']['country_unknown']Passed

SHA-256 / 15ed7573fed3a2c99522d9d3a3b4dc8f2309c30cd65981d57f4c1fb4b166318f

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 / 1cb95d302bd955fda360eef5db9e3fa6de7db521b90c0a9a2498a1c717fec0ba