{"abstract":"Symbols with padding fail strict verification because every randomised pad is off by one position.","category":"Barcode symbology encoding","checks":8,"contract":"Data Matrix ASCII encodation into `capacity` data codewords: two consecutive ASCII digits become 130 + their value; ASCII 0..127 becomes ord + 1; 128..255 becomes Upper Shift 235 then ord - 127; higher code points are unencodable. Too many codewords -> overflow. Padding: the first pad is 129; each later pad at 1-based position p is 129 + ((149 * p) mod 253) + 1, minus 254 if above 254.","evaluation_group":"w2-barcode-symbology-encoding-datamatrix-ascii","failed_approach":"Adding two overshoots the position.","family":"w2-barcode-symbology-encoding-datamatrix-ascii-pad-position","id":"FA-79801","implementations":{"attempt":{"sha256":"4a35bf72fb4a16c57b30b4c88b1b9c716191631005353787c345712da53f2064","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, capacity):\n    cw = []\n    i = 0\n    while i < len(text):\n        c = text[i]\n        if c in '0123456789' and i + 1 < len(text) and text[i + 1] in '0123456789':\n            cw.append(130 + int(text[i:i + 2]))\n            i += 2\n            continue\n        o = ord(c)\n        if o > 255:\n            return {'error': 'unencodable'}\n        if o > 127:\n            cw += [235, o - 127]\n        else:\n            cw.append(o + 1)\n        i += 1\n    if len(cw) > capacity:\n        return {'error': 'overflow'}\n    if len(cw) < capacity:\n        cw.append(129)\n    while len(cw) < capacity:\n        p = len(cw) + 2\n        v = 129 + ((149 * p) % 253) + 1\n        if v > 254:\n            v -= 254\n        cw.append(v)\n    return cw\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('', 6), [129, 175, 70, 220, 115, 11]], [('\\x80', 4), [235, 1, 129, 220]], [('0AB12', 3), {'error': 'overflow'}], [('ABé', 1), {'error': 'overflow'}], [('AB€€', 10), {'error': 'unencodable'}], [('ÿAB', 5), [235, 128, 66, 67, 129]], [(' ÿ5', 2), {'error': 'overflow'}], [('99x', 5), [229, 121, 129, 220, 115]]], [[('0', 9), [49, 129, 70, 220, 115, 11, 161, 56, 206]], [(' x99x', 10), [33, 121, 229, 121, 129, 11, 161, 56, 206, 101]], [('ABxx', 2), {'error': 'overflow'}], [(' AB', 4), [33, 66, 67, 129]], [('x€', 10), {'error': 'unencodable'}], [(' 125', 1), {'error': 'overflow'}], [('99€x', 6), {'error': 'unencodable'}], [('', 2), [129, 175]]], [[('', 4), [129, 175, 70, 220]], [('99ÿx\\x80', 11), [229, 235, 128, 121, 235, 1, 129, 56, 206, 101, 251]], [('éé', 3), {'error': 'overflow'}], [('é\\x80\\x80', 3), {'error': 'overflow'}], [('0', 2), [49, 129]], [('99é0', 5), [229, 235, 106, 49, 129]], [('€', 6), {'error': 'unencodable'}], [('x99AB', 11), [121, 229, 66, 67, 129, 11, 161, 56, 206, 101, 251]]], [[('0xÿ', 8), [49, 121, 235, 128, 129, 11, 161, 56]], [(' 12', 9), [33, 142, 129, 220, 115, 11, 161, 56, 206]], [('\\x8012x5', 1), {'error': 'overflow'}], [(' €ÿ\\x80', 5), {'error': 'unencodable'}], [('AB€x', 2), {'error': 'unencodable'}], [('€ ', 4), {'error': 'unencodable'}], [('\\x80x0', 5), [235, 1, 121, 49, 129]], [('', 6), [129, 175, 70, 220, 115, 11]]], [[('995', 11), [229, 54, 129, 220, 115, 11, 161, 56, 206, 101, 251]], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('599AB€', 8), {'error': 'unencodable'}], [('\\x80€ 0', 8), {'error': 'unencodable'}], [('AB\\x805AB', 8), [66, 67, 235, 1, 54, 66, 67, 129]], [('€99', 7), {'error': 'unencodable'}], [('€\\x80', 9), {'error': 'unencodable'}], [(' 12\\x80x', 7), [33, 142, 235, 1, 121, 129, 161]]]]\nlabels = [\"regression: pad randomisation position\", \"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":"015f757d907584cbe6092c6a71e0b06a2d861d434babc8f26b0ea48ed51049ea","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, capacity):\n    cw = []\n    i = 0\n    while i < len(text):\n        c = text[i]\n        if c in '0123456789' and i + 1 < len(text) and text[i + 1] in '0123456789':\n            cw.append(130 + int(text[i:i + 2]))\n            i += 2\n            continue\n        o = ord(c)\n        if o > 255:\n            return {'error': 'unencodable'}\n        if o > 127:\n            cw += [235, o - 127]\n        else:\n            cw.append(o + 1)\n        i += 1\n    if len(cw) > capacity:\n        return {'error': 'overflow'}\n    if len(cw) < capacity:\n        cw.append(129)\n    while len(cw) < capacity:\n        p = len(cw)\n        v = 129 + ((149 * p) % 253) + 1\n        if v > 254:\n            v -= 254\n        cw.append(v)\n    return cw\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('', 6), [129, 175, 70, 220, 115, 11]], [('\\x80', 4), [235, 1, 129, 220]], [('0AB12', 3), {'error': 'overflow'}], [('ABé', 1), {'error': 'overflow'}], [('AB€€', 10), {'error': 'unencodable'}], [('ÿAB', 5), [235, 128, 66, 67, 129]], [(' ÿ5', 2), {'error': 'overflow'}], [('99x', 5), [229, 121, 129, 220, 115]]], [[('0', 9), [49, 129, 70, 220, 115, 11, 161, 56, 206]], [(' x99x', 10), [33, 121, 229, 121, 129, 11, 161, 56, 206, 101]], [('ABxx', 2), {'error': 'overflow'}], [(' AB', 4), [33, 66, 67, 129]], [('x€', 10), {'error': 'unencodable'}], [(' 125', 1), {'error': 'overflow'}], [('99€x', 6), {'error': 'unencodable'}], [('', 2), [129, 175]]], [[('', 4), [129, 175, 70, 220]], [('99ÿx\\x80', 11), [229, 235, 128, 121, 235, 1, 129, 56, 206, 101, 251]], [('éé', 3), {'error': 'overflow'}], [('é\\x80\\x80', 3), {'error': 'overflow'}], [('0', 2), [49, 129]], [('99é0', 5), [229, 235, 106, 49, 129]], [('€', 6), {'error': 'unencodable'}], [('x99AB', 11), [121, 229, 66, 67, 129, 11, 161, 56, 206, 101, 251]]], [[('0xÿ', 8), [49, 121, 235, 128, 129, 11, 161, 56]], [(' 12', 9), [33, 142, 129, 220, 115, 11, 161, 56, 206]], [('\\x8012x5', 1), {'error': 'overflow'}], [(' €ÿ\\x80', 5), {'error': 'unencodable'}], [('AB€x', 2), {'error': 'unencodable'}], [('€ ', 4), {'error': 'unencodable'}], [('\\x80x0', 5), [235, 1, 121, 49, 129]], [('', 6), [129, 175, 70, 220, 115, 11]]], [[('995', 11), [229, 54, 129, 220, 115, 11, 161, 56, 206, 101, 251]], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('599AB€', 8), {'error': 'unencodable'}], [('\\x80€ 0', 8), {'error': 'unencodable'}], [('AB\\x805AB', 8), [66, 67, 235, 1, 54, 66, 67, 129]], [('€99', 7), {'error': 'unencodable'}], [('€\\x80', 9), {'error': 'unencodable'}], [(' 12\\x80x', 7), [33, 142, 235, 1, 121, 129, 161]]]]\nlabels = [\"regression: pad randomisation position\", \"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":"860e632bd13fce562794a8ef4e7120eb408685ec3665d7b9c57b77dcaee1dc3a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, capacity):\n    cw = []\n    i = 0\n    while i < len(text):\n        c = text[i]\n        if c in '0123456789' and i + 1 < len(text) and text[i + 1] in '0123456789':\n            cw.append(130 + int(text[i:i + 2]))\n            i += 2\n            continue\n        o = ord(c)\n        if o > 255:\n            return {'error': 'unencodable'}\n        if o > 127:\n            cw += [235, o - 127]\n        else:\n            cw.append(o + 1)\n        i += 1\n    if len(cw) > capacity:\n        return {'error': 'overflow'}\n    if len(cw) < capacity:\n        cw.append(129)\n    while len(cw) < capacity:\n        p = len(cw) + 1\n        v = 129 + ((149 * p) % 253) + 1\n        if v > 254:\n            v -= 254\n        cw.append(v)\n    return cw\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('', 6), [129, 175, 70, 220, 115, 11]], [('\\x80', 4), [235, 1, 129, 220]], [('0AB12', 3), {'error': 'overflow'}], [('ABé', 1), {'error': 'overflow'}], [('AB€€', 10), {'error': 'unencodable'}], [('ÿAB', 5), [235, 128, 66, 67, 129]], [(' ÿ5', 2), {'error': 'overflow'}], [('99x', 5), [229, 121, 129, 220, 115]]], [[('0', 9), [49, 129, 70, 220, 115, 11, 161, 56, 206]], [(' x99x', 10), [33, 121, 229, 121, 129, 11, 161, 56, 206, 101]], [('ABxx', 2), {'error': 'overflow'}], [(' AB', 4), [33, 66, 67, 129]], [('x€', 10), {'error': 'unencodable'}], [(' 125', 1), {'error': 'overflow'}], [('99€x', 6), {'error': 'unencodable'}], [('', 2), [129, 175]]], [[('', 4), [129, 175, 70, 220]], [('99ÿx\\x80', 11), [229, 235, 128, 121, 235, 1, 129, 56, 206, 101, 251]], [('éé', 3), {'error': 'overflow'}], [('é\\x80\\x80', 3), {'error': 'overflow'}], [('0', 2), [49, 129]], [('99é0', 5), [229, 235, 106, 49, 129]], [('€', 6), {'error': 'unencodable'}], [('x99AB', 11), [121, 229, 66, 67, 129, 11, 161, 56, 206, 101, 251]]], [[('0xÿ', 8), [49, 121, 235, 128, 129, 11, 161, 56]], [(' 12', 9), [33, 142, 129, 220, 115, 11, 161, 56, 206]], [('\\x8012x5', 1), {'error': 'overflow'}], [(' €ÿ\\x80', 5), {'error': 'unencodable'}], [('AB€x', 2), {'error': 'unencodable'}], [('€ ', 4), {'error': 'unencodable'}], [('\\x80x0', 5), [235, 1, 121, 49, 129]], [('', 6), [129, 175, 70, 220, 115, 11]]], [[('995', 11), [229, 54, 129, 220, 115, 11, 161, 56, 206, 101, 251]], [('', 11), [129, 175, 70, 220, 115, 11, 161, 56, 206, 101, 251]], [('599AB€', 8), {'error': 'unencodable'}], [('\\x80€ 0', 8), {'error': 'unencodable'}], [('AB\\x805AB', 8), [66, 67, 235, 1, 54, 66, 67, 129]], [('€99', 7), {'error': 'unencodable'}], [('€\\x80', 9), {'error': 'unencodable'}], [(' 12\\x80x', 7), [33, 142, 235, 1, 121, 129, 161]]]]\nlabels = [\"regression: pad randomisation position\", \"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-datamatrix-ascii-pad-position","generated_at":"2026-09-29T14:49:47.814865+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 1-based codeword position.","root_cause":"The 253-state randomiser is fed the zero-based index of the pad codeword.","sha256":"bf43effe4f6ca16b8c9f27856b75dbd3d703a0dd7d6d573a06d5dafc587a0341","title":"Pad randomisation uses a zero-based position · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.482,"exit_code":1,"observations":[{"actual":[129,70,220,115,11,161],"check":"regression: pad randomisation position 0","expected":[129,175,70,220,115,11],"passed":false},{"actual":[235,1,129,115],"check":"repair trap 1","expected":[235,1,129,220],"passed":false},{"actual":{"error":"overflow"},"check":"combined fault 2","expected":{"error":"overflow"},"passed":true},{"actual":{"error":"overflow"},"check":"control 3","expected":{"error":"overflow"},"passed":true},{"actual":{"error":"unencodable"},"check":"control 4","expected":{"error":"unencodable"},"passed":true},{"actual":[235,128,66,67,129],"check":"boundary 5","expected":[235,128,66,67,129],"passed":true},{"actual":{"error":"overflow"},"check":"boundary 6","expected":{"error":"overflow"},"passed":true},{"actual":[229,121,129,115,11],"check":"control 7","expected":[229,121,129,220,115],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: pad randomisation position 0\", \"actual\": [129, 70, 220, 115, 11, 161], \"expected\": [129, 175, 70, 220, 115, 11], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [235, 1, 129, 115], \"expected\": [235, 1, 129, 220], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"unencodable\"}, \"expected\": {\"error\": \"unencodable\"}, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [235, 128, 66, 67, 129], \"expected\": [235, 128, 66, 67, 129], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": [229, 121, 129, 115, 11], \"expected\": [229, 121, 129, 220, 115], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.798,"exit_code":1,"observations":[{"actual":[129,25,175,70,220,115],"check":"regression: pad randomisation position 0","expected":[129,175,70,220,115,11],"passed":false},{"actual":[235,1,129,70],"check":"repair trap 1","expected":[235,1,129,220],"passed":false},{"actual":{"error":"overflow"},"check":"combined fault 2","expected":{"error":"overflow"},"passed":true},{"actual":{"error":"overflow"},"check":"control 3","expected":{"error":"overflow"},"passed":true},{"actual":{"error":"unencodable"},"check":"control 4","expected":{"error":"unencodable"},"passed":true},{"actual":[235,128,66,67,129],"check":"boundary 5","expected":[235,128,66,67,129],"passed":true},{"actual":{"error":"overflow"},"check":"boundary 6","expected":{"error":"overflow"},"passed":true},{"actual":[229,121,129,70,220],"check":"control 7","expected":[229,121,129,220,115],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: pad randomisation position 0\", \"actual\": [129, 25, 175, 70, 220, 115], \"expected\": [129, 175, 70, 220, 115, 11], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [235, 1, 129, 70], \"expected\": [235, 1, 129, 220], \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"unencodable\"}, \"expected\": {\"error\": \"unencodable\"}, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [235, 128, 66, 67, 129], \"expected\": [235, 128, 66, 67, 129], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": [229, 121, 129, 70, 220], \"expected\": [229, 121, 129, 220, 115], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.265,"exit_code":0,"observations":[{"actual":[129,175,70,220,115,11],"check":"regression: pad randomisation position 0","expected":[129,175,70,220,115,11],"passed":true},{"actual":[235,1,129,220],"check":"repair trap 1","expected":[235,1,129,220],"passed":true},{"actual":{"error":"overflow"},"check":"combined fault 2","expected":{"error":"overflow"},"passed":true},{"actual":{"error":"overflow"},"check":"control 3","expected":{"error":"overflow"},"passed":true},{"actual":{"error":"unencodable"},"check":"control 4","expected":{"error":"unencodable"},"passed":true},{"actual":[235,128,66,67,129],"check":"boundary 5","expected":[235,128,66,67,129],"passed":true},{"actual":{"error":"overflow"},"check":"boundary 6","expected":{"error":"overflow"},"passed":true},{"actual":[229,121,129,220,115],"check":"control 7","expected":[229,121,129,220,115],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: pad randomisation position 0\", \"actual\": [129, 175, 70, 220, 115, 11], \"expected\": [129, 175, 70, 220, 115, 11], \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": [235, 1, 129, 220], \"expected\": [235, 1, 129, 220], \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"unencodable\"}, \"expected\": {\"error\": \"unencodable\"}, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [235, 128, 66, 67, 129], \"expected\": [235, 128, 66, 67, 129], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"overflow\"}, \"expected\": {\"error\": \"overflow\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": [229, 121, 129, 220, 115], \"expected\": [229, 121, 129, 220, 115], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}