{"abstract":"Codes starting with 7 decode as starting with 8 and vice versa, silently changing the country prefix.","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.","contract_signature":"code","evaluation_group":"w2-barcode-symbology-encoding-ean13-modules","failed_approach":"Duplicating the 7 row makes 8-prefixed codes decode as 7.","family":"w2-barcode-symbology-encoding-ean13-modules-parity-rows","id":"FA-79346","implementations":{"attempt":{"sha256":"f750d5812b8555e0c83d8f4955dd227e88c551f93ca8377f28e0a6ed5e503f7e","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', 'LGLGLG', '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 = [[['8708854500750', '10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101'], ['8966493447779', '10100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101'], ['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101'], ['3339552094472', '10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101'], ['2923603435282', '10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101'], ['3510413208309', '10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101'], ['8535822111223', '10101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101']], [['8021320736862', '10100011010011011001100101000010011011000110101010100010010000101010000100100010100001101100101'], ['8355706274976', '10101111010111001011000100100010100111010111101010110110010001001011100111010010001001010000101'], ['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101'], ['3766842531699', '10101110110101111000010100010010011101001001101010100111010000101100110101000011101001110100101'], ['5117058572420', '10100110010110011001000100011010110001000100101010100111010001001101100101110011011001110010101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['7358317090517', '10101111010111001011011101000010011001001000101010111001011101001110010100111011001101000100101']], [['7867470575448', '10101101110000101011101100111010111011010011101010100111010001001001110101110010111001001000101'], ['8763496138721', '10101110110000101011110100111010010111010111101010110011010000101001000100010011011001100110101'], ['8457347577022', '10101000110111001011101101000010011101011101101010100111010001001000100111001011011001101100101'], ['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['5108124299029', '10100110010100111000100100110010010011001110101010110110011101001110100111001011011001110100101'], ['4275982832382', '10100100110010001011000100010110001001001101101010100100010000101101100100001010010001101100101'], ['1841559138266', '10101101110100011011001101100010111001001011101010110011010000101001000110110010100001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101']], [['8352800374001', '10101111010111001001001100010010100111000110101010100001010001001011100111001011100101100110101'], ['8557236078630', '10101100010111001011101100110110100001010111101010111001010001001001000101000010000101110010101'], ['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6087726577121', '10100011010001001001000100100010010011010111101010100111010001001000100110011011011001100110101'], ['9139450687171', '10100110010100001001011101000110111001000110101010101000010010001000100110011010001001100110101'], ['9147502050346', '10100110010011101001000101100010100111001001101010111001010011101110010100001010111001010000101'], ['3621226624482', '10101011110010011011001100110110011011010111101010101000011011001011100101110010010001101100101'], ['8651558989874', '10101011110111001001100101110010111001011011101010111010010010001110100100100010001001011100101']], [['7195448424184', '10100110010010111011000100111010100011000100101010101110011011001011100110011010010001011100101'], ['8606108755061', '10101011110100111010111101100110100111011011101010100010010011101001110111001010100001100110101'], ['8930890112346', '10100010110100001000110100010010010111000110101010110011011001101101100100001010111001010000101'], ['9803396505759', '10101101110100111010000101111010010111010111101010100111011100101001110100010010011101110100101'], ['5845180047269', '10101101110011101011100100110010110111010011101010111001010111001000100110110010100001110100101'], ['9648988190302', '10101011110011101000100100010110001001011011101010110011011101001110010100001011100101101100101'], ['2139834231886', '10100110010111101001011100010010111101001110101010110110010000101100110100100010010001010000101'], ['8011609402200', '10100011010110011001100100001010100111000101101010101110011100101101100110110011100101110010101']]]\nlabels = [\"regression: parity rows for leading 7 and 8\", \"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":"7896321ef75064a10f82b2521f80b1a9fd081b5f24cd4bff061f96ca22cc37f9","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', 'LGLGGL', 'LGLGLG', '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 = [[['8708854500750', '10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101'], ['8966493447779', '10100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101'], ['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101'], ['3339552094472', '10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101'], ['2923603435282', '10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101'], ['3510413208309', '10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101'], ['8535822111223', '10101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101']], [['8021320736862', '10100011010011011001100101000010011011000110101010100010010000101010000100100010100001101100101'], ['8355706274976', '10101111010111001011000100100010100111010111101010110110010001001011100111010010001001010000101'], ['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101'], ['3766842531699', '10101110110101111000010100010010011101001001101010100111010000101100110101000011101001110100101'], ['5117058572420', '10100110010110011001000100011010110001000100101010100111010001001101100101110011011001110010101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['7358317090517', '10101111010111001011011101000010011001001000101010111001011101001110010100111011001101000100101']], [['7867470575448', '10101101110000101011101100111010111011010011101010100111010001001001110101110010111001001000101'], ['8763496138721', '10101110110000101011110100111010010111010111101010110011010000101001000100010011011001100110101'], ['8457347577022', '10101000110111001011101101000010011101011101101010100111010001001000100111001011011001101100101'], ['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['5108124299029', '10100110010100111000100100110010010011001110101010110110011101001110100111001011011001110100101'], ['4275982832382', '10100100110010001011000100010110001001001101101010100100010000101101100100001010010001101100101'], ['1841559138266', '10101101110100011011001101100010111001001011101010110011010000101001000110110010100001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101']], [['8352800374001', '10101111010111001001001100010010100111000110101010100001010001001011100111001011100101100110101'], ['8557236078630', '10101100010111001011101100110110100001010111101010111001010001001001000101000010000101110010101'], ['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6087726577121', '10100011010001001001000100100010010011010111101010100111010001001000100110011011011001100110101'], ['9139450687171', '10100110010100001001011101000110111001000110101010101000010010001000100110011010001001100110101'], ['9147502050346', '10100110010011101001000101100010100111001001101010111001010011101110010100001010111001010000101'], ['3621226624482', '10101011110010011011001100110110011011010111101010101000011011001011100101110010010001101100101'], ['8651558989874', '10101011110111001001100101110010111001011011101010111010010010001110100100100010001001011100101']], [['7195448424184', '10100110010010111011000100111010100011000100101010101110011011001011100110011010010001011100101'], ['8606108755061', '10101011110100111010111101100110100111011011101010100010010011101001110111001010100001100110101'], ['8930890112346', '10100010110100001000110100010010010111000110101010110011011001101101100100001010111001010000101'], ['9803396505759', '10101101110100111010000101111010010111010111101010100111011100101001110100010010011101110100101'], ['5845180047269', '10101101110011101011100100110010110111010011101010111001010111001000100110110010100001110100101'], ['9648988190302', '10101011110011101000100100010110001001011011101010110011011101001110010100001011100101101100101'], ['2139834231886', '10100110010111101001011100010010111101001110101010110110010000101100110100100010010001010000101'], ['8011609402200', '10100011010110011001100100001010100111000101101010101110011100101101100110110011100101110010101']]]\nlabels = [\"regression: parity rows for leading 7 and 8\", \"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-parity-rows","generated_at":"2026-09-29T14:49:43.758492+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 parity table lists the rows for 7 and 8 in swapped order.","sha256":"d5239778c9fef114a34e552e434d298ac24f08434a4f93a1a89a308864ea97ea","title":"EAN-13 parity rows for leading digits 7 and 8 are exchanged · 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":40.521,"exit_code":1,"observations":[{"actual":"10101110110100111011011100010010110001001110101010100111011100101110010100010010011101110010101","check":"regression: parity rows for leading 7 and 8 0","expected":"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101","passed":false},{"actual":"10100010110000101010111100111010001011010000101010101110010111001000100100010010001001110100101","check":"repair trap 1","expected":"10100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101","passed":false},{"actual":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","check":"combined fault 2","expected":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","passed":true},{"actual":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","check":"control 3","expected":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","passed":true},{"actual":"10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101","check":"control 4","expected":"10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101","passed":true},{"actual":"10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101","check":"boundary 5","expected":"10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101","passed":true},{"actual":"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","check":"boundary 6","expected":"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","passed":true},{"actual":"10101100010100001011000100010010010011001101101010110011011001101100110110110011011001000010101","check":"control 7","expected":"10101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: parity rows for leading 7 and 8 0\", \"actual\": \"10101110110100111011011100010010110001001110101010100111011100101110010100010010011101110010101\", \"expected\": \"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"10100010110000101010111100111010001011010000101010101110010111001000100100010010001001110100101\", \"expected\": \"10100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"expected\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"expected\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101\", \"expected\": \"10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101\", \"expected\": \"10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"expected\": \"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"10101100010100001011000100010010010011001101101010110011011001101100110110110011011001000010101\", \"expected\": \"10101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.815,"exit_code":1,"observations":[{"actual":"10101110110100111011011100010010110001001110101010100111011100101110010100010010011101110010101","check":"regression: parity rows for leading 7 and 8 0","expected":"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101","passed":false},{"actual":"10100010110000101010111100111010001011010000101010101110010111001000100100010010001001110100101","check":"repair trap 1","expected":"10100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101","passed":false},{"actual":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","check":"combined fault 2","expected":"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101","passed":true},{"actual":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","check":"control 3","expected":"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101","passed":true},{"actual":"10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101","check":"control 4","expected":"10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101","passed":true},{"actual":"10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101","check":"boundary 5","expected":"10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101","passed":true},{"actual":"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","check":"boundary 6","expected":"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101","passed":true},{"actual":"10101100010100001011000100010010010011001101101010110011011001101100110110110011011001000010101","check":"control 7","expected":"10101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: parity rows for leading 7 and 8 0\", \"actual\": \"10101110110100111011011100010010110001001110101010100111011100101110010100010010011101110010101\", \"expected\": \"10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"10100010110000101010111100111010001011010000101010101110010111001000100100010010001001110100101\", \"expected\": \"10100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"expected\": \"10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"expected\": \"10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101\", \"expected\": \"10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101\", \"expected\": \"10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"expected\": \"10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"10101100010100001011000100010010010011001101101010110011011001101100110110110011011001000010101\", \"expected\": \"10101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101\", \"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."}}