{"abstract":"Codes ending in 4 collide with codes ending in 3.","category":"Barcode symbology encoding","checks":8,"contract":"Expand an 8-digit zero-suppressed UPC-E string (number system 0 or 1, six digits d1..d6, check digit passed through) into 12-digit UPC-A: d6 in 0-2 -> d1 d2 d6 0000 d3 d4 d5; d6 = 3 -> d1 d2 d3 00000 d4 d5; d6 = 4 -> d1 d2 d3 d4 00000 d5; d6 in 5-9 -> d1..d5 0000 d6. Invalid input returns None.","contract_signature":"e","evaluation_group":"w2-barcode-symbology-encoding-upce-expansion","failed_approach":"Appending a trailing zero shifts d5 out of the item reference position.","family":"w2-barcode-symbology-encoding-upce-expansion-rule-four","id":"FA-79381","implementations":{"attempt":{"sha256":"0940845e92a1764e3cf78fb40992b8e487160b17cbc4b55fe7d4dde984c6fd00","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(e):\n    if len(e) != 8 or not all(ch in '0123456789' for ch in e):\n        return None\n    ns, d, chk = e[0], e[1:7], e[7]\n    if ns not in ('0', '1'):\n        return None\n    last = d[5]\n    if last in '012':\n        body = d[0:2] + last + '0000' + d[2:5]\n    elif last == '3':\n        body = d[0:3] + '00000' + d[3:5]\n    elif last == '4':\n        body = d[0:4] + '0000' + d[4] + '0'\n    else:\n        body = d[0:5] + '0000' + last\n    return ns + body + chk\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['03495247', '034950000027'], ['06000842', '060000000082'], ['13586942', '135860000092'], ['25279409', None], ['04319958', '043199000058'], ['08023781', '080237000081'], ['16787022', '167200008702'], ['03832344', '038320000034']], [['01699444', '016990000044'], ['11536842', '115360000082'], ['06482006', '064000008206'], ['13115485', '131154000085'], ['28046301', None], ['15524099', '155240000099'], ['18039301', '180000003931'], ['02636740', '026360000070']], [['17043643', '170430000063'], ['03250241', '032500000021'], ['00007549', '000070000059'], ['19115135', '191100000515'], ['11882825', '118200008285'], ['21587198', None], ['01282734', '012800000274'], ['16023547', '160230000057']], [['00767246', '007670000026'], ['03161940', '031610000090'], ['08858661', '088586000061'], ['24707936', None], ['09720132', '097200000012'], ['06596582', '065965000082'], ['07319884', '073198000084'], ['00787643', '007870000063']], [['03581849', '035810000089'], ['17614340', '176140000030'], ['16789341', '167890000031'], ['08283998', '082839000098'], ['28773952', None], ['18771250', '187712000050'], ['13513558', '135135000058'], ['10079442', '100790000042']]]\nlabels = [\"regression: final digit 4 layout\", \"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":"1ad5cb063cb33efd9298d01f53fdfe6dc09fcb186a594002244751bec9ef7d94","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(e):\n    if len(e) != 8 or not all(ch in '0123456789' for ch in e):\n        return None\n    ns, d, chk = e[0], e[1:7], e[7]\n    if ns not in ('0', '1'):\n        return None\n    last = d[5]\n    if last in '012':\n        body = d[0:2] + last + '0000' + d[2:5]\n    elif last == '3':\n        body = d[0:3] + '00000' + d[3:5]\n    elif last == '4':\n        body = d[0:3] + '00000' + d[3:5]\n    else:\n        body = d[0:5] + '0000' + last\n    return ns + body + chk\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['03495247', '034950000027'], ['06000842', '060000000082'], ['13586942', '135860000092'], ['25279409', None], ['04319958', '043199000058'], ['08023781', '080237000081'], ['16787022', '167200008702'], ['03832344', '038320000034']], [['01699444', '016990000044'], ['11536842', '115360000082'], ['06482006', '064000008206'], ['13115485', '131154000085'], ['28046301', None], ['15524099', '155240000099'], ['18039301', '180000003931'], ['02636740', '026360000070']], [['17043643', '170430000063'], ['03250241', '032500000021'], ['00007549', '000070000059'], ['19115135', '191100000515'], ['11882825', '118200008285'], ['21587198', None], ['01282734', '012800000274'], ['16023547', '160230000057']], [['00767246', '007670000026'], ['03161940', '031610000090'], ['08858661', '088586000061'], ['24707936', None], ['09720132', '097200000012'], ['06596582', '065965000082'], ['07319884', '073198000084'], ['00787643', '007870000063']], [['03581849', '035810000089'], ['17614340', '176140000030'], ['16789341', '167890000031'], ['08283998', '082839000098'], ['28773952', None], ['18771250', '187712000050'], ['13513558', '135135000058'], ['10079442', '100790000042']]]\nlabels = [\"regression: final digit 4 layout\", \"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-upce-expansion-rule-four","generated_at":"2026-09-29T14:49:44.000479+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 d6 = 4 case copies the rule-3 layout.","sha256":"fba514364339b45fcbf4dac2d4a9d681715347572d4204cfbfdd52d4a072bd21","title":"UPC-E rule 4 uses the three-digit manufacturer layout · 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":42.015,"exit_code":1,"observations":[{"actual":"034950000207","check":"regression: final digit 4 layout 0","expected":"034950000027","passed":false},{"actual":"060000000802","check":"repair trap 1","expected":"060000000082","passed":false},{"actual":"135860000902","check":"combined fault 2","expected":"135860000092","passed":false},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":"043199000058","check":"control 4","expected":"043199000058","passed":true},{"actual":"080237000081","check":"boundary 5","expected":"080237000081","passed":true},{"actual":"167200008702","check":"boundary 6","expected":"167200008702","passed":true},{"actual":"038320000304","check":"control 7","expected":"038320000034","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: final digit 4 layout 0\", \"actual\": \"034950000207\", \"expected\": \"034950000027\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"060000000802\", \"expected\": \"060000000082\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"135860000902\", \"expected\": \"135860000092\", \"passed\": false}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"043199000058\", \"expected\": \"043199000058\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"080237000081\", \"expected\": \"080237000081\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"167200008702\", \"expected\": \"167200008702\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"038320000304\", \"expected\": \"038320000034\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.753,"exit_code":1,"observations":[{"actual":"034900000527","check":"regression: final digit 4 layout 0","expected":"034950000027","passed":false},{"actual":"060000000082","check":"repair trap 1","expected":"060000000082","passed":true},{"actual":"135800000692","check":"combined fault 2","expected":"135860000092","passed":false},{"actual":null,"check":"control 3","expected":null,"passed":true},{"actual":"043199000058","check":"control 4","expected":"043199000058","passed":true},{"actual":"080237000081","check":"boundary 5","expected":"080237000081","passed":true},{"actual":"167200008702","check":"boundary 6","expected":"167200008702","passed":true},{"actual":"038300000234","check":"control 7","expected":"038320000034","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: final digit 4 layout 0\", \"actual\": \"034900000527\", \"expected\": \"034950000027\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"060000000082\", \"expected\": \"060000000082\", \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": \"135800000692\", \"expected\": \"135860000092\", \"passed\": false}, {\"check\": \"control 3\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"043199000058\", \"expected\": \"043199000058\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"080237000081\", \"expected\": \"080237000081\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"167200008702\", \"expected\": \"167200008702\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"038300000234\", \"expected\": \"038320000034\", \"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."}}