FAILURE MAP
← Case archive

FA-46171 / Bounded deques / Open access

Permit allocator rejects a request that exactly fits · case 01

Permit allocator rejects a request that exactly fits.

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

ROOT CAUSE

Permit allocator rejects a request that exactly fits.

THE FAILURE

Permit allocator rejects a request that exactly fits.

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

Case contract

Bounded deque capacity includes live items and outstanding insertion permits. Grant a new permit only if it fits, then cancel one named permit and report the remaining permits and capacity.

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,size,claims,want,cancel=x
    reserved=sum(c[1] for c in claims)
    available=cap-size-reserved
    accepted=want<available
    active=claims+([['new',want]] if accepted else [])
    active=[c for c in active if c[0]!=cancel]
    free=cap-size-sum(c[1] for c in active)
    return [active,accepted,free]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserved blocks grant', solve([8,3,[["a",3]],3,"none"]), {1: [[['a', 3]], False, 2], 2: [[['a', 3]], False, 2], 3: [[['a', 3]], False, 2], 4: [[['a', 3]], False, 2], 5: [[['a', 3]], False, 2]}[N])
check('cancel existing', solve([9,2,[["a",2],["b",1]],2,"a"]), {1: [[['b', 1], ['new', 2]], True, 4], 2: [[['b', 1], ['new', 2]], True, 4], 3: [[['b', 1], ['new', 2]], True, 4], 4: [[['b', 1], ['new', 2]], True, 4], 5: [[['b', 1], ['new', 2]], True, 4]}[N])
check('cancel new', solve([7,2,[["a",1]],3,"new"]), {1: [[['a', 1]], True, 4], 2: [[['a', 1]], True, 4], 3: [[['a', 1]], True, 4], 4: [[['a', 1]], True, 4], 5: [[['a', 1]], True, 4]}[N])
check('exact available', solve([6,2,[["a",1]],3,"none"]), {1: [[['a', 1], ['new', 3]], True, 0], 2: [[['a', 1], ['new', 3]], True, 0], 3: [[['a', 1], ['new', 3]], True, 0], 4: [[['a', 1], ['new', 3]], True, 0], 5: [[['a', 1], ['new', 3]], True, 0]}[N])
check('no claims', solve([N+4,N,[],2,"none"]), {1: [[['new', 2]], True, 2], 2: [[['new', 2]], True, 2], 3: [[['new', 2]], True, 2], 4: [[['new', 2]], True, 2], 5: [[['new', 2]], True, 2]}[N])
check('zero permit', solve([4,4,[],0,"none"]), {1: [[['new', 0]], True, 0], 2: [[['new', 0]], True, 0], 3: [[['new', 0]], True, 0], 4: [[['new', 0]], True, 0], 5: [[['new', 0]], True, 0]}[N])
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
reserved blocks grant[[['a', 3]], False, 2][[['a', 3]], False, 2]Passed
cancel existing[[['b', 1], ['new', 2]], True, 4][[['b', 1], ['new', 2]], True, 4]Passed
cancel new[[['a', 1]], True, 4][[['a', 1]], True, 4]Passed
exact available[[['a', 1]], False, 3][[['a', 1], ['new', 3]], True, 0]Failed
no claims[[['new', 2]], True, 2][[['new', 2]], True, 2]Passed
zero permit[[], False, 0][[['new', 0]], True, 0]Failed

SHA-256 / f481cc46a6b44e8a2784cb111812e8a1f04e73244ec01aa9a6fb2263d57a1d2b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    cap,size,claims,want,cancel=x
    reserved=sum(c[1] for c in claims)
    available=cap-size-reserved
    accepted=want==0 or want<available
    active=claims+([['new',want]] if accepted else [])
    active=[c for c in active if c[0]!=cancel]
    free=cap-size-sum(c[1] for c in active)
    return [active,accepted,free]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserved blocks grant', solve([8,3,[["a",3]],3,"none"]), {1: [[['a', 3]], False, 2], 2: [[['a', 3]], False, 2], 3: [[['a', 3]], False, 2], 4: [[['a', 3]], False, 2], 5: [[['a', 3]], False, 2]}[N])
check('cancel existing', solve([9,2,[["a",2],["b",1]],2,"a"]), {1: [[['b', 1], ['new', 2]], True, 4], 2: [[['b', 1], ['new', 2]], True, 4], 3: [[['b', 1], ['new', 2]], True, 4], 4: [[['b', 1], ['new', 2]], True, 4], 5: [[['b', 1], ['new', 2]], True, 4]}[N])
check('cancel new', solve([7,2,[["a",1]],3,"new"]), {1: [[['a', 1]], True, 4], 2: [[['a', 1]], True, 4], 3: [[['a', 1]], True, 4], 4: [[['a', 1]], True, 4], 5: [[['a', 1]], True, 4]}[N])
check('exact available', solve([6,2,[["a",1]],3,"none"]), {1: [[['a', 1], ['new', 3]], True, 0], 2: [[['a', 1], ['new', 3]], True, 0], 3: [[['a', 1], ['new', 3]], True, 0], 4: [[['a', 1], ['new', 3]], True, 0], 5: [[['a', 1], ['new', 3]], True, 0]}[N])
check('no claims', solve([N+4,N,[],2,"none"]), {1: [[['new', 2]], True, 2], 2: [[['new', 2]], True, 2], 3: [[['new', 2]], True, 2], 4: [[['new', 2]], True, 2], 5: [[['new', 2]], True, 2]}[N])
check('zero permit', solve([4,4,[],0,"none"]), {1: [[['new', 0]], True, 0], 2: [[['new', 0]], True, 0], 3: [[['new', 0]], True, 0], 4: [[['new', 0]], True, 0], 5: [[['new', 0]], True, 0]}[N])
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
reserved blocks grant[[['a', 3]], False, 2][[['a', 3]], False, 2]Passed
cancel existing[[['b', 1], ['new', 2]], True, 4][[['b', 1], ['new', 2]], True, 4]Passed
cancel new[[['a', 1]], True, 4][[['a', 1]], True, 4]Passed
exact available[[['a', 1]], False, 3][[['a', 1], ['new', 3]], True, 0]Failed
no claims[[['new', 2]], True, 2][[['new', 2]], True, 2]Passed
zero permit[[['new', 0]], True, 0][[['new', 0]], True, 0]Passed

SHA-256 / 9b6833fd83c3903c3242218f5cb689ed8401ae981b6986ef8a155f121aeaece9

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

Case digest / c0ca2bc469b1ce4a38aa876113c53e8a92af63401946debfbc40e59566957d70