FAILURE MAP
← Case archive

FA-10986 / Audio playback scheduling / Open access

Write ring wraparound · case 01

A contiguous write discards the portion crossing the ring end.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

A contiguous write discards the portion crossing the ring end.

VERIFIED REPAIR

Apply the explicit PCM/playback contract: Write at most capacity incoming samples into a nonempty ring buffer at valid position, wrapping once and preserving unwritten slots.

Unsuccessful approach: Writing from buffer zero ignores the ring write cursor.

Case contract

Write at most capacity incoming samples into a nonempty ring buffer at valid position, wrapping once and preserving unwritten slots.

Why this case matters

A pure Python local audio pipeline stage with explicit sample formats and frame conventions; no real-time device or signal-spectrum claims.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(buffer, position, incoming):
    return [incoming[i-position] if position<=i<position+len(incoming) else x for i,x in enumerate(buffer)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([0, 0, 0, 0], 3, [7, 8])),[8, 0, 0, 7])
check('fixture 2',solve(*([1, 2, 3], 1, [9])),[1, 9, 3])
check('fixture 3',solve(*([1, 2], 0, [])),[1, 2])
check('fixture 4',solve(*([0, 0], 0, [5, 6])),[5, 6])
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 fixtureActualExpectedOutcome
fixture 1[0, 0, 0, 7][8, 0, 0, 7]Failed
fixture 2[1, 9, 3][1, 9, 3]Passed
fixture 3[1, 2][1, 2]Passed
fixture 4[5, 6][5, 6]Passed

SHA-256 / 0c241b6c23ae6af3213a2e3e4ff5efbf8586c63217b98bf899ae9538d330a157

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(buffer, position, incoming):
    return [incoming[i] if i<len(incoming) else x for i,x in enumerate(buffer)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([0, 0, 0, 0], 3, [7, 8])),[8, 0, 0, 7])
check('fixture 2',solve(*([1, 2, 3], 1, [9])),[1, 9, 3])
check('fixture 3',solve(*([1, 2], 0, [])),[1, 2])
check('fixture 4',solve(*([0, 0], 0, [5, 6])),[5, 6])
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 fixtureActualExpectedOutcome
fixture 1[7, 8, 0, 0][8, 0, 0, 7]Failed
fixture 2[9, 2, 3][1, 9, 3]Failed
fixture 3[1, 2][1, 2]Passed
fixture 4[5, 6][5, 6]Passed

SHA-256 / fbc48f68c2d570816d86b18b3002aa126ac29fa319520f0356f94543832fb114

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(buffer, position, incoming):
    return [(incoming[(i-position)%len(buffer)] if (i-position)%len(buffer)<len(incoming) else x) for i,x in enumerate(buffer)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1',solve(*([0, 0, 0, 0], 3, [7, 8])),[8, 0, 0, 7])
check('fixture 2',solve(*([1, 2, 3], 1, [9])),[1, 9, 3])
check('fixture 3',solve(*([1, 2], 0, [])),[1, 2])
check('fixture 4',solve(*([0, 0], 0, [5, 6])),[5, 6])
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 fixtureActualExpectedOutcome
fixture 1[8, 0, 0, 7][8, 0, 0, 7]Passed
fixture 2[1, 9, 3][1, 9, 3]Passed
fixture 3[1, 2][1, 2]Passed
fixture 4[5, 6][5, 6]Passed

SHA-256 / 597084a256363b1f0f8c407012a06d787b8d77d0b60d434a1a322c4bbcbee6c3

Verification & scope

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:38:43.971123+00:00.

Case digest / 2f0f11b54fa46e4c004724d40e5d0d6ed15397befb828eb9c40986f63eed0ec2