FA-72226 / Error-correcting codes / Open access
CRC correction presets the register to all ones · case 01
Clean frames are reported corrupted or "corrected" into different payloads.
ROOT CAUSE
The CRC register starts at 0xFF although the stated CRC-8 starts at 0.
VERIFIED REPAIR
Initialise the register to 0.
Unsuccessful approach: Starting at 0 but XORing 0xFF at the end is a different CRC variant.
Case contract
Frames of 2..15 bytes end with a CRC-8 (polynomial 0x07, initial value 0, MSB first, no final XOR) over the preceding bytes. A matching CRC is "clean"; otherwise try every single-bit flip across the whole frame, including the CRC byte, and accept the first that makes the CRC match ("corrected"). Otherwise "uncorrectable". Return [status, payload bytes or None].
Why this case matters
Sensor buses use short CRC-protected frames and correct single-bit upsets instead of retransmitting.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(frame):
def crc8(data):
c = 0xFF
for byte in data:
c ^= byte
for _ in range(8):
c = ((c << 1) ^ 0x07) & 0xFF if c & 0x80 else (c << 1) & 0xFF
return c
if not 2 <= len(frame) <= 15:
return None
if crc8(frame[:-1]) == frame[-1]:
return ['clean', list(frame[:-1])]
for pos in range(8 * len(frame)):
trial = list(frame)
trial[pos // 8] ^= 0x80 >> (pos % 8)
if crc8(trial[:-1]) == trial[-1]:
return ['corrected', trial[:-1]]
return ['uncorrectable', None]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]]', [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]], ['clean', [49, 50, 51, 52, 53, 54, 55, 56, 57]]], ['regression [[61, 179]]', [[61, 179]], ['clean', [61]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[61, 51]]', [[61, 51]], ['corrected', [61]]], ['control [[61, 177]]', [[61, 177]], ['corrected', [61]]], ['control [[167, 181, 113]]', [[167, 181, 113]], ['clean', [167, 181]]], ['control [[183, 181, 113]]', [[183, 181, 113]], ['corrected', [167, 181]]]], [['regression [[61, 177]]', [[61, 177]], ['corrected', [61]]], ['regression [[167, 181, 113]]', [[167, 181, 113]], ['clean', [167, 181]]], ['control [[1]]', [[1]], None], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[72, 197, 62, 193]]', [[72, 197, 62, 193]], ['clean', [72, 197, 62]]], ['control [[72, 197, 62, 201]]', [[72, 197, 62, 201]], ['corrected', [72, 197, 62]]], ['control [[175, 80, 114, 95, 27]]', [[175, 80, 114, 95, 27]], ['clean', [175, 80, 114, 95]]], ['control [[175, 80, 115, 95, 27]]', [[175, 80, 115, 95, 27]], ['corrected', [175, 80, 114, 95]]]], [['regression [[167, 181, 81]]', [[167, 181, 81]], ['corrected', [167, 181]]], ['regression [[72, 197, 62, 193]]', [[72, 197, 62, 193]], ['clean', [72, 197, 62]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[2, 155, 243, 103, 139, 4, 159]]', [[2, 155, 243, 103, 139, 4, 159]], ['clean', [2, 155, 243, 103, 139, 4]]], ['control [[2, 155, 243, 111, 139, 4, 159]]', [[2, 155, 243, 111, 139, 4, 159]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[2, 155, 243, 103, 139, 4, 158]]', [[2, 155, 243, 103, 139, 4, 158]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[210, 131, 94, 129, 185, 125, 64, 227, 14]]', [[210, 131, 94, 129, 185, 125, 64, 227, 14]], ['clean', [210, 131, 94, 129, 185, 125, 64, 227]]]], [['regression [[175, 80, 114, 95, 27]]', [[175, 80, 114, 95, 27]], ['clean', [175, 80, 114, 95]]], ['regression [[175, 80, 115, 95, 27]]', [[175, 80, 115, 95, 27]], ['corrected', [175, 80, 114, 95]]], ['control [[1]]', [[1]], None], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[210, 131, 94, 129, 185, 125, 64, 227, 15]]', [[210, 131, 94, 129, 185, 125, 64, 227, 15]], ['corrected', [210, 131, 94, 129, 185, 125, 64, 227]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 147]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 147]], ['clean', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 155]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 155]], ['corrected', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 151]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 151]], ['corrected', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]]], [['regression [[2, 155, 243, 103, 139, 4, 159]]', [[2, 155, 243, 103, 139, 4, 159]], ['clean', [2, 155, 243, 103, 139, 4]]], ['regression [[2, 155, 243, 111, 139, 4, 159]]', [[2, 155, 243, 111, 139, 4, 159]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[195, 130, 127, 222]]', [[195, 130, 127, 222]], ['corrected', [195, 130, 127]]], ['control [[195, 130, 127, 215]]', [[195, 130, 127, 215]], ['corrected', [195, 130, 127]]], ['control [[127, 209, 201, 183, 47, 43]]', [[127, 209, 201, 183, 47, 43]], ['clean', [127, 209, 201, 183, 47]]], ['control [[127, 209, 205, 183, 47, 43]]', [[127, 209, 205, 183, 47, 43]], ['corrected', [127, 209, 201, 183, 47]]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]] | ['uncorrectable', None] | ['clean', [49, 50, 51, 52, 53, 54, 55, 56, 57]] | Failed |
| regression [[61, 179]] | ['uncorrectable', None] | ['clean', [61]] | Failed |
| control [[49, 50, 51]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[1]] | None | None | Passed |
| control [[61, 51]] | ['uncorrectable', None] | ['corrected', [61]] | Failed |
| control [[61, 177]] | ['uncorrectable', None] | ['corrected', [61]] | Failed |
| control [[167, 181, 113]] | ['uncorrectable', None] | ['clean', [167, 181]] | Failed |
| control [[183, 181, 113]] | ['corrected', [183, 181]] | ['corrected', [167, 181]] | Failed |
SHA-256 / e625f3050a66158c15531c650450dbbb1c0b4ce3cfcb21815d341f5a1831ca76
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(frame):
def crc8(data):
c = 0
for byte in data:
c ^= byte
for _ in range(8):
c = ((c << 1) ^ 0x07) & 0xFF if c & 0x80 else (c << 1) & 0xFF
return c ^ 0xFF
if not 2 <= len(frame) <= 15:
return None
if crc8(frame[:-1]) == frame[-1]:
return ['clean', list(frame[:-1])]
for pos in range(8 * len(frame)):
trial = list(frame)
trial[pos // 8] ^= 0x80 >> (pos % 8)
if crc8(trial[:-1]) == trial[-1]:
return ['corrected', trial[:-1]]
return ['uncorrectable', None]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]]', [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]], ['clean', [49, 50, 51, 52, 53, 54, 55, 56, 57]]], ['regression [[61, 179]]', [[61, 179]], ['clean', [61]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[61, 51]]', [[61, 51]], ['corrected', [61]]], ['control [[61, 177]]', [[61, 177]], ['corrected', [61]]], ['control [[167, 181, 113]]', [[167, 181, 113]], ['clean', [167, 181]]], ['control [[183, 181, 113]]', [[183, 181, 113]], ['corrected', [167, 181]]]], [['regression [[61, 177]]', [[61, 177]], ['corrected', [61]]], ['regression [[167, 181, 113]]', [[167, 181, 113]], ['clean', [167, 181]]], ['control [[1]]', [[1]], None], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[72, 197, 62, 193]]', [[72, 197, 62, 193]], ['clean', [72, 197, 62]]], ['control [[72, 197, 62, 201]]', [[72, 197, 62, 201]], ['corrected', [72, 197, 62]]], ['control [[175, 80, 114, 95, 27]]', [[175, 80, 114, 95, 27]], ['clean', [175, 80, 114, 95]]], ['control [[175, 80, 115, 95, 27]]', [[175, 80, 115, 95, 27]], ['corrected', [175, 80, 114, 95]]]], [['regression [[167, 181, 81]]', [[167, 181, 81]], ['corrected', [167, 181]]], ['regression [[72, 197, 62, 193]]', [[72, 197, 62, 193]], ['clean', [72, 197, 62]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[2, 155, 243, 103, 139, 4, 159]]', [[2, 155, 243, 103, 139, 4, 159]], ['clean', [2, 155, 243, 103, 139, 4]]], ['control [[2, 155, 243, 111, 139, 4, 159]]', [[2, 155, 243, 111, 139, 4, 159]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[2, 155, 243, 103, 139, 4, 158]]', [[2, 155, 243, 103, 139, 4, 158]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[210, 131, 94, 129, 185, 125, 64, 227, 14]]', [[210, 131, 94, 129, 185, 125, 64, 227, 14]], ['clean', [210, 131, 94, 129, 185, 125, 64, 227]]]], [['regression [[175, 80, 114, 95, 27]]', [[175, 80, 114, 95, 27]], ['clean', [175, 80, 114, 95]]], ['regression [[175, 80, 115, 95, 27]]', [[175, 80, 115, 95, 27]], ['corrected', [175, 80, 114, 95]]], ['control [[1]]', [[1]], None], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[210, 131, 94, 129, 185, 125, 64, 227, 15]]', [[210, 131, 94, 129, 185, 125, 64, 227, 15]], ['corrected', [210, 131, 94, 129, 185, 125, 64, 227]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 147]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 147]], ['clean', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 155]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 155]], ['corrected', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 151]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 151]], ['corrected', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]]], [['regression [[2, 155, 243, 103, 139, 4, 159]]', [[2, 155, 243, 103, 139, 4, 159]], ['clean', [2, 155, 243, 103, 139, 4]]], ['regression [[2, 155, 243, 111, 139, 4, 159]]', [[2, 155, 243, 111, 139, 4, 159]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[195, 130, 127, 222]]', [[195, 130, 127, 222]], ['corrected', [195, 130, 127]]], ['control [[195, 130, 127, 215]]', [[195, 130, 127, 215]], ['corrected', [195, 130, 127]]], ['control [[127, 209, 201, 183, 47, 43]]', [[127, 209, 201, 183, 47, 43]], ['clean', [127, 209, 201, 183, 47]]], ['control [[127, 209, 205, 183, 47, 43]]', [[127, 209, 205, 183, 47, 43]], ['corrected', [127, 209, 201, 183, 47]]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]] | ['uncorrectable', None] | ['clean', [49, 50, 51, 52, 53, 54, 55, 56, 57]] | Failed |
| regression [[61, 179]] | ['uncorrectable', None] | ['clean', [61]] | Failed |
| control [[49, 50, 51]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[1]] | None | None | Passed |
| control [[61, 51]] | ['uncorrectable', None] | ['corrected', [61]] | Failed |
| control [[61, 177]] | ['uncorrectable', None] | ['corrected', [61]] | Failed |
| control [[167, 181, 113]] | ['uncorrectable', None] | ['clean', [167, 181]] | Failed |
| control [[183, 181, 113]] | ['corrected', [191, 181]] | ['corrected', [167, 181]] | Failed |
SHA-256 / 9523b83a57e9a5c7dc5ac453ae11cc189242334b7f2739ccaf0c2d2c9daecf64
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(frame):
def crc8(data):
c = 0
for byte in data:
c ^= byte
for _ in range(8):
c = ((c << 1) ^ 0x07) & 0xFF if c & 0x80 else (c << 1) & 0xFF
return c
if not 2 <= len(frame) <= 15:
return None
if crc8(frame[:-1]) == frame[-1]:
return ['clean', list(frame[:-1])]
for pos in range(8 * len(frame)):
trial = list(frame)
trial[pos // 8] ^= 0x80 >> (pos % 8)
if crc8(trial[:-1]) == trial[-1]:
return ['corrected', trial[:-1]]
return ['uncorrectable', None]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]]', [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]], ['clean', [49, 50, 51, 52, 53, 54, 55, 56, 57]]], ['regression [[61, 179]]', [[61, 179]], ['clean', [61]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[61, 51]]', [[61, 51]], ['corrected', [61]]], ['control [[61, 177]]', [[61, 177]], ['corrected', [61]]], ['control [[167, 181, 113]]', [[167, 181, 113]], ['clean', [167, 181]]], ['control [[183, 181, 113]]', [[183, 181, 113]], ['corrected', [167, 181]]]], [['regression [[61, 177]]', [[61, 177]], ['corrected', [61]]], ['regression [[167, 181, 113]]', [[167, 181, 113]], ['clean', [167, 181]]], ['control [[1]]', [[1]], None], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[72, 197, 62, 193]]', [[72, 197, 62, 193]], ['clean', [72, 197, 62]]], ['control [[72, 197, 62, 201]]', [[72, 197, 62, 201]], ['corrected', [72, 197, 62]]], ['control [[175, 80, 114, 95, 27]]', [[175, 80, 114, 95, 27]], ['clean', [175, 80, 114, 95]]], ['control [[175, 80, 115, 95, 27]]', [[175, 80, 115, 95, 27]], ['corrected', [175, 80, 114, 95]]]], [['regression [[167, 181, 81]]', [[167, 181, 81]], ['corrected', [167, 181]]], ['regression [[72, 197, 62, 193]]', [[72, 197, 62, 193]], ['clean', [72, 197, 62]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[2, 155, 243, 103, 139, 4, 159]]', [[2, 155, 243, 103, 139, 4, 159]], ['clean', [2, 155, 243, 103, 139, 4]]], ['control [[2, 155, 243, 111, 139, 4, 159]]', [[2, 155, 243, 111, 139, 4, 159]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[2, 155, 243, 103, 139, 4, 158]]', [[2, 155, 243, 103, 139, 4, 158]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[210, 131, 94, 129, 185, 125, 64, 227, 14]]', [[210, 131, 94, 129, 185, 125, 64, 227, 14]], ['clean', [210, 131, 94, 129, 185, 125, 64, 227]]]], [['regression [[175, 80, 114, 95, 27]]', [[175, 80, 114, 95, 27]], ['clean', [175, 80, 114, 95]]], ['regression [[175, 80, 115, 95, 27]]', [[175, 80, 115, 95, 27]], ['corrected', [175, 80, 114, 95]]], ['control [[1]]', [[1]], None], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[210, 131, 94, 129, 185, 125, 64, 227, 15]]', [[210, 131, 94, 129, 185, 125, 64, 227, 15]], ['corrected', [210, 131, 94, 129, 185, 125, 64, 227]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 147]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 147]], ['clean', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 155]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 155]], ['corrected', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]], ['control [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 151]]', [[210, 125, 246, 195, 53, 171, 122, 103, 140, 202, 151]], ['corrected', [210, 125, 246, 195, 53, 171, 122, 103, 140, 202]]]], [['regression [[2, 155, 243, 103, 139, 4, 159]]', [[2, 155, 243, 103, 139, 4, 159]], ['clean', [2, 155, 243, 103, 139, 4]]], ['regression [[2, 155, 243, 111, 139, 4, 159]]', [[2, 155, 243, 111, 139, 4, 159]], ['corrected', [2, 155, 243, 103, 139, 4]]], ['control [[49, 50, 51]]', [[49, 50, 51]], ['uncorrectable', None]], ['control [[1]]', [[1]], None], ['control [[195, 130, 127, 222]]', [[195, 130, 127, 222]], ['corrected', [195, 130, 127]]], ['control [[195, 130, 127, 215]]', [[195, 130, 127, 215]], ['corrected', [195, 130, 127]]], ['control [[127, 209, 201, 183, 47, 43]]', [[127, 209, 201, 183, 47, 43]], ['clean', [127, 209, 201, 183, 47]]], ['control [[127, 209, 205, 183, 47, 43]]', [[127, 209, 205, 183, 47, 43]], ['corrected', [127, 209, 201, 183, 47]]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[49, 50, 51, 52, 53, 54, 55, 56, 57, 244]] | ['clean', [49, 50, 51, 52, 53, 54, 55, 56, 57]] | ['clean', [49, 50, 51, 52, 53, 54, 55, 56, 57]] | Passed |
| regression [[61, 179]] | ['clean', [61]] | ['clean', [61]] | Passed |
| control [[49, 50, 51]] | ['uncorrectable', None] | ['uncorrectable', None] | Passed |
| control [[1]] | None | None | Passed |
| control [[61, 51]] | ['corrected', [61]] | ['corrected', [61]] | Passed |
| control [[61, 177]] | ['corrected', [61]] | ['corrected', [61]] | Passed |
| control [[167, 181, 113]] | ['clean', [167, 181]] | ['clean', [167, 181]] | Passed |
| control [[183, 181, 113]] | ['corrected', [167, 181]] | ['corrected', [167, 181]] | Passed |
SHA-256 / bf2c79246708671dccda8ff686c31471aba8bdf2a1a6b7fab1e93f085da96be2
Verification & scope
A deterministic, bounded teaching model of the named code under the stated contract; not a production codec. 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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:48:36.635299+00:00.
Case digest / 18efe041ec98cc795f026f88a562d33d604ee142b5ce150874d797ec08010536