FAILURE MAP
← Case archive

FA-45871 / Bounded deques / Open access

Bulk consume clears slots relative to array zero · case 01

Bulk consume clears slots relative to array zero.

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

ROOT CAUSE

The clearing loop forgets the logical head displacement.

VERIFIED REPAIR

Restore the documented clear origin 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 = list(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 fixtureActualExpectedOutcome
wrap consume[2, 1, [0, 1, 2], True][2, 1, [5, 0, 1], True]Failed
oversized consume[3, 0, [0, 1], False][3, 0, [1, 2], False]Failed
empty[2, 0, [], False][2, 0, [], False]Passed
zero consume[2, 3, [], False][2, 3, [], False]Passed
exact boundary[0, 0, [0, 1], False][0, 0, [4, 5], False]Failed
single retained[3, 1, [0, 1], False][3, 1, [1, 2], False]Failed

SHA-256 / fe9e2806ed2e174860a4fefa4f258e7840abee00def9799a4231c4490f66cd7a

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)] if head == 1 else list(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 fixtureActualExpectedOutcome
wrap consume[2, 1, [0, 1, 2], 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, [0, 1], False][0, 0, [4, 5], False]Failed
single retained[3, 1, [1, 2], False][3, 1, [1, 2], False]Passed

SHA-256 / cfe0e4ea36e2e81c767aa7858b9be23e2a161857279629f5d58236316f6ecd72

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 fixtureActualExpectedOutcome
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.494367+00:00.

Case digest / 11cdbcaf99511d8dda52c8f5d03a7fb99a861c01dd1f8e45a29bf4f803c70346