FA-96146 / Postal address normalization / Open access
Delivery point check digit: the first two house digits are used · case 01
House 123 gets delivery point 12 instead of 23.
ROOT CAUSE
The slice takes the leading two digits instead of the last two.
VERIFIED REPAIR
Use the last two leading digits.
Unsuccessful approach: Slicing positions 1 to 3 works for three-digit numbers only.
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) % 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| three-digit house number | 123416789126 | 123416789234 | Failed |
| four-digit house number | 123416789450 | 123416789676 | Failed |
| one-digit house number is padded | 123416789072 | 123416789072 | Passed |
| no house digits uses the default | 123416789991 | 123416789991 | Passed |
| hyphenated house number stops at the hyphen | 123416789126 | 123416789126 | Passed |
| five-digit code has no delivery point | 123419 | 123419 | Passed |
| digit sum already a multiple of ten | 190000000307 | 190000000000 | Failed |
SHA-256 / 95282c860dfb877793cbe502e5197a25e81541b441254ca6d8a8e58717f5d270
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[1:3].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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| three-digit house number | 123416789234 | 123416789234 | Passed |
| four-digit house number | 123416789568 | 123416789676 | Failed |
| one-digit house number is padded | 123416789009 | 123416789072 | Failed |
| no house digits uses the default | 123416789991 | 123416789991 | Passed |
| hyphenated house number stops at the hyphen | 123416789027 | 123416789126 | Failed |
| five-digit code has no delivery point | 123419 | 123419 | Passed |
| digit sum already a multiple of ten | 190000000000 | 190000000000 | Passed |
SHA-256 / be5532b7da3939e174ee139607c76ad7b61558b41e44fee01bf169e669b55d9a
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| three-digit house number | 123416789234 | 123416789234 | Passed |
| four-digit house number | 123416789676 | 123416789676 | Passed |
| one-digit house number is padded | 123416789072 | 123416789072 | Passed |
| no house digits uses the default | 123416789991 | 123416789991 | Passed |
| hyphenated house number stops at the hyphen | 123416789126 | 123416789126 | Passed |
| five-digit code has no delivery point | 123419 | 123419 | Passed |
| digit sum already a multiple of ten | 190000000000 | 190000000000 | Passed |
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.104447+00:00.
Case digest / d9246e5ce3e1d0b7a72c5a1635a3e0522a520fa85d93d85e658539beb1f7732f