{"abstract":"Codes ending in compressed digit 2 expand into the wrong manufacturer number.","category":"Check-digit algorithms","checks":8,"contract":"Expand an 8-digit UPC-E (number system 0 or 1, six compressed digits m1..m6, check digit) to UPC-A. By m6: 0-2 -> m1 m2 m6 0000 m3 m4 m5; 3 -> m1 m2 m3 00000 m4 m5; 4 -> m1 m2 m3 m4 00000 m5; 5-9 -> m1..m5 0000 m6. The UPC-A check (weights 3,1 from the left over the 11 digits) must equal the given check digit; return the 12-digit UPC-A string, or None for malformed or mismatching input.","evaluation_group":"w2-check_digit_algorithms-upce-expand","failed_approach":"Extending the rule to 0-3 fixes 2 but steals the 3 case.","family":"w2-check_digit_algorithms-upce-expand-manufacturer-zero-rule","id":"FA-72651","implementations":{"attempt":{"sha256":"50cf48f35d37632604b5fce9c716d05271ecaa654f04ea032fc8f025c6112def","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    if len(s) != 8 or not s.isascii() or not s.isdigit() or s[0] not in '01':\n        return None\n    ns, m, chk = s[0], s[1:7], s[7]\n    last = m[5]\n    if last in '0123':\n        body = m[0:2] + last + '0000' + m[2:5]\n    elif last == '3':\n        body = m[0:3] + '00000' + m[3:5]\n    elif last == '4':\n        body = m[0:4] + '00000' + m[4]\n    else:\n        body = m[0:5] + '0000' + last\n    a = ns + body\n    total = sum(int(ch) * (3 if i % 2 == 0 else 1) for i, ch in enumerate(a))\n    check = (10 - total % 10) % 10\n    if str(check) != chk:\n        return None\n    return a + chk\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"13813703\"]', ['13813703'], '138000001373'], ['control [\"06109613\"]', ['06109613'], '061100000963'], ['control [\"10054749\"]', ['10054749'], '100540000079'], ['control [\"08190253\"]', ['08190253'], '081902000053']], [['regression [\"14586929\"]', ['14586929'], '145200008699'], ['regression [\"08548229\"]', ['08548229'], '085200004829'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"15067371\"]', ['15067371'], '150673000071'], ['control [\"00140485\"]', ['00140485'], '001404000085'], ['control [\"04896098\"]', ['04896098'], '048960000098'], ['control [\"14227004\"]', ['14227004'], '142000002704']], [['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"07813340\"]', ['07813340'], '078130000030'], ['control [\"16526754\"]', ['16526754'], '165267000054'], ['control [\"28109420\"]', ['28109420'], None], ['control [\"32492194\"]', ['32492194'], None]], [['regression [\"14586929\"]', ['14586929'], '145200008699'], ['regression [\"08548229\"]', ['08548229'], '085200004829'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"97987994\"]', ['97987994'], None], ['control [\"04252614\"]', ['04252614'], '042100005264'], ['control [\"01234565\"]', ['01234565'], '012345000065'], ['control [\"23456781\"]', ['23456781'], None]], [['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"0425261a\"]', ['0425261a'], None], ['control [\"04252615\"]', ['04252615'], None], ['control [\"12345670\"]', ['12345670'], '123456000070'], ['control [\"00000000\"]', ['00000000'], '000000000000']]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, 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":"5215ac04fcb557be29d086c2ad68998b2c64a6fcec3475eec87f12260750a36e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    if len(s) != 8 or not s.isascii() or not s.isdigit() or s[0] not in '01':\n        return None\n    ns, m, chk = s[0], s[1:7], s[7]\n    last = m[5]\n    if last in '01':\n        body = m[0:2] + last + '0000' + m[2:5]\n    elif last == '3':\n        body = m[0:3] + '00000' + m[3:5]\n    elif last == '4':\n        body = m[0:4] + '00000' + m[4]\n    else:\n        body = m[0:5] + '0000' + last\n    a = ns + body\n    total = sum(int(ch) * (3 if i % 2 == 0 else 1) for i, ch in enumerate(a))\n    check = (10 - total % 10) % 10\n    if str(check) != chk:\n        return None\n    return a + chk\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"13813703\"]', ['13813703'], '138000001373'], ['control [\"06109613\"]', ['06109613'], '061100000963'], ['control [\"10054749\"]', ['10054749'], '100540000079'], ['control [\"08190253\"]', ['08190253'], '081902000053']], [['regression [\"14586929\"]', ['14586929'], '145200008699'], ['regression [\"08548229\"]', ['08548229'], '085200004829'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"15067371\"]', ['15067371'], '150673000071'], ['control [\"00140485\"]', ['00140485'], '001404000085'], ['control [\"04896098\"]', ['04896098'], '048960000098'], ['control [\"14227004\"]', ['14227004'], '142000002704']], [['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"07813340\"]', ['07813340'], '078130000030'], ['control [\"16526754\"]', ['16526754'], '165267000054'], ['control [\"28109420\"]', ['28109420'], None], ['control [\"32492194\"]', ['32492194'], None]], [['regression [\"14586929\"]', ['14586929'], '145200008699'], ['regression [\"08548229\"]', ['08548229'], '085200004829'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"97987994\"]', ['97987994'], None], ['control [\"04252614\"]', ['04252614'], '042100005264'], ['control [\"01234565\"]', ['01234565'], '012345000065'], ['control [\"23456781\"]', ['23456781'], None]], [['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"0425261a\"]', ['0425261a'], None], ['control [\"04252615\"]', ['04252615'], None], ['control [\"12345670\"]', ['12345670'], '123456000070'], ['control [\"00000000\"]', ['00000000'], '000000000000']]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, 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":"cbff61943dc75cc55ed9318ddfd80bd4660f092cd4cdc3e6cdd836b278e27a6a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    if len(s) != 8 or not s.isascii() or not s.isdigit() or s[0] not in '01':\n        return None\n    ns, m, chk = s[0], s[1:7], s[7]\n    last = m[5]\n    if last in '012':\n        body = m[0:2] + last + '0000' + m[2:5]\n    elif last == '3':\n        body = m[0:3] + '00000' + m[3:5]\n    elif last == '4':\n        body = m[0:4] + '00000' + m[4]\n    else:\n        body = m[0:5] + '0000' + last\n    a = ns + body\n    total = sum(int(ch) * (3 if i % 2 == 0 else 1) for i, ch in enumerate(a))\n    check = (10 - total % 10) % 10\n    if str(check) != chk:\n        return None\n    return a + chk\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"13813703\"]', ['13813703'], '138000001373'], ['control [\"06109613\"]', ['06109613'], '061100000963'], ['control [\"10054749\"]', ['10054749'], '100540000079'], ['control [\"08190253\"]', ['08190253'], '081902000053']], [['regression [\"14586929\"]', ['14586929'], '145200008699'], ['regression [\"08548229\"]', ['08548229'], '085200004829'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"15067371\"]', ['15067371'], '150673000071'], ['control [\"00140485\"]', ['00140485'], '001404000085'], ['control [\"04896098\"]', ['04896098'], '048960000098'], ['control [\"14227004\"]', ['14227004'], '142000002704']], [['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"07813340\"]', ['07813340'], '078130000030'], ['control [\"16526754\"]', ['16526754'], '165267000054'], ['control [\"28109420\"]', ['28109420'], None], ['control [\"32492194\"]', ['32492194'], None]], [['regression [\"14586929\"]', ['14586929'], '145200008699'], ['regression [\"08548229\"]', ['08548229'], '085200004829'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"97987994\"]', ['97987994'], None], ['control [\"04252614\"]', ['04252614'], '042100005264'], ['control [\"01234565\"]', ['01234565'], '012345000065'], ['control [\"23456781\"]', ['23456781'], None]], [['regression [\"08548229\"]', ['08548229'], '085200004829'], ['regression [\"14586929\"]', ['14586929'], '145200008699'], ['partial-repair [\"03909633\"]', ['03909633'], '039000000963'], ['partial-repair [\"04793431\"]', ['04793431'], '047900000341'], ['control [\"0425261a\"]', ['0425261a'], None], ['control [\"04252615\"]', ['04252615'], None], ['control [\"12345670\"]', ['12345670'], '123456000070'], ['control [\"00000000\"]', ['00000000'], '000000000000']]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, 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 of the named scheme under the stated contract; not a certified validator. 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-check_digit_algorithms-upce-expand-manufacturer-zero-rule","generated_at":"2026-09-29T14:48:40.392440+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Point-of-sale systems normalise zero-suppressed UPC-E labels into UPC-A keys for price lookup.","repair":"Apply the m1 m2 m6 0000 m3 m4 m5 rule for m6 in 0, 1 and 2.","root_cause":"Only m6 in 0-1 uses the manufacturer rule; 2 falls through to the 5-9 rule.","sha256":"6bfcb7bef1c4855e43a4aa72373db2c5324c4b93d47a878d67b843991aac746e","title":"UPC-E expansion treats m6 = 2 as a product digit · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.597,"exit_code":1,"observations":[{"actual":"085200004829","check":"regression [\"08548229\"]","expected":"085200004829","passed":true},{"actual":"145200008699","check":"regression [\"14586929\"]","expected":"145200008699","passed":true},{"actual":null,"check":"partial-repair [\"03909633\"]","expected":"039000000963","passed":false},{"actual":null,"check":"partial-repair [\"04793431\"]","expected":"047900000341","passed":false},{"actual":"138000001373","check":"control [\"13813703\"]","expected":"138000001373","passed":true},{"actual":"061100000963","check":"control [\"06109613\"]","expected":"061100000963","passed":true},{"actual":"100540000079","check":"control [\"10054749\"]","expected":"100540000079","passed":true},{"actual":"081902000053","check":"control [\"08190253\"]","expected":"081902000053","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"08548229\\\"]\", \"actual\": \"085200004829\", \"expected\": \"085200004829\", \"passed\": true}, {\"check\": \"regression [\\\"14586929\\\"]\", \"actual\": \"145200008699\", \"expected\": \"145200008699\", \"passed\": true}, {\"check\": \"partial-repair [\\\"03909633\\\"]\", \"actual\": null, \"expected\": \"039000000963\", \"passed\": false}, {\"check\": \"partial-repair [\\\"04793431\\\"]\", \"actual\": null, \"expected\": \"047900000341\", \"passed\": false}, {\"check\": \"control [\\\"13813703\\\"]\", \"actual\": \"138000001373\", \"expected\": \"138000001373\", \"passed\": true}, {\"check\": \"control [\\\"06109613\\\"]\", \"actual\": \"061100000963\", \"expected\": \"061100000963\", \"passed\": true}, {\"check\": \"control [\\\"10054749\\\"]\", \"actual\": \"100540000079\", \"expected\": \"100540000079\", \"passed\": true}, {\"check\": \"control [\\\"08190253\\\"]\", \"actual\": \"081902000053\", \"expected\": \"081902000053\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.042,"exit_code":1,"observations":[{"actual":null,"check":"regression [\"08548229\"]","expected":"085200004829","passed":false},{"actual":null,"check":"regression [\"14586929\"]","expected":"145200008699","passed":false},{"actual":"039000000963","check":"partial-repair [\"03909633\"]","expected":"039000000963","passed":true},{"actual":"047900000341","check":"partial-repair [\"04793431\"]","expected":"047900000341","passed":true},{"actual":"138000001373","check":"control [\"13813703\"]","expected":"138000001373","passed":true},{"actual":"061100000963","check":"control [\"06109613\"]","expected":"061100000963","passed":true},{"actual":"100540000079","check":"control [\"10054749\"]","expected":"100540000079","passed":true},{"actual":"081902000053","check":"control [\"08190253\"]","expected":"081902000053","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"08548229\\\"]\", \"actual\": null, \"expected\": \"085200004829\", \"passed\": false}, {\"check\": \"regression [\\\"14586929\\\"]\", \"actual\": null, \"expected\": \"145200008699\", \"passed\": false}, {\"check\": \"partial-repair [\\\"03909633\\\"]\", \"actual\": \"039000000963\", \"expected\": \"039000000963\", \"passed\": true}, {\"check\": \"partial-repair [\\\"04793431\\\"]\", \"actual\": \"047900000341\", \"expected\": \"047900000341\", \"passed\": true}, {\"check\": \"control [\\\"13813703\\\"]\", \"actual\": \"138000001373\", \"expected\": \"138000001373\", \"passed\": true}, {\"check\": \"control [\\\"06109613\\\"]\", \"actual\": \"061100000963\", \"expected\": \"061100000963\", \"passed\": true}, {\"check\": \"control [\\\"10054749\\\"]\", \"actual\": \"100540000079\", \"expected\": \"100540000079\", \"passed\": true}, {\"check\": \"control [\\\"08190253\\\"]\", \"actual\": \"081902000053\", \"expected\": \"081902000053\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.073,"exit_code":0,"observations":[{"actual":"085200004829","check":"regression [\"08548229\"]","expected":"085200004829","passed":true},{"actual":"145200008699","check":"regression [\"14586929\"]","expected":"145200008699","passed":true},{"actual":"039000000963","check":"partial-repair [\"03909633\"]","expected":"039000000963","passed":true},{"actual":"047900000341","check":"partial-repair [\"04793431\"]","expected":"047900000341","passed":true},{"actual":"138000001373","check":"control [\"13813703\"]","expected":"138000001373","passed":true},{"actual":"061100000963","check":"control [\"06109613\"]","expected":"061100000963","passed":true},{"actual":"100540000079","check":"control [\"10054749\"]","expected":"100540000079","passed":true},{"actual":"081902000053","check":"control [\"08190253\"]","expected":"081902000053","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"08548229\\\"]\", \"actual\": \"085200004829\", \"expected\": \"085200004829\", \"passed\": true}, {\"check\": \"regression [\\\"14586929\\\"]\", \"actual\": \"145200008699\", \"expected\": \"145200008699\", \"passed\": true}, {\"check\": \"partial-repair [\\\"03909633\\\"]\", \"actual\": \"039000000963\", \"expected\": \"039000000963\", \"passed\": true}, {\"check\": \"partial-repair [\\\"04793431\\\"]\", \"actual\": \"047900000341\", \"expected\": \"047900000341\", \"passed\": true}, {\"check\": \"control [\\\"13813703\\\"]\", \"actual\": \"138000001373\", \"expected\": \"138000001373\", \"passed\": true}, {\"check\": \"control [\\\"06109613\\\"]\", \"actual\": \"061100000963\", \"expected\": \"061100000963\", \"passed\": true}, {\"check\": \"control [\\\"10054749\\\"]\", \"actual\": \"100540000079\", \"expected\": \"100540000079\", \"passed\": true}, {\"check\": \"control [\\\"08190253\\\"]\", \"actual\": \"081902000053\", \"expected\": \"081902000053\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}