FAILURE MAP
← Case archive

FA-79371 / Barcode symbology encoding / Open access

UPC-E expansion applies the 0-2 rule to a final 3 · case 01

Compressed codes ending in 3 expand to a different manufacturer number.

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

ROOT CAUSE

The first rule captures d6 = 3, so the dedicated 3 rule never runs.

VERIFIED REPAIR

Apply the d6-into-manufacturer rule only for final digits 0, 1 and 2.

Unsuccessful approach: Restricting it to 0 and 1 sends 2 to the fall-through rule.

Case contract

Expand an 8-digit zero-suppressed UPC-E string (number system 0 or 1, six digits d1..d6, check digit passed through) into 12-digit UPC-A: d6 in 0-2 -> d1 d2 d6 0000 d3 d4 d5; d6 = 3 -> d1 d2 d3 00000 d4 d5; d6 = 4 -> d1 d2 d3 d4 00000 d5; d6 in 5-9 -> d1..d5 0000 d6. Invalid input returns None.

Why this case matters

Retail, logistics, pharmacy and document workflows depend on encoders that produce exactly the module pattern, code-set switches, separators and quiet zones scanners expect; one misplaced module or separator makes a label unreadable or, worse, scan as different data.

1 / The failure

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

N = 1
observations = []
def solve(e):
    if len(e) != 8 or not all(ch in '0123456789' for ch in e):
        return None
    ns, d, chk = e[0], e[1:7], e[7]
    if ns not in ('0', '1'):
        return None
    last = d[5]
    if last in '0123':
        body = d[0:2] + last + '0000' + d[2:5]
    elif last == '3':
        body = d[0:3] + '00000' + d[3:5]
    elif last == '4':
        body = d[0:4] + '00000' + d[4]
    else:
        body = d[0:5] + '0000' + last
    return ns + body + chk
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['01189536', '011800000956'], ['16787022', '167200008702'], ['25279409', None], ['04319958', '043199000058'], ['08023781', '080237000081'], ['24955674', None], ['29819666', None], ['09341436', '093400000146']], [['10930437', '109300000047'], ['09520429', '095200002049'], ['06482006', '064000008206'], ['13115485', '131154000085'], ['28046301', None], ['15524099', '155240000099'], ['18039301', '180000003931'], ['00286336', '002800000636']], [['15918031', '159100000801'], ['14075822', '140200007582'], ['07273910', '072100007390'], ['29592260', None], ['00838090', '008380000090'], ['19840591', '198405000091'], ['21922317', None], ['01282734', '012800000274']], [['03368937', '033600000897'], ['07252722', '072200005272'], ['08533799', '085337000099'], ['00787643', '007870000063'], ['08858661', '088586000061'], ['24707936', None], ['06596582', '065965000082'], ['06465438', '064600000548']], [['00537830', '005300000780'], ['19262728', '192200006278'], ['28773952', None], ['18771250', '187712000050'], ['13513558', '135135000058'], ['03833572', '038335000072'], ['17673991', '176739000091'], ['02109436', '021000000946']]]
labels = ["regression: manufacturer rule boundary", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), 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
regression: manufacturer rule boundary 0011300008956011800000956Failed
repair trap 1167200008702167200008702Passed
combined fault 2NoneNonePassed
control 3043199000058043199000058Passed
control 4080237000081080237000081Passed
boundary 5NoneNonePassed
boundary 6NoneNonePassed
control 7093300004146093400000146Failed

