FA-95966 / Postal address normalization / Open access
Alternating letter-digit postal code: letter and digit positions are swapped · case 01
Every valid code is rejected.
ROOT CAUSE
Letter positions are taken as odd indexes, as if counting from one.
THE FAILURE
Letter positions are taken as odd indexes, as if counting from one.
Unsuccessful approach: Listing the letter positions by hand as 0, 2, 5 still misplaces the last pair.
Case contract
Strip and uppercase. A 7-character input with a space at index 3 loses the space. The result must be 6 characters alternating ASCII letter, digit, letter, digit, letter, digit. Letters D F I O Q U are forbidden everywhere; W and Z are forbidden in the first position only. Return "L9L 9L9" or None.
Why this case matters
Six-character alternating codes are typed with and without the space; rejecting or accepting the wrong letters silently drops or misroutes mail.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
s = x.strip().upper()
if len(s) == 7 and s[3] == ' ':
s = s[:3] + s[4:]
if len(s) != 6:
return None
for i, c in enumerate(s):
if i % 2 == 1:
if not ('A' <= c <= 'Z') or c in 'DFIOQU':
return None
elif not c.isdigit():
return None
if s[0] in 'WZ':
return None
return s[:3] + ' ' + s[3:]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['compact code gets its space', 'K1A4B1', 'K1A 4B1'], ['spaced lowercase code', 'k1a 4b1', 'K1A 4B1'], ['hyphen separator rejected', 'K1A-4B1', None], ['forbidden letter in third position', 'K1U 4B1', None], ['Z not allowed first', 'Z1A 4B1', None], ['W allowed after the first position', 'K1W 4B1', 'K1W 4B1'], ['seven characters without space rejected', 'K1A4B1C', None], ['five characters rejected', 'K1A4B', None]], [['compact code gets its space', 'K2A5B2', 'K2A 5B2'], ['spaced lowercase code', 'k2a 5b2', 'K2A 5B2'], ['hyphen separator rejected', 'K2A-5B2', None], ['forbidden letter in third position', 'K2U 5B2', None], ['Z not allowed first', 'Z2A 5B2', None], ['W allowed after the first position', 'K2W 5B2', 'K2W 5B2'], ['seven characters without space rejected', 'K2A5B2C', None], ['five characters rejected', 'K2A5B', None]], [['compact code gets its space', 'K3A6B3', 'K3A 6B3'], ['spaced lowercase code', 'k3a 6b3', 'K3A 6B3'], ['hyphen separator rejected', 'K3A-6B3', None], ['forbidden letter in third position', 'K3U 6B3', None], ['Z not allowed first', 'Z3A 6B3', None], ['W allowed after the first position', 'K3W 6B3', 'K3W 6B3'], ['seven characters without space rejected', 'K3A6B3C', None], ['five characters rejected', 'K3A6B', None]], [['compact code gets its space', 'K4A7B4', 'K4A 7B4'], ['spaced lowercase code', 'k4a 7b4', 'K4A 7B4'], ['hyphen separator rejected', 'K4A-7B4', None], ['forbidden letter in third position', 'K4U 7B4', None], ['Z not allowed first', 'Z4A 7B4', None], ['W allowed after the first position', 'K4W 7B4', 'K4W 7B4'], ['seven characters without space rejected', 'K4A7B4C', None], ['five characters rejected', 'K4A7B', None]], [['compact code gets its space', 'K5A8B5', 'K5A 8B5'], ['spaced lowercase code', 'k5a 8b5', 'K5A 8B5'], ['hyphen separator rejected', 'K5A-8B5', None], ['forbidden letter in third position', 'K5U 8B5', None], ['Z not allowed first', 'Z5A 8B5', None], ['W allowed after the first position', 'K5W 8B5', 'K5W 8B5'], ['seven characters without space rejected', 'K5A8B5C', None], ['five characters rejected', 'K5A8B', None]]]
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 |
|---|---|---|---|
| compact code gets its space | None | K1A 4B1 | Failed |
| spaced lowercase code | None | K1A 4B1 | Failed |
| hyphen separator rejected | None | None | Passed |
| forbidden letter in third position | None | None | Passed |
| Z not allowed first | None | None | Passed |
| W allowed after the first position | None | K1W 4B1 | Failed |
| seven characters without space rejected | None | None | Passed |
| five characters rejected | None | None | Passed |
SHA-256 / 78bf5c660c5367cbd47e8f8cae312947f7d3ba50936b3cde9378ab8a2b8730db
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
s = x.strip().upper()
if len(s) == 7 and s[3] == ' ':
s = s[:3] + s[4:]
if len(s) != 6:
return None
for i, c in enumerate(s):
if i in (0, 2, 5):
if not ('A' <= c <= 'Z') or c in 'DFIOQU':
return None
elif not c.isdigit():
return None
if s[0] in 'WZ':
return None
return s[:3] + ' ' + s[3:]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['compact code gets its space', 'K1A4B1', 'K1A 4B1'], ['spaced lowercase code', 'k1a 4b1', 'K1A 4B1'], ['hyphen separator rejected', 'K1A-4B1', None], ['forbidden letter in third position', 'K1U 4B1', None], ['Z not allowed first', 'Z1A 4B1', None], ['W allowed after the first position', 'K1W 4B1', 'K1W 4B1'], ['seven characters without space rejected', 'K1A4B1C', None], ['five characters rejected', 'K1A4B', None]], [['compact code gets its space', 'K2A5B2', 'K2A 5B2'], ['spaced lowercase code', 'k2a 5b2', 'K2A 5B2'], ['hyphen separator rejected', 'K2A-5B2', None], ['forbidden letter in third position', 'K2U 5B2', None], ['Z not allowed first', 'Z2A 5B2', None], ['W allowed after the first position', 'K2W 5B2', 'K2W 5B2'], ['seven characters without space rejected', 'K2A5B2C', None], ['five characters rejected', 'K2A5B', None]], [['compact code gets its space', 'K3A6B3', 'K3A 6B3'], ['spaced lowercase code', 'k3a 6b3', 'K3A 6B3'], ['hyphen separator rejected', 'K3A-6B3', None], ['forbidden letter in third position', 'K3U 6B3', None], ['Z not allowed first', 'Z3A 6B3', None], ['W allowed after the first position', 'K3W 6B3', 'K3W 6B3'], ['seven characters without space rejected', 'K3A6B3C', None], ['five characters rejected', 'K3A6B', None]], [['compact code gets its space', 'K4A7B4', 'K4A 7B4'], ['spaced lowercase code', 'k4a 7b4', 'K4A 7B4'], ['hyphen separator rejected', 'K4A-7B4', None], ['forbidden letter in third position', 'K4U 7B4', None], ['Z not allowed first', 'Z4A 7B4', None], ['W allowed after the first position', 'K4W 7B4', 'K4W 7B4'], ['seven characters without space rejected', 'K4A7B4C', None], ['five characters rejected', 'K4A7B', None]], [['compact code gets its space', 'K5A8B5', 'K5A 8B5'], ['spaced lowercase code', 'k5a 8b5', 'K5A 8B5'], ['hyphen separator rejected', 'K5A-8B5', None], ['forbidden letter in third position', 'K5U 8B5', None], ['Z not allowed first', 'Z5A 8B5', None], ['W allowed after the first position', 'K5W 8B5', 'K5W 8B5'], ['seven characters without space rejected', 'K5A8B5C', None], ['five characters rejected', 'K5A8B', None]]]
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 |
|---|---|---|---|
| compact code gets its space | None | K1A 4B1 | Failed |
| spaced lowercase code | None | K1A 4B1 | Failed |
| hyphen separator rejected | None | None | Passed |
| forbidden letter in third position | None | None | Passed |
| Z not allowed first | None | None | Passed |
| W allowed after the first position | None | K1W 4B1 | Failed |
| seven characters without space rejected | None | None | Passed |
| five characters rejected | None | None | Passed |
SHA-256 / b26865b8f5977f88b1f14d17dddc6ac0575b376298196d50722c2a098c85a40e
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:18.716306+00:00.
Case digest / cde97290e3534d52e65a29c48c4ed069c18ee88e7ce97b87892d691ebca365e5