{"abstract":"The encoder moves to a larger version for payloads that fit exactly.","category":"Barcode symbology encoding","checks":8,"contract":"Finish a QR data bit stream for a symbol with `capacity` data codewords: data longer than capacity*8 bits returns None; append a terminator of up to four 0 bits (truncated if capacity is reached), pad with 0 bits to a byte boundary, split into codewords, then append pad codewords alternating 0xEC, 0x11 starting with 0xEC until the capacity is filled.","contract_signature":"bits, capacity","evaluation_group":"w2-barcode-symbology-encoding-qr-terminator-padding","failed_approach":"Allowing four extra bits accepts data that does not fit.","family":"w2-barcode-symbology-encoding-qr-terminator-padding-exact-fit","id":"FA-79706","implementations":{"attempt":{"sha256":"2f58e4f40fca10bd59d85accb87d5cf33418b48ff6da3d58b875861fa89d7d22","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(bits, capacity):\n    cap = capacity * 8\n    if len(bits) > cap + 4:\n        return None\n    bits += '0' * min(4, cap - len(bits))\n    bits += '0' * (-len(bits) % 8)\n    words = [int(bits[i:i + 8], 2) for i in range(0, len(bits), 8)]\n    pads = [0xEC, 0x11]\n    k = 0\n    while len(words) < capacity:\n        words.append(pads[k % 2])\n        k += 1\n    return words\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('10111110000100110101101101110110', 4), [190, 19, 91, 118]], [('101011111101111010101001010011000', 4), None], [('11110', 1), [240]], [('010010001010011000110010101000', 4), [72, 166, 50, 160]], [('0101100111101', 2), [89, 232]], [('011111010101101111101000', 5), [125, 91, 232, 0, 236]], [('1110001010001010000011000101110', 4), [226, 138, 12, 92]], [('01110101', 1), [117]]], [[('0000010010000100111101000110000101110011', 5), [4, 132, 244, 97, 115]], [('00101010101111110010011110110010011100110', 5), None], [('1110011111000110', 7), [231, 198, 0, 236, 17, 236, 17]], [('010111100111111111101011010111010101', 6), [94, 127, 235, 93, 80, 236]], [('000100', 1), [16]], [('0110001100001', 2), [99, 8]], [('110000', 1), [192]], [('10100100000101111100100011011110', 4), [164, 23, 200, 222]]], [[('1001111000111101000111101011000010011100', 5), [158, 61, 30, 176, 156]], [('1100011111010101100100001111010111100110101001110', 6), None], [('00111000', 6), [56, 0, 236, 17, 236, 17]], [('', 5), [0, 236, 17, 236, 17]], [('1011011', 1), [182]], [('011000110111001010011001100110101001', 5), [99, 114, 153, 154, 144]], [('0101101001011000000111111001001110110111010010101000', 7), [90, 88, 31, 147, 183, 74, 128]], [('1001101000011101000000110011010010100101', 5), [154, 29, 3, 52, 165]]], [[('00010010010101111101101100010011101101001111010110100000', 7), [18, 87, 219, 19, 180, 245, 160]], [('10001101000010011', 2), None], [('01000011', 2), [67, 0]], [('10110010', 2), [178, 0]], [('111110101001011001000', 3), [250, 150, 64]], [('10110101101011111001101001000', 4), [181, 175, 154, 64]], [('0011001110001010', 6), [51, 138, 0, 236, 17, 236]], [('01110011101100110010100111000111100111011111110101101110', 7), [115, 179, 41, 199, 157, 253, 110]]], [[('111100010111101010011001', 3), [241, 122, 153]], [('100010101011001101000110110111110', 4), None], [('100100000001111010001', 3), [144, 30, 136]], [('10101100011011111011000010111001110101111010010011011', 7), [172, 111, 176, 185, 215, 164, 216]], [('0100011110111010010001', 5), [71, 186, 68, 0, 236]], [('1011000001110101001101010100', 6), [176, 117, 53, 64, 236, 17]], [('1011110011011110010111001100011010', 5), [188, 222, 92, 198, 128]], [('1001000010101110001111000110111010001110', 5), [144, 174, 60, 110, 142]]]]\nlabels = [\"regression: exactly full data\", \"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":"e6f37a0abe188d6affdc12f9d51c5c11ca1ec1e3f44cd991a82a5db65c8b9b46","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(bits, capacity):\n    cap = capacity * 8\n    if len(bits) >= cap:\n        return None\n    bits += '0' * min(4, cap - len(bits))\n    bits += '0' * (-len(bits) % 8)\n    words = [int(bits[i:i + 8], 2) for i in range(0, len(bits), 8)]\n    pads = [0xEC, 0x11]\n    k = 0\n    while len(words) < capacity:\n        words.append(pads[k % 2])\n        k += 1\n    return words\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('10111110000100110101101101110110', 4), [190, 19, 91, 118]], [('101011111101111010101001010011000', 4), None], [('11110', 1), [240]], [('010010001010011000110010101000', 4), [72, 166, 50, 160]], [('0101100111101', 2), [89, 232]], [('011111010101101111101000', 5), [125, 91, 232, 0, 236]], [('1110001010001010000011000101110', 4), [226, 138, 12, 92]], [('01110101', 1), [117]]], [[('0000010010000100111101000110000101110011', 5), [4, 132, 244, 97, 115]], [('00101010101111110010011110110010011100110', 5), None], [('1110011111000110', 7), [231, 198, 0, 236, 17, 236, 17]], [('010111100111111111101011010111010101', 6), [94, 127, 235, 93, 80, 236]], [('000100', 1), [16]], [('0110001100001', 2), [99, 8]], [('110000', 1), [192]], [('10100100000101111100100011011110', 4), [164, 23, 200, 222]]], [[('1001111000111101000111101011000010011100', 5), [158, 61, 30, 176, 156]], [('1100011111010101100100001111010111100110101001110', 6), None], [('00111000', 6), [56, 0, 236, 17, 236, 17]], [('', 5), [0, 236, 17, 236, 17]], [('1011011', 1), [182]], [('011000110111001010011001100110101001', 5), [99, 114, 153, 154, 144]], [('0101101001011000000111111001001110110111010010101000', 7), [90, 88, 31, 147, 183, 74, 128]], [('1001101000011101000000110011010010100101', 5), [154, 29, 3, 52, 165]]], [[('00010010010101111101101100010011101101001111010110100000', 7), [18, 87, 219, 19, 180, 245, 160]], [('10001101000010011', 2), None], [('01000011', 2), [67, 0]], [('10110010', 2), [178, 0]], [('111110101001011001000', 3), [250, 150, 64]], [('10110101101011111001101001000', 4), [181, 175, 154, 64]], [('0011001110001010', 6), [51, 138, 0, 236, 17, 236]], [('01110011101100110010100111000111100111011111110101101110', 7), [115, 179, 41, 199, 157, 253, 110]]], [[('111100010111101010011001', 3), [241, 122, 153]], [('100010101011001101000110110111110', 4), None], [('100100000001111010001', 3), [144, 30, 136]], [('10101100011011111011000010111001110101111010010011011', 7), [172, 111, 176, 185, 215, 164, 216]], [('0100011110111010010001', 5), [71, 186, 68, 0, 236]], [('1011000001110101001101010100', 6), [176, 117, 53, 64, 236, 17]], [('1011110011011110010111001100011010', 5), [188, 222, 92, 198, 128]], [('1001000010101110001111000110111010001110', 5), [144, 174, 60, 110, 142]]]]\nlabels = [\"regression: exactly full data\", \"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-qr-terminator-padding-exact-fit","generated_at":"2026-09-29T14:49:46.985190+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 overflow test rejects data equal to the capacity.","sha256":"1a7435822987301dc054531dead5fa6cced7652c61755253ad6e5646f0c27f9a","title":"Data that exactly fills the symbol is rejected · 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":41.237,"exit_code":1,"observations":[{"actual":[190,19,91,118],"check":"regression: exactly full data 0","expected":[190,19,91,118],"passed":true},{"actual":[175,222,169,76,0],"check":"repair trap 1","expected":null,"passed":false},{"actual":[240],"check":"combined fault 2","expected":[240],"passed":true},{"actual":[72,166,50,160],"check":"control 3","expected":[72,166,50,160],"passed":true},{"actual":[89,232],"check":"control 4","expected":[89,232],"passed":true},{"actual":[125,91,232,0,236],"check":"boundary 5","expected":[125,91,232,0,236],"passed":true},{"actual":[226,138,12,92],"check":"boundary 6","expected":[226,138,12,92],"passed":true},{"actual":[117],"check":"control 7","expected":[117],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: exactly full data 0\", \"actual\": [190, 19, 91, 118], \"expected\": [190, 19, 91, 118], \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": [175, 222, 169, 76, 0], \"expected\": null, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": [240], \"expected\": [240], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [72, 166, 50, 160], \"expected\": [72, 166, 50, 160], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [89, 232], \"expected\": [89, 232], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [125, 91, 232, 0, 236], \"expected\": [125, 91, 232, 0, 236], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [226, 138, 12, 92], \"expected\": [226, 138, 12, 92], \"passed\": true}, {\"check\": \"control 7\", \"actual\": [117], \"expected\": [117], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.497,"exit_code":1,"observations":[{"actual":null,"check":"regression: exactly full data 0","expected":[190,19,91,118],"passed":false},{"actual":null,"check":"repair trap 1","expected":null,"passed":true},{"actual":[240],"check":"combined fault 2","expected":[240],"passed":true},{"actual":[72,166,50,160],"check":"control 3","expected":[72,166,50,160],"passed":true},{"actual":[89,232],"check":"control 4","expected":[89,232],"passed":true},{"actual":[125,91,232,0,236],"check":"boundary 5","expected":[125,91,232,0,236],"passed":true},{"actual":[226,138,12,92],"check":"boundary 6","expected":[226,138,12,92],"passed":true},{"actual":null,"check":"control 7","expected":[117],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: exactly full data 0\", \"actual\": null, \"expected\": [190, 19, 91, 118], \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": [240], \"expected\": [240], \"passed\": true}, {\"check\": \"control 3\", \"actual\": [72, 166, 50, 160], \"expected\": [72, 166, 50, 160], \"passed\": true}, {\"check\": \"control 4\", \"actual\": [89, 232], \"expected\": [89, 232], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": [125, 91, 232, 0, 236], \"expected\": [125, 91, 232, 0, 236], \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": [226, 138, 12, 92], \"expected\": [226, 138, 12, 92], \"passed\": true}, {\"check\": \"control 7\", \"actual\": null, \"expected\": [117], \"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."}}