FA-79571 / Barcode symbology encoding / Open access
Codabar accepts ratios above 3 · case 01
Oversized wide elements push the symbol beyond its allocated width.
ROOT CAUSE
Only the lower ratio bound is enforced.
VERIFIED REPAIR
Accept ratios from 2 through 3 inclusive.
Unsuccessful approach: An exclusive lower bound rejects the common 2:1 ratio.
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 ratio < 2:
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 = [[[('D$554A', 4), {'error': 'ratio'}], [('A5547:T', 2), {'error': 'start-stop'}], [('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'}], [('D97.5D', 4), {'error': 'ratio'}]], [[('D.48E6C', 4), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('C773C', 1.5), {'error': 'ratio'}], [('a2$A', 1.5), {'error': 'ratio'}], [('BE3Ed', 2.5), {'error': 'start-stop'}], [('A63$T', 4), {'error': 'ratio'}]], [[('a6C', 4), {'error': 'ratio'}], [('aEd', 2), {'error': 'start-stop'}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('A:5A$D', 3), {'error': 'char', 'char': 'A'}], [('A$0552T', 2.5), {'error': 'start-stop'}], [('A/.ET', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}]], [[('A9d', 4), {'error': 'ratio'}], [('D67C', 2), {'modules': 41}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A55+5A', 3), {'modules': 77}], [('a/55--d', 4), {'error': 'ratio'}]], [[('C0.9.D', 4), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('aB', 3), {'error': 'start-stop'}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('AT', 4), {'error': 'ratio'}]]]
labels = ["regression: ratio validation bounds", "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: ratio validation bounds 0 | {'modules': 89} | {'error': 'ratio'} | Failed |
| repair trap 1 | {'error': 'start-stop'} | {'error': 'start-stop'} | 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': 92} | {'error': 'ratio'} | Failed |
SHA-256 / 5a2d52a72b3c5f10a566d9258c492b46926b5e7246ae6ff4cf6a8ca15a21e356
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 = [[[('D$554A', 4), {'error': 'ratio'}], [('A5547:T', 2), {'error': 'start-stop'}], [('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'}], [('D97.5D', 4), {'error': 'ratio'}]], [[('D.48E6C', 4), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('C773C', 1.5), {'error': 'ratio'}], [('a2$A', 1.5), {'error': 'ratio'}], [('BE3Ed', 2.5), {'error': 'start-stop'}], [('A63$T', 4), {'error': 'ratio'}]], [[('a6C', 4), {'error': 'ratio'}], [('aEd', 2), {'error': 'start-stop'}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('A:5A$D', 3), {'error': 'char', 'char': 'A'}], [('A$0552T', 2.5), {'error': 'start-stop'}], [('A/.ET', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}]], [[('A9d', 4), {'error': 'ratio'}], [('D67C', 2), {'modules': 41}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A55+5A', 3), {'modules': 77}], [('a/55--d', 4), {'error': 'ratio'}]], [[('C0.9.D', 4), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('aB', 3), {'error': 'start-stop'}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('AT', 4), {'error': 'ratio'}]]]
labels = ["regression: ratio validation bounds", "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: ratio validation bounds 0 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| repair trap 1 | {'error': 'ratio'} | {'error': 'start-stop'} | 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 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
SHA-256 / 9e452180d46c02b0da7bfadc358be42ab814ae7b6587270064fa7581f6fa46bf
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 = [[[('D$554A', 4), {'error': 'ratio'}], [('A5547:T', 2), {'error': 'start-stop'}], [('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'}], [('D97.5D', 4), {'error': 'ratio'}]], [[('D.48E6C', 4), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('C773C', 1.5), {'error': 'ratio'}], [('a2$A', 1.5), {'error': 'ratio'}], [('BE3Ed', 2.5), {'error': 'start-stop'}], [('A63$T', 4), {'error': 'ratio'}]], [[('a6C', 4), {'error': 'ratio'}], [('aEd', 2), {'error': 'start-stop'}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('A:5A$D', 3), {'error': 'char', 'char': 'A'}], [('A$0552T', 2.5), {'error': 'start-stop'}], [('A/.ET', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}]], [[('A9d', 4), {'error': 'ratio'}], [('D67C', 2), {'modules': 41}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A55+5A', 3), {'modules': 77}], [('a/55--d', 4), {'error': 'ratio'}]], [[('C0.9.D', 4), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('aB', 3), {'error': 'start-stop'}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('AT', 4), {'error': 'ratio'}]]]
labels = ["regression: ratio validation bounds", "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: ratio validation bounds 0 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
| repair trap 1 | {'error': 'start-stop'} | {'error': 'start-stop'} | 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 | {'error': 'ratio'} | {'error': 'ratio'} | Passed |
SHA-256 / 08c9ed5a45043c4ff6b34c590c831c59031465cab3c5bf7ac5705b197aeb396e
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.714729+00:00.
Case digest / 98ec2d707e55236c50f989172e2e18e76ca5ff224bc87e37911a51311bc29dc2