{"abstract":"Every barcode gets the wrong check symbol.","category":"Check-digit algorithms","checks":8,"contract":"Code 128 symbol check value. Start codes A/B/C have values 103/104/105 (other codes: None). Code B accepts characters 32..127 (value ord - 32); code A accepts 0..95 (values ord - 32, controls ord + 64); code C accepts an even number of ASCII digits taken in pairs (value 0..99). The checksum is (start + sum(position * value)) mod 103 with positions starting at 1 after the start code. Invalid data returns None.","contract_signature":"code, data","evaluation_group":"w2-check_digit_algorithms-code128-checksum","failed_approach":"Starting positions at 2 treats the start code as if it occupied position 1 twice.","family":"w2-check_digit_algorithms-code128-checksum-position-origin","id":"FA-72631","implementations":{"attempt":{"sha256":"8a9dfdf27d2d20d50567fb2e16b0a1cfea1112ddcc64f0e35b0969d01033783b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(code, data):\n    starts = {'A': 103, 'B': 104, 'C': 105}\n    if code not in starts:\n        return None\n    if code == 'C':\n        if len(data) % 2 or not data.isascii() or not data.isdigit():\n            return None\n        values = [int(data[i:i + 2]) for i in range(0, len(data), 2)]\n    elif code == 'B':\n        if any(not 32 <= ord(ch) <= 127 for ch in data):\n            return None\n        values = [ord(ch) - 32 for ch in data]\n    else:\n        if any(not 0 <= ord(ch) <= 95 for ch in data):\n            return None\n        values = [ord(ch) - 32 if ord(ch) >= 32 else ord(ch) + 64 for ch in data]\n    total = starts[code]\n    for pos, v in enumerate(values, 2):\n        total += pos * v\n    return total % 103\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"B\", \"@w~\\'\"]', ['B', \"@w~'\"], 2], ['regression [\"B\", \"Ht?\"]', ['B', 'Ht?'], 96], ['control [\"C\", \"12345\"]', ['C', '12345'], None], ['control [\"B\", \"\"]', ['B', ''], 1], ['control [\"D\", \"X\"]', ['D', 'X'], None], ['control [\"A\", \"abc\"]', ['A', 'abc'], None], ['control [\"C\", \"00\"]', ['C', '00'], 2], ['control [\"B\", \" \"]', ['B', ' '], 1]], [['regression [\"B\", \")r\"]', ['B', ')r'], 71], ['regression [\"B\", \"YyUx>VrW{?\"]', ['B', 'YyUx>VrW{?'], 68], ['control [\"B\", \" \"]', ['B', ' '], 1], ['control [\"B\", \"café\"]', ['B', 'café'], None], ['control [\"C\", \"12345\"]', ['C', '12345'], None], ['control [\"B\", \"\"]', ['B', ''], 1], ['control [\"D\", \"X\"]', ['D', 'X'], None], ['control [\"A\", \"abc\"]', ['A', 'abc'], None]], [['regression [\"B\", \"wm$|^uemYo/\"]', ['B', 'wm$|^uemYo/'], 95], ['regression [\"B\", \"UI}*7pnZebjZ\"]', ['B', 'UI}*7pnZebjZ'], 10], ['control [\"A\", \"abc\"]', ['A', 'abc'], None], ['control [\"C\", \"00\"]', ['C', '00'], 2], ['control [\"B\", \" \"]', ['B', ' '], 1], ['control [\"B\", \"café\"]', ['B', 'café'], None], ['control [\"C\", \"12345\"]', ['C', '12345'], None], ['control [\"B\", \"\"]', ['B', ''], 1]], [['regression [\"B\", \"{j]OWCR\"]', ['B', '{j]OWCR'], 4], ['regression [\"C\", \"9158\"]', ['C', '9158'], 3], ['control [\"B\", \"\"]', ['B', ''], 1], ['control [\"D\", \"X\"]', ['D', 'X'], None], ['control [\"A\", \"abc\"]', ['A', 'abc'], None], ['control [\"C\", \"00\"]', ['C', '00'], 2], ['control [\"B\", \" \"]', ['B', ' '], 1], ['control [\"B\", \"café\"]', ['B', 'café'], None]], [['regression [\"C\", \"976797\"]', ['C', '976797'], 9], ['regression [\"C\", \"209091\"]', ['C', '209091'], 63], ['control [\"B\", \"café\"]', ['B', 'café'], None], ['control [\"C\", \"12345\"]', ['C', '12345'], None], ['control [\"B\", \"\"]', ['B', ''], 1], ['control [\"D\", \"X\"]', ['D', 'X'], None], ['control [\"A\", \"abc\"]', ['A', 'abc'], None], ['control [\"C\", \"00\"]', ['C', '00'], 2]]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, 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":"967319c9cd8d07b500e4d7ecaf4d5395454e189c263f6c073775159f6e1008f7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(code, data):\n    starts = {'A': 103, 'B': 104, 'C': 105}\n    if code not in starts:\n        return None\n    if code == 'C':\n        if len(data) % 2 or not data.isascii() or not data.isdigit():\n            return None\n        values = [int(data[i:i + 2]) for i in range(0, len(data), 2)]\n    elif code == 'B':\n        if any(not 32 <= ord(ch) <= 127 for ch in data):\n            return None\n        values = [ord(ch) - 32 for ch in data]\n    else:\n        if any(not 0 <= ord(ch) <= 95 for ch in data):\n            return None\n        values = [ord(ch) - 32 if ord(ch) >= 32 else ord(ch) + 64 for ch in data]\n    total = starts[code]\n    for pos, v in enumerate(values):\n        total += pos * v\n    return total % 103\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression [\"B\", \"@w~\\'\"]', ['B', \"@w~'\"], 2], ['regression [\"B\", \"Ht?\"]', ['B', 'Ht?'], 96], ['control [\"C\", \"12345\"]', ['C', '12345'], None], ['control [\"B\", \"\"]', ['B', ''], 1], ['control [\"D\", \"X\"]', ['D', 'X'], None], ['control [\"A\", \"abc\"]', ['A', 'abc'], None], ['control [\"C\", \"00\"]', ['C', '00'], 2], ['control [\"B\", \" \"]', ['B', ' '], 1]], [['regression [\"B\", \")r\"]', ['B', ')r'], 71], ['regression [\"B\", \"YyUx>VrW{?\"]', ['B', 'YyUx>VrW{?'], 68], ['control [\"B\", \" \"]', ['B', ' '], 1], ['control [\"B\", \"café\"]', ['B', 'café'], None], ['control [\"C\", \"12345\"]', ['C', '12345'], None], ['control [\"B\", \"\"]', ['B', ''], 1], ['control [\"D\", \"X\"]', ['D', 'X'], None], ['control [\"A\", \"abc\"]', ['A', 'abc'], None]], [['regression [\"B\", \"wm$|^uemYo/\"]', ['B', 'wm$|^uemYo/'], 95], ['regression [\"B\", \"UI}*7pnZebjZ\"]', ['B', 'UI}*7pnZebjZ'], 10], ['control [\"A\", \"abc\"]', ['A', 'abc'], None], ['control [\"C\", \"00\"]', ['C', '00'], 2], ['control [\"B\", \" \"]', ['B', ' '], 1], ['control [\"B\", \"café\"]', ['B', 'café'], None], ['control [\"C\", \"12345\"]', ['C', '12345'], None], ['control [\"B\", \"\"]', ['B', ''], 1]], [['regression [\"B\", \"{j]OWCR\"]', ['B', '{j]OWCR'], 4], ['regression [\"C\", \"9158\"]', ['C', '9158'], 3], ['control [\"B\", \"\"]', ['B', ''], 1], ['control [\"D\", \"X\"]', ['D', 'X'], None], ['control [\"A\", \"abc\"]', ['A', 'abc'], None], ['control [\"C\", \"00\"]', ['C', '00'], 2], ['control [\"B\", \" \"]', ['B', ' '], 1], ['control [\"B\", \"café\"]', ['B', 'café'], None]], [['regression [\"C\", \"976797\"]', ['C', '976797'], 9], ['regression [\"C\", \"209091\"]', ['C', '209091'], 63], ['control [\"B\", \"café\"]', ['B', 'café'], None], ['control [\"C\", \"12345\"]', ['C', '12345'], None], ['control [\"B\", \"\"]', ['B', ''], 1], ['control [\"D\", \"X\"]', ['D', 'X'], None], ['control [\"A\", \"abc\"]', ['A', 'abc'], None], ['control [\"C\", \"00\"]', ['C', '00'], 2]]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, 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 of the named scheme under the stated contract; not a certified validator. 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-check_digit_algorithms-code128-checksum-position-origin","generated_at":"2026-09-29T14:48:40.263652+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Label printers compute the Code 128 check symbol before rendering shipping barcodes.","root_cause":"Positions are enumerated from 0, so the first data symbol drops out and every later weight is one low.","sha256":"72ed4a3b11d56336d437b34445f94609465e858b3a1ca2ec7acb85ba34cad36c","title":"Code 128 weights the first data symbol by zero · 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":38.85,"exit_code":1,"observations":[{"actual":16,"check":"regression [\"B\", \"@w~'\"]","expected":2,"passed":false},{"actual":45,"check":"regression [\"B\", \"Ht?\"]","expected":96,"passed":false},{"actual":null,"check":"control [\"C\", \"12345\"]","expected":null,"passed":true},{"actual":1,"check":"control [\"B\", \"\"]","expected":1,"passed":true},{"actual":null,"check":"control [\"D\", \"X\"]","expected":null,"passed":true},{"actual":null,"check":"control [\"A\", \"abc\"]","expected":null,"passed":true},{"actual":2,"check":"control [\"C\", \"00\"]","expected":2,"passed":true},{"actual":1,"check":"control [\"B\", \" \"]","expected":1,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"B\\\", \\\"@w~'\\\"]\", \"actual\": 16, \"expected\": 2, \"passed\": false}, {\"check\": \"regression [\\\"B\\\", \\\"Ht?\\\"]\", \"actual\": 45, \"expected\": 96, \"passed\": false}, {\"check\": \"control [\\\"C\\\", \\\"12345\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"B\\\", \\\"\\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"control [\\\"D\\\", \\\"X\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"A\\\", \\\"abc\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"C\\\", \\\"00\\\"]\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"control [\\\"B\\\", \\\" \\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.64,"exit_code":1,"observations":[{"actual":91,"check":"regression [\"B\", \"@w~'\"]","expected":2,"passed":false},{"actual":44,"check":"regression [\"B\", \"Ht?\"]","expected":96,"passed":false},{"actual":null,"check":"control [\"C\", \"12345\"]","expected":null,"passed":true},{"actual":1,"check":"control [\"B\", \"\"]","expected":1,"passed":true},{"actual":null,"check":"control [\"D\", \"X\"]","expected":null,"passed":true},{"actual":null,"check":"control [\"A\", \"abc\"]","expected":null,"passed":true},{"actual":2,"check":"control [\"C\", \"00\"]","expected":2,"passed":true},{"actual":1,"check":"control [\"B\", \" \"]","expected":1,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression [\\\"B\\\", \\\"@w~'\\\"]\", \"actual\": 91, \"expected\": 2, \"passed\": false}, {\"check\": \"regression [\\\"B\\\", \\\"Ht?\\\"]\", \"actual\": 44, \"expected\": 96, \"passed\": false}, {\"check\": \"control [\\\"C\\\", \\\"12345\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"B\\\", \\\"\\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"control [\\\"D\\\", \\\"X\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"A\\\", \\\"abc\\\"]\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"control [\\\"C\\\", \\\"00\\\"]\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"control [\\\"B\\\", \\\" \\\"]\", \"actual\": 1, \"expected\": 1, \"passed\": true}], \"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."}}