{"abstract":"A seven-digit run ends with a lone digit that forces another switch back to B.","category":"Barcode symbology encoding","checks":8,"contract":"Plan Code 128 code sets for printable ASCII data (other characters -> None) as a list of [set, text] segments. Start in C when the data begins with at least 4 digits or is entirely digits of even length >= 2, else B. In C consume digit pairs and fall back to B when fewer than two digits remain in the run. In B switch to C before a run of at least 6 digits, or at least 4 digits that reach the end of the data; an odd run first encodes one digit in B. Empty data yields [[\"B\", \"\"]].","contract_signature":"data","evaluation_group":"w2-barcode-symbology-encoding-code128-codeset-plan","failed_approach":"Peeling a digit from even runs makes them odd inside set C.","family":"w2-barcode-symbology-encoding-code128-codeset-plan-odd-run","id":"FA-79416","implementations":{"attempt":{"sha256":"6b3074d1bc9e5d3702815b3ce47f3047b2a6f670b72e97cba50841468169d400","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(data):\n    if any(not (32 <= ord(ch) <= 126) for ch in data):\n        return None\n    n = len(data)\n    def run(j):\n        k = j\n        while k < n and data[k] in '0123456789':\n            k += 1\n        return k - j\n    segs = []\n    r = run(0)\n    if r >= 4 or (r == n and n >= 2 and n % 2 == 0):\n        cur = 'C'\n    else:\n        cur = 'B'\n    buf = ''\n    i = 0\n    while i < n:\n        if cur == 'C':\n            if run(i) >= 2:\n                buf += data[i:i + 2]\n                i += 2\n                continue\n            segs.append(['C', buf])\n            buf = ''\n            cur = 'B'\n            continue\n        r = run(i)\n        if r >= 6 or (r >= 4 and i + r == n):\n            if r % 2 == 0:\n                buf += data[i]\n                i += 1\n            if buf:\n                segs.append(['B', buf])\n            buf = ''\n            cur = 'C'\n            continue\n        buf += data[i]\n        i += 1\n    if buf or not segs:\n        segs.append([cur, buf])\n    return segs\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['Q7 2187698', [['B', 'Q7 2'], ['C', '187698']]], ['lot17764124x', [['B', 'lot'], ['C', '17764124'], ['B', 'x']]], ['ABlot61791', [['B', 'ABlot6'], ['C', '1791']]], ['3580131', [['C', '358013'], ['B', '1']]], ['xAB', [['B', 'xAB']]], ['AB', [['B', 'AB']]], ['x15', [['B', 'x15']]], ['Q7697394151338692706401453', [['B', 'Q7'], ['C', '697394151338692706401453']]]], [['-831943095', [['B', '-8'], ['C', '31943095']]], [' 1422146', [['B', ' 1'], ['C', '422146']]], ['Q7lotQ7lot', [['B', 'Q7lotQ7lot']]], ['101874486507729', [['C', '10187448650772'], ['B', '9']]], ['x22', [['B', 'x22']]], [' ', [['B', ' ']]], ['-006', [['B', '-006']]], ['lot13579626033845980', [['B', 'lot1'], ['C', '3579626033845980']]]], [[' 09255480AB663673713', [['B', ' '], ['C', '09255480'], ['B', 'AB6'], ['C', '63673713']]], ['x76654214lot2355', [['B', 'x'], ['C', '76654214'], ['B', 'lot'], ['C', '2355']]], [' 684915593AB', [['B', ' 6'], ['C', '84915593'], ['B', 'AB']]], ['0964853799773055547674lot', [['C', '0964853799773055547674'], ['B', 'lot']]], ['lot', [['B', 'lot']]], ['1', [['B', '1']]], ['Q7 lotAB', [['B', 'Q7 lotAB']]], ['827 AB51544', [['B', '827 AB5'], ['C', '1544']]]], [['lot1743-0346174', [['B', 'lot1743-0'], ['C', '346174']]], [' 705791-x', [['B', ' '], ['C', '705791'], ['B', '-x']]], ['lot6746309', [['B', 'lot6'], ['C', '746309']]], ['733-', [['B', '733-']]], ['46450162930', [['C', '4645016293'], ['B', '0']]], [' - ', [['B', ' - ']]], ['lot5899 ', [['B', 'lot5899 ']]], [' 838245148', [['B', ' 8'], ['C', '38245148']]]], [['10026xAB91695', [['C', '1002'], ['B', '6xAB9'], ['C', '1695']]], ['AB638804007 ', [['B', 'AB6'], ['C', '38804007'], ['B', ' ']]], ['AB98585', [['B', 'AB9'], ['C', '8585']]], ['AB8', [['B', 'AB8']]], ['014550632960 753', [['C', '014550632960'], ['B', ' 753']]], [' x', [['B', ' x']]], ['2637', [['C', '2637']]], ['lotx628901387', [['B', 'lotx6'], ['C', '28901387']]]]]\nlabels = [\"regression: odd digit run alignment\", \"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":"510f4e048b199e052f96c084c1355767f3da38242a4518f2a469ba503016b370","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(data):\n    if any(not (32 <= ord(ch) <= 126) for ch in data):\n        return None\n    n = len(data)\n    def run(j):\n        k = j\n        while k < n and data[k] in '0123456789':\n            k += 1\n        return k - j\n    segs = []\n    r = run(0)\n    if r >= 4 or (r == n and n >= 2 and n % 2 == 0):\n        cur = 'C'\n    else:\n        cur = 'B'\n    buf = ''\n    i = 0\n    while i < n:\n        if cur == 'C':\n            if run(i) >= 2:\n                buf += data[i:i + 2]\n                i += 2\n                continue\n            segs.append(['C', buf])\n            buf = ''\n            cur = 'B'\n            continue\n        r = run(i)\n        if r >= 6 or (r >= 4 and i + r == n):\n            if False:\n                buf += data[i]\n                i += 1\n            if buf:\n                segs.append(['B', buf])\n            buf = ''\n            cur = 'C'\n            continue\n        buf += data[i]\n        i += 1\n    if buf or not segs:\n        segs.append([cur, buf])\n    return segs\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['Q7 2187698', [['B', 'Q7 2'], ['C', '187698']]], ['lot17764124x', [['B', 'lot'], ['C', '17764124'], ['B', 'x']]], ['ABlot61791', [['B', 'ABlot6'], ['C', '1791']]], ['3580131', [['C', '358013'], ['B', '1']]], ['xAB', [['B', 'xAB']]], ['AB', [['B', 'AB']]], ['x15', [['B', 'x15']]], ['Q7697394151338692706401453', [['B', 'Q7'], ['C', '697394151338692706401453']]]], [['-831943095', [['B', '-8'], ['C', '31943095']]], [' 1422146', [['B', ' 1'], ['C', '422146']]], ['Q7lotQ7lot', [['B', 'Q7lotQ7lot']]], ['101874486507729', [['C', '10187448650772'], ['B', '9']]], ['x22', [['B', 'x22']]], [' ', [['B', ' ']]], ['-006', [['B', '-006']]], ['lot13579626033845980', [['B', 'lot1'], ['C', '3579626033845980']]]], [[' 09255480AB663673713', [['B', ' '], ['C', '09255480'], ['B', 'AB6'], ['C', '63673713']]], ['x76654214lot2355', [['B', 'x'], ['C', '76654214'], ['B', 'lot'], ['C', '2355']]], [' 684915593AB', [['B', ' 6'], ['C', '84915593'], ['B', 'AB']]], ['0964853799773055547674lot', [['C', '0964853799773055547674'], ['B', 'lot']]], ['lot', [['B', 'lot']]], ['1', [['B', '1']]], ['Q7 lotAB', [['B', 'Q7 lotAB']]], ['827 AB51544', [['B', '827 AB5'], ['C', '1544']]]], [['lot1743-0346174', [['B', 'lot1743-0'], ['C', '346174']]], [' 705791-x', [['B', ' '], ['C', '705791'], ['B', '-x']]], ['lot6746309', [['B', 'lot6'], ['C', '746309']]], ['733-', [['B', '733-']]], ['46450162930', [['C', '4645016293'], ['B', '0']]], [' - ', [['B', ' - ']]], ['lot5899 ', [['B', 'lot5899 ']]], [' 838245148', [['B', ' 8'], ['C', '38245148']]]], [['10026xAB91695', [['C', '1002'], ['B', '6xAB9'], ['C', '1695']]], ['AB638804007 ', [['B', 'AB6'], ['C', '38804007'], ['B', ' ']]], ['AB98585', [['B', 'AB9'], ['C', '8585']]], ['AB8', [['B', 'AB8']]], ['014550632960 753', [['C', '014550632960'], ['B', ' 753']]], [' x', [['B', ' x']]], ['2637', [['C', '2637']]], ['lotx628901387', [['B', 'lotx6'], ['C', '28901387']]]]]\nlabels = [\"regression: odd digit run alignment\", \"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-code128-codeset-plan-odd-run","generated_at":"2026-09-29T14:49:44.392593+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.","root_cause":"The first digit of an odd run is not encoded in B before switching to C.","sha256":"c056a6105970b89028dffddf559ccdfcbf89317e5019280f9b10c8c2d4a29910","title":"Odd digit run enters set C without peeling a digit · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":39.736,"exit_code":1,"observations":[{"actual":[["B","Q7 "],["C","218769"],["B","8"]],"check":"regression: odd digit run alignment 0","expected":[["B","Q7 2"],["C","187698"]],"passed":false},{"actual":[["B","lot1"],["C","776412"],["B","4x"]],"check":"repair trap 1","expected":[["B","lot"],["C","17764124"],["B","x"]],"passed":false},{"actual":[["B","ABlot"],["C","6179"],["B","1"]],"check":"combined fault 2","expected":[["B","ABlot6"],["C","1791"]],"passed":false},{"actual":[["C","358013"],["B","1"]],"check":"control 3","expected":[["C","358013"],["B","1"]],"passed":true},{"actual":[["B","xAB"]],"check":"control 4","expected":[["B","xAB"]],"passed":true},{"actual":[["B","AB"]],"check":"boundary 5","expected":[["B","AB"]],"passed":true},{"actual":[["B","x15"]],"check":"boundary 6","expected":[["B","x15"]],"passed":true},{"actual":[["B","Q"],["C","769739415133869270640145"],["B","3"]],"check":"control 7","expected":[["B","Q7"],["C","697394151338692706401453"]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: odd digit run alignment 0\", \"actual\": [[\"B\", \"Q7 \"], [\"C\", \"218769\"], [\"B\", \"8\"]], \"expected\": [[\"B\", \"Q7 2\"], [\"C\", \"187698\"]], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [[\"B\", \"lot1\"], [\"C\", \"776412\"], [\"B\", \"4x\"]], \"expected\": [[\"B\", \"lot\"], [\"C\", \"17764124\"], [\"B\", \"x\"]], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [[\"B\", \"ABlot\"], [\"C\", \"6179\"], [\"B\", \"1\"]], \"expected\": [[\"B\", \"ABlot6\"], [\"C\", \"1791\"]], \"passed\": false}, {\"check\": \"control 3\", \"actual\": [[\"C\", \"358013\"], [\"B\", \"1\"]], \"expected\": [[\"C\", \"358013\"], [\"B\", \"1\"]], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [[\"B\", \"xAB\"]], \"expected\": [[\"B\", \"xAB\"]], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [[\"B\", \"AB\"]], \"expected\": [[\"B\", \"AB\"]], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [[\"B\", \"x15\"]], \"expected\": [[\"B\", \"x15\"]], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [[\"B\", \"Q\"], [\"C\", \"769739415133869270640145\"], [\"B\", \"3\"]], \"expected\": [[\"B\", \"Q7\"], [\"C\", \"697394151338692706401453\"]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.794,"exit_code":1,"observations":[{"actual":[["B","Q7 "],["C","218769"],["B","8"]],"check":"regression: odd digit run alignment 0","expected":[["B","Q7 2"],["C","187698"]],"passed":false},{"actual":[["B","lot"],["C","17764124"],["B","x"]],"check":"repair trap 1","expected":[["B","lot"],["C","17764124"],["B","x"]],"passed":true},{"actual":[["B","ABlot"],["C","6179"],["B","1"]],"check":"combined fault 2","expected":[["B","ABlot6"],["C","1791"]],"passed":false},{"actual":[["C","358013"],["B","1"]],"check":"control 3","expected":[["C","358013"],["B","1"]],"passed":true},{"actual":[["B","xAB"]],"check":"control 4","expected":[["B","xAB"]],"passed":true},{"actual":[["B","AB"]],"check":"boundary 5","expected":[["B","AB"]],"passed":true},{"actual":[["B","x15"]],"check":"boundary 6","expected":[["B","x15"]],"passed":true},{"actual":[["B","Q"],["C","769739415133869270640145"],["B","3"]],"check":"control 7","expected":[["B","Q7"],["C","697394151338692706401453"]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: odd digit run alignment 0\", \"actual\": [[\"B\", \"Q7 \"], [\"C\", \"218769\"], [\"B\", \"8\"]], \"expected\": [[\"B\", \"Q7 2\"], [\"C\", \"187698\"]], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [[\"B\", \"lot\"], [\"C\", \"17764124\"], [\"B\", \"x\"]], \"expected\": [[\"B\", \"lot\"], [\"C\", \"17764124\"], [\"B\", \"x\"]], \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": [[\"B\", \"ABlot\"], [\"C\", \"6179\"], [\"B\", \"1\"]], \"expected\": [[\"B\", \"ABlot6\"], [\"C\", \"1791\"]], \"passed\": false}, {\"check\": \"control 3\", \"actual\": [[\"C\", \"358013\"], [\"B\", \"1\"]], \"expected\": [[\"C\", \"358013\"], [\"B\", \"1\"]], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [[\"B\", \"xAB\"]], \"expected\": [[\"B\", \"xAB\"]], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [[\"B\", \"AB\"]], \"expected\": [[\"B\", \"AB\"]], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [[\"B\", \"x15\"]], \"expected\": [[\"B\", \"x15\"]], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [[\"B\", \"Q\"], [\"C\", \"769739415133869270640145\"], [\"B\", \"3\"]], \"expected\": [[\"B\", \"Q7\"], [\"C\", \"697394151338692706401453\"]], \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}