{"abstract":"Symbols whose spaces are all narrow fail to decode with an ambiguity error.","category":"Barcode symbology encoding","checks":8,"contract":"Classify measured element widths of a two-width symbology scanline (bars at even indexes, spaces at odd) into N/W. Bars and spaces are classified separately because ink spread widens bars. Within a class, if max < 1.5 * min all elements are narrow; otherwise the threshold is (min + max) / 2, elements above it are wide, below it narrow, and an element exactly on it is {\"error\": \"ambiguous\", \"index\": i}.","contract_signature":"w","evaluation_group":"w2-barcode-symbology-encoding-scanline-width-classes","failed_approach":"Handling only exactly equal widths still misclassifies 3-and-4 unit noise as N and W.","family":"w2-barcode-symbology-encoding-scanline-width-classes-uniform-class","id":"FA-79771","implementations":{"attempt":{"sha256":"e7f7a531e24b2901be123f9e318835df184fa48ab6e4ac6b00dcecab617ac2f6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(w):\n    out = [''] * len(w)\n    for parity in (0, 1):\n        idx = list(range(parity, len(w), 2))\n        if not idx:\n            continue\n        vals = [w[i] for i in idx]\n        lo, hi = min(vals), max(vals)\n        if hi == lo:\n            for i in idx:\n                out[i] = 'N'\n            continue\n        t2 = lo + hi\n        for i in idx:\n            if w[i] * 2 == t2:\n                return {'error': 'ambiguous', 'index': i}\n            out[i] = 'W' if w[i] * 2 > t2 else 'N'\n    return ''.join(out)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[4, 4, 4, 4, 3, 3, 3, 3], 'NNNNNNNN'], [[4, 5, 5, 4, 4, 5], 'NNNNNN'], [[6, 8, 4, 3, 3, 8, 7], 'WWNNNWW'], [[2, 5, 2, 10, 9], 'NNNWW'], [[6, 2, 4, 2, 3, 5, 7], 'WNNNNWW'], [[7, 10, 3, 5, 8, 10], 'WWNNWW'], [[13, 2, 5, 1, 5, 2, 5], 'WWNNNWN'], [[6, 11, 6, 3, 6, 4, 6, 3, 5], 'NWNNNNNNN']], [[[3, 5, 11], 'NNW'], [[6, 3, 5, 2, 5, 9], 'NNNNNW'], [[5, 4, 10, 3, 10, 4], 'NNWNWN'], [[5, 2, 11, 2, 11, 6, 11, 2], 'NNWNWWWN'], [[3, 11, 2, 4, 6], 'NWNNW'], [[2, 6, 2, 3, 13, 6], 'NWNNWW'], [[8, 1, 8, 8, 6, 1, 6, 1, 5], 'WNWWNNNNN'], [[4, 2, 4, 2, 3, 2, 3, 9, 4], 'NNNNNNNWN']], [[[9, 3, 9, 4, 5], 'WNWNN'], [[4, 5, 4, 5, 3, 5], 'NNNNNN'], [[2, 12, 13, 12, 12, 13, 13], 'NNWNWNW'], [[3, 1, 7, 1, 3, 11, 3, 12], 'NNWNNWNW'], [[2, 9, 2, 4, 8, 9, 7, 10, 8], 'NWNNWWWWW'], [[8, 2, 9, 13, 4, 13], 'WNWWNW'], [[4, 6, 8, 5, 5, 2, 5, 5, 4], 'NWWWNNNWN'], [[12, 4, 4, 4], 'WNNN']], [[[13, 4, 5, 3, 12, 4, 6, 4, 6], 'WNNNWNNNN'], [[4, 3, 3], 'NNN'], [[12, 3, 3, 4, 2, 3, 3, 3, 12], 'WNNNNNNNW'], [[4, 2, 11, 6, 5, 6, 10], 'NNWWNWW'], [[3, 7, 10, 2, 4, 7], 'NWWNNW'], [[3, 6, 8, 4], 'NWWN'], [[14, 10, 3, 1], 'WWNN'], [[6, 1, 5, 1, 6], 'NNNNN']], [[[4, 5, 10], 'NNW'], [[4, 4, 3, 3, 3], 'NNNNN'], [[3, 3, 4, 4, 3, 4, 4, 4, 3], 'NNNNNNNNN'], [[3, 9, 9, 5, 4, 9], 'NWWNNW'], [[14, 12, 6, 2, 5], 'WWNNN'], [[13, 2, 5, 7], 'WNNW'], [[10, 3, 6, 12], 'WNNW'], [[8, 1, 6], 'NNN']]]\nlabels = [\"regression: all-narrow ratio guard\", \"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":"0c8d225a009c9010e7a98620fbd41c5baf99fb758b7b21fe8e4ca66e8add8411","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(w):\n    out = [''] * len(w)\n    for parity in (0, 1):\n        idx = list(range(parity, len(w), 2))\n        if not idx:\n            continue\n        vals = [w[i] for i in idx]\n        lo, hi = min(vals), max(vals)\n        if False:\n            for i in idx:\n                out[i] = 'N'\n            continue\n        t2 = lo + hi\n        for i in idx:\n            if w[i] * 2 == t2:\n                return {'error': 'ambiguous', 'index': i}\n            out[i] = 'W' if w[i] * 2 > t2 else 'N'\n    return ''.join(out)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[4, 4, 4, 4, 3, 3, 3, 3], 'NNNNNNNN'], [[4, 5, 5, 4, 4, 5], 'NNNNNN'], [[6, 8, 4, 3, 3, 8, 7], 'WWNNNWW'], [[2, 5, 2, 10, 9], 'NNNWW'], [[6, 2, 4, 2, 3, 5, 7], 'WNNNNWW'], [[7, 10, 3, 5, 8, 10], 'WWNNWW'], [[13, 2, 5, 1, 5, 2, 5], 'WWNNNWN'], [[6, 11, 6, 3, 6, 4, 6, 3, 5], 'NWNNNNNNN']], [[[3, 5, 11], 'NNW'], [[6, 3, 5, 2, 5, 9], 'NNNNNW'], [[5, 4, 10, 3, 10, 4], 'NNWNWN'], [[5, 2, 11, 2, 11, 6, 11, 2], 'NNWNWWWN'], [[3, 11, 2, 4, 6], 'NWNNW'], [[2, 6, 2, 3, 13, 6], 'NWNNWW'], [[8, 1, 8, 8, 6, 1, 6, 1, 5], 'WNWWNNNNN'], [[4, 2, 4, 2, 3, 2, 3, 9, 4], 'NNNNNNNWN']], [[[9, 3, 9, 4, 5], 'WNWNN'], [[4, 5, 4, 5, 3, 5], 'NNNNNN'], [[2, 12, 13, 12, 12, 13, 13], 'NNWNWNW'], [[3, 1, 7, 1, 3, 11, 3, 12], 'NNWNNWNW'], [[2, 9, 2, 4, 8, 9, 7, 10, 8], 'NWNNWWWWW'], [[8, 2, 9, 13, 4, 13], 'WNWWNW'], [[4, 6, 8, 5, 5, 2, 5, 5, 4], 'NWWWNNNWN'], [[12, 4, 4, 4], 'WNNN']], [[[13, 4, 5, 3, 12, 4, 6, 4, 6], 'WNNNWNNNN'], [[4, 3, 3], 'NNN'], [[12, 3, 3, 4, 2, 3, 3, 3, 12], 'WNNNNNNNW'], [[4, 2, 11, 6, 5, 6, 10], 'NNWWNWW'], [[3, 7, 10, 2, 4, 7], 'NWWNNW'], [[3, 6, 8, 4], 'NWWN'], [[14, 10, 3, 1], 'WWNN'], [[6, 1, 5, 1, 6], 'NNNNN']], [[[4, 5, 10], 'NNW'], [[4, 4, 3, 3, 3], 'NNNNN'], [[3, 3, 4, 4, 3, 4, 4, 4, 3], 'NNNNNNNNN'], [[3, 9, 9, 5, 4, 9], 'NWWNNW'], [[14, 12, 6, 2, 5], 'WWNNN'], [[13, 2, 5, 7], 'WNNW'], [[10, 3, 6, 12], 'WNNW'], [[8, 1, 6], 'NNN']]]\nlabels = [\"regression: all-narrow ratio guard\", \"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-scanline-width-classes-uniform-class","generated_at":"2026-09-29T14:49:47.602858+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":"Without the ratio guard a class of equal widths puts every element exactly on the threshold.","sha256":"4800f5526aaad10a1a48e57a090f986dcc65b9a87228e1d398c8cfff580265dd","title":"Uniform element widths are reported as ambiguous · 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.621,"exit_code":1,"observations":[{"actual":"WWWWNNNN","check":"regression: all-narrow ratio guard 0","expected":"NNNNNNNN","passed":false},{"actual":"NWWNNW","check":"repair trap 1","expected":"NNNNNN","passed":false},{"actual":"WWNNNWW","check":"combined fault 2","expected":"WWNNNWW","passed":true},{"actual":"NNNWW","check":"control 3","expected":"NNNWW","passed":true},{"actual":"WNNNNWW","check":"control 4","expected":"WNNNNWW","passed":true},{"actual":"WWNNWW","check":"boundary 5","expected":"WWNNWW","passed":true},{"actual":"WWNNNWN","check":"boundary 6","expected":"WWNNNWN","passed":true},{"actual":"WWWNWNWNN","check":"control 7","expected":"NWNNNNNNN","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: all-narrow ratio guard 0\", \"actual\": \"WWWWNNNN\", \"expected\": \"NNNNNNNN\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"NWWNNW\", \"expected\": \"NNNNNN\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"WWNNNWW\", \"expected\": \"WWNNNWW\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"NNNWW\", \"expected\": \"NNNWW\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"WNNNNWW\", \"expected\": \"WNNNNWW\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"WWNNWW\", \"expected\": \"WWNNWW\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"WWNNNWN\", \"expected\": \"WWNNNWN\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"WWWNWNWNN\", \"expected\": \"NWNNNNNNN\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.168,"exit_code":1,"observations":[{"actual":"WWWWNNNN","check":"regression: all-narrow ratio guard 0","expected":"NNNNNNNN","passed":false},{"actual":"NWWNNW","check":"repair trap 1","expected":"NNNNNN","passed":false},{"actual":"WWNNNWW","check":"combined fault 2","expected":"WWNNNWW","passed":true},{"actual":"NNNWW","check":"control 3","expected":"NNNWW","passed":true},{"actual":"WNNNNWW","check":"control 4","expected":"WNNNNWW","passed":true},{"actual":"WWNNWW","check":"boundary 5","expected":"WWNNWW","passed":true},{"actual":"WWNNNWN","check":"boundary 6","expected":"WWNNNWN","passed":true},{"actual":"WWWNWNWNN","check":"control 7","expected":"NWNNNNNNN","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: all-narrow ratio guard 0\", \"actual\": \"WWWWNNNN\", \"expected\": \"NNNNNNNN\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"NWWNNW\", \"expected\": \"NNNNNN\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"WWNNNWW\", \"expected\": \"WWNNNWW\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"NNNWW\", \"expected\": \"NNNWW\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"WNNNNWW\", \"expected\": \"WNNNNWW\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"WWNNWW\", \"expected\": \"WWNNWW\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"WWNNNWN\", \"expected\": \"WWNNNWN\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"WWWNWNWNN\", \"expected\": \"NWNNNNNNN\", \"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."}}