FAILURE MAP
← Case archive

FA-45841 / Bounded deques / Open access

Reservation counts occupied slots as available · case 01

Reservation counts occupied slots as available.

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

ROOT CAUSE

The free-space calculation uses occupancy instead of its complement.

THE FAILURE

The free-space calculation uses occupancy instead of its complement.

Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.

Case contract

Reserve up to requested free positions in a reject-on-full ring. Return [grant,tail,first-span,second-span,free-after]. Head and size are valid, capacity positive.

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
    free = size
    grant = min(requested, free)
    tail = (head + size) % cap
    first = min(grant, cap - tail)
    second = grant - first
    return [grant, tail, first, second, free - grant]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrapped free region', solve([N+5, N+3, 1, 3]), [3,N+4,1,2,N+1])
check('limited free space', solve([N+5, 2, N+3, 4]), [2,0,2,0,0])
check('empty shifted ring', solve([N+5,N+4,0,4]), [4,N+4,1,3,N+1])
check('empty request', solve([N+5,1,2,0]), [0,3,0,0,N+3])
check('full ring', solve([N+5,2,N+5,3]), [0,2,0,0,0])
check('contiguous grant', solve([N+5,0,1,2]), [2,1,2,0,N+2])
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
wrapped free region[1, 5, 1, 0, 0][3, 5, 1, 2, 2]Failed
limited free space[4, 0, 4, 0, 0][2, 0, 2, 0, 0]Failed
empty shifted ring[0, 5, 0, 0, 0][4, 5, 1, 3, 2]Failed
empty request[0, 3, 0, 0, 2][0, 3, 0, 0, 4]Failed
full ring[3, 2, 3, 0, 3][0, 2, 0, 0, 0]Failed
contiguous grant[1, 1, 1, 0, 0][2, 1, 2, 0, 3]Failed

SHA-256 / 72f20ebbef16c83076dd2ca6f7c62bb8893ab798df640db753a3a51b8c970e7e

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
    free = cap if size == 0 else size
    grant = min(requested, free)
    tail = (head + size) % cap
    first = min(grant, cap - tail)
    second = grant - first
    return [grant, tail, first, second, free - grant]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('wrapped free region', solve([N+5, N+3, 1, 3]), [3,N+4,1,2,N+1])
check('limited free space', solve([N+5, 2, N+3, 4]), [2,0,2,0,0])
check('empty shifted ring', solve([N+5,N+4,0,4]), [4,N+4,1,3,N+1])
check('empty request', solve([N+5,1,2,0]), [0,3,0,0,N+3])
check('full ring', solve([N+5,2,N+5,3]), [0,2,0,0,0])
check('contiguous grant', solve([N+5,0,1,2]), [2,1,2,0,N+2])
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
wrapped free region[1, 5, 1, 0, 0][3, 5, 1, 2, 2]Failed
limited free space[4, 0, 4, 0, 0][2, 0, 2, 0, 0]Failed
empty shifted ring[4, 5, 1, 3, 2][4, 5, 1, 3, 2]Passed
empty request[0, 3, 0, 0, 2][0, 3, 0, 0, 4]Failed
full ring[3, 2, 3, 0, 3][0, 2, 0, 0, 0]Failed
contiguous grant[1, 1, 1, 0, 0][2, 1, 2, 0, 3]Failed

SHA-256 / 6964e73303d5b5105791b9a6a4cce315afa79a18cf50b4b05c7f1871e3ab3c86

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / b77ae1a341229a2e3ea7721a1231fde083579299e3e7a3ff1428d61586c42c55