{"abstract":"Magazine issue numbers decode as different issues.","category":"Barcode symbology encoding","checks":8,"contract":"Encode a two-digit EAN-2 add-on (issue number) as modules: start 1011, first character, separator 01, second character. The parity pattern is chosen by the two-digit value modulo 4: 0 LL, 1 LG, 2 GL, 3 GG, using the EAN L and G code sets. Invalid input returns None.","evaluation_group":"w2-barcode-symbology-encoding-ean2-addon","failed_approach":"Using only the last digit ignores the tens digit, which changes the value modulo 4.","family":"w2-barcode-symbology-encoding-ean2-addon-parity-source","id":"FA-79721","implementations":{"attempt":{"sha256":"991ded1672d299d116cde60872dd2098ee4abccf60c5733d7e71a5e2032f4f88","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    if len(s) != 2 or not all(c in '0123456789' for c in s):\n        return None\n    L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']\n    G = ['0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111']\n    par = ['LL', 'LG', 'GL', 'GG'][int(s[1]) % 4]\n    a = (L if par[0] == 'L' else G)[int(s[0])]\n    b = (L if par[1] == 'L' else G)[int(s[1])]\n    return '1011' + a + '01' + b\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['73', '10110111011010100001'], ['30', '10110100001010001101'], ['42', '10110011101010010011'], ['05', '10110001101010111001'], ['08', '10110001101010110111'], ['06', '10110100111010101111'], ['49', '10110100011010010111'], ['55', '10110111001010111001']], [['19', '10110110011010010111'], ['98', '10110010111010110111'], ['96', '10110001011010101111'], ['44', '10110100011010100011'], ['47', '10110011101010010001'], ['08', '10110001101010110111'], ['06', '10110100111010101111'], ['22', '10110011011010010011']], [['38', '10110100001010110111'], ['73', '10110111011010100001'], ['88', '10110110111010110111'], ['87', '10110001001010010001'], ['83', '10110001001010100001'], ['02', '10110100111010010011'], ['85', '10110110111010111001'], ['17', '10110011001010010001']], [['66', '10110000101010101111'], ['77', '10110111011010010001'], ['92', '10110001011010010011'], ['40', '10110100011010001101'], ['84', '10110110111010100011'], ['49', '10110100011010010111'], ['89', '10110110111010010111'], ['13', '10110011001010100001']], [['52', '10110110001010010011'], ['50', '10110111001010001101'], ['16', '10110011001010101111'], ['85', '10110110111010111001'], ['43', '10110011101010100001'], ['89', '10110110111010010111'], ['48', '10110100011010110111'], ['29', '10110010011010010111']]]\nlabels = [\"regression: parity selector value\", \"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":"47ccf4ad9cb8ed3ac678664796587e92dc2e46087e6478be918e52cd73ffcfdf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    if len(s) != 2 or not all(c in '0123456789' for c in s):\n        return None\n    L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']\n    G = ['0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111']\n    par = ['LL', 'LG', 'GL', 'GG'][(int(s[0]) + int(s[1])) % 4]\n    a = (L if par[0] == 'L' else G)[int(s[0])]\n    b = (L if par[1] == 'L' else G)[int(s[1])]\n    return '1011' + a + '01' + b\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['73', '10110111011010100001'], ['30', '10110100001010001101'], ['42', '10110011101010010011'], ['05', '10110001101010111001'], ['08', '10110001101010110111'], ['06', '10110100111010101111'], ['49', '10110100011010010111'], ['55', '10110111001010111001']], [['19', '10110110011010010111'], ['98', '10110010111010110111'], ['96', '10110001011010101111'], ['44', '10110100011010100011'], ['47', '10110011101010010001'], ['08', '10110001101010110111'], ['06', '10110100111010101111'], ['22', '10110011011010010011']], [['38', '10110100001010110111'], ['73', '10110111011010100001'], ['88', '10110110111010110111'], ['87', '10110001001010010001'], ['83', '10110001001010100001'], ['02', '10110100111010010011'], ['85', '10110110111010111001'], ['17', '10110011001010010001']], [['66', '10110000101010101111'], ['77', '10110111011010010001'], ['92', '10110001011010010011'], ['40', '10110100011010001101'], ['84', '10110110111010100011'], ['49', '10110100011010010111'], ['89', '10110110111010010111'], ['13', '10110011001010100001']], [['52', '10110110001010010011'], ['50', '10110111001010001101'], ['16', '10110011001010101111'], ['85', '10110110111010111001'], ['43', '10110011101010100001'], ['89', '10110110111010010111'], ['48', '10110100011010110111'], ['29', '10110010011010010111']]]\nlabels = [\"regression: parity selector value\", \"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":"d67588bcb1109dd1ab5b9383cd5b05f7e65d6f558869c01c8550ca0212aef4d6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    if len(s) != 2 or not all(c in '0123456789' for c in s):\n        return None\n    L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']\n    G = ['0100111', '0110011', '0011011', '0100001', '0011101', '0111001', '0000101', '0010001', '0001001', '0010111']\n    par = ['LL', 'LG', 'GL', 'GG'][int(s) % 4]\n    a = (L if par[0] == 'L' else G)[int(s[0])]\n    b = (L if par[1] == 'L' else G)[int(s[1])]\n    return '1011' + a + '01' + b\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['73', '10110111011010100001'], ['30', '10110100001010001101'], ['42', '10110011101010010011'], ['05', '10110001101010111001'], ['08', '10110001101010110111'], ['06', '10110100111010101111'], ['49', '10110100011010010111'], ['55', '10110111001010111001']], [['19', '10110110011010010111'], ['98', '10110010111010110111'], ['96', '10110001011010101111'], ['44', '10110100011010100011'], ['47', '10110011101010010001'], ['08', '10110001101010110111'], ['06', '10110100111010101111'], ['22', '10110011011010010011']], [['38', '10110100001010110111'], ['73', '10110111011010100001'], ['88', '10110110111010110111'], ['87', '10110001001010010001'], ['83', '10110001001010100001'], ['02', '10110100111010010011'], ['85', '10110110111010111001'], ['17', '10110011001010010001']], [['66', '10110000101010101111'], ['77', '10110111011010010001'], ['92', '10110001011010010011'], ['40', '10110100011010001101'], ['84', '10110110111010100011'], ['49', '10110100011010010111'], ['89', '10110110111010010111'], ['13', '10110011001010100001']], [['52', '10110110001010010011'], ['50', '10110111001010001101'], ['16', '10110011001010101111'], ['85', '10110110111010111001'], ['43', '10110011101010100001'], ['89', '10110110111010010111'], ['48', '10110100011010110111'], ['29', '10110010011010010111']]]\nlabels = [\"regression: parity selector value\", \"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-ean2-addon-parity-source","generated_at":"2026-09-29T14:49:47.025760+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":"Use the two-digit value modulo 4.","root_cause":"The parity index uses the sum of the digits instead of the two-digit value.","sha256":"52e32443eb32c617a13fe9852cb12bfeaa95071d927c030c6ae38491a24067e5","title":"EAN-2 parity is chosen from the digit sum · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.57,"exit_code":1,"observations":[{"actual":"10110010001010100001","check":"regression: parity selector value 0","expected":"10110111011010100001","passed":false},{"actual":"10110111101010001101","check":"repair trap 1","expected":"10110100001010001101","passed":false},{"actual":"10110011101010010011","check":"combined fault 2","expected":"10110011101010010011","passed":true},{"actual":"10110001101010111001","check":"control 3","expected":"10110001101010111001","passed":true},{"actual":"10110001101010110111","check":"control 4","expected":"10110001101010110111","passed":true},{"actual":"10110100111010101111","check":"boundary 5","expected":"10110100111010101111","passed":true},{"actual":"10110100011010010111","check":"boundary 6","expected":"10110100011010010111","passed":true},{"actual":"10110110001010111001","check":"control 7","expected":"10110111001010111001","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: parity selector value 0\", \"actual\": \"10110010001010100001\", \"expected\": \"10110111011010100001\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"10110111101010001101\", \"expected\": \"10110100001010001101\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"10110011101010010011\", \"expected\": \"10110011101010010011\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"10110001101010111001\", \"expected\": \"10110001101010111001\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"10110001101010110111\", \"expected\": \"10110001101010110111\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"10110100111010101111\", \"expected\": \"10110100111010101111\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"10110100011010010111\", \"expected\": \"10110100011010010111\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"10110110001010111001\", \"expected\": \"10110111001010111001\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.796,"exit_code":1,"observations":[{"actual":"10110010001010111101","check":"regression: parity selector value 0","expected":"10110111011010100001","passed":false},{"actual":"10110100001010100111","check":"repair trap 1","expected":"10110100001010001101","passed":false},{"actual":"10110011101010010011","check":"combined fault 2","expected":"10110011101010010011","passed":true},{"actual":"10110001101010111001","check":"control 3","expected":"10110001101010111001","passed":true},{"actual":"10110001101010110111","check":"control 4","expected":"10110001101010110111","passed":true},{"actual":"10110100111010101111","check":"boundary 5","expected":"10110100111010101111","passed":true},{"actual":"10110100011010010111","check":"boundary 6","expected":"10110100011010010111","passed":true},{"actual":"10110111001010110001","check":"control 7","expected":"10110111001010111001","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: parity selector value 0\", \"actual\": \"10110010001010111101\", \"expected\": \"10110111011010100001\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"10110100001010100111\", \"expected\": \"10110100001010001101\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"10110011101010010011\", \"expected\": \"10110011101010010011\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"10110001101010111001\", \"expected\": \"10110001101010111001\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"10110001101010110111\", \"expected\": \"10110001101010110111\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"10110100111010101111\", \"expected\": \"10110100111010101111\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"10110100011010010111\", \"expected\": \"10110100011010010111\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"10110111001010110001\", \"expected\": \"10110111001010111001\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.869,"exit_code":0,"observations":[{"actual":"10110111011010100001","check":"regression: parity selector value 0","expected":"10110111011010100001","passed":true},{"actual":"10110100001010001101","check":"repair trap 1","expected":"10110100001010001101","passed":true},{"actual":"10110011101010010011","check":"combined fault 2","expected":"10110011101010010011","passed":true},{"actual":"10110001101010111001","check":"control 3","expected":"10110001101010111001","passed":true},{"actual":"10110001101010110111","check":"control 4","expected":"10110001101010110111","passed":true},{"actual":"10110100111010101111","check":"boundary 5","expected":"10110100111010101111","passed":true},{"actual":"10110100011010010111","check":"boundary 6","expected":"10110100011010010111","passed":true},{"actual":"10110111001010111001","check":"control 7","expected":"10110111001010111001","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: parity selector value 0\", \"actual\": \"10110111011010100001\", \"expected\": \"10110111011010100001\", \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": \"10110100001010001101\", \"expected\": \"10110100001010001101\", \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": \"10110011101010010011\", \"expected\": \"10110011101010010011\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"10110001101010111001\", \"expected\": \"10110001101010111001\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"10110001101010110111\", \"expected\": \"10110001101010110111\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"10110100111010101111\", \"expected\": \"10110100111010101111\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"10110100011010010111\", \"expected\": \"10110100011010010111\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"10110111001010111001\", \"expected\": \"10110111001010111001\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}