FA-45876 / Bounded deques / Open access
Read cursor escapes the backing allocation after consume · case 01
Read cursor escapes the backing allocation after consume.
ROOT CAUSE
Only exact-boundary wrap is repaired, leaving crossing consumption invalid.
VERIFIED REPAIR
Restore the documented cursor wrap invariant in ring-consume.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
Consume min(requested,size) slots from a ring. Report new head, count, cleared physical slots, and whether its occupied arc crossed the physical boundary.
Why this case matters
Controlled bounded deque implementation model with explicit storage and lifecycle observations.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
cap, head, size, requested = x
count = min(requested, size)
cleared = [(head + i) % cap for i in range(count)]
new_head = head + count
remaining = size - count
crossed = head + count > cap
return [new_head, remaining, cleared, crossed]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrap consume', solve([N+5,N+4,4,3]), [2,1,[N+4,0,1],True])
check('oversized consume', solve([N+5,1,2,4]), [3,0,[1,2],False])
check('empty', solve([N+5,2,0,4]), [2,0,[],False])
check('zero consume', solve([N+5,2,3,0]), [2,3,[],False])
check('exact boundary', solve([N+5,N+3,2,2]), [0,0,[N+3,N+4],False])
check('single retained', solve([N+5,1,3,2]), [3,1,[1,2],False])
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 |
|---|---|---|---|
| wrap consume | [8, 1, [5, 0, 1], True] | [2, 1, [5, 0, 1], True] | Failed |
| oversized consume | [3, 0, [1, 2], False] | [3, 0, [1, 2], False] | Passed |
| empty | [2, 0, [], False] | [2, 0, [], False] | Passed |
| zero consume | [2, 3, [], False] | [2, 3, [], False] | Passed |
| exact boundary | [6, 0, [4, 5], False] | [0, 0, [4, 5], False] | Failed |
| single retained | [3, 1, [1, 2], False] | [3, 1, [1, 2], False] | Passed |
SHA-256 / 703b554f2f1282cdf8607a99636f259c2b5864581a5008bf6f3b39e10fe16fb7
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
cap, head, size, requested = x
count = min(requested, size)
cleared = [(head + i) % cap for i in range(count)]
new_head = 0 if head + count == cap else head + count
remaining = size - count
crossed = head + count > cap
return [new_head, remaining, cleared, crossed]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrap consume', solve([N+5,N+4,4,3]), [2,1,[N+4,0,1],True])
check('oversized consume', solve([N+5,1,2,4]), [3,0,[1,2],False])
check('empty', solve([N+5,2,0,4]), [2,0,[],False])
check('zero consume', solve([N+5,2,3,0]), [2,3,[],False])
check('exact boundary', solve([N+5,N+3,2,2]), [0,0,[N+3,N+4],False])
check('single retained', solve([N+5,1,3,2]), [3,1,[1,2],False])
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 |
|---|---|---|---|
| wrap consume | [8, 1, [5, 0, 1], True] | [2, 1, [5, 0, 1], True] | Failed |
| oversized consume | [3, 0, [1, 2], False] | [3, 0, [1, 2], False] | Passed |
| empty | [2, 0, [], False] | [2, 0, [], False] | Passed |
| zero consume | [2, 3, [], False] | [2, 3, [], False] | Passed |
| exact boundary | [0, 0, [4, 5], False] | [0, 0, [4, 5], False] | Passed |
| single retained | [3, 1, [1, 2], False] | [3, 1, [1, 2], False] | Passed |
SHA-256 / 8fe5f3805680292e0e28bf22db1c9ac4b981f0f43a48ef7b1081eb831dbbdc31
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
cap, head, size, requested = x
count = min(requested, size)
cleared = [(head + i) % cap for i in range(count)]
new_head = (head + count) % cap
remaining = size - count
crossed = head + count > cap
return [new_head, remaining, cleared, crossed]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrap consume', solve([N+5,N+4,4,3]), [2,1,[N+4,0,1],True])
check('oversized consume', solve([N+5,1,2,4]), [3,0,[1,2],False])
check('empty', solve([N+5,2,0,4]), [2,0,[],False])
check('zero consume', solve([N+5,2,3,0]), [2,3,[],False])
check('exact boundary', solve([N+5,N+3,2,2]), [0,0,[N+3,N+4],False])
check('single retained', solve([N+5,1,3,2]), [3,1,[1,2],False])
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 |
|---|---|---|---|
| wrap consume | [2, 1, [5, 0, 1], True] | [2, 1, [5, 0, 1], True] | Passed |
| oversized consume | [3, 0, [1, 2], False] | [3, 0, [1, 2], False] | Passed |
| empty | [2, 0, [], False] | [2, 0, [], False] | Passed |
| zero consume | [2, 3, [], False] | [2, 3, [], False] | Passed |
| exact boundary | [0, 0, [4, 5], False] | [0, 0, [4, 5], False] | Passed |
| single retained | [3, 1, [1, 2], False] | [3, 1, [1, 2], False] | Passed |
SHA-256 / 1b602f3b68e899ed965c67271fd3ce5668b96915cd87a09759db030e22a6b1bc
Verification & scope
Offline finite deterministic model; no claim of production implementation or concurrent memory-model 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:26.540032+00:00.
Case digest / 65126f6e9d0e79d7b6e10243c2c55539467b1caf1d0e28a1a55de86da17973c8