FA-96081 / Postal address normalization / Open access
Post office box canonicalizer: the spelled-out prefix is missing · case 01
"post office box 101" is a street line.
ROOT CAUSE
The prefix list lacks POST OFFICE BOX.
VERIFIED REPAIR
Include the three-token spelled-out prefix.
Unsuccessful approach: Adding POST OFFICE as a prefix makes BOX look like the identifier and marks the line invalid.
Case contract
Uppercase, turn periods into spaces and collapse whitespace. If the tokens start with one of the prefixes POST OFFICE BOX, P O BOX, PO BOX, POB, BOX (whole tokens) the line is a box line: exactly one alphanumeric identifier must follow, giving {"kind": "pobox", "line": "PO BOX ID"}, otherwise {"kind": "invalid", "line": cleaned}. Other lines return {"kind": "street", "line": cleaned}.
Why this case matters
Box addresses need different delivery handling from street addresses; misclassifying either breaks carrier selection and deduplication.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
s = ' '.join(x.upper().replace('.', ' ').split())
t = s.split()
for prefix in (['P', 'O', 'BOX'], ['PO', 'BOX'], ['POB'], ['BOX']):
k = len(prefix)
if t[:k] == prefix:
if len(t) == k + 1 and t[k].isalnum():
return {'kind': 'pobox', 'line': 'PO BOX ' + t[k]}
return {'kind': 'invalid', 'line': s}
return {'kind': 'street', 'line': s}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['dotted prefix', 'P.O. Box 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['dotted prefix without spaces', 'P.O.BOX 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['spelled-out prefix', 'post office box 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['short prefix', 'POB 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['bare box with letter suffix', 'Box 1A', {'kind': 'pobox', 'line': 'PO BOX 1A'}], ['box identifier starting with a letter', 'BOX A1', {'kind': 'pobox', 'line': 'PO BOX A1'}], ['trailing town after the box', 'PO BOX 101 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '1 FAKE RD', {'kind': 'street', 'line': '1 FAKE RD'}]], [['dotted prefix', 'P.O. Box 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['dotted prefix without spaces', 'P.O.BOX 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['spelled-out prefix', 'post office box 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['short prefix', 'POB 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['bare box with letter suffix', 'Box 2A', {'kind': 'pobox', 'line': 'PO BOX 2A'}], ['box identifier starting with a letter', 'BOX A2', {'kind': 'pobox', 'line': 'PO BOX A2'}], ['trailing town after the box', 'PO BOX 102 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 102 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '2 FAKE RD', {'kind': 'street', 'line': '2 FAKE RD'}]], [['dotted prefix', 'P.O. Box 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['dotted prefix without spaces', 'P.O.BOX 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['spelled-out prefix', 'post office box 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['short prefix', 'POB 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['bare box with letter suffix', 'Box 3A', {'kind': 'pobox', 'line': 'PO BOX 3A'}], ['box identifier starting with a letter', 'BOX A3', {'kind': 'pobox', 'line': 'PO BOX A3'}], ['trailing town after the box', 'PO BOX 103 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 103 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '3 FAKE RD', {'kind': 'street', 'line': '3 FAKE RD'}]], [['dotted prefix', 'P.O. Box 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['dotted prefix without spaces', 'P.O.BOX 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['spelled-out prefix', 'post office box 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['short prefix', 'POB 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['bare box with letter suffix', 'Box 4A', {'kind': 'pobox', 'line': 'PO BOX 4A'}], ['box identifier starting with a letter', 'BOX A4', {'kind': 'pobox', 'line': 'PO BOX A4'}], ['trailing town after the box', 'PO BOX 104 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 104 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '4 FAKE RD', {'kind': 'street', 'line': '4 FAKE RD'}]], [['dotted prefix', 'P.O. Box 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['dotted prefix without spaces', 'P.O.BOX 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['spelled-out prefix', 'post office box 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['short prefix', 'POB 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['bare box with letter suffix', 'Box 5A', {'kind': 'pobox', 'line': 'PO BOX 5A'}], ['box identifier starting with a letter', 'BOX A5', {'kind': 'pobox', 'line': 'PO BOX A5'}], ['trailing town after the box', 'PO BOX 105 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 105 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '5 FAKE RD', {'kind': 'street', 'line': '5 FAKE RD'}]]]
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 |
|---|---|---|---|
| dotted prefix | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| dotted prefix without spaces | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| spelled-out prefix | {'kind': 'street', 'line': 'POST OFFICE BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Failed |
| short prefix | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| bare box with letter suffix | {'kind': 'pobox', 'line': 'PO BOX 1A'} | {'kind': 'pobox', 'line': 'PO BOX 1A'} | Passed |
| box identifier starting with a letter | {'kind': 'pobox', 'line': 'PO BOX A1'} | {'kind': 'pobox', 'line': 'PO BOX A1'} | Passed |
| trailing town after the box | {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'} | {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'} | Passed |
| prefix without number | {'kind': 'invalid', 'line': 'PO BOX'} | {'kind': 'invalid', 'line': 'PO BOX'} | Passed |
| spelled prefix without number | {'kind': 'street', 'line': 'POST OFFICE BOX'} | {'kind': 'invalid', 'line': 'POST OFFICE BOX'} | Failed |
| street starting with BOX letters | {'kind': 'street', 'line': 'BOXWOOD LANE'} | {'kind': 'street', 'line': 'BOXWOOD LANE'} | Passed |
| street spacing collapsed | {'kind': 'street', 'line': '1 FAKE RD'} | {'kind': 'street', 'line': '1 FAKE RD'} | Passed |
SHA-256 / 916f418da5fb0dfb13e733e02ed54f20f0e5927e4dcea63f918a093ca81413e7
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
s = ' '.join(x.upper().replace('.', ' ').split())
t = s.split()
for prefix in (['POST', 'OFFICE'], ['P', 'O', 'BOX'], ['PO', 'BOX'], ['POB'], ['BOX']):
k = len(prefix)
if t[:k] == prefix:
if len(t) == k + 1 and t[k].isalnum():
return {'kind': 'pobox', 'line': 'PO BOX ' + t[k]}
return {'kind': 'invalid', 'line': s}
return {'kind': 'street', 'line': s}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['dotted prefix', 'P.O. Box 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['dotted prefix without spaces', 'P.O.BOX 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['spelled-out prefix', 'post office box 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['short prefix', 'POB 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['bare box with letter suffix', 'Box 1A', {'kind': 'pobox', 'line': 'PO BOX 1A'}], ['box identifier starting with a letter', 'BOX A1', {'kind': 'pobox', 'line': 'PO BOX A1'}], ['trailing town after the box', 'PO BOX 101 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '1 FAKE RD', {'kind': 'street', 'line': '1 FAKE RD'}]], [['dotted prefix', 'P.O. Box 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['dotted prefix without spaces', 'P.O.BOX 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['spelled-out prefix', 'post office box 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['short prefix', 'POB 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['bare box with letter suffix', 'Box 2A', {'kind': 'pobox', 'line': 'PO BOX 2A'}], ['box identifier starting with a letter', 'BOX A2', {'kind': 'pobox', 'line': 'PO BOX A2'}], ['trailing town after the box', 'PO BOX 102 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 102 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '2 FAKE RD', {'kind': 'street', 'line': '2 FAKE RD'}]], [['dotted prefix', 'P.O. Box 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['dotted prefix without spaces', 'P.O.BOX 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['spelled-out prefix', 'post office box 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['short prefix', 'POB 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['bare box with letter suffix', 'Box 3A', {'kind': 'pobox', 'line': 'PO BOX 3A'}], ['box identifier starting with a letter', 'BOX A3', {'kind': 'pobox', 'line': 'PO BOX A3'}], ['trailing town after the box', 'PO BOX 103 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 103 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '3 FAKE RD', {'kind': 'street', 'line': '3 FAKE RD'}]], [['dotted prefix', 'P.O. Box 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['dotted prefix without spaces', 'P.O.BOX 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['spelled-out prefix', 'post office box 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['short prefix', 'POB 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['bare box with letter suffix', 'Box 4A', {'kind': 'pobox', 'line': 'PO BOX 4A'}], ['box identifier starting with a letter', 'BOX A4', {'kind': 'pobox', 'line': 'PO BOX A4'}], ['trailing town after the box', 'PO BOX 104 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 104 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '4 FAKE RD', {'kind': 'street', 'line': '4 FAKE RD'}]], [['dotted prefix', 'P.O. Box 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['dotted prefix without spaces', 'P.O.BOX 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['spelled-out prefix', 'post office box 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['short prefix', 'POB 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['bare box with letter suffix', 'Box 5A', {'kind': 'pobox', 'line': 'PO BOX 5A'}], ['box identifier starting with a letter', 'BOX A5', {'kind': 'pobox', 'line': 'PO BOX A5'}], ['trailing town after the box', 'PO BOX 105 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 105 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '5 FAKE RD', {'kind': 'street', 'line': '5 FAKE RD'}]]]
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 |
|---|---|---|---|
| dotted prefix | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| dotted prefix without spaces | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| spelled-out prefix | {'kind': 'invalid', 'line': 'POST OFFICE BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Failed |
| short prefix | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| bare box with letter suffix | {'kind': 'pobox', 'line': 'PO BOX 1A'} | {'kind': 'pobox', 'line': 'PO BOX 1A'} | Passed |
| box identifier starting with a letter | {'kind': 'pobox', 'line': 'PO BOX A1'} | {'kind': 'pobox', 'line': 'PO BOX A1'} | Passed |
| trailing town after the box | {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'} | {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'} | Passed |
| prefix without number | {'kind': 'invalid', 'line': 'PO BOX'} | {'kind': 'invalid', 'line': 'PO BOX'} | Passed |
| spelled prefix without number | {'kind': 'pobox', 'line': 'PO BOX BOX'} | {'kind': 'invalid', 'line': 'POST OFFICE BOX'} | Failed |
| street starting with BOX letters | {'kind': 'street', 'line': 'BOXWOOD LANE'} | {'kind': 'street', 'line': 'BOXWOOD LANE'} | Passed |
| street spacing collapsed | {'kind': 'street', 'line': '1 FAKE RD'} | {'kind': 'street', 'line': '1 FAKE RD'} | Passed |
SHA-256 / 8e171639b6c2e818c183be6f3f381fbd16f33548a7534461283b4bd70fdf257f
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
s = ' '.join(x.upper().replace('.', ' ').split())
t = s.split()
for prefix in (['POST', 'OFFICE', 'BOX'], ['P', 'O', 'BOX'], ['PO', 'BOX'], ['POB'], ['BOX']):
k = len(prefix)
if t[:k] == prefix:
if len(t) == k + 1 and t[k].isalnum():
return {'kind': 'pobox', 'line': 'PO BOX ' + t[k]}
return {'kind': 'invalid', 'line': s}
return {'kind': 'street', 'line': s}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['dotted prefix', 'P.O. Box 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['dotted prefix without spaces', 'P.O.BOX 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['spelled-out prefix', 'post office box 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['short prefix', 'POB 101', {'kind': 'pobox', 'line': 'PO BOX 101'}], ['bare box with letter suffix', 'Box 1A', {'kind': 'pobox', 'line': 'PO BOX 1A'}], ['box identifier starting with a letter', 'BOX A1', {'kind': 'pobox', 'line': 'PO BOX A1'}], ['trailing town after the box', 'PO BOX 101 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '1 FAKE RD', {'kind': 'street', 'line': '1 FAKE RD'}]], [['dotted prefix', 'P.O. Box 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['dotted prefix without spaces', 'P.O.BOX 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['spelled-out prefix', 'post office box 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['short prefix', 'POB 102', {'kind': 'pobox', 'line': 'PO BOX 102'}], ['bare box with letter suffix', 'Box 2A', {'kind': 'pobox', 'line': 'PO BOX 2A'}], ['box identifier starting with a letter', 'BOX A2', {'kind': 'pobox', 'line': 'PO BOX A2'}], ['trailing town after the box', 'PO BOX 102 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 102 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '2 FAKE RD', {'kind': 'street', 'line': '2 FAKE RD'}]], [['dotted prefix', 'P.O. Box 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['dotted prefix without spaces', 'P.O.BOX 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['spelled-out prefix', 'post office box 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['short prefix', 'POB 103', {'kind': 'pobox', 'line': 'PO BOX 103'}], ['bare box with letter suffix', 'Box 3A', {'kind': 'pobox', 'line': 'PO BOX 3A'}], ['box identifier starting with a letter', 'BOX A3', {'kind': 'pobox', 'line': 'PO BOX A3'}], ['trailing town after the box', 'PO BOX 103 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 103 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '3 FAKE RD', {'kind': 'street', 'line': '3 FAKE RD'}]], [['dotted prefix', 'P.O. Box 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['dotted prefix without spaces', 'P.O.BOX 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['spelled-out prefix', 'post office box 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['short prefix', 'POB 104', {'kind': 'pobox', 'line': 'PO BOX 104'}], ['bare box with letter suffix', 'Box 4A', {'kind': 'pobox', 'line': 'PO BOX 4A'}], ['box identifier starting with a letter', 'BOX A4', {'kind': 'pobox', 'line': 'PO BOX A4'}], ['trailing town after the box', 'PO BOX 104 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 104 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '4 FAKE RD', {'kind': 'street', 'line': '4 FAKE RD'}]], [['dotted prefix', 'P.O. Box 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['dotted prefix without spaces', 'P.O.BOX 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['spelled-out prefix', 'post office box 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['short prefix', 'POB 105', {'kind': 'pobox', 'line': 'PO BOX 105'}], ['bare box with letter suffix', 'Box 5A', {'kind': 'pobox', 'line': 'PO BOX 5A'}], ['box identifier starting with a letter', 'BOX A5', {'kind': 'pobox', 'line': 'PO BOX A5'}], ['trailing town after the box', 'PO BOX 105 FAKETOWN', {'kind': 'invalid', 'line': 'PO BOX 105 FAKETOWN'}], ['prefix without number', 'PO BOX', {'kind': 'invalid', 'line': 'PO BOX'}], ['spelled prefix without number', 'POST OFFICE BOX', {'kind': 'invalid', 'line': 'POST OFFICE BOX'}], ['street starting with BOX letters', 'BOXWOOD LANE', {'kind': 'street', 'line': 'BOXWOOD LANE'}], ['street spacing collapsed', '5 FAKE RD', {'kind': 'street', 'line': '5 FAKE RD'}]]]
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 |
|---|---|---|---|
| dotted prefix | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| dotted prefix without spaces | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| spelled-out prefix | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| short prefix | {'kind': 'pobox', 'line': 'PO BOX 101'} | {'kind': 'pobox', 'line': 'PO BOX 101'} | Passed |
| bare box with letter suffix | {'kind': 'pobox', 'line': 'PO BOX 1A'} | {'kind': 'pobox', 'line': 'PO BOX 1A'} | Passed |
| box identifier starting with a letter | {'kind': 'pobox', 'line': 'PO BOX A1'} | {'kind': 'pobox', 'line': 'PO BOX A1'} | Passed |
| trailing town after the box | {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'} | {'kind': 'invalid', 'line': 'PO BOX 101 FAKETOWN'} | Passed |
| prefix without number | {'kind': 'invalid', 'line': 'PO BOX'} | {'kind': 'invalid', 'line': 'PO BOX'} | Passed |
| spelled prefix without number | {'kind': 'invalid', 'line': 'POST OFFICE BOX'} | {'kind': 'invalid', 'line': 'POST OFFICE BOX'} | Passed |
| street starting with BOX letters | {'kind': 'street', 'line': 'BOXWOOD LANE'} | {'kind': 'street', 'line': 'BOXWOOD LANE'} | Passed |
| street spacing collapsed | {'kind': 'street', 'line': '1 FAKE RD'} | {'kind': 'street', 'line': '1 FAKE RD'} | Passed |
SHA-256 / 11e8509fa44f4e2d4c0c7ee3aef51804fb8bfbe284b0fc2a04aff7367210d416
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:19.473820+00:00.
Case digest / 4f85ba2aaece46ed44f5c1ed437cce55ecf693bd9c9347892b2270ef3959da0c