FA-79686 / Barcode symbology encoding / Open access
Last alphanumeric pair is dropped · case 01
Even-length strings lose their final two characters.
ROOT CAUSE
The loop stops before the last complete pair.
VERIFIED REPAIR
Iterate over i = 0, 2, ... while i + 1 < len(s).
Unsuccessful approach: Bounding the loop by the pair count stops halfway through the string.
Case contract
Encode the data part of a QR alphanumeric segment. Character values: 0-9 -> 0-9, A-Z -> 10-35, space 36, $ 37, % 38, * 39, + 40, - 41, . 42, / 43, : 44. Each pair becomes 45*first + second in 11 bits, a final single character becomes its value in 6 bits. Characters outside the set return 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(s):
ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
if any(c not in ALNUM for c in s):
return None
bits = ''
for i in range(0, len(s) - 2, 2):
v = 45 * ALNUM.index(s[i]) + ALNUM.index(s[i + 1])
bits += format(v, '011b')
if len(s) % 2:
bits += format(ALNUM.index(s[-1]), '06b')
return bits
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['A8CG', '0011100101001000101100'], ['GF7$8C', '010110111110010110000000101110100'], ['', ''], ['IG:', '01100111010101100'], ['X', '100001'], ['R1K', '10011000000010100'], ['F -', '01011000111101001'], ['L1', '01110110010']], [['VK5/1S', '101100001110010000110000001001001'], ['Z6UKSE', '110001011011010101101010011111010'], ['4.KFO8', '000110111100111001001110001000000'], ['', ''], ['E', '001110'], ['S', '011100'], ['F6D', '01010101001001101'], ['I1', '01100101011']], [['20Y%', '0000101101011000100000'], ['Y6WB', '1100000000010110101011'], ['%.HZ', '1101101100001100100000'], ['X', '100001'], ['.O/', '11101111010101011'], ['', ''], ['Q', '011010'], ['$K', '11010010101']], [['OJOU', '1000100101110001010110'], ['4F./', '0001100001111110001101'], ['KCK1$.', '011100100000111000010111010101011'], ['1', '000001'], ['', ''], ['89%', '00101110001100110'], [' ', '100100'], ['R2YP', '1001100000111000010011']], [['EWRZTW', '010100101101001110001010100111001'], ['1T0G9', '0000100101000000010000001001'], [' Y/7', '1100111011011110010110'], ['*', '100111'], ['', ''], ['*UZ', '11011111001100011'], ['GNN', '01011100111010111'], ['VS63', '1011000111100100010001']]]
labels = ["regression: pair loop bound", "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: pair loop bound 0 | 00111001010 | 0011100101001000101100 | Failed |
| repair trap 1 | 0101101111100101100000 | 010110111110010110000000101110100 | Failed |
| combined fault 2 | | | Passed |
| control 3 | 01100111010101100 | 01100111010101100 | Passed |
| control 4 | 100001 | 100001 | Passed |
| boundary 5 | 10011000000010100 | 10011000000010100 | Passed |
| boundary 6 | 01011000111101001 | 01011000111101001 | Passed |
| control 7 | | 01110110010 | Failed |
SHA-256 / 2db08d2a514fa0d628f8458fe25790c176310b1c1dafcfde56dee1e07afae3e8
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
if any(c not in ALNUM for c in s):
return None
bits = ''
for i in range(0, len(s) // 2, 2):
v = 45 * ALNUM.index(s[i]) + ALNUM.index(s[i + 1])
bits += format(v, '011b')
if len(s) % 2:
bits += format(ALNUM.index(s[-1]), '06b')
return bits
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['A8CG', '0011100101001000101100'], ['GF7$8C', '010110111110010110000000101110100'], ['', ''], ['IG:', '01100111010101100'], ['X', '100001'], ['R1K', '10011000000010100'], ['F -', '01011000111101001'], ['L1', '01110110010']], [['VK5/1S', '101100001110010000110000001001001'], ['Z6UKSE', '110001011011010101101010011111010'], ['4.KFO8', '000110111100111001001110001000000'], ['', ''], ['E', '001110'], ['S', '011100'], ['F6D', '01010101001001101'], ['I1', '01100101011']], [['20Y%', '0000101101011000100000'], ['Y6WB', '1100000000010110101011'], ['%.HZ', '1101101100001100100000'], ['X', '100001'], ['.O/', '11101111010101011'], ['', ''], ['Q', '011010'], ['$K', '11010010101']], [['OJOU', '1000100101110001010110'], ['4F./', '0001100001111110001101'], ['KCK1$.', '011100100000111000010111010101011'], ['1', '000001'], ['', ''], ['89%', '00101110001100110'], [' ', '100100'], ['R2YP', '1001100000111000010011']], [['EWRZTW', '010100101101001110001010100111001'], ['1T0G9', '0000100101000000010000001001'], [' Y/7', '1100111011011110010110'], ['*', '100111'], ['', ''], ['*UZ', '11011111001100011'], ['GNN', '01011100111010111'], ['VS63', '1011000111100100010001']]]
labels = ["regression: pair loop bound", "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: pair loop bound 0 | 00111001010 | 0011100101001000101100 | Failed |
| repair trap 1 | 0101101111100101100000 | 010110111110010110000000101110100 | Failed |
| combined fault 2 | | | Passed |
| control 3 | 01100111010101100 | 01100111010101100 | Passed |
| control 4 | 100001 | 100001 | Passed |
| boundary 5 | 10011000000010100 | 10011000000010100 | Passed |
| boundary 6 | 01011000111101001 | 01011000111101001 | Passed |
| control 7 | 01110110010 | 01110110010 | Passed |
SHA-256 / d858b7ab4a4dfecec403a8804d8871757175d70eea94bd2c2071791b0884d1a3
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
if any(c not in ALNUM for c in s):
return None
bits = ''
for i in range(0, len(s) - 1, 2):
v = 45 * ALNUM.index(s[i]) + ALNUM.index(s[i + 1])
bits += format(v, '011b')
if len(s) % 2:
bits += format(ALNUM.index(s[-1]), '06b')
return bits
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['A8CG', '0011100101001000101100'], ['GF7$8C', '010110111110010110000000101110100'], ['', ''], ['IG:', '01100111010101100'], ['X', '100001'], ['R1K', '10011000000010100'], ['F -', '01011000111101001'], ['L1', '01110110010']], [['VK5/1S', '101100001110010000110000001001001'], ['Z6UKSE', '110001011011010101101010011111010'], ['4.KFO8', '000110111100111001001110001000000'], ['', ''], ['E', '001110'], ['S', '011100'], ['F6D', '01010101001001101'], ['I1', '01100101011']], [['20Y%', '0000101101011000100000'], ['Y6WB', '1100000000010110101011'], ['%.HZ', '1101101100001100100000'], ['X', '100001'], ['.O/', '11101111010101011'], ['', ''], ['Q', '011010'], ['$K', '11010010101']], [['OJOU', '1000100101110001010110'], ['4F./', '0001100001111110001101'], ['KCK1$.', '011100100000111000010111010101011'], ['1', '000001'], ['', ''], ['89%', '00101110001100110'], [' ', '100100'], ['R2YP', '1001100000111000010011']], [['EWRZTW', '010100101101001110001010100111001'], ['1T0G9', '0000100101000000010000001001'], [' Y/7', '1100111011011110010110'], ['*', '100111'], ['', ''], ['*UZ', '11011111001100011'], ['GNN', '01011100111010111'], ['VS63', '1011000111100100010001']]]
labels = ["regression: pair loop bound", "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: pair loop bound 0 | 0011100101001000101100 | 0011100101001000101100 | Passed |
| repair trap 1 | 010110111110010110000000101110100 | 010110111110010110000000101110100 | Passed |
| combined fault 2 | | | Passed |
| control 3 | 01100111010101100 | 01100111010101100 | Passed |
| control 4 | 100001 | 100001 | Passed |
| boundary 5 | 10011000000010100 | 10011000000010100 | Passed |
| boundary 6 | 01011000111101001 | 01011000111101001 | Passed |
| control 7 | 01110110010 | 01110110010 | Passed |
SHA-256 / 6de35d5ec3e7451959eccb98ef34841f4e8d499c6c89599545d29ebf3af49aa9
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:46.900111+00:00.
Case digest / 548b72a35a6286a922a2515908119d508fd70919c5006a461abe644c819c08cc