FA-96246 / Postal address normalization / Open access
Country address template renderer: city uppercasing applies to the wrong destinations · case 01
BB labels print the city in capitals.
ROOT CAUSE
Uppercasing is applied to every non-AA destination.
THE FAILURE
Uppercasing is applied to every non-AA destination.
Unsuccessful approach: Uppercasing every field for CC also capitalizes the name and street.
Case contract
Input fields name, street, city, region, postal, country (destination) and origin. Toy templates: AA "{city} {region} {postal}", BB "{postal} {city}", CC city and postal on separate lines with the city uppercased; unknown destinations use AA. Each rendered line is whitespace-collapsed and empty lines are dropped. When origin differs from destination the destination name (or its code when unknown) is appended.
Why this case matters
Cross-border labels must follow the destination order; misplaced or doubled components delay or return shipments.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
T = {'AA': ['{name}', '{street}', '{city} {region} {postal}'], 'BB': ['{name}', '{street}', '{postal} {city}'],
'CC': ['{name}', '{street}', '{city}', '{postal}']}
NAMES = {'AA': 'AALANDIA', 'BB': 'BEEMARK', 'CC': 'CEELAND'}
dest = x['country']
fields = dict(x)
if dest != 'AA':
fields['city'] = fields['city'].upper()
lines = []
for tpl in T.get(dest, T['AA']):
line = ' '.join(tpl.format(**fields).split())
if line:
lines.append(line)
if x['origin'] != dest:
lines.append(NAMES.get(dest, dest))
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['domestic three-part last line', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345']], ['missing region collapses spacing', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': '', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', 'Faketown 11345']], ['only a postal code on the last line', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': '', 'region': '', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', '11345']], ['postal code first, international', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': '', 'postal': '1234', 'country': 'BB', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', '1234 Faketown', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': '', 'postal': '11345', 'country': 'CC', 'origin': 'BB'}, ['Pat Example', '4 Fake Rd', 'FAKETOWN', '11345', 'CEELAND']], ['unknown destination falls back', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'DD', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345', 'DD']], ['empty name line dropped', {'name': '', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['4 Fake Rd', 'Faketown ZZ 11345']], ['one-letter name kept', {'name': 'Q', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['Q', '4 Fake Rd', 'Faketown ZZ 11345']]], [['domestic three-part last line', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', 'Nowhereville ZZ 12345']], ['missing region collapses spacing', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': '', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', 'Nowhereville 12345']], ['only a postal code on the last line', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': '', 'region': '', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', '12345']], ['postal code first, international', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': '', 'postal': '2234', 'country': 'BB', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', '2234 Nowhereville', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': '', 'postal': '12345', 'country': 'CC', 'origin': 'BB'}, ['Lee Sample', '5 Fake Rd', 'NOWHEREVILLE', '12345', 'CEELAND']], ['unknown destination falls back', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'DD', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', 'Nowhereville ZZ 12345', 'DD']], ['empty name line dropped', {'name': '', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['5 Fake Rd', 'Nowhereville ZZ 12345']], ['one-letter name kept', {'name': 'Q', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['Q', '5 Fake Rd', 'Nowhereville ZZ 12345']]], [['domestic three-part last line', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', 'Zorbleton ZZ 13345']], ['missing region collapses spacing', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': '', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', 'Zorbleton 13345']], ['only a postal code on the last line', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': '', 'region': '', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', '13345']], ['postal code first, international', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': '', 'postal': '3234', 'country': 'BB', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', '3234 Zorbleton', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': '', 'postal': '13345', 'country': 'CC', 'origin': 'BB'}, ['Robin Placeholder', '6 Fake Rd', 'ZORBLETON', '13345', 'CEELAND']], ['unknown destination falls back', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'DD', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', 'Zorbleton ZZ 13345', 'DD']], ['empty name line dropped', {'name': '', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['6 Fake Rd', 'Zorbleton ZZ 13345']], ['one-letter name kept', {'name': 'Q', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['Q', '6 Fake Rd', 'Zorbleton ZZ 13345']]], [['domestic three-part last line', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', 'Quillby ZZ 14345']], ['missing region collapses spacing', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': '', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', 'Quillby 14345']], ['only a postal code on the last line', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': '', 'region': '', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', '14345']], ['postal code first, international', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': '', 'postal': '4234', 'country': 'BB', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', '4234 Quillby', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': '', 'postal': '14345', 'country': 'CC', 'origin': 'BB'}, ['Sam Demo', '7 Fake Rd', 'QUILLBY', '14345', 'CEELAND']], ['unknown destination falls back', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'DD', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', 'Quillby ZZ 14345', 'DD']], ['empty name line dropped', {'name': '', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['7 Fake Rd', 'Quillby ZZ 14345']], ['one-letter name kept', {'name': 'Q', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['Q', '7 Fake Rd', 'Quillby ZZ 14345']]], [['domestic three-part last line', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', 'Spraxham ZZ 15345']], ['missing region collapses spacing', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': '', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', 'Spraxham 15345']], ['only a postal code on the last line', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': '', 'region': '', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', '15345']], ['postal code first, international', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': '', 'postal': '5234', 'country': 'BB', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', '5234 Spraxham', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': '', 'postal': '15345', 'country': 'CC', 'origin': 'BB'}, ['Alex Fiction', '8 Fake Rd', 'SPRAXHAM', '15345', 'CEELAND']], ['unknown destination falls back', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'DD', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', 'Spraxham ZZ 15345', 'DD']], ['empty name line dropped', {'name': '', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['8 Fake Rd', 'Spraxham ZZ 15345']], ['one-letter name kept', {'name': 'Q', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['Q', '8 Fake Rd', 'Spraxham ZZ 15345']]]]
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 |
|---|---|---|---|
| domestic three-part last line | ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345'] | ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345'] | Passed |
| missing region collapses spacing | ['Pat Example', '4 Fake Rd', 'Faketown 11345'] | ['Pat Example', '4 Fake Rd', 'Faketown 11345'] | Passed |
| only a postal code on the last line | ['Pat Example', '4 Fake Rd', '11345'] | ['Pat Example', '4 Fake Rd', '11345'] | Passed |
| postal code first, international | ['Pat Example', '4 Fake Rd', '1234 FAKETOWN', 'BEEMARK'] | ['Pat Example', '4 Fake Rd', '1234 Faketown', 'BEEMARK'] | Failed |
| uppercase city on its own line | ['Pat Example', '4 Fake Rd', 'FAKETOWN', '11345', 'CEELAND'] | ['Pat Example', '4 Fake Rd', 'FAKETOWN', '11345', 'CEELAND'] | Passed |
| unknown destination falls back | ['Pat Example', '4 Fake Rd', 'FAKETOWN ZZ 11345', 'DD'] | ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345', 'DD'] | Failed |
| empty name line dropped | ['4 Fake Rd', 'Faketown ZZ 11345'] | ['4 Fake Rd', 'Faketown ZZ 11345'] | Passed |
| one-letter name kept | ['Q', '4 Fake Rd', 'Faketown ZZ 11345'] | ['Q', '4 Fake Rd', 'Faketown ZZ 11345'] | Passed |
SHA-256 / 3dcb5b953a42d5caaaf8ca229ede023c5feb4ebd72cbbefe7bc64608cd74bba4
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
T = {'AA': ['{name}', '{street}', '{city} {region} {postal}'], 'BB': ['{name}', '{street}', '{postal} {city}'],
'CC': ['{name}', '{street}', '{city}', '{postal}']}
NAMES = {'AA': 'AALANDIA', 'BB': 'BEEMARK', 'CC': 'CEELAND'}
dest = x['country']
fields = dict(x)
if dest == 'CC':
fields = {k: str(v).upper() for k, v in fields.items()}
lines = []
for tpl in T.get(dest, T['AA']):
line = ' '.join(tpl.format(**fields).split())
if line:
lines.append(line)
if x['origin'] != dest:
lines.append(NAMES.get(dest, dest))
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['domestic three-part last line', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345']], ['missing region collapses spacing', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': '', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', 'Faketown 11345']], ['only a postal code on the last line', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': '', 'region': '', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', '11345']], ['postal code first, international', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': '', 'postal': '1234', 'country': 'BB', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', '1234 Faketown', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': '', 'postal': '11345', 'country': 'CC', 'origin': 'BB'}, ['Pat Example', '4 Fake Rd', 'FAKETOWN', '11345', 'CEELAND']], ['unknown destination falls back', {'name': 'Pat Example', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'DD', 'origin': 'AA'}, ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345', 'DD']], ['empty name line dropped', {'name': '', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['4 Fake Rd', 'Faketown ZZ 11345']], ['one-letter name kept', {'name': 'Q', 'street': '4 Fake Rd', 'city': 'Faketown', 'region': 'ZZ', 'postal': '11345', 'country': 'AA', 'origin': 'AA'}, ['Q', '4 Fake Rd', 'Faketown ZZ 11345']]], [['domestic three-part last line', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', 'Nowhereville ZZ 12345']], ['missing region collapses spacing', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': '', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', 'Nowhereville 12345']], ['only a postal code on the last line', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': '', 'region': '', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', '12345']], ['postal code first, international', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': '', 'postal': '2234', 'country': 'BB', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', '2234 Nowhereville', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': '', 'postal': '12345', 'country': 'CC', 'origin': 'BB'}, ['Lee Sample', '5 Fake Rd', 'NOWHEREVILLE', '12345', 'CEELAND']], ['unknown destination falls back', {'name': 'Lee Sample', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'DD', 'origin': 'AA'}, ['Lee Sample', '5 Fake Rd', 'Nowhereville ZZ 12345', 'DD']], ['empty name line dropped', {'name': '', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['5 Fake Rd', 'Nowhereville ZZ 12345']], ['one-letter name kept', {'name': 'Q', 'street': '5 Fake Rd', 'city': 'Nowhereville', 'region': 'ZZ', 'postal': '12345', 'country': 'AA', 'origin': 'AA'}, ['Q', '5 Fake Rd', 'Nowhereville ZZ 12345']]], [['domestic three-part last line', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', 'Zorbleton ZZ 13345']], ['missing region collapses spacing', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': '', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', 'Zorbleton 13345']], ['only a postal code on the last line', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': '', 'region': '', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', '13345']], ['postal code first, international', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': '', 'postal': '3234', 'country': 'BB', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', '3234 Zorbleton', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': '', 'postal': '13345', 'country': 'CC', 'origin': 'BB'}, ['Robin Placeholder', '6 Fake Rd', 'ZORBLETON', '13345', 'CEELAND']], ['unknown destination falls back', {'name': 'Robin Placeholder', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'DD', 'origin': 'AA'}, ['Robin Placeholder', '6 Fake Rd', 'Zorbleton ZZ 13345', 'DD']], ['empty name line dropped', {'name': '', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['6 Fake Rd', 'Zorbleton ZZ 13345']], ['one-letter name kept', {'name': 'Q', 'street': '6 Fake Rd', 'city': 'Zorbleton', 'region': 'ZZ', 'postal': '13345', 'country': 'AA', 'origin': 'AA'}, ['Q', '6 Fake Rd', 'Zorbleton ZZ 13345']]], [['domestic three-part last line', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', 'Quillby ZZ 14345']], ['missing region collapses spacing', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': '', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', 'Quillby 14345']], ['only a postal code on the last line', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': '', 'region': '', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', '14345']], ['postal code first, international', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': '', 'postal': '4234', 'country': 'BB', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', '4234 Quillby', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': '', 'postal': '14345', 'country': 'CC', 'origin': 'BB'}, ['Sam Demo', '7 Fake Rd', 'QUILLBY', '14345', 'CEELAND']], ['unknown destination falls back', {'name': 'Sam Demo', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'DD', 'origin': 'AA'}, ['Sam Demo', '7 Fake Rd', 'Quillby ZZ 14345', 'DD']], ['empty name line dropped', {'name': '', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['7 Fake Rd', 'Quillby ZZ 14345']], ['one-letter name kept', {'name': 'Q', 'street': '7 Fake Rd', 'city': 'Quillby', 'region': 'ZZ', 'postal': '14345', 'country': 'AA', 'origin': 'AA'}, ['Q', '7 Fake Rd', 'Quillby ZZ 14345']]], [['domestic three-part last line', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', 'Spraxham ZZ 15345']], ['missing region collapses spacing', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': '', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', 'Spraxham 15345']], ['only a postal code on the last line', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': '', 'region': '', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', '15345']], ['postal code first, international', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': '', 'postal': '5234', 'country': 'BB', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', '5234 Spraxham', 'BEEMARK']], ['uppercase city on its own line', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': '', 'postal': '15345', 'country': 'CC', 'origin': 'BB'}, ['Alex Fiction', '8 Fake Rd', 'SPRAXHAM', '15345', 'CEELAND']], ['unknown destination falls back', {'name': 'Alex Fiction', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'DD', 'origin': 'AA'}, ['Alex Fiction', '8 Fake Rd', 'Spraxham ZZ 15345', 'DD']], ['empty name line dropped', {'name': '', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['8 Fake Rd', 'Spraxham ZZ 15345']], ['one-letter name kept', {'name': 'Q', 'street': '8 Fake Rd', 'city': 'Spraxham', 'region': 'ZZ', 'postal': '15345', 'country': 'AA', 'origin': 'AA'}, ['Q', '8 Fake Rd', 'Spraxham ZZ 15345']]]]
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 |
|---|---|---|---|
| domestic three-part last line | ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345'] | ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345'] | Passed |
| missing region collapses spacing | ['Pat Example', '4 Fake Rd', 'Faketown 11345'] | ['Pat Example', '4 Fake Rd', 'Faketown 11345'] | Passed |
| only a postal code on the last line | ['Pat Example', '4 Fake Rd', '11345'] | ['Pat Example', '4 Fake Rd', '11345'] | Passed |
| postal code first, international | ['Pat Example', '4 Fake Rd', '1234 Faketown', 'BEEMARK'] | ['Pat Example', '4 Fake Rd', '1234 Faketown', 'BEEMARK'] | Passed |
| uppercase city on its own line | ['PAT EXAMPLE', '4 FAKE RD', 'FAKETOWN', '11345', 'CEELAND'] | ['Pat Example', '4 Fake Rd', 'FAKETOWN', '11345', 'CEELAND'] | Failed |
| unknown destination falls back | ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345', 'DD'] | ['Pat Example', '4 Fake Rd', 'Faketown ZZ 11345', 'DD'] | Passed |
| empty name line dropped | ['4 Fake Rd', 'Faketown ZZ 11345'] | ['4 Fake Rd', 'Faketown ZZ 11345'] | Passed |
| one-letter name kept | ['Q', '4 Fake Rd', 'Faketown ZZ 11345'] | ['Q', '4 Fake Rd', 'Faketown ZZ 11345'] | Passed |
SHA-256 / f767e5b518c96c5ed73765c129cbadf9cd615a24d084c3f8c02becd58b79a60b
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
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.151418+00:00.
Case digest / 9ddffc48262dba82d1c240e36f4365aa976f50c120d886e1e0d7e0b2297b0bc6