SHA-256 / f1e17d5b7164dca8a2815930f329585ae845bde3914d0a8d24c3c359474266a9

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(e):
    if len(e) != 8 or not all(ch in '0123456789' for ch in e):
        return None
    ns, d, chk = e[0], e[1:7], e[7]
    if ns not in ('0', '1'):
        return None
    last = d[5]
    if last in '01':
        body = d[0:2] + last + '0000' + d[2:5]
    elif last == '3':
        body = d[0:3] + '00000' + d[3:5]
    elif last == '4':
        body = d[0:4] + '00000' + d[4]
    else:
        body = d[0:5] + '0000' + last
    return ns + body + chk
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['01189536', '011800000956'], ['16787022', '167200008702'], ['25279409', None], ['04319958', '043199000058'], ['08023781', '080237000081'], ['24955674', None], ['29819666', None], ['09341436', '093400000146']], [['10930437', '109300000047'], ['09520429', '095200002049'], ['06482006', '064000008206'], ['13115485', '131154000085'], ['28046301', None], ['15524099', '155240000099'], ['18039301', '180000003931'], ['00286336', '002800000636']], [['15918031', '159100000801'], ['14075822', '140200007582'], ['07273910', '072100007390'], ['29592260', None], ['00838090', '008380000090'], ['19840591', '198405000091'], ['21922317', None], ['01282734', '012800000274']], [['03368937', '033600000897'], ['07252722', '072200005272'], ['08533799', '085337000099'], ['00787643', '007870000063'], ['08858661', '088586000061'], ['24707936', None], ['06596582', '065965000082'], ['06465438', '064600000548']], [['00537830', '005300000780'], ['19262728', '192200006278'], ['28773952', None], ['18771250', '187712000050'], ['13513558', '135135000058'], ['03833572', '038335000072'], ['17673991', '176739000091'], ['02109436', '021000000946']]]
labels = ["regression: manufacturer rule boundary", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), 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
regression: manufacturer rule boundary 0011800000956011800000956Passed
repair trap 1167870000022167200008702Failed
combined fault 2NoneNonePassed
control 3043199000058043199000058Passed
control 4080237000081080237000081Passed
boundary 5NoneNonePassed
boundary 6NoneNonePassed
control 7093400000146093400000146Passed

SHA-256 / 6044c46e0577ce78383cb3245b3523c79b7335f3bba43ea7fa97c8b2b19bd2b9

3 / The verified repair

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

N = 1
observations = []
def solve(e):
    if len(e) != 8 or not all(ch in '0123456789' for ch in e):
        return None
    ns, d, chk = e[0], e[1:7], e[7]
    if ns not in ('0', '1'):
        return None
    last = d[5]
    if last in '012':
        body = d[0:2] + last + '0000' + d[2:5]
    elif last == '3':
        body = d[0:3] + '00000' + d[3:5]
    elif last == '4':
        body = d[0:4] + '00000' + d[4]
    else:
        body = d[0:5] + '0000' + last
    return ns + body + chk
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['01189536', '011800000956'], ['16787022', '167200008702'], ['25279409', None], ['04319958', '043199000058'], ['08023781', '080237000081'], ['24955674', None], ['29819666', None], ['09341436', '093400000146']], [['10930437', '109300000047'], ['09520429', '095200002049'], ['06482006', '064000008206'], ['13115485', '131154000085'], ['28046301', None], ['15524099', '155240000099'], ['18039301', '180000003931'], ['00286336', '002800000636']], [['15918031', '159100000801'], ['14075822', '140200007582'], ['07273910', '072100007390'], ['29592260', None], ['00838090', '008380000090'], ['19840591', '198405000091'], ['21922317', None], ['01282734', '012800000274']], [['03368937', '033600000897'], ['07252722', '072200005272'], ['08533799', '085337000099'], ['00787643', '007870000063'], ['08858661', '088586000061'], ['24707936', None], ['06596582', '065965000082'], ['06465438', '064600000548']], [['00537830', '005300000780'], ['19262728', '192200006278'], ['28773952', None], ['18771250', '187712000050'], ['13513558', '135135000058'], ['03833572', '038335000072'], ['17673991', '176739000091'], ['02109436', '021000000946']]]
labels = ["regression: manufacturer rule boundary", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), 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
regression: manufacturer rule boundary 0011800000956011800000956Passed
repair trap 1167200008702167200008702Passed
combined fault 2NoneNonePassed
control 3043199000058043199000058Passed
control 4080237000081080237000081Passed
boundary 5NoneNonePassed
boundary 6NoneNonePassed
control 7093400000146093400000146Passed

SHA-256 / 27cfca0e824271824f8db9e676990938345316285bb2533eb9f7337486012818

Verification & scope

A deterministic bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. 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:49:43.824649+00:00.

Case digest / 9ff24c8e13e134acc922631a51e0b8089322a464c3c7755c4169e94c6cdeabb9