{"abstract":"The encoded symbol repeats the first digit and drops the seventh.","category":"Barcode symbology encoding","checks":8,"contract":"Encode a 13-character string of ASCII digits (the check digit is taken as given, not verified) as the 95-module EAN-13 pattern: start guard 101, six left digits in L or G sets chosen by the parity row of the leading digit, centre guard 01010, six right digits in the R set, end guard 101. R is the bitwise complement of L and G is R reversed. Anything else returns None.","evaluation_group":"w2-barcode-symbology-encoding-ean13-modules","failed_approach":"Special-casing only the first position still encodes the leading digit instead of the second.","family":"w2-barcode-symbology-encoding-ean13-modules-left-digit-offset","id":"FA-79351","implementations":{"attempt":{"sha256":"0f58986fced23f481c2093b53597b0ad98bf6731880bd9d3fe6d1a2ce7a49917","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(code):\n    if len(code) != 13 or not all(ch in '0123456789' for ch in code):\n        return None\n    L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']\n    R = [''.join('1' if b == '0' else '0' for b in p) for p in L]\n    G = [p[::-1] for p in R]\n    parity = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL']\n    pat = parity[int(code[0])]\n    left = ''.join((L if pat[i] == 'L' else G)[int(code[1 + i]) if i else int(code[0])] for i in range(6))\n    right = ''.join(R[int(ch)] for ch in code[7:])\n    return '101' + left + '01010' + right + '101'\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['8708854500750', '10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101'], ['3510413208309', '10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101'], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101']], [['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['400638133393１', None], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101']], [['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101'], ['123456789012', None], ['12345678901234', None], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['6191360813603', '10100110010010111011001101000010101111000110101010100100011001101000010101000011100101000010101']], [['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6274612745694', '10100100110010001001110100001010011001001001101010100010010111001001110101000011101001011100101'], ['12345678901234', None], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['6346382380419', '10101111010011101000010101000010110111001001101010100001010010001110010101110011001101110100101']], [['8746102916553', '10101110110011101010111101100110100111001001101010111010011001101010000100111010011101000010101'], ['5334300159167', '10101111010100001001110101111010001101010011101010110011010011101110100110011010100001000100101'], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['3842111701831', '10101101110100011001101101100110110011001100101010100010011100101100110100100010000101100110101']]]\nlabels = [\"regression: left half digit index\", \"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":"bcdf8b68ed0ac359ce3afed6c4e7481ae1281db897a465a7a2f896bd4023a002","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(code):\n    if len(code) != 13 or not all(ch in '0123456789' for ch in code):\n        return None\n    L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']\n    R = [''.join('1' if b == '0' else '0' for b in p) for p in L]\n    G = [p[::-1] for p in R]\n    parity = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL']\n    pat = parity[int(code[0])]\n    left = ''.join((L if pat[i] == 'L' else G)[int(code[i])] for i in range(6))\n    right = ''.join(R[int(ch)] for ch in code[7:])\n    return '101' + left + '01010' + right + '101'\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['8708854500750', '10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101'], ['3510413208309', '10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101'], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101']], [['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['400638133393１', None], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101']], [['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101'], ['123456789012', None], ['12345678901234', None], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['6191360813603', '10100110010010111011001101000010101111000110101010100100011001101000010101000011100101000010101']], [['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6274612745694', '10100100110010001001110100001010011001001001101010100010010111001001110101000011101001011100101'], ['12345678901234', None], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['6346382380419', '10101111010011101000010101000010110111001001101010100001010010001110010101110011001101110100101']], [['8746102916553', '10101110110011101010111101100110100111001001101010111010011001101010000100111010011101000010101'], ['5334300159167', '10101111010100001001110101111010001101010011101010110011010011101110100110011010100001000100101'], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['3842111701831', '10101101110100011001101101100110110011001100101010100010011100101100110100100010000101100110101']]]\nlabels = [\"regression: left half digit index\", \"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":"2088b5f5dfec49f436ff810986a3a5664770d1bed70b52a41fd86e10e3fbd729","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(code):\n    if len(code) != 13 or not all(ch in '0123456789' for ch in code):\n        return None\n    L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']\n    R = [''.join('1' if b == '0' else '0' for b in p) for p in L]\n    G = [p[::-1] for p in R]\n    parity = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL']\n    pat = parity[int(code[0])]\n    left = ''.join((L if pat[i] == 'L' else G)[int(code[1 + i])] for i in range(6))\n    right = ''.join(R[int(ch)] for ch in code[7:])\n    return '101' + left + '01010' + right + '101'\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['8708854500750', '10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101'], ['3510413208309', '10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101'], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101']], [['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['400638133393１', None], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101']], [['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101'], ['123456789012', None], ['12345678901234', None], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['6191360813603', '10100110010010111011001101000010101111000110101010100100011001101000010101000011100101000010101']], [['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6274612745694', '10100100110010001001110100001010011001001001101010100010010111001001110101000011101001011100101'], ['12345678901234', None], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['6346382380419', '10101111010011101000010101000010110111001001101010100001010010001110010101110011001101110100101']], [['8746102916553', '10101110110011101010111101100110100111001001101010111010011001101010000100111010011101000010101'], ['5334300159167', '10101111010100001001110101111010001101010011101010110011010011101110100110011010100001000100101'], ['', None], ['400638133393１', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['3842111701831', '10101101110100011001101101100110110011001100101010100010011100101100110100100010000101100110101']]]\nlabels = [\"regression: left half digit index\", \"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-ean13-modules-left-digit-offset","generated_at":"2026-09-29T14:49:43.801740+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":"Encode digits 2 through 7 (indices 1..6) in the left half.","root_cause":"The left half is indexed from 0, but the first digit is carried by the parity pattern, not by modules.","sha256":"6900ea3b1448b2335621f503d430692c00a465acc8a9e7143802fea6431af91f","title":"EAN-13 left half encodes the implied leading digit · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.809,"exit_code":1,"observations":[{"actual":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","check":"regression: left half digit index 0","expected":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","passed":true},{"actual":"10101101110100111011011100010010111001010001101010100111011100101110010100010010011101110010101","check":"repair trap 1","expected":"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101","passed":false},{"actual":"10101111010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","check":"combined fault 2","expected":"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","passed":false},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":null,"check":"control 4","expected":null,"passed":true},{"actual":null,"check":"boundary 5","expected":null,"passed":true},{"actual":null,"check":"boundary 6","expected":null,"passed":true},{"actual":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","check":"control 7","expected":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: left half digit index 0\", \"actual\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"expected\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": \"10101101110100111011011100010010111001010001101010100111011100101110010100010010011101110010101\", \"expected\": \"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"10101111010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"expected\": \"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"passed\": false}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"expected\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.843,"exit_code":1,"observations":[{"actual":"10101100010111001000010100010110111011011001101010100100010001001110100100111011101001011100101","check":"regression: left half digit index 0","expected":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","passed":false},{"actual":"10101101110010001000110100010010001001011000101010100111011100101110010100010010011101110010101","check":"repair trap 1","expected":"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101","passed":false},{"actual":"10101111010110001011001101001110011101001100101010110110011100101001000100001011100101110100101","check":"combined fault 2","expected":"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","passed":false},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":null,"check":"control 4","expected":null,"passed":true},{"actual":null,"check":"boundary 5","expected":null,"passed":true},{"actual":null,"check":"boundary 6","expected":null,"passed":true},{"actual":"10101100010111001000010101000110101111011100101010111010010100001011100100001010000101100110101","check":"control 7","expected":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: left half digit index 0\", \"actual\": \"10101100010111001000010100010110111011011001101010100100010001001110100100111011101001011100101\", \"expected\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"10101101110010001000110100010010001001011000101010100111011100101110010100010010011101110010101\", \"expected\": \"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"10101111010110001011001101001110011101001100101010110110011100101001000100001011100101110100101\", \"expected\": \"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"passed\": false}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"10101100010111001000010101000110101111011100101010111010010100001011100100001010000101100110101\", \"expected\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.136,"exit_code":0,"observations":[{"actual":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","check":"regression: left half digit index 0","expected":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","passed":true},{"actual":"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101","check":"repair trap 1","expected":"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101","passed":true},{"actual":"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","check":"combined fault 2","expected":"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","passed":true},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":null,"check":"control 4","expected":null,"passed":true},{"actual":null,"check":"boundary 5","expected":null,"passed":true},{"actual":null,"check":"boundary 6","expected":null,"passed":true},{"actual":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","check":"control 7","expected":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: left half digit index 0\", \"actual\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"expected\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": \"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101\", \"expected\": \"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101\", \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": \"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"expected\": \"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"expected\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}