FA-79796 / Barcode symbology encoding / Open access
Upper Shift value is one too low · case 01
Accented characters decode as the previous Latin-1 character.
ROOT CAUSE
The byte after Upper Shift is ord - 128, omitting the ASCII +1 offset.
VERIFIED REPAIR
After 235 write ord - 127 (ord - 128 + 1).
Unsuccessful approach: Writing the raw code point exceeds the ASCII value range.
Case contract
Data Matrix ASCII encodation into `capacity` data codewords: two consecutive ASCII digits become 130 + their value; ASCII 0..127 becomes ord + 1; 128..255 becomes Upper Shift 235 then ord - 127; higher code points are unencodable. Too many codewords -> overflow. Padding: the first pad is 129; each later pad at 1-based position p is 129 + ((149 * p) mod 253) + 1, minus 254 if above 254.
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, capacity):
cw = []
i = 0
while i < len(text):
c = text[i]
if c in '0123456789' and i + 1 < len(text) and text[i + 1] in '0123456789':
cw.append(130 + int(text[i:i + 2]))
i += 2
continue
o = ord(c)
if o > 255:
return {'error': 'unencodable'}
if o > 127:
cw += [235, o - 128]
else:
cw.append(o + 1)
i += 1
if len(cw) > capacity:
return {'error': 'overflow'}
if len(cw) < capacity:
cw.append(129)
while len(cw) < capacity:
p = len(cw) + 1
v = 129 + ((149 * p) % 253) + 1
if v > 254:
v -= 254
cw.append(v)
return cw
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('\x80', 4), [235, 1, 129, 220]], [('\x800', 7), [235, 1, 49, 129, 115, 11, 161]], [('', 6), [129, 175, 70, 220, 115, 11]], [('99x', 5), [229, 121, 129, 220, 115]], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('0AB12', 3), {'error': 'overflow'}], [('ABé', 1), {'error': 'overflow'}], [('é99AB0', 10), [235, 106, 229, 66, 67, 49, 129, 56, 206, 101]]], [[('AB\x8012', 10), [66, 67, 235, 1, 142, 129, 161, 56, 206, 101]], [('55xé', 9), [185, 121, 235, 106, 129, 11, 161, 56, 206]], [('ABxx', 2), {'error': 'overflow'}], [(' ABAB12', 8), [33, 66, 67, 66, 67, 142, 129, 56]], [(' AB', 4), [33, 66, 67, 129]], [('0', 9), [49, 129, 70, 220, 115, 11, 161, 56, 206]], [('', 2), [129, 175]], [('é995x', 8), [235, 106, 229, 54, 121, 129, 161, 56]]], [[('ÿé12', 9), [235, 128, 235, 106, 142, 129, 161, 56, 206]], [('ÿ', 3), [235, 128, 129]], [('x99AB', 11), [121, 229, 66, 67, 129, 11, 161, 56, 206, 101, 251]], [('éé', 3), {'error': 'overflow'}], [('é\x80\x80', 3), {'error': 'overflow'}], [('', 4), [129, 175, 70, 220]], [('', 5), [129, 175, 70, 220, 115]], [('éÿ5', 9), [235, 106, 235, 128, 54, 129, 161, 56, 206]]], [[('\x80x0', 5), [235, 1, 121, 49, 129]], [('\x80\x80\x80', 7), [235, 1, 235, 1, 235, 1, 129]], [('0\x80€ÿ', 1), {'error': 'unencodable'}], [('', 6), [129, 175, 70, 220, 115, 11]], [('\x8012x5', 1), {'error': 'overflow'}], [(' €ÿ\x80', 5), {'error': 'unencodable'}], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('xÿx', 12), [121, 235, 128, 121, 129, 11, 161, 56, 206, 101, 251, 147]]], [[('xÿ99', 9), [121, 235, 128, 229, 129, 11, 161, 56, 206]], [('5ÿ ', 12), [54, 235, 128, 33, 129, 11, 161, 56, 206, 101, 251, 147]], [('990', 1), {'error': 'overflow'}], [('599AB€', 8), {'error': 'unencodable'}], [('', 7), [129, 175, 70, 220, 115, 11, 161]], [('995', 11), [229, 54, 129, 220, 115, 11, 161, 56, 206, 101, 251]], [('05', 7), [135, 129, 70, 220, 115, 11, 161]], [('\x80ÿ', 9), [235, 1, 235, 128, 129, 11, 161, 56, 206]]]]
labels = ["regression: extended character value", "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: extended character value 0 | [235, 0, 129, 220] | [235, 1, 129, 220] | Failed |
| repair trap 1 | [235, 0, 49, 129, 115, 11, 161] | [235, 1, 49, 129, 115, 11, 161] | Failed |
| combined fault 2 | [129, 175, 70, 220, 115, 11] | [129, 175, 70, 220, 115, 11] | Passed |
| control 3 | [229, 121, 129, 220, 115] | [229, 121, 129, 220, 115] | Passed |
| control 4 | [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251] | [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251] | Passed |
| boundary 5 | {'error': 'overflow'} | {'error': 'overflow'} | Passed |
| boundary 6 | {'error': 'overflow'} | {'error': 'overflow'} | Passed |
| control 7 | [235, 105, 229, 66, 67, 49, 129, 56, 206, 101] | [235, 106, 229, 66, 67, 49, 129, 56, 206, 101] | Failed |
SHA-256 / 5e60ae9b4f7fc388c4abb9e7f01dac405566638cc170caececfd2f45f2d350c2
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(text, capacity):
cw = []
i = 0
while i < len(text):
c = text[i]
if c in '0123456789' and i + 1 < len(text) and text[i + 1] in '0123456789':
cw.append(130 + int(text[i:i + 2]))
i += 2
continue
o = ord(c)
if o > 255:
return {'error': 'unencodable'}
if o > 127:
cw += [235, o]
else:
cw.append(o + 1)
i += 1
if len(cw) > capacity:
return {'error': 'overflow'}
if len(cw) < capacity:
cw.append(129)
while len(cw) < capacity:
p = len(cw) + 1
v = 129 + ((149 * p) % 253) + 1
if v > 254:
v -= 254
cw.append(v)
return cw
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('\x80', 4), [235, 1, 129, 220]], [('\x800', 7), [235, 1, 49, 129, 115, 11, 161]], [('', 6), [129, 175, 70, 220, 115, 11]], [('99x', 5), [229, 121, 129, 220, 115]], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('0AB12', 3), {'error': 'overflow'}], [('ABé', 1), {'error': 'overflow'}], [('é99AB0', 10), [235, 106, 229, 66, 67, 49, 129, 56, 206, 101]]], [[('AB\x8012', 10), [66, 67, 235, 1, 142, 129, 161, 56, 206, 101]], [('55xé', 9), [185, 121, 235, 106, 129, 11, 161, 56, 206]], [('ABxx', 2), {'error': 'overflow'}], [(' ABAB12', 8), [33, 66, 67, 66, 67, 142, 129, 56]], [(' AB', 4), [33, 66, 67, 129]], [('0', 9), [49, 129, 70, 220, 115, 11, 161, 56, 206]], [('', 2), [129, 175]], [('é995x', 8), [235, 106, 229, 54, 121, 129, 161, 56]]], [[('ÿé12', 9), [235, 128, 235, 106, 142, 129, 161, 56, 206]], [('ÿ', 3), [235, 128, 129]], [('x99AB', 11), [121, 229, 66, 67, 129, 11, 161, 56, 206, 101, 251]], [('éé', 3), {'error': 'overflow'}], [('é\x80\x80', 3), {'error': 'overflow'}], [('', 4), [129, 175, 70, 220]], [('', 5), [129, 175, 70, 220, 115]], [('éÿ5', 9), [235, 106, 235, 128, 54, 129, 161, 56, 206]]], [[('\x80x0', 5), [235, 1, 121, 49, 129]], [('\x80\x80\x80', 7), [235, 1, 235, 1, 235, 1, 129]], [('0\x80€ÿ', 1), {'error': 'unencodable'}], [('', 6), [129, 175, 70, 220, 115, 11]], [('\x8012x5', 1), {'error': 'overflow'}], [(' €ÿ\x80', 5), {'error': 'unencodable'}], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('xÿx', 12), [121, 235, 128, 121, 129, 11, 161, 56, 206, 101, 251, 147]]], [[('xÿ99', 9), [121, 235, 128, 229, 129, 11, 161, 56, 206]], [('5ÿ ', 12), [54, 235, 128, 33, 129, 11, 161, 56, 206, 101, 251, 147]], [('990', 1), {'error': 'overflow'}], [('599AB€', 8), {'error': 'unencodable'}], [('', 7), [129, 175, 70, 220, 115, 11, 161]], [('995', 11), [229, 54, 129, 220, 115, 11, 161, 56, 206, 101, 251]], [('05', 7), [135, 129, 70, 220, 115, 11, 161]], [('\x80ÿ', 9), [235, 1, 235, 128, 129, 11, 161, 56, 206]]]]
labels = ["regression: extended character value", "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: extended character value 0 | [235, 128, 129, 220] | [235, 1, 129, 220] | Failed |
| repair trap 1 | [235, 128, 49, 129, 115, 11, 161] | [235, 1, 49, 129, 115, 11, 161] | Failed |
| combined fault 2 | [129, 175, 70, 220, 115, 11] | [129, 175, 70, 220, 115, 11] | Passed |
| control 3 | [229, 121, 129, 220, 115] | [229, 121, 129, 220, 115] | Passed |
| control 4 | [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251] | [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251] | Passed |
| boundary 5 | {'error': 'overflow'} | {'error': 'overflow'} | Passed |
| boundary 6 | {'error': 'overflow'} | {'error': 'overflow'} | Passed |
| control 7 | [235, 233, 229, 66, 67, 49, 129, 56, 206, 101] | [235, 106, 229, 66, 67, 49, 129, 56, 206, 101] | Failed |
SHA-256 / 0c74d9a549b377130cbe00bdcc58b56f18d7e8c5145f832028c5015430eb606d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(text, capacity):
cw = []
i = 0
while i < len(text):
c = text[i]
if c in '0123456789' and i + 1 < len(text) and text[i + 1] in '0123456789':
cw.append(130 + int(text[i:i + 2]))
i += 2
continue
o = ord(c)
if o > 255:
return {'error': 'unencodable'}
if o > 127:
cw += [235, o - 127]
else:
cw.append(o + 1)
i += 1
if len(cw) > capacity:
return {'error': 'overflow'}
if len(cw) < capacity:
cw.append(129)
while len(cw) < capacity:
p = len(cw) + 1
v = 129 + ((149 * p) % 253) + 1
if v > 254:
v -= 254
cw.append(v)
return cw
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('\x80', 4), [235, 1, 129, 220]], [('\x800', 7), [235, 1, 49, 129, 115, 11, 161]], [('', 6), [129, 175, 70, 220, 115, 11]], [('99x', 5), [229, 121, 129, 220, 115]], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('0AB12', 3), {'error': 'overflow'}], [('ABé', 1), {'error': 'overflow'}], [('é99AB0', 10), [235, 106, 229, 66, 67, 49, 129, 56, 206, 101]]], [[('AB\x8012', 10), [66, 67, 235, 1, 142, 129, 161, 56, 206, 101]], [('55xé', 9), [185, 121, 235, 106, 129, 11, 161, 56, 206]], [('ABxx', 2), {'error': 'overflow'}], [(' ABAB12', 8), [33, 66, 67, 66, 67, 142, 129, 56]], [(' AB', 4), [33, 66, 67, 129]], [('0', 9), [49, 129, 70, 220, 115, 11, 161, 56, 206]], [('', 2), [129, 175]], [('é995x', 8), [235, 106, 229, 54, 121, 129, 161, 56]]], [[('ÿé12', 9), [235, 128, 235, 106, 142, 129, 161, 56, 206]], [('ÿ', 3), [235, 128, 129]], [('x99AB', 11), [121, 229, 66, 67, 129, 11, 161, 56, 206, 101, 251]], [('éé', 3), {'error': 'overflow'}], [('é\x80\x80', 3), {'error': 'overflow'}], [('', 4), [129, 175, 70, 220]], [('', 5), [129, 175, 70, 220, 115]], [('éÿ5', 9), [235, 106, 235, 128, 54, 129, 161, 56, 206]]], [[('\x80x0', 5), [235, 1, 121, 49, 129]], [('\x80\x80\x80', 7), [235, 1, 235, 1, 235, 1, 129]], [('0\x80€ÿ', 1), {'error': 'unencodable'}], [('', 6), [129, 175, 70, 220, 115, 11]], [('\x8012x5', 1), {'error': 'overflow'}], [(' €ÿ\x80', 5), {'error': 'unencodable'}], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('xÿx', 12), [121, 235, 128, 121, 129, 11, 161, 56, 206, 101, 251, 147]]], [[('xÿ99', 9), [121, 235, 128, 229, 129, 11, 161, 56, 206]], [('5ÿ ', 12), [54, 235, 128, 33, 129, 11, 161, 56, 206, 101, 251, 147]], [('990', 1), {'error': 'overflow'}], [('599AB€', 8), {'error': 'unencodable'}], [('', 7), [129, 175, 70, 220, 115, 11, 161]], [('995', 11), [229, 54, 129, 220, 115, 11, 161, 56, 206, 101, 251]], [('05', 7), [135, 129, 70, 220, 115, 11, 161]], [('\x80ÿ', 9), [235, 1, 235, 128, 129, 11, 161, 56, 206]]]]
labels = ["regression: extended character value", "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: extended character value 0 | [235, 1, 129, 220] | [235, 1, 129, 220] | Passed |
| repair trap 1 | [235, 1, 49, 129, 115, 11, 161] | [235, 1, 49, 129, 115, 11, 161] | Passed |
| combined fault 2 | [129, 175, 70, 220, 115, 11] | [129, 175, 70, 220, 115, 11] | Passed |
| control 3 | [229, 121, 129, 220, 115] | [229, 121, 129, 220, 115] | Passed |
| control 4 | [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251] | [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251] | Passed |
| boundary 5 | {'error': 'overflow'} | {'error': 'overflow'} | Passed |
| boundary 6 | {'error': 'overflow'} | {'error': 'overflow'} | Passed |
| control 7 | [235, 106, 229, 66, 67, 49, 129, 56, 206, 101] | [235, 106, 229, 66, 67, 49, 129, 56, 206, 101] | Passed |
SHA-256 / 84b98e1256f9f78c2989b1b9bed9ca4a1e07b3b5144fef2e4e12905d893aedde
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:47.650209+00:00.
Case digest / 6bf997de737e0804df862c63f51a6e15fc4ca8c2d8aa130adc59c2080eb4bdf5