FAILURE MAP
← Case archive

FA-96166 / Postal address normalization / Open access

Delivery point check digit: delivery point is appended to five-digit codes · case 01

A code without plus-four still carries a delivery point.

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

ROOT CAUSE

The delivery point is always appended regardless of the plus-four.

VERIFIED REPAIR

Append plus-four and delivery point only when plus-four is present.

Unsuccessful approach: Dropping the delivery point whenever plus-four is present removes it from full codes.

Case contract

Input [zip5, plus4, primary]. The delivery point is the last two of the leading digits of the primary number, zero-padded to two, or "99" when there are none. With a plus-four the digit string is zip5 + plus4 + delivery point, otherwise zip5 alone. Append the check digit (10 - digit sum mod 10) mod 10.

Why this case matters

A wrong delivery point or check digit sends machine-sorted mail to the wrong door or rejects it.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    zip5, plus4, primary = x
    lead = ''
    for c in primary:
        if not c.isdigit():
            break
        lead += c
    dp = lead[-2:].zfill(2) if lead else '99'
    digits = zip5 + plus4 + dp
    check = (10 - sum(int(c) for c in digits) % 10) % 10
    return digits + str(check)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['three-digit house number', ['12341', '6789', '123'], '123416789234'], ['four-digit house number', ['12341', '6789', '4567'], '123416789676'], ['one-digit house number is padded', ['12341', '6789', '7'], '123416789072'], ['no house digits uses the default', ['12341', '6789', 'RR'], '123416789991'], ['hyphenated house number stops at the hyphen', ['12341', '6789', '12-4'], '123416789126'], ['five-digit code has no delivery point', ['12341', '', '123'], '123419'], ['digit sum already a multiple of ten', ['19000', '0000', '300'], '190000000000']], [['three-digit house number', ['23442', '6789', '123'], '234426789230'], ['four-digit house number', ['23442', '6789', '4567'], '234426789672'], ['one-digit house number is padded', ['23442', '6789', '7'], '234426789078'], ['no house digits uses the default', ['23442', '6789', 'RR'], '234426789997'], ['hyphenated house number stops at the hyphen', ['23442', '6789', '12-4'], '234426789122'], ['five-digit code has no delivery point', ['23442', '', '123'], '234425'], ['digit sum already a multiple of ten', ['28000', '0000', '300'], '280000000000']], [['three-digit house number', ['34543', '6789', '123'], '345436789236'], ['four-digit house number', ['34543', '6789', '4567'], '345436789678'], ['one-digit house number is padded', ['34543', '6789', '7'], '345436789074'], ['no house digits uses the default', ['34543', '6789', 'RR'], '345436789993'], ['hyphenated house number stops at the hyphen', ['34543', '6789', '12-4'], '345436789128'], ['five-digit code has no delivery point', ['34543', '', '123'], '345431'], ['digit sum already a multiple of ten', ['37000', '0000', '300'], '370000000000']], [['three-digit house number', ['45644', '6789', '123'], '456446789232'], ['four-digit house number', ['45644', '6789', '4567'], '456446789674'], ['one-digit house number is padded', ['45644', '6789', '7'], '456446789070'], ['no house digits uses the default', ['45644', '6789', 'RR'], '456446789999'], ['hyphenated house number stops at the hyphen', ['45644', '6789', '12-4'], '456446789124'], ['five-digit code has no delivery point', ['45644', '', '123'], '456447'], ['digit sum already a multiple of ten', ['46000', '0000', '300'], '460000000000']], [['three-digit house number', ['56745', '6789', '123'], '567456789238'], ['four-digit house number', ['56745', '6789', '4567'], '567456789670'], ['one-digit house number is padded', ['56745', '6789', '7'], '567456789076'], ['no house digits uses the default', ['56745', '6789', 'RR'], '567456789995'], ['hyphenated house number stops at the hyphen', ['56745', '6789', '12-4'], '567456789120'], ['five-digit code has no delivery point', ['56745', '', '123'], '567453'], ['digit sum already a multiple of ten', ['55000', '0000', '300'], '550000000000']]]
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
three-digit house number123416789234123416789234Passed
four-digit house number123416789676123416789676Passed
one-digit house number is padded123416789072123416789072Passed
no house digits uses the default123416789991123416789991Passed
hyphenated house number stops at the hyphen123416789126123416789126Passed
five-digit code has no delivery point12341234123419Failed
digit sum already a multiple of ten190000000000190000000000Passed

