FA-79546 / Barcode symbology encoding / Open access
Codabar gives dash and dollar three wide elements · case 01
Blood-bag and library labels containing "-" are laid out wider than printed.
ROOT CAUSE
Only digits are placed in the two-wide class; "-" and "$" also belong to it.
VERIFIED REPAIR
Treat 0-9, "-" and "$" as two-wide characters.
Unsuccessful approach: Adding only "-" still sizes "$" incorrectly.
Case contract
Validate and size a Codabar symbol text with a wide:narrow ratio between 2 and 3 inclusive. The first and last characters must be start/stop letters A-D (uppercase only, at least two characters); body characters are 0-9 - $ : / . +. Each character has 7 elements: digits, "-" and "$" have 2 wide elements, ": / . +" and A-D have 3. One narrow gap separates adjacent characters. Return the total width in narrow modules or an error.
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, ratio):
if not 2 <= ratio <= 3:
return {'error': 'ratio'}
if len(text) < 2:
return {'error': 'short'}
if text[0] not in 'ABCD' or text[-1] not in 'ABCD':
return {'error': 'start-stop'}
body = text[1:-1]
for ch in body:
if ch not in '0123456789-$:/.+':
return {'error': 'char', 'char': ch}
total = 0
for ch in text:
wides = 2 if ch in '0123456789' else 3
total += (7 - wides) + wides * ratio
return {'modules': total + len(text) - 1}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('A$5535B', 3), {'modules': 87}], [('A+1$$3C', 3), {'modules': 89}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('a+d', 2.5), {'error': 'start-stop'}], [('ad', 3), {'error': 'start-stop'}], [('C5525D', 1.5), {'error': 'ratio'}], [('A10-A', 2), {'modules': 51}]], [[('A1$57-B', 3), {'modules': 87}], [('A$6D', 3), {'modules': 51}], [('A$65B', 3), {'modules': 63}], [('a$5D', 1.5), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('A5/39-C', 2.5), {'modules': 80.5}]], [[('D/2-B', 2.5), {'modules': 58.5}], [('C:$63A', 2.5), {'modules': 69.5}], [('D+$$75C', 2), {'modules': 72}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('B5$C', 2.5), {'modules': 46.0}]], [[('D556$A', 2), {'modules': 61}], [('B$D', 2), {'modules': 31}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A:5B', 2), {'modules': 42}], [('D0+$A', 2.5), {'modules': 58.5}]], [[('D$D', 3), {'modules': 39}], [('C5$C', 2), {'modules': 41}], [('A$A', 2.5), {'modules': 35.0}], [('Cd', 2.5), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('aB', 3), {'error': 'start-stop'}], [('A-31A', 3), {'modules': 63}]]]
labels = ["regression: wide count for - and $", "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: wide count for - and $ 0 | {'modules': 89} | {'modules': 87} | Failed |
| repair trap 1 | {'modules': 93} | {'modules': 89} | Failed |
| combined fault 2 | {'char': 'A', 'error': 'char'} | {'char': 'A', 'error': 'char'} | Passed |
| control 3 | {'char': 'E', 'error': 'char'} | {'char': 'E', 'error': 'char'} | Passed |
| control 4 | {'error': 'start-stop'} | {'error': 'start-stop'} | Passed |
| boundary 5 | {'error': 'start-stop'} | {'error': 'start-stop'} | Passed |
| boundary 6 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 7 | {'modules': 52} | {'modules': 51} | Failed |
SHA-256 / d59507f7fd71c905bed2729e329aa59ff404fa0ce5a3afae1b8c2dc4801243bc
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(text, ratio):
if not 2 <= ratio <= 3:
return {'error': 'ratio'}
if len(text) < 2:
return {'error': 'short'}
if text[0] not in 'ABCD' or text[-1] not in 'ABCD':
return {'error': 'start-stop'}
body = text[1:-1]
for ch in body:
if ch not in '0123456789-$:/.+':
return {'error': 'char', 'char': ch}
total = 0
for ch in text:
wides = 2 if ch in '0123456789-' else 3
total += (7 - wides) + wides * ratio
return {'modules': total + len(text) - 1}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('A$5535B', 3), {'modules': 87}], [('A+1$$3C', 3), {'modules': 89}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('a+d', 2.5), {'error': 'start-stop'}], [('ad', 3), {'error': 'start-stop'}], [('C5525D', 1.5), {'error': 'ratio'}], [('A10-A', 2), {'modules': 51}]], [[('A1$57-B', 3), {'modules': 87}], [('A$6D', 3), {'modules': 51}], [('A$65B', 3), {'modules': 63}], [('a$5D', 1.5), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('A5/39-C', 2.5), {'modules': 80.5}]], [[('D/2-B', 2.5), {'modules': 58.5}], [('C:$63A', 2.5), {'modules': 69.5}], [('D+$$75C', 2), {'modules': 72}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('B5$C', 2.5), {'modules': 46.0}]], [[('D556$A', 2), {'modules': 61}], [('B$D', 2), {'modules': 31}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A:5B', 2), {'modules': 42}], [('D0+$A', 2.5), {'modules': 58.5}]], [[('D$D', 3), {'modules': 39}], [('C5$C', 2), {'modules': 41}], [('A$A', 2.5), {'modules': 35.0}], [('Cd', 2.5), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('aB', 3), {'error': 'start-stop'}], [('A-31A', 3), {'modules': 63}]]]
labels = ["regression: wide count for - and $", "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: wide count for - and $ 0 | {'modules': 89} | {'modules': 87} | Failed |
| repair trap 1 | {'modules': 93} | {'modules': 89} | Failed |
| combined fault 2 | {'char': 'A', 'error': 'char'} | {'char': 'A', 'error': 'char'} | Passed |
| control 3 | {'char': 'E', 'error': 'char'} | {'char': 'E', 'error': 'char'} | Passed |
| control 4 | {'error': 'start-stop'} | {'error': 'start-stop'} | Passed |
| boundary 5 | {'error': 'start-stop'} | {'error': 'start-stop'} | Passed |
| boundary 6 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 7 | {'modules': 51} | {'modules': 51} | Passed |
SHA-256 / 56149b505b316387334b3f5b2149ae9d947562f19f801bc03bec789194313cb1
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(text, ratio):
if not 2 <= ratio <= 3:
return {'error': 'ratio'}
if len(text) < 2:
return {'error': 'short'}
if text[0] not in 'ABCD' or text[-1] not in 'ABCD':
return {'error': 'start-stop'}
body = text[1:-1]
for ch in body:
if ch not in '0123456789-$:/.+':
return {'error': 'char', 'char': ch}
total = 0
for ch in text:
wides = 2 if ch in '0123456789-$' else 3
total += (7 - wides) + wides * ratio
return {'modules': total + len(text) - 1}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('A$5535B', 3), {'modules': 87}], [('A+1$$3C', 3), {'modules': 89}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('a+d', 2.5), {'error': 'start-stop'}], [('ad', 3), {'error': 'start-stop'}], [('C5525D', 1.5), {'error': 'ratio'}], [('A10-A', 2), {'modules': 51}]], [[('A1$57-B', 3), {'modules': 87}], [('A$6D', 3), {'modules': 51}], [('A$65B', 3), {'modules': 63}], [('a$5D', 1.5), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('A5/39-C', 2.5), {'modules': 80.5}]], [[('D/2-B', 2.5), {'modules': 58.5}], [('C:$63A', 2.5), {'modules': 69.5}], [('D+$$75C', 2), {'modules': 72}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('B5$C', 2.5), {'modules': 46.0}]], [[('D556$A', 2), {'modules': 61}], [('B$D', 2), {'modules': 31}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A:5B', 2), {'modules': 42}], [('D0+$A', 2.5), {'modules': 58.5}]], [[('D$D', 3), {'modules': 39}], [('C5$C', 2), {'modules': 41}], [('A$A', 2.5), {'modules': 35.0}], [('Cd', 2.5), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('aB', 3), {'error': 'start-stop'}], [('A-31A', 3), {'modules': 63}]]]
labels = ["regression: wide count for - and $", "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: wide count for - and $ 0 | {'modules': 87} | {'modules': 87} | Passed |
| repair trap 1 | {'modules': 89} | {'modules': 89} | Passed |
| combined fault 2 | {'char': 'A', 'error': 'char'} | {'char': 'A', 'error': 'char'} | Passed |
| control 3 | {'char': 'E', 'error': 'char'} | {'char': 'E', 'error': 'char'} | Passed |
| control 4 | {'error': 'start-stop'} | {'error': 'start-stop'} | Passed |
| boundary 5 | {'error': 'start-stop'} | {'error': 'start-stop'} | Passed |
| boundary 6 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| control 7 | {'modules': 51} | {'modules': 51} | Passed |
SHA-256 / d8c82a47de320f9c7df1dde048ae02491704a320e9740c92c654a0341b024c47
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:45.628364+00:00.
Case digest / 6a723aea74985fe6a0f6e779b853036256cc6cc0794321e020d9426842afac50