{"abstract":"Heavily printed labels read every narrow bar as wide because ink spread shifts bars against spaces.","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}.","evaluation_group":"w2-barcode-symbology-encoding-scanline-width-classes","failed_approach":"Overlapping index ranges let the second pass reclassify bars with the space threshold.","family":"w2-barcode-symbology-encoding-scanline-width-classes-shared-threshold","id":"FA-79766","implementations":{"attempt":{"sha256":"b75057a726be7bc51ab8b2580c4467fd9e976f05740170496b7414889cfa0332","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)))\n        if not idx:\n            continue\n        vals = [w[i] for i in idx]\n        lo, hi = min(vals), max(vals)\n        if hi * 2 < lo * 3:\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 = [[[[5, 10, 6, 11, 8, 11, 6, 11], 'NNNNWNNN'], [[13, 4, 6], 'WNN'], [[13, 2, 5, 1, 5, 2, 5], 'WWNNNWN'], [[4, 4, 4, 4, 3, 3, 3, 3], 'NNNNNNNN'], [[6, 8, 4, 3, 3, 8, 7], 'WWNNNWW'], [[2, 5, 2, 10, 9], 'NNNWW'], [[6, 11, 6, 3, 6, 4, 6, 3, 5], 'NWNNNNNNN'], [[3, 10, 3, 11], 'NNNN']], [[[3, 11, 2, 4, 6], 'NWNNW'], [[4, 1, 7], 'NNW'], [[3, 5, 11], 'NNW'], [[4, 2, 4, 2, 3, 2, 3, 9, 4], 'NNNNNNNWN'], [[4, 3, 4, 4], 'NNNN'], [[13, 3, 13, 3, 13, 4, 2], 'WNWNWNN'], [[3, 4, 3, 3, 3, 3, 4], 'NNNNNNN'], [[6, 2, 7, 2, 6], 'NNNNN']], [[[2, 4], 'NN'], [[4, 5, 4, 5, 3, 5], 'NNNNNN'], [[2, 5, 3, 5, 2], 'NNWNN'], [[11, 4, 4, 4, 3, 10], 'WNNNNW'], [[9, 3, 9, 4, 5], 'WNWNN'], [[3, 1, 7, 1, 3, 11, 3, 12], 'NNWNNWNW'], [[3, 3, 9, 4, 3, 4, 2], 'NNWNNNN'], [[3, 4, 3, 6, 4, 6, 11, 5], {'error': 'ambiguous', 'index': 7}]], [[[13, 3], 'NN'], [[5, 2, 4, 2, 4, 2], 'NNNNNN'], [[2], 'N'], [[4], 'N'], [[14, 2, 14, 2, 4], 'WNWNN'], [[4, 2, 10, 11, 5, 2, 5, 12, 9], 'NNWWNNNWW'], [[4, 3, 3], 'NNN'], [[11, 1, 4, 2, 11, 1], 'WNNWWN']], [[[10, 2], 'NN'], [[11, 2, 11], 'NNN'], [[4, 5, 10], 'NNW'], [[3], 'N'], [[8], 'N'], [[4, 4, 3, 3, 3], 'NNNNN'], [[4, 4, 4, 3, 4, 3, 3, 3], 'NNNNNNNN'], [[8, 1, 6], 'NNN']]]\nlabels = [\"regression: separate bar and space thresholds\", \"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":"892123ef86d0ea7ddbe5b30ae8c039db296cd66c97808db29092e326bb7deeae","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,):\n        idx = list(range(len(w)))\n        if not idx:\n            continue\n        vals = [w[i] for i in idx]\n        lo, hi = min(vals), max(vals)\n        if hi * 2 < lo * 3:\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 = [[[[5, 10, 6, 11, 8, 11, 6, 11], 'NNNNWNNN'], [[13, 4, 6], 'WNN'], [[13, 2, 5, 1, 5, 2, 5], 'WWNNNWN'], [[4, 4, 4, 4, 3, 3, 3, 3], 'NNNNNNNN'], [[6, 8, 4, 3, 3, 8, 7], 'WWNNNWW'], [[2, 5, 2, 10, 9], 'NNNWW'], [[6, 11, 6, 3, 6, 4, 6, 3, 5], 'NWNNNNNNN'], [[3, 10, 3, 11], 'NNNN']], [[[3, 11, 2, 4, 6], 'NWNNW'], [[4, 1, 7], 'NNW'], [[3, 5, 11], 'NNW'], [[4, 2, 4, 2, 3, 2, 3, 9, 4], 'NNNNNNNWN'], [[4, 3, 4, 4], 'NNNN'], [[13, 3, 13, 3, 13, 4, 2], 'WNWNWNN'], [[3, 4, 3, 3, 3, 3, 4], 'NNNNNNN'], [[6, 2, 7, 2, 6], 'NNNNN']], [[[2, 4], 'NN'], [[4, 5, 4, 5, 3, 5], 'NNNNNN'], [[2, 5, 3, 5, 2], 'NNWNN'], [[11, 4, 4, 4, 3, 10], 'WNNNNW'], [[9, 3, 9, 4, 5], 'WNWNN'], [[3, 1, 7, 1, 3, 11, 3, 12], 'NNWNNWNW'], [[3, 3, 9, 4, 3, 4, 2], 'NNWNNNN'], [[3, 4, 3, 6, 4, 6, 11, 5], {'error': 'ambiguous', 'index': 7}]], [[[13, 3], 'NN'], [[5, 2, 4, 2, 4, 2], 'NNNNNN'], [[2], 'N'], [[4], 'N'], [[14, 2, 14, 2, 4], 'WNWNN'], [[4, 2, 10, 11, 5, 2, 5, 12, 9], 'NNWWNNNWW'], [[4, 3, 3], 'NNN'], [[11, 1, 4, 2, 11, 1], 'WNNWWN']], [[[10, 2], 'NN'], [[11, 2, 11], 'NNN'], [[4, 5, 10], 'NNW'], [[3], 'N'], [[8], 'N'], [[4, 4, 3, 3, 3], 'NNNNN'], [[4, 4, 4, 3, 4, 3, 3, 3], 'NNNNNNNN'], [[8, 1, 6], 'NNN']]]\nlabels = [\"regression: separate bar and space thresholds\", \"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":"d00aef575b344b48b4fd0b8ee76726f52e7d727fce146befe3fa02d50661f131","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 * 2 < lo * 3:\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 = [[[[5, 10, 6, 11, 8, 11, 6, 11], 'NNNNWNNN'], [[13, 4, 6], 'WNN'], [[13, 2, 5, 1, 5, 2, 5], 'WWNNNWN'], [[4, 4, 4, 4, 3, 3, 3, 3], 'NNNNNNNN'], [[6, 8, 4, 3, 3, 8, 7], 'WWNNNWW'], [[2, 5, 2, 10, 9], 'NNNWW'], [[6, 11, 6, 3, 6, 4, 6, 3, 5], 'NWNNNNNNN'], [[3, 10, 3, 11], 'NNNN']], [[[3, 11, 2, 4, 6], 'NWNNW'], [[4, 1, 7], 'NNW'], [[3, 5, 11], 'NNW'], [[4, 2, 4, 2, 3, 2, 3, 9, 4], 'NNNNNNNWN'], [[4, 3, 4, 4], 'NNNN'], [[13, 3, 13, 3, 13, 4, 2], 'WNWNWNN'], [[3, 4, 3, 3, 3, 3, 4], 'NNNNNNN'], [[6, 2, 7, 2, 6], 'NNNNN']], [[[2, 4], 'NN'], [[4, 5, 4, 5, 3, 5], 'NNNNNN'], [[2, 5, 3, 5, 2], 'NNWNN'], [[11, 4, 4, 4, 3, 10], 'WNNNNW'], [[9, 3, 9, 4, 5], 'WNWNN'], [[3, 1, 7, 1, 3, 11, 3, 12], 'NNWNNWNW'], [[3, 3, 9, 4, 3, 4, 2], 'NNWNNNN'], [[3, 4, 3, 6, 4, 6, 11, 5], {'error': 'ambiguous', 'index': 7}]], [[[13, 3], 'NN'], [[5, 2, 4, 2, 4, 2], 'NNNNNN'], [[2], 'N'], [[4], 'N'], [[14, 2, 14, 2, 4], 'WNWNN'], [[4, 2, 10, 11, 5, 2, 5, 12, 9], 'NNWWNNNWW'], [[4, 3, 3], 'NNN'], [[11, 1, 4, 2, 11, 1], 'WNNWWN']], [[[10, 2], 'NN'], [[11, 2, 11], 'NNN'], [[4, 5, 10], 'NNW'], [[3], 'N'], [[8], 'N'], [[4, 4, 3, 3, 3], 'NNNNN'], [[4, 4, 4, 3, 4, 3, 3, 3], 'NNNNNNNN'], [[8, 1, 6], 'NNN']]]\nlabels = [\"regression: separate bar and space thresholds\", \"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-shared-threshold","generated_at":"2026-09-29T14:49:47.563252+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":"Compute separate thresholds for bars (even) and spaces (odd).","root_cause":"All elements are classified against a single threshold.","sha256":"c0154da785ea16f88888b4e3b2108eff5967517192f0c96742824460ca8cdc3d","title":"Bars and spaces share one width threshold · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":37.323,"exit_code":1,"observations":[{"actual":{"error":"ambiguous","index":4},"check":"regression: separate bar and space thresholds 0","expected":"NNNNWNNN","passed":false},{"actual":"WNW","check":"repair trap 1","expected":"WNN","passed":false},{"actual":"WNWNWNW","check":"combined fault 2","expected":"WWNNNWN","passed":false},{"actual":"NNNNNNNN","check":"control 3","expected":"NNNNNNNN","passed":true},{"actual":"WWNNNWW","check":"control 4","expected":"WWNNNWW","passed":true},{"actual":"NNNWW","check":"boundary 5","expected":"NNNWW","passed":true},{"actual":"NWNNNNNNN","check":"boundary 6","expected":"NWNNNNNNN","passed":true},{"actual":"NWNW","check":"control 7","expected":"NNNN","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: separate bar and space thresholds 0\", \"actual\": {\"error\": \"ambiguous\", \"index\": 4}, \"expected\": \"NNNNWNNN\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"WNW\", \"expected\": \"WNN\", \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"WNWNWNW\", \"expected\": \"WWNNNWN\", \"passed\": false}, {\"check\": \"control 3\", \"actual\": \"NNNNNNNN\", \"expected\": \"NNNNNNNN\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"WWNNNWW\", \"expected\": \"WWNNNWW\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"NNNWW\", \"expected\": \"NNNWW\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"NWNNNNNNN\", \"expected\": \"NWNNNNNNN\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"NWNW\", \"expected\": \"NNNN\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.371,"exit_code":1,"observations":[{"actual":{"error":"ambiguous","index":4},"check":"regression: separate bar and space thresholds 0","expected":"NNNNWNNN","passed":false},{"actual":"WNN","check":"repair trap 1","expected":"WNN","passed":true},{"actual":"WNNNNNN","check":"combined fault 2","expected":"WWNNNWN","passed":false},{"actual":"NNNNNNNN","check":"control 3","expected":"NNNNNNNN","passed":true},{"actual":"WWNNNWW","check":"control 4","expected":"WWNNNWW","passed":true},{"actual":"NNNWW","check":"boundary 5","expected":"NNNWW","passed":true},{"actual":"NWNNNNNNN","check":"boundary 6","expected":"NWNNNNNNN","passed":true},{"actual":"NWNW","check":"control 7","expected":"NNNN","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: separate bar and space thresholds 0\", \"actual\": {\"error\": \"ambiguous\", \"index\": 4}, \"expected\": \"NNNNWNNN\", \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": \"WNN\", \"expected\": \"WNN\", \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": \"WNNNNNN\", \"expected\": \"WWNNNWN\", \"passed\": false}, {\"check\": \"control 3\", \"actual\": \"NNNNNNNN\", \"expected\": \"NNNNNNNN\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"WWNNNWW\", \"expected\": \"WWNNNWW\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"NNNWW\", \"expected\": \"NNNWW\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"NWNNNNNNN\", \"expected\": \"NWNNNNNNN\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"NWNW\", \"expected\": \"NNNN\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.594,"exit_code":0,"observations":[{"actual":"NNNNWNNN","check":"regression: separate bar and space thresholds 0","expected":"NNNNWNNN","passed":true},{"actual":"WNN","check":"repair trap 1","expected":"WNN","passed":true},{"actual":"WWNNNWN","check":"combined fault 2","expected":"WWNNNWN","passed":true},{"actual":"NNNNNNNN","check":"control 3","expected":"NNNNNNNN","passed":true},{"actual":"WWNNNWW","check":"control 4","expected":"WWNNNWW","passed":true},{"actual":"NNNWW","check":"boundary 5","expected":"NNNWW","passed":true},{"actual":"NWNNNNNNN","check":"boundary 6","expected":"NWNNNNNNN","passed":true},{"actual":"NNNN","check":"control 7","expected":"NNNN","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: separate bar and space thresholds 0\", \"actual\": \"NNNNWNNN\", \"expected\": \"NNNNWNNN\", \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": \"WNN\", \"expected\": \"WNN\", \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": \"WWNNNWN\", \"expected\": \"WWNNNWN\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"NNNNNNNN\", \"expected\": \"NNNNNNNN\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": \"WWNNNWW\", \"expected\": \"WWNNNWW\", \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": \"NNNWW\", \"expected\": \"NNNWW\", \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": \"NWNNNNNNN\", \"expected\": \"NWNNNNNNN\", \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"NNNN\", \"expected\": \"NNNN\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}