SHA-256 / 112f114a759fc40b2661116aaf0e3314a006df8bde8f51e16808ba2927d15d98

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    zip5, plus4, primary = x
    lead = ''
    for c in primary:
        if not c.isdigit():
            break
        lead += c
    dp = lead[-2:].zfill(2) if lead else '99'
    digits = zip5 + plus4 if plus4 else zip5
    check = (10 - sum(int(c) for c in digits) % 10) % 10
    return digits + str(check)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['three-digit house number', ['12341', '6789', '123'], '123416789234'], ['four-digit house number', ['12341', '6789', '4567'], '123416789676'], ['one-digit house number is padded', ['12341', '6789', '7'], '123416789072'], ['no house digits uses the default', ['12341', '6789', 'RR'], '123416789991'], ['hyphenated house number stops at the hyphen', ['12341', '6789', '12-4'], '123416789126'], ['five-digit code has no delivery point', ['12341', '', '123'], '123419'], ['digit sum already a multiple of ten', ['19000', '0000', '300'], '190000000000']], [['three-digit house number', ['23442', '6789', '123'], '234426789230'], ['four-digit house number', ['23442', '6789', '4567'], '234426789672'], ['one-digit house number is padded', ['23442', '6789', '7'], '234426789078'], ['no house digits uses the default', ['23442', '6789', 'RR'], '234426789997'], ['hyphenated house number stops at the hyphen', ['23442', '6789', '12-4'], '234426789122'], ['five-digit code has no delivery point', ['23442', '', '123'], '234425'], ['digit sum already a multiple of ten', ['28000', '0000', '300'], '280000000000']], [['three-digit house number', ['34543', '6789', '123'], '345436789236'], ['four-digit house number', ['34543', '6789', '4567'], '345436789678'], ['one-digit house number is padded', ['34543', '6789', '7'], '345436789074'], ['no house digits uses the default', ['34543', '6789', 'RR'], '345436789993'], ['hyphenated house number stops at the hyphen', ['34543', '6789', '12-4'], '345436789128'], ['five-digit code has no delivery point', ['34543', '', '123'], '345431'], ['digit sum already a multiple of ten', ['37000', '0000', '300'], '370000000000']], [['three-digit house number', ['45644', '6789', '123'], '456446789232'], ['four-digit house number', ['45644', '6789', '4567'], '456446789674'], ['one-digit house number is padded', ['45644', '6789', '7'], '456446789070'], ['no house digits uses the default', ['45644', '6789', 'RR'], '456446789999'], ['hyphenated house number stops at the hyphen', ['45644', '6789', '12-4'], '456446789124'], ['five-digit code has no delivery point', ['45644', '', '123'], '456447'], ['digit sum already a multiple of ten', ['46000', '0000', '300'], '460000000000']], [['three-digit house number', ['56745', '6789', '123'], '567456789238'], ['four-digit house number', ['56745', '6789', '4567'], '567456789670'], ['one-digit house number is padded', ['56745', '6789', '7'], '567456789076'], ['no house digits uses the default', ['56745', '6789', 'RR'], '567456789995'], ['hyphenated house number stops at the hyphen', ['56745', '6789', '12-4'], '567456789120'], ['five-digit code has no delivery point', ['56745', '', '123'], '567453'], ['digit sum already a multiple of ten', ['55000', '0000', '300'], '550000000000']]]
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
three-digit house number1234167899123416789234Failed
four-digit house number1234167899123416789676Failed
one-digit house number is padded1234167899123416789072Failed
no house digits uses the default1234167899123416789991Failed
hyphenated house number stops at the hyphen1234167899123416789126Failed
five-digit code has no delivery point123419123419Passed
digit sum already a multiple of ten1900000000190000000000Failed

