{"abstract":"Lowercase URLs are sized as alphanumeric but the encoder has no values for them.","category":"Barcode symbology encoding","checks":8,"contract":"Compute the length in bits of one QR segment: 4-bit mode indicator, a character count indicator whose width depends on mode and version band (1-9, 10-26, 27-40): numeric 10/12/14, alphanumeric 9/11/13, byte 8/16/16, and the data bits: numeric 10 bits per 3 digits plus 4 or 7 for a remainder of 1 or 2, alphanumeric 11 bits per pair plus 6 for a single, byte 8 bits per UTF-8 byte. Alphanumeric allows 0-9 A-Z space $ % * + - . / :. A count that does not fit the indicator is too-long. Errors: version, charset, mode, too-long.","contract_signature":"mode, data, version","evaluation_group":"w2-barcode-symbology-encoding-qr-segment-bits","failed_approach":"isalnum accepts lowercase and non-ASCII letters.","family":"w2-barcode-symbology-encoding-qr-segment-bits-alnum-charset","id":"FA-79656","implementations":{"attempt":{"sha256":"59e26d260fce20150b7b6e30430ac6006dbb9bae4fbe2889536951b52145bd7f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(mode, data, version):\n    if not 1 <= version <= 40:\n        return {'error': 'version'}\n    band = 0 if version <= 9 else (1 if version <= 26 else 2)\n    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'\n    if mode == 'numeric':\n        if not all(c in '0123456789' for c in data):\n            return {'error': 'charset'}\n        count = len(data)\n        bits = 10 * (count // 3) + [0, 4, 7][count % 3]\n        cci = [10, 12, 14][band]\n    elif mode == 'alnum':\n        if not all(c.isalnum() or c in ' $%*+-./:' for c in data):\n            return {'error': 'charset'}\n        count = len(data)\n        bits = 11 * (count // 2) + 6 * (count % 2)\n        cci = [9, 11, 13][band]\n    elif mode == 'byte':\n        count = len(data.encode('utf-8'))\n        bits = 8 * count\n        cci = [8, 16, 16][band]\n    else:\n        return {'error': 'mode'}\n    if count >= 1 << cci:\n        return {'error': 'too-long'}\n    return 4 + cci + bits\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('alnum', '1+$q2*', 40), {'error': 'charset'}], [('alnum', 'ééA- q', 9), {'error': 'charset'}], [('alnum', 'q .B2%*', 5), {'error': 'charset'}], [('alnum', '-/$é+/%é+', 0), {'error': 'version'}], [('alnum', '-', 1), 19], [('alnum', '%', 1), 19], [('byte', '1€11€é', 40), 108], [('alnum', '/q', 9), {'error': 'charset'}]], [[('alnum', ' Aq%:.', 27), {'error': 'charset'}], [('alnum', '++$:é1*.+', 10), {'error': 'charset'}], [('alnum', '-:q2*-q', 15), {'error': 'charset'}], [('numeric', '053142', 0), {'error': 'version'}], [('numeric', '089405', 10), 36], [('kanji', 'b1ab11', 5), {'error': 'mode'}], [('alnum', '+qB+', 0), {'error': 'version'}], [('alnum', 'Aq ', 5), {'error': 'charset'}]], [[('alnum', 'BA qq/', 1), {'error': 'charset'}], [('alnum', ': q', 15), {'error': 'charset'}], [('alnum', 'ZZq', 1), {'error': 'charset'}], [('numeric', '00575', 9), 31], [('numeric', '37219', 5), 31], [('numeric', '', 40), 18], [('numeric', '716925614701', 5), 54], [('alnum', '*Zq$', 40), {'error': 'charset'}]], [[('alnum', 'B+ +q+B', 26), {'error': 'charset'}], [('alnum', 'B2q*.é.2-', 15), {'error': 'charset'}], [('alnum', '1ZqA-', 1), {'error': 'charset'}], [('byte', 'abbbaaa', 26), 76], [('byte', '€', 41), {'error': 'version'}], [('numeric', '', 0), {'error': 'version'}], [('numeric', '2', 1), 18], [('alnum', 'A+*+Zq1B.', 26), {'error': 'charset'}]], [[('alnum', 'q1 :B.-', 1), {'error': 'charset'}], [('alnum', 'q*/q-é', 9), {'error': 'charset'}], [('alnum', '*/Zq1 %B', 10), {'error': 'charset'}], [('kanji', 'é ba', 40), {'error': 'mode'}], [('kanji', 'éb', 1), {'error': 'mode'}], [('byte', 'a€', 26), 52], [('alnum', '.', 5), 19], [('alnum', '.1q', 5), {'error': 'charset'}]]]\nlabels = [\"regression: alphanumeric character set\", \"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":"973afdb1a448a3c257241a50591eec7557ce9ed3ce1c750fbbcc61bf9b7bb3cd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(mode, data, version):\n    if not 1 <= version <= 40:\n        return {'error': 'version'}\n    band = 0 if version <= 9 else (1 if version <= 26 else 2)\n    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'\n    if mode == 'numeric':\n        if not all(c in '0123456789' for c in data):\n            return {'error': 'charset'}\n        count = len(data)\n        bits = 10 * (count // 3) + [0, 4, 7][count % 3]\n        cci = [10, 12, 14][band]\n    elif mode == 'alnum':\n        if not all(c.upper() in ALNUM for c in data):\n            return {'error': 'charset'}\n        count = len(data)\n        bits = 11 * (count // 2) + 6 * (count % 2)\n        cci = [9, 11, 13][band]\n    elif mode == 'byte':\n        count = len(data.encode('utf-8'))\n        bits = 8 * count\n        cci = [8, 16, 16][band]\n    else:\n        return {'error': 'mode'}\n    if count >= 1 << cci:\n        return {'error': 'too-long'}\n    return 4 + cci + bits\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[('alnum', '1+$q2*', 40), {'error': 'charset'}], [('alnum', 'ééA- q', 9), {'error': 'charset'}], [('alnum', 'q .B2%*', 5), {'error': 'charset'}], [('alnum', '-/$é+/%é+', 0), {'error': 'version'}], [('alnum', '-', 1), 19], [('alnum', '%', 1), 19], [('byte', '1€11€é', 40), 108], [('alnum', '/q', 9), {'error': 'charset'}]], [[('alnum', ' Aq%:.', 27), {'error': 'charset'}], [('alnum', '++$:é1*.+', 10), {'error': 'charset'}], [('alnum', '-:q2*-q', 15), {'error': 'charset'}], [('numeric', '053142', 0), {'error': 'version'}], [('numeric', '089405', 10), 36], [('kanji', 'b1ab11', 5), {'error': 'mode'}], [('alnum', '+qB+', 0), {'error': 'version'}], [('alnum', 'Aq ', 5), {'error': 'charset'}]], [[('alnum', 'BA qq/', 1), {'error': 'charset'}], [('alnum', ': q', 15), {'error': 'charset'}], [('alnum', 'ZZq', 1), {'error': 'charset'}], [('numeric', '00575', 9), 31], [('numeric', '37219', 5), 31], [('numeric', '', 40), 18], [('numeric', '716925614701', 5), 54], [('alnum', '*Zq$', 40), {'error': 'charset'}]], [[('alnum', 'B+ +q+B', 26), {'error': 'charset'}], [('alnum', 'B2q*.é.2-', 15), {'error': 'charset'}], [('alnum', '1ZqA-', 1), {'error': 'charset'}], [('byte', 'abbbaaa', 26), 76], [('byte', '€', 41), {'error': 'version'}], [('numeric', '', 0), {'error': 'version'}], [('numeric', '2', 1), 18], [('alnum', 'A+*+Zq1B.', 26), {'error': 'charset'}]], [[('alnum', 'q1 :B.-', 1), {'error': 'charset'}], [('alnum', 'q*/q-é', 9), {'error': 'charset'}], [('alnum', '*/Zq1 %B', 10), {'error': 'charset'}], [('kanji', 'é ba', 40), {'error': 'mode'}], [('kanji', 'éb', 1), {'error': 'mode'}], [('byte', 'a€', 26), 52], [('alnum', '.', 5), 19], [('alnum', '.1q', 5), {'error': 'charset'}]]]\nlabels = [\"regression: alphanumeric character set\", \"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-segment-bits-alnum-charset","generated_at":"2026-09-29T14:49:46.395979+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":"Characters are upper-cased before the set membership test.","sha256":"7c6d4df61800fd72a2621d3fd061e3fa2896c70be8ab234a4845ca7f1a286e61","title":"Alphanumeric mode accepts lowercase letters · 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":39.842,"exit_code":1,"observations":[{"actual":50,"check":"regression: alphanumeric character set 0","expected":{"error":"charset"},"passed":false},{"actual":46,"check":"repair trap 1","expected":{"error":"charset"},"passed":false},{"actual":52,"check":"combined fault 2","expected":{"error":"charset"},"passed":false},{"actual":{"error":"version"},"check":"control 3","expected":{"error":"version"},"passed":true},{"actual":19,"check":"control 4","expected":19,"passed":true},{"actual":19,"check":"boundary 5","expected":19,"passed":true},{"actual":108,"check":"boundary 6","expected":108,"passed":true},{"actual":24,"check":"control 7","expected":{"error":"charset"},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: alphanumeric character set 0\", \"actual\": 50, \"expected\": {\"error\": \"charset\"}, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": 46, \"expected\": {\"error\": \"charset\"}, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": 52, \"expected\": {\"error\": \"charset\"}, \"passed\": false}, {\"check\": \"control 3\", \"actual\": {\"error\": \"version\"}, \"expected\": {\"error\": \"version\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": 19, \"expected\": 19, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": 19, \"expected\": 19, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": 108, \"expected\": 108, \"passed\": true}, {\"check\": \"control 7\", \"actual\": 24, \"expected\": {\"error\": \"charset\"}, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.477,"exit_code":1,"observations":[{"actual":50,"check":"regression: alphanumeric character set 0","expected":{"error":"charset"},"passed":false},{"actual":{"error":"charset"},"check":"repair trap 1","expected":{"error":"charset"},"passed":true},{"actual":52,"check":"combined fault 2","expected":{"error":"charset"},"passed":false},{"actual":{"error":"version"},"check":"control 3","expected":{"error":"version"},"passed":true},{"actual":19,"check":"control 4","expected":19,"passed":true},{"actual":19,"check":"boundary 5","expected":19,"passed":true},{"actual":108,"check":"boundary 6","expected":108,"passed":true},{"actual":24,"check":"control 7","expected":{"error":"charset"},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: alphanumeric character set 0\", \"actual\": 50, \"expected\": {\"error\": \"charset\"}, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": {\"error\": \"charset\"}, \"expected\": {\"error\": \"charset\"}, \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": 52, \"expected\": {\"error\": \"charset\"}, \"passed\": false}, {\"check\": \"control 3\", \"actual\": {\"error\": \"version\"}, \"expected\": {\"error\": \"version\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": 19, \"expected\": 19, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": 19, \"expected\": 19, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": 108, \"expected\": 108, \"passed\": true}, {\"check\": \"control 7\", \"actual\": 24, \"expected\": {\"error\": \"charset\"}, \"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."}}