FAILURE MAP
← Case archive

FA-96141 / Postal address normalization / Open access

Delivery point check digit: a zero check digit becomes 10 · case 01

Codes whose digit sum is a multiple of ten end in "10".

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

ROOT CAUSE

The outer modulo that maps 10 back to 0 is missing.

VERIFIED REPAIR

Take (10 - sum % 10) % 10.

Unsuccessful approach: Using the digit sum modulo 10 as the check value is the complement of the required digit.

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 if plus4 else zip5
    check = 10 - sum(int(c) for c in digits) % 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 ten1900000000010190000000000Failed

SHA-256 / 2ca4b02cac0cfe365ba2106cf65f751f88d8da2c4d007f7d5801dc445b2e503c

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 + dp if plus4 else zip5
    check = sum(int(c) for c in digits) % 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 number123416789236123416789234Failed
four-digit house number123416789674123416789676Failed
one-digit house number is padded123416789078123416789072Failed
no house digits uses the default123416789999123416789991Failed
hyphenated house number stops at the hyphen123416789124123416789126Failed
five-digit code has no delivery point123411123419Failed
digit sum already a multiple of ten190000000000190000000000Passed

SHA-256 / d14a2420c7d4487ac0267f07c44a7526ef9e2e0439a8993ac6d9de38e6e5aca8

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

Case digest / 2dc0ee13d2a375ef6569f96ce73be5865e19444ddd450f7161aea443079473e5