SHA-256 / 48f7815562913a32e97155f5007a2340f7e59d328a4a0aea7d60aeffc3014756

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    zip5, plus4, primary = x
    lead = ''
    for c in primary:
        if not c.isdigit():
            break
        lead += c
    dp = lead[-2:].zfill(2) if lead else '99'
    digits = zip5 + plus4 + dp if plus4 else zip5
    check = (10 - sum(int(c) for c in digits) % 10) % 10
    return digits + str(check)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['three-digit house number', ['12341', '6789', '123'], '123416789234'], ['four-digit house number', ['12341', '6789', '4567'], '123416789676'], ['one-digit house number is padded', ['12341', '6789', '7'], '123416789072'], ['no house digits uses the default', ['12341', '6789', 'RR'], '123416789991'], ['hyphenated house number stops at the hyphen', ['12341', '6789', '12-4'], '123416789126'], ['five-digit code has no delivery point', ['12341', '', '123'], '123419'], ['digit sum already a multiple of ten', ['19000', '0000', '300'], '190000000000']], [['three-digit house number', ['23442', '6789', '123'], '234426789230'], ['four-digit house number', ['23442', '6789', '4567'], '234426789672'], ['one-digit house number is padded', ['23442', '6789', '7'], '234426789078'], ['no house digits uses the default', ['23442', '6789', 'RR'], '234426789997'], ['hyphenated house number stops at the hyphen', ['23442', '6789', '12-4'], '234426789122'], ['five-digit code has no delivery point', ['23442', '', '123'], '234425'], ['digit sum already a multiple of ten', ['28000', '0000', '300'], '280000000000']], [['three-digit house number', ['34543', '6789', '123'], '345436789236'], ['four-digit house number', ['34543', '6789', '4567'], '345436789678'], ['one-digit house number is padded', ['34543', '6789', '7'], '345436789074'], ['no house digits uses the default', ['34543', '6789', 'RR'], '345436789993'], ['hyphenated house number stops at the hyphen', ['34543', '6789', '12-4'], '345436789128'], ['five-digit code has no delivery point', ['34543', '', '123'], '345431'], ['digit sum already a multiple of ten', ['37000', '0000', '300'], '370000000000']], [['three-digit house number', ['45644', '6789', '123'], '456446789232'], ['four-digit house number', ['45644', '6789', '4567'], '456446789674'], ['one-digit house number is padded', ['45644', '6789', '7'], '456446789070'], ['no house digits uses the default', ['45644', '6789', 'RR'], '456446789999'], ['hyphenated house number stops at the hyphen', ['45644', '6789', '12-4'], '456446789124'], ['five-digit code has no delivery point', ['45644', '', '123'], '456447'], ['digit sum already a multiple of ten', ['46000', '0000', '300'], '460000000000']], [['three-digit house number', ['56745', '6789', '123'], '567456789238'], ['four-digit house number', ['56745', '6789', '4567'], '567456789670'], ['one-digit house number is padded', ['56745', '6789', '7'], '567456789076'], ['no house digits uses the default', ['56745', '6789', 'RR'], '567456789995'], ['hyphenated house number stops at the hyphen', ['56745', '6789', '12-4'], '567456789120'], ['five-digit code has no delivery point', ['56745', '', '123'], '567453'], ['digit sum already a multiple of ten', ['55000', '0000', '300'], '550000000000']]]
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
three-digit house number123416789234123416789234Passed
four-digit house number123416789676123416789676Passed
one-digit house number is padded123416789072123416789072Passed
no house digits uses the default123416789991123416789991Passed
hyphenated house number stops at the hyphen123416789126123416789126Passed
five-digit code has no delivery point123419123419Passed
digit sum already a multiple of ten190000000000190000000000Passed

SHA-256 / a1af4429ffda66938003d4e30131d093702831f4e549075692d328dc8d7ab5f6

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

Case digest / 44b8a8fe9400bb990ac98b99c8c2bc6e63e9d6c0bc808e66af63e55022e563c2