FAILURE MAP
← Case archive

FA-95976 / Postal address normalization / Open access

Alternating letter-digit postal code: a leading Z is accepted · case 01

"Z1A 4B1" is accepted.

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

ROOT CAUSE

Only W is excluded in the first position.

THE FAILURE

Only W is excluded in the first position.

Unsuccessful approach: Excluding W and Z everywhere rejects valid codes such as "K1W 4B1".

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 == 0:
            if not ('A' <= c <= 'Z') or c in 'DFIOQU':
                return None
        elif not c.isdigit():
            return None
    if s[0] == 'W':
        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 fixtureActualExpectedOutcome
compact code gets its spaceK1A 4B1K1A 4B1Passed
spaced lowercase codeK1A 4B1K1A 4B1Passed
hyphen separator rejectedNoneNonePassed
forbidden letter in third positionNoneNonePassed
Z not allowed firstZ1A 4B1NoneFailed
W allowed after the first positionK1W 4B1K1W 4B1Passed
seven characters without space rejectedNoneNonePassed
five characters rejectedNoneNonePassed

SHA-256 / 0c039d2f6b4f5e062e02db3524fbefd51f95812a9dd5c885e8685dffb649eabe

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 % 2 == 0:
            if not ('A' <= c <= 'Z') or c in 'DFIOQU':
                return None
        elif not c.isdigit():
            return None
    if any(c in 'WZ' for c in s):
        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 fixtureActualExpectedOutcome
compact code gets its spaceK1A 4B1K1A 4B1Passed
spaced lowercase codeK1A 4B1K1A 4B1Passed
hyphen separator rejectedNoneNonePassed
forbidden letter in third positionNoneNonePassed
Z not allowed firstNoneNonePassed
W allowed after the first positionNoneK1W 4B1Failed
seven characters without space rejectedNoneNonePassed
five characters rejectedNoneNonePassed

SHA-256 / 1576a499118182847fed58202e0c83195ce858fc1682439c4637881abe0ba99b

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 / af408eb59d232dcb1142e3be265dd10f102c47704fa481f13f131aac76ecc3f0