FA-79381 / Barcode symbology encoding / Open access
UPC-E rule 4 uses the three-digit manufacturer layout · case 01
Codes ending in 4 collide with codes ending in 3.
ROOT CAUSE
The d6 = 4 case copies the rule-3 layout.
THE FAILURE
The d6 = 4 case copies the rule-3 layout.
Unsuccessful approach: Appending a trailing zero shifts d5 out of the item reference position.
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 '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:3] + '00000' + d[3:5]
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 = [[['03495247', '034950000027'], ['06000842', '060000000082'], ['13586942', '135860000092'], ['25279409', None], ['04319958', '043199000058'], ['08023781', '080237000081'], ['16787022', '167200008702'], ['03832344', '038320000034']], [['01699444', '016990000044'], ['11536842', '115360000082'], ['06482006', '064000008206'], ['13115485', '131154000085'], ['28046301', None], ['15524099', '155240000099'], ['18039301', '180000003931'], ['02636740', '026360000070']], [['17043643', '170430000063'], ['03250241', '032500000021'], ['00007549', '000070000059'], ['19115135', '191100000515'], ['11882825', '118200008285'], ['21587198', None], ['01282734', '012800000274'], ['16023547', '160230000057']], [['00767246', '007670000026'], ['03161940', '031610000090'], ['08858661', '088586000061'], ['24707936', None], ['09720132', '097200000012'], ['06596582', '065965000082'], ['07319884', '073198000084'], ['00787643', '007870000063']], [['03581849', '035810000089'], ['17614340', '176140000030'], ['16789341', '167890000031'], ['08283998', '082839000098'], ['28773952', None], ['18771250', '187712000050'], ['13513558', '135135000058'], ['10079442', '100790000042']]]
labels = ["regression: final digit 4 layout", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: final digit 4 layout 0 | 034900000527 | 034950000027 | Failed |
| repair trap 1 | 060000000082 | 060000000082 | Passed |
| combined fault 2 | 135800000692 | 135860000092 | Failed |
| control 3 | None | None | Passed |
| control 4 | 043199000058 | 043199000058 | Passed |
| boundary 5 | 080237000081 | 080237000081 | Passed |
| boundary 6 | 167200008702 | 167200008702 | Passed |
| control 7 | 038300000234 | 038320000034 | Failed |
SHA-256 / 1ad5cb063cb33efd9298d01f53fdfe6dc09fcb186a594002244751bec9ef7d94
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 '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] + '0000' + d[4] + '0'
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 = [[['03495247', '034950000027'], ['06000842', '060000000082'], ['13586942', '135860000092'], ['25279409', None], ['04319958', '043199000058'], ['08023781', '080237000081'], ['16787022', '167200008702'], ['03832344', '038320000034']], [['01699444', '016990000044'], ['11536842', '115360000082'], ['06482006', '064000008206'], ['13115485', '131154000085'], ['28046301', None], ['15524099', '155240000099'], ['18039301', '180000003931'], ['02636740', '026360000070']], [['17043643', '170430000063'], ['03250241', '032500000021'], ['00007549', '000070000059'], ['19115135', '191100000515'], ['11882825', '118200008285'], ['21587198', None], ['01282734', '012800000274'], ['16023547', '160230000057']], [['00767246', '007670000026'], ['03161940', '031610000090'], ['08858661', '088586000061'], ['24707936', None], ['09720132', '097200000012'], ['06596582', '065965000082'], ['07319884', '073198000084'], ['00787643', '007870000063']], [['03581849', '035810000089'], ['17614340', '176140000030'], ['16789341', '167890000031'], ['08283998', '082839000098'], ['28773952', None], ['18771250', '187712000050'], ['13513558', '135135000058'], ['10079442', '100790000042']]]
labels = ["regression: final digit 4 layout", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: final digit 4 layout 0 | 034950000207 | 034950000027 | Failed |
| repair trap 1 | 060000000802 | 060000000082 | Failed |
| combined fault 2 | 135860000902 | 135860000092 | Failed |
| control 3 | None | None | Passed |
| control 4 | 043199000058 | 043199000058 | Passed |
| boundary 5 | 080237000081 | 080237000081 | Passed |
| boundary 6 | 167200008702 | 167200008702 | Passed |
| control 7 | 038320000304 | 038320000034 | Failed |
SHA-256 / 0940845e92a1764e3cf78fb40992b8e487160b17cbc4b55fe7d4dde984c6fd00
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 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:44.000479+00:00.
Case digest / fba514364339b45fcbf4dac2d4a9d681715347572d4204cfbfdd52d4a072bd21