FA-79471 / Barcode symbology encoding / Open access
Full ASCII Code 39 leaves $ % + / unescaped · case 01
A price such as "$5" decodes in full ASCII readers as a control character.
ROOT CAUSE
The four shift characters are treated as ordinary standard characters in full ASCII mode.
THE FAILURE
The four shift characters are treated as ordinary standard characters in full ASCII mode.
Unsuccessful approach: Escaping only $ and % still lets "+b" decode as a lowercase letter.
Case contract
Encode text for Code 39 with a wide:narrow ratio of 2 or 3. Standard mode accepts only the 43 characters 0-9 A-Z - . space $ / + %. Full ASCII mode maps lowercase to "+" plus the capital, controls 1..26 to "$" plus A..Z, NUL to %U, 27..31 to %A..%E, DEL to %T, and punctuation (including the four standard shift characters $ % + /) to its two-character escape. Every symbol character, including the start/stop "*", has 6 narrow and 3 wide elements, and one narrow gap separates adjacent characters. Return the framed data and the total width in narrow modules.
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(text, mode, ratio):
std = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%'
if ratio not in (2, 3):
return {'error': 'ratio'}
if mode == 'standard':
for ch in text:
if ch not in std:
return {'error': 'char', 'char': ch}
enc = text
else:
punct = {'!': '/A', '"': '/B', '#': '/C', '&': '/F', "'": '/G',
'(': '/H', ')': '/I', '*': '/J', ',': '/L', ':': '/Z', ';': '%F', '<': '%G', '=': '%H', '>': '%I',
'?': '%J', '@': '%V', '[': '%K', '\\': '%L', ']': '%M', '^': '%N', '_': '%O', '`': '%W',
'{': '%P', '|': '%Q', '}': '%R', '~': '%S'}
enc = ''
for ch in text:
o = ord(ch)
if o > 127:
return {'error': 'char', 'char': ch}
if ch in punct:
enc += punct[ch]
elif 'a' <= ch <= 'z':
enc += '+' + ch.upper()
elif 1 <= o <= 26:
enc += '$' + chr(o + 64)
elif o == 0:
enc += '%U'
elif 27 <= o <= 31:
enc += '%' + chr(o - 27 + 65)
elif o == 127:
enc += '%T'
else:
enc += ch
count = len(enc) + 2
return {'data': '*' + enc + '*', 'modules': count * (6 + 3 * ratio) + (count - 1)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('PN/7PN/7$5', 'full', 3), {'data': '*PN/O7PN/O7/D5*', 'modules': 239}], [('PN/7', 'full', 2), {'data': '*PN/O7*', 'modules': 90}], [('café', 'standard', 4), {'error': 'ratio'}], [('ABPN/7PN/7', 'full', 1), {'error': 'ratio'}], [('a+ba+b', 'full', 4), {'error': 'ratio'}], [('Z-9a+blot', 'standard', 2), {'error': 'char', 'char': 'a'}], [('café\t', 'full', 4), {'error': 'ratio'}], [('*$5\x1b', 'full', 2), {'data': '*/J/D5%A*', 'modules': 116}]], [[(' 50% ', 'full', 2), {'data': '* 50/E *', 'modules': 103}], [('PN/750%*', 'full', 2), {'data': '*PN/O750/E/J*', 'modules': 168}], [('PN/7PN/7', 'full', 3), {'data': '*PN/O7PN/O7*', 'modules': 191}], [('', 'standard', 1), {'error': 'ratio'}], [('\x1blotlot', 'full', 2), {'data': '*%A+L+O+T+L+O+T*', 'modules': 207}], [('#1', 'full', 2), {'data': '*/C1*', 'modules': 64}], [('', 'full', 3), {'data': '**', 'modules': 31}], [('50%\x00', 'full', 3), {'data': '*50/E%U*', 'modules': 127}]], [[('$5 \x00', 'full', 2), {'data': '*/D5 %U*', 'modules': 103}], [(' a+b\x7f', 'full', 2), {'data': '* +A/K+B%T*', 'modules': 142}], [('a+b\x1b', 'full', 3), {'data': '*+A/K+B%A*', 'modules': 159}], [('#1café', 'standard', 4), {'error': 'ratio'}], [(' ', 'full', 1), {'error': 'ratio'}], [('*\x1bcafé', 'full', 2), {'error': 'char', 'char': 'é'}], [('q \x00', 'full', 2), {'data': '*+Q %U*', 'modules': 90}], [('ABPN/7Z-9', 'full', 2), {'data': '*ABPN/O7Z-9*', 'modules': 155}]], [[('*a+b50%', 'full', 2), {'data': '*/J+A/K+B50/E*', 'modules': 181}], [('$5a+b', 'full', 3), {'data': '*/D5+A/K+B*', 'modules': 175}], [('xPN/7\x00', 'full', 3), {'data': '*+XPN/O7%U*', 'modules': 175}], [('AB\x00 ', 'full', 1), {'error': 'ratio'}], [('*', 'full', 2), {'data': '*/J*', 'modules': 51}], [('AB12', 'standard', 2), {'data': '*AB12*', 'modules': 77}], [('\x7f\tlot', 'full', 3), {'data': '*%T$I+L+O+T*', 'modules': 191}], [('PN/7', 'full', 2), {'data': '*PN/O7*', 'modules': 90}]], [[('q50%', 'full', 2), {'data': '*+Q50/E*', 'modules': 103}], [('Z-9qa+b', 'full', 2), {'data': '*Z-9+Q+A/K+B*', 'modules': 168}], [('a+b', 'full', 2), {'data': '*+A/K+B*', 'modules': 103}], [('\x00', 'full', 1), {'error': 'ratio'}], [('', 'standard', 2), {'data': '**', 'modules': 25}], [('', 'standard', 1), {'error': 'ratio'}], [('\x7f\x00', 'full', 4), {'error': 'ratio'}], [('$5a+bAB', 'full', 3), {'data': '*/D5+A/K+BAB*', 'modules': 207}]]]
labels = ["regression: escaping the shift characters", "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: escaping the shift characters 0 | {'data': '*PN/7PN/7$5*', 'modules': 191} | {'data': '*PN/O7PN/O7/D5*', 'modules': 239} | Failed |
| repair trap 1 | {'data': '*PN/7*', 'modules': 77} | {'data': '*PN/O7*', 'modules': 90} | Failed |
| combined fault 2 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 3 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 4 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| boundary 5 | {'char': 'a', 'error': 'char'} | {'char': 'a', 'error': 'char'} | Passed |
| boundary 6 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 7 | {'data': '*/J$5%A*', 'modules': 103} | {'data': '*/J/D5%A*', 'modules': 116} | Failed |
SHA-256 / ee9ab738e0e0c5a241c39750b54ab739ddb3645545d4aef6eb8776dcd2cc5e90
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(text, mode, ratio):
std = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%'
if ratio not in (2, 3):
return {'error': 'ratio'}
if mode == 'standard':
for ch in text:
if ch not in std:
return {'error': 'char', 'char': ch}
enc = text
else:
punct = {'$': '/D', '%': '/E', '!': '/A', '"': '/B', '#': '/C', '&': '/F', "'": '/G',
'(': '/H', ')': '/I', '*': '/J', ',': '/L', ':': '/Z', ';': '%F', '<': '%G', '=': '%H', '>': '%I',
'?': '%J', '@': '%V', '[': '%K', '\\': '%L', ']': '%M', '^': '%N', '_': '%O', '`': '%W',
'{': '%P', '|': '%Q', '}': '%R', '~': '%S'}
enc = ''
for ch in text:
o = ord(ch)
if o > 127:
return {'error': 'char', 'char': ch}
if ch in punct:
enc += punct[ch]
elif 'a' <= ch <= 'z':
enc += '+' + ch.upper()
elif 1 <= o <= 26:
enc += '$' + chr(o + 64)
elif o == 0:
enc += '%U'
elif 27 <= o <= 31:
enc += '%' + chr(o - 27 + 65)
elif o == 127:
enc += '%T'
else:
enc += ch
count = len(enc) + 2
return {'data': '*' + enc + '*', 'modules': count * (6 + 3 * ratio) + (count - 1)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('PN/7PN/7$5', 'full', 3), {'data': '*PN/O7PN/O7/D5*', 'modules': 239}], [('PN/7', 'full', 2), {'data': '*PN/O7*', 'modules': 90}], [('café', 'standard', 4), {'error': 'ratio'}], [('ABPN/7PN/7', 'full', 1), {'error': 'ratio'}], [('a+ba+b', 'full', 4), {'error': 'ratio'}], [('Z-9a+blot', 'standard', 2), {'error': 'char', 'char': 'a'}], [('café\t', 'full', 4), {'error': 'ratio'}], [('*$5\x1b', 'full', 2), {'data': '*/J/D5%A*', 'modules': 116}]], [[(' 50% ', 'full', 2), {'data': '* 50/E *', 'modules': 103}], [('PN/750%*', 'full', 2), {'data': '*PN/O750/E/J*', 'modules': 168}], [('PN/7PN/7', 'full', 3), {'data': '*PN/O7PN/O7*', 'modules': 191}], [('', 'standard', 1), {'error': 'ratio'}], [('\x1blotlot', 'full', 2), {'data': '*%A+L+O+T+L+O+T*', 'modules': 207}], [('#1', 'full', 2), {'data': '*/C1*', 'modules': 64}], [('', 'full', 3), {'data': '**', 'modules': 31}], [('50%\x00', 'full', 3), {'data': '*50/E%U*', 'modules': 127}]], [[('$5 \x00', 'full', 2), {'data': '*/D5 %U*', 'modules': 103}], [(' a+b\x7f', 'full', 2), {'data': '* +A/K+B%T*', 'modules': 142}], [('a+b\x1b', 'full', 3), {'data': '*+A/K+B%A*', 'modules': 159}], [('#1café', 'standard', 4), {'error': 'ratio'}], [(' ', 'full', 1), {'error': 'ratio'}], [('*\x1bcafé', 'full', 2), {'error': 'char', 'char': 'é'}], [('q \x00', 'full', 2), {'data': '*+Q %U*', 'modules': 90}], [('ABPN/7Z-9', 'full', 2), {'data': '*ABPN/O7Z-9*', 'modules': 155}]], [[('*a+b50%', 'full', 2), {'data': '*/J+A/K+B50/E*', 'modules': 181}], [('$5a+b', 'full', 3), {'data': '*/D5+A/K+B*', 'modules': 175}], [('xPN/7\x00', 'full', 3), {'data': '*+XPN/O7%U*', 'modules': 175}], [('AB\x00 ', 'full', 1), {'error': 'ratio'}], [('*', 'full', 2), {'data': '*/J*', 'modules': 51}], [('AB12', 'standard', 2), {'data': '*AB12*', 'modules': 77}], [('\x7f\tlot', 'full', 3), {'data': '*%T$I+L+O+T*', 'modules': 191}], [('PN/7', 'full', 2), {'data': '*PN/O7*', 'modules': 90}]], [[('q50%', 'full', 2), {'data': '*+Q50/E*', 'modules': 103}], [('Z-9qa+b', 'full', 2), {'data': '*Z-9+Q+A/K+B*', 'modules': 168}], [('a+b', 'full', 2), {'data': '*+A/K+B*', 'modules': 103}], [('\x00', 'full', 1), {'error': 'ratio'}], [('', 'standard', 2), {'data': '**', 'modules': 25}], [('', 'standard', 1), {'error': 'ratio'}], [('\x7f\x00', 'full', 4), {'error': 'ratio'}], [('$5a+bAB', 'full', 3), {'data': '*/D5+A/K+BAB*', 'modules': 207}]]]
labels = ["regression: escaping the shift characters", "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: escaping the shift characters 0 | {'data': '*PN/7PN/7/D5*', 'modules': 207} | {'data': '*PN/O7PN/O7/D5*', 'modules': 239} | Failed |
| repair trap 1 | {'data': '*PN/7*', 'modules': 77} | {'data': '*PN/O7*', 'modules': 90} | Failed |
| combined fault 2 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 3 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 4 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| boundary 5 | {'char': 'a', 'error': 'char'} | {'char': 'a', 'error': 'char'} | Passed |
| boundary 6 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 7 | {'data': '*/J/D5%A*', 'modules': 116} | {'data': '*/J/D5%A*', 'modules': 116} | Passed |
SHA-256 / 2baed891dc791520a1fc3dcd21cf19e5203d51b90d7272cacfe9930d9c0203ee
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.990771+00:00.
Case digest / 84c6b8147d9fa28c81eac749905e44a05aa2c7e8c75be74d4e3a12f5b6824aa6