FAILURE MAP
← Case archive

FA-96051 / Postal address normalization / Open access

Post office box canonicalizer: periods are deleted instead of becoming spaces · case 01

"P.O.BOX 101" is classified as a street line "POBOX 101".

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

ROOT CAUSE

Periods are removed outright, fusing the prefix letters with BOX.

VERIFIED REPAIR

Replace every period with a space before collapsing whitespace.

Unsuccessful approach: Replacing only the first period still fuses "O.BOX".

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 (['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 fixtureActualExpectedOutcome
dotted prefix{'kind': 'pobox', 'line': 'PO BOX 101'}{'kind': 'pobox', 'line': 'PO BOX 101'}Passed
dotted prefix without spaces{'kind': 'street', 'line': 'POBOX 101'}{'kind': 'pobox', 'line': 'PO BOX 101'}Failed
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 / 29646ea126e76831fc76686fc3b59c0fd6e8169536696eaf20b35589a39c4b3b

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('.', ' ', 1).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 fixtureActualExpectedOutcome
dotted prefix{'kind': 'street', 'line': 'P O. BOX 101'}{'kind': 'pobox', 'line': 'PO BOX 101'}Failed
dotted prefix without spaces{'kind': 'street', 'line': 'P O.BOX 101'}{'kind': 'pobox', 'line': 'PO BOX 101'}Failed
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 / 58d193d2b9e5e66c984962169f4ea5f19c98a59ce6d73c009a82f6af942ddd08

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 fixtureActualExpectedOutcome
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.319951+00:00.

Case digest / 498e757580b6176cf8826e1efa4fe88dac0a828f6bb2e97cdc0f0e5bf48f884a