FA-79386 / Barcode symbology encoding / Open access
UPC-E rule 5-9 places the final digit in the manufacturer number · case 01
Codes ending in 5 through 9 expand to six-digit manufacturer prefixes.
ROOT CAUSE
The final digit is concatenated before the zero fill instead of at the end of the item reference.
VERIFIED REPAIR
Fill with four zeros and put d6 last.
Unsuccessful approach: Dropping d6 loses the item reference digit.
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:4] + '00000' + d[4]
else:
body = d[0:5] + last + '0000'
return ns + body + chk
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['04319958', '043199000058'], ['05569680', '055696000080'], ['25279409', None], ['16787022', '167200008702'], ['24955674', None], ['01189536', '011800000956'], ['29819666', None], ['08023781', '080237000081']], [['15524099', '155240000099'], ['15378564', '153785000064'], ['06482006', '064000008206'], ['28046301', None], ['18039301', '180000003931'], ['01759900', '017000005990'], ['07073924', '070200007394'], ['08877566', '088775000066']], [['19840591', '198405000091'], ['15031958', '150319000058'], ['11882825', '118200008285'], ['21587198', None], ['01282734', '012800000274'], ['07273910', '072100007390'], ['29592260', None], ['00838090', '008380000090']], [['08858661', '088586000061'], ['01646181', '016461000081'], ['09720132', '097200000012'], ['14528005', '145000002805'], ['06465438', '064600000548'], ['07908112', '079100000812'], ['17766731', '177600000671'], ['10203167', '102031000067']], [['03833572', '038335000072'], ['00721470', '007214000070'], ['28773952', None], ['11755520', '117200005550'], ['16547623', '165200004763'], ['06185620', '061200008560'], ['02180640', '021800000060'], ['08283998', '082839000098']]]
labels = ["regression: final digit 5-9 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 5-9 layout 0 | 043199500008 | 043199000058 | Failed |
| repair trap 1 | 055696800000 | 055696000080 | Failed |
| combined fault 2 | None | None | Passed |
| control 3 | 167200008702 | 167200008702 | Passed |
| control 4 | None | None | Passed |
| boundary 5 | 011800000956 | 011800000956 | Passed |
| boundary 6 | None | None | Passed |
| control 7 | 080237800001 | 080237000081 | Failed |
SHA-256 / a3d00ba6962f0ce6d3da9c0be31d3db6b8808a1346c3a0b270aeb29326284545
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] + '00000' + d[4]
else:
body = d[0:5] + '00000'
return ns + body + chk
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['04319958', '043199000058'], ['05569680', '055696000080'], ['25279409', None], ['16787022', '167200008702'], ['24955674', None], ['01189536', '011800000956'], ['29819666', None], ['08023781', '080237000081']], [['15524099', '155240000099'], ['15378564', '153785000064'], ['06482006', '064000008206'], ['28046301', None], ['18039301', '180000003931'], ['01759900', '017000005990'], ['07073924', '070200007394'], ['08877566', '088775000066']], [['19840591', '198405000091'], ['15031958', '150319000058'], ['11882825', '118200008285'], ['21587198', None], ['01282734', '012800000274'], ['07273910', '072100007390'], ['29592260', None], ['00838090', '008380000090']], [['08858661', '088586000061'], ['01646181', '016461000081'], ['09720132', '097200000012'], ['14528005', '145000002805'], ['06465438', '064600000548'], ['07908112', '079100000812'], ['17766731', '177600000671'], ['10203167', '102031000067']], [['03833572', '038335000072'], ['00721470', '007214000070'], ['28773952', None], ['11755520', '117200005550'], ['16547623', '165200004763'], ['06185620', '061200008560'], ['02180640', '021800000060'], ['08283998', '082839000098']]]
labels = ["regression: final digit 5-9 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 5-9 layout 0 | 043199000008 | 043199000058 | Failed |
| repair trap 1 | 055696000000 | 055696000080 | Failed |
| combined fault 2 | None | None | Passed |
| control 3 | 167200008702 | 167200008702 | Passed |
| control 4 | None | None | Passed |
| boundary 5 | 011800000956 | 011800000956 | Passed |
| boundary 6 | None | None | Passed |
| control 7 | 080237000001 | 080237000081 | Failed |
SHA-256 / 848e32e051ecbe79eb86deacf426bfeeddccbdb34213042450ad2c7902504990
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 = [[['04319958', '043199000058'], ['05569680', '055696000080'], ['25279409', None], ['16787022', '167200008702'], ['24955674', None], ['01189536', '011800000956'], ['29819666', None], ['08023781', '080237000081']], [['15524099', '155240000099'], ['15378564', '153785000064'], ['06482006', '064000008206'], ['28046301', None], ['18039301', '180000003931'], ['01759900', '017000005990'], ['07073924', '070200007394'], ['08877566', '088775000066']], [['19840591', '198405000091'], ['15031958', '150319000058'], ['11882825', '118200008285'], ['21587198', None], ['01282734', '012800000274'], ['07273910', '072100007390'], ['29592260', None], ['00838090', '008380000090']], [['08858661', '088586000061'], ['01646181', '016461000081'], ['09720132', '097200000012'], ['14528005', '145000002805'], ['06465438', '064600000548'], ['07908112', '079100000812'], ['17766731', '177600000671'], ['10203167', '102031000067']], [['03833572', '038335000072'], ['00721470', '007214000070'], ['28773952', None], ['11755520', '117200005550'], ['16547623', '165200004763'], ['06185620', '061200008560'], ['02180640', '021800000060'], ['08283998', '082839000098']]]
labels = ["regression: final digit 5-9 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 5-9 layout 0 | 043199000058 | 043199000058 | Passed |
| repair trap 1 | 055696000080 | 055696000080 | Passed |
| combined fault 2 | None | None | Passed |
| control 3 | 167200008702 | 167200008702 | Passed |
| control 4 | None | None | Passed |
| boundary 5 | 011800000956 | 011800000956 | Passed |
| boundary 6 | None | None | Passed |
| control 7 | 080237000081 | 080237000081 | Passed |
SHA-256 / 87994348208de10d0bc12a514e8d8a01e4221eed0ec80d07fcff50ed46d1ff7d
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.085008+00:00.
Case digest / 629d09dc88c6fc7be529af7aaf4125d9a344f26442d8ae299046c5f2281af567