FA-48841 / PCM sample encoding / Open access
Subbyte code packer: preserve prefix · case 01
The packet sync prefix is dropped before packed sample codes.
ROOT CAUSE
The packet sync prefix is dropped before packed sample codes.
VERIFIED REPAIR
Use the stated conversion contract at preserve prefix.
Unsuccessful approach: Restoring the prefix in reverse wire order corrupts sync bits.
Case contract
Pack unsigned codes fitting width 1..7 most-significant bit first after an explicit bit prefix; return octets, significant-bit count and zero tail padding count.
Why this case matters
Offline PCM interchange uses these exact bounded packet and sample representation decisions.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(codes, width, prefix):
bits = []
for code in codes:
bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
padding = (-len(bits)) % 8
bits += [0] * padding
out = []
for start in range(0,len(bits),8):
out.append(sum(bits[start+j] << (7-j) for j in range(8)))
return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 0])
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 |
|---|---|---|---|
| oracle 1 | [[7, 128], 11, 7] | [[129, 224], 11, 5] | Failed |
| oracle 2 | [[168], 6, 2] | [[168], 6, 2] | Passed |
| oracle 3 | [[], 0, 0] | [[], 0, 0] | Passed |
| oracle 4 | [[240], 8, 0] | [[240], 8, 0] | Passed |
| oracle 5 | [[128], 4, 7] | [[208], 4, 4] | Failed |
| oracle 6 | [[57], 9, 0] | [[28, 128], 9, 7] | Failed |
| oracle 7 | [[136, 192], 13, 6] | [[177, 24], 13, 3] | Failed |
| variant packet 1 | [[7, 131, 192], 20, 6] | [[129, 224, 240], 20, 4] | Failed |
SHA-256 / a79a7c74d6cc94116eefe9f087350bb9dd5268a11511786b562129adb1107c70
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(codes, width, prefix):
bits = list(reversed(prefix))
for code in codes:
bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
padding = (-len(bits)) % 8
bits += [0] * padding
out = []
for start in range(0,len(bits),8):
out.append(sum(bits[start+j] << (7-j) for j in range(8)))
return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 0])
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 |
|---|---|---|---|
| oracle 1 | [[65, 224], 11, 5] | [[129, 224], 11, 5] | Failed |
| oracle 2 | [[168], 6, 2] | [[168], 6, 2] | Passed |
| oracle 3 | [[], 0, 0] | [[], 0, 0] | Passed |
| oracle 4 | [[240], 8, 0] | [[240], 8, 0] | Passed |
| oracle 5 | [[112], 4, 4] | [[208], 4, 4] | Failed |
| oracle 6 | [[28, 128], 9, 7] | [[28, 128], 9, 7] | Passed |
| oracle 7 | [[177, 24], 13, 3] | [[177, 24], 13, 3] | Passed |
| variant packet 1 | [[65, 224, 240], 20, 4] | [[129, 224, 240], 20, 4] | Failed |
SHA-256 / 2cbf58241b7c3ae18d85b79259611accd4047a3f4205e96083546574fc19cd23
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(codes, width, prefix):
bits = list(prefix)
for code in codes:
bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
padding = (-len(bits)) % 8
bits += [0] * padding
out = []
for start in range(0,len(bits),8):
out.append(sum(bits[start+j] << (7-j) for j in range(8)))
return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 0])
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 |
|---|---|---|---|
| oracle 1 | [[129, 224], 11, 5] | [[129, 224], 11, 5] | Passed |
| oracle 2 | [[168], 6, 2] | [[168], 6, 2] | Passed |
| oracle 3 | [[], 0, 0] | [[], 0, 0] | Passed |
| oracle 4 | [[240], 8, 0] | [[240], 8, 0] | Passed |
| oracle 5 | [[208], 4, 4] | [[208], 4, 4] | Passed |
| oracle 6 | [[28, 128], 9, 7] | [[28, 128], 9, 7] | Passed |
| oracle 7 | [[177, 24], 13, 3] | [[177, 24], 13, 3] | Passed |
| variant packet 1 | [[129, 224, 240], 20, 4] | [[129, 224, 240], 20, 4] | Passed |
SHA-256 / 1a6bacfd1831f882754c5a37ea36bf06a700319d8b5d2e8b37722f9b529e9506
Verification & scope
Stipulated finite model; no claim of hardware timing or full file-format conformance. 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:44:54.447535+00:00.
Case digest / 8844ddeccc36680630eb686da41d523c605961da98b19fe032ebee90fa18bad8