{"abstract":"The symbol is one narrow module wider than the layout expects.","category":"Barcode symbology encoding","checks":8,"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.","evaluation_group":"w2-barcode-symbology-encoding-codabar-width","failed_approach":"Counting gaps only within the body misses the two gaps next to start and stop.","family":"w2-barcode-symbology-encoding-codabar-width-gap-total","id":"FA-79556","implementations":{"attempt":{"sha256":"14c6fe8444c09b310ac692be74b439ef45ee476c41e6ce24251bbd1d1b5e759a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, ratio):\n    if not 2 <= ratio <= 3:\n        return {'error': 'ratio'}\n    if len(text) < 2:\n        return {'error': 'short'}\n    if text[0] not in 'ABCD' or text[-1] not in 'ABCD':\n        return {'error': 'start-stop'}\n    body = text[1:-1]\n    for ch in body:\n        if ch not in '0123456789-$:/.+':\n            return {'error': 'char', 'char': ch}\n    total = 0\n    for ch in text:\n        wides = 2 if ch in '0123456789-$' else 3\n        total += (7 - wides) + wides * ratio\n    return {'modules': total + len(body) - 1}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('C+B', 3), {'modules': 41}], [('B:0C', 3), {'modules': 53}], [('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'}], [('B5355D', 3), {'modules': 75}]], [[('CD', 2), {'modules': 21}], [('C//5D', 2.5), {'modules': 60.0}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('C773C', 1.5), {'error': 'ratio'}], [('CA', 3), {'modules': 27}]], [[('B957A', 2.5), {'modules': 57.0}], [('B53C', 2), {'modules': 41}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}], [('D5-B', 2.5), {'modules': 46.0}]], [[('A:5B', 2), {'modules': 42}], [('B$D', 2), {'modules': 31}], [('aT', 2.5), {'error': 'start-stop'}], [('D3$20d', 3), {'error': 'start-stop'}], [('C58d', 1.5), {'error': 'ratio'}], [('D/5:3B', 4), {'error': 'ratio'}], [('AA', 1.5), {'error': 'ratio'}], [('A1D', 3), {'modules': 39}]], [[('A-31A', 3), {'modules': 63}], [('A905C', 3), {'modules': 63}], [('aB', 3), {'error': 'start-stop'}], [('Cd', 2), {'error': 'start-stop'}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('aD', 3), {'error': 'start-stop'}], [('C55C', 3), {'modules': 51}]]]\nlabels = [\"regression: intercharacter gaps\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"a99cd3d34c4626ecf47021059d2255dcffba6b2abc7d4914aa8a18fd8914ab5a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, ratio):\n    if not 2 <= ratio <= 3:\n        return {'error': 'ratio'}\n    if len(text) < 2:\n        return {'error': 'short'}\n    if text[0] not in 'ABCD' or text[-1] not in 'ABCD':\n        return {'error': 'start-stop'}\n    body = text[1:-1]\n    for ch in body:\n        if ch not in '0123456789-$:/.+':\n            return {'error': 'char', 'char': ch}\n    total = 0\n    for ch in text:\n        wides = 2 if ch in '0123456789-$' else 3\n        total += (7 - wides) + wides * ratio\n    return {'modules': total + len(text)}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('C+B', 3), {'modules': 41}], [('B:0C', 3), {'modules': 53}], [('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'}], [('B5355D', 3), {'modules': 75}]], [[('CD', 2), {'modules': 21}], [('C//5D', 2.5), {'modules': 60.0}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('C773C', 1.5), {'error': 'ratio'}], [('CA', 3), {'modules': 27}]], [[('B957A', 2.5), {'modules': 57.0}], [('B53C', 2), {'modules': 41}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}], [('D5-B', 2.5), {'modules': 46.0}]], [[('A:5B', 2), {'modules': 42}], [('B$D', 2), {'modules': 31}], [('aT', 2.5), {'error': 'start-stop'}], [('D3$20d', 3), {'error': 'start-stop'}], [('C58d', 1.5), {'error': 'ratio'}], [('D/5:3B', 4), {'error': 'ratio'}], [('AA', 1.5), {'error': 'ratio'}], [('A1D', 3), {'modules': 39}]], [[('A-31A', 3), {'modules': 63}], [('A905C', 3), {'modules': 63}], [('aB', 3), {'error': 'start-stop'}], [('Cd', 2), {'error': 'start-stop'}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('aD', 3), {'error': 'start-stop'}], [('C55C', 3), {'modules': 51}]]]\nlabels = [\"regression: intercharacter gaps\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"925fd9b065a9dca93194fca673cdd4fc436c9f002fcbec444980c489e9ba9f23","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, ratio):\n    if not 2 <= ratio <= 3:\n        return {'error': 'ratio'}\n    if len(text) < 2:\n        return {'error': 'short'}\n    if text[0] not in 'ABCD' or text[-1] not in 'ABCD':\n        return {'error': 'start-stop'}\n    body = text[1:-1]\n    for ch in body:\n        if ch not in '0123456789-$:/.+':\n            return {'error': 'char', 'char': ch}\n    total = 0\n    for ch in text:\n        wides = 2 if ch in '0123456789-$' else 3\n        total += (7 - wides) + wides * ratio\n    return {'modules': total + len(text) - 1}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('C+B', 3), {'modules': 41}], [('B:0C', 3), {'modules': 53}], [('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'}], [('B5355D', 3), {'modules': 75}]], [[('CD', 2), {'modules': 21}], [('C//5D', 2.5), {'modules': 60.0}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('C773C', 1.5), {'error': 'ratio'}], [('CA', 3), {'modules': 27}]], [[('B957A', 2.5), {'modules': 57.0}], [('B53C', 2), {'modules': 41}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}], [('D5-B', 2.5), {'modules': 46.0}]], [[('A:5B', 2), {'modules': 42}], [('B$D', 2), {'modules': 31}], [('aT', 2.5), {'error': 'start-stop'}], [('D3$20d', 3), {'error': 'start-stop'}], [('C58d', 1.5), {'error': 'ratio'}], [('D/5:3B', 4), {'error': 'ratio'}], [('AA', 1.5), {'error': 'ratio'}], [('A1D', 3), {'modules': 39}]], [[('A-31A', 3), {'modules': 63}], [('A905C', 3), {'modules': 63}], [('aB', 3), {'error': 'start-stop'}], [('Cd', 2), {'error': 'start-stop'}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('aD', 3), {'error': 'start-stop'}], [('C55C', 3), {'modules': 51}]]]\nlabels = [\"regression: intercharacter gaps\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-barcode-symbology-encoding-codabar-width-gap-total","generated_at":"2026-09-29T14:49:45.670043+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"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.","repair":"Add len(text) - 1 gaps.","root_cause":"One gap per character is added instead of one between adjacent characters.","sha256":"5118721034c1d4d453b721334823a2bea9050cb71f9de7c35a5c5ce89246932b","title":"Codabar width adds a gap after the stop character · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.165,"exit_code":1,"observations":[{"actual":{"modules":39},"check":"regression: intercharacter gaps 0","expected":{"modules":41},"passed":false},{"actual":{"modules":51},"check":"repair trap 1","expected":{"modules":53},"passed":false},{"actual":{"char":"A","error":"char"},"check":"combined fault 2","expected":{"char":"A","error":"char"},"passed":true},{"actual":{"char":"E","error":"char"},"check":"control 3","expected":{"char":"E","error":"char"},"passed":true},{"actual":{"error":"start-stop"},"check":"control 4","expected":{"error":"start-stop"},"passed":true},{"actual":{"error":"start-stop"},"check":"boundary 5","expected":{"error":"start-stop"},"passed":true},{"actual":{"error":"ratio"},"check":"boundary 6","expected":{"error":"ratio"},"passed":true},{"actual":{"modules":73},"check":"control 7","expected":{"modules":75},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: intercharacter gaps 0\", \"actual\": {\"modules\": 39}, \"expected\": {\"modules\": 41}, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": {\"modules\": 51}, \"expected\": {\"modules\": 53}, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": {\"error\": \"char\", \"char\": \"A\"}, \"expected\": {\"error\": \"char\", \"char\": \"A\"}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"char\", \"char\": \"E\"}, \"expected\": {\"error\": \"char\", \"char\": \"E\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"start-stop\"}, \"expected\": {\"error\": \"start-stop\"}, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": {\"error\": \"start-stop\"}, \"expected\": {\"error\": \"start-stop\"}, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"ratio\"}, \"expected\": {\"error\": \"ratio\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": {\"modules\": 73}, \"expected\": {\"modules\": 75}, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.174,"exit_code":1,"observations":[{"actual":{"modules":42},"check":"regression: intercharacter gaps 0","expected":{"modules":41},"passed":false},{"actual":{"modules":54},"check":"repair trap 1","expected":{"modules":53},"passed":false},{"actual":{"char":"A","error":"char"},"check":"combined fault 2","expected":{"char":"A","error":"char"},"passed":true},{"actual":{"char":"E","error":"char"},"check":"control 3","expected":{"char":"E","error":"char"},"passed":true},{"actual":{"error":"start-stop"},"check":"control 4","expected":{"error":"start-stop"},"passed":true},{"actual":{"error":"start-stop"},"check":"boundary 5","expected":{"error":"start-stop"},"passed":true},{"actual":{"error":"ratio"},"check":"boundary 6","expected":{"error":"ratio"},"passed":true},{"actual":{"modules":76},"check":"control 7","expected":{"modules":75},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: intercharacter gaps 0\", \"actual\": {\"modules\": 42}, \"expected\": {\"modules\": 41}, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": {\"modules\": 54}, \"expected\": {\"modules\": 53}, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": {\"error\": \"char\", \"char\": \"A\"}, \"expected\": {\"error\": \"char\", \"char\": \"A\"}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"char\", \"char\": \"E\"}, \"expected\": {\"error\": \"char\", \"char\": \"E\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"start-stop\"}, \"expected\": {\"error\": \"start-stop\"}, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": {\"error\": \"start-stop\"}, \"expected\": {\"error\": \"start-stop\"}, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"ratio\"}, \"expected\": {\"error\": \"ratio\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": {\"modules\": 76}, \"expected\": {\"modules\": 75}, \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.982,"exit_code":0,"observations":[{"actual":{"modules":41},"check":"regression: intercharacter gaps 0","expected":{"modules":41},"passed":true},{"actual":{"modules":53},"check":"repair trap 1","expected":{"modules":53},"passed":true},{"actual":{"char":"A","error":"char"},"check":"combined fault 2","expected":{"char":"A","error":"char"},"passed":true},{"actual":{"char":"E","error":"char"},"check":"control 3","expected":{"char":"E","error":"char"},"passed":true},{"actual":{"error":"start-stop"},"check":"control 4","expected":{"error":"start-stop"},"passed":true},{"actual":{"error":"start-stop"},"check":"boundary 5","expected":{"error":"start-stop"},"passed":true},{"actual":{"error":"ratio"},"check":"boundary 6","expected":{"error":"ratio"},"passed":true},{"actual":{"modules":75},"check":"control 7","expected":{"modules":75},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: intercharacter gaps 0\", \"actual\": {\"modules\": 41}, \"expected\": {\"modules\": 41}, \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": {\"modules\": 53}, \"expected\": {\"modules\": 53}, \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": {\"error\": \"char\", \"char\": \"A\"}, \"expected\": {\"error\": \"char\", \"char\": \"A\"}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"char\", \"char\": \"E\"}, \"expected\": {\"error\": \"char\", \"char\": \"E\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"start-stop\"}, \"expected\": {\"error\": \"start-stop\"}, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": {\"error\": \"start-stop\"}, \"expected\": {\"error\": \"start-stop\"}, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"ratio\"}, \"expected\": {\"error\": \"ratio\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": {\"modules\": 75}, \"expected\": {\"modules\": 75}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}