FA-45931 / Bounded deques / Open access
Shrink decrements available capacity by pre-shrink occupancy · case 01
Shrink decrements available capacity by pre-shrink occupancy.
ROOT CAUSE
Free capacity is based on released entries as if they remained live.
THE FAILURE
Free capacity is based on released entries as if they remained live.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
Shrink an occupied logical deque to a smaller bound, retaining the newest suffix. Return retained values, evicted prefix, a linear backing allocation, and free 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):
items, bound = x
lost = max(0, len(items) - bound)
evicted = items[:lost]
kept = items[lost:]
slots = kept + [None] * (bound - len(kept))
free = bound - len(items)
return [kept, evicted, slots, free]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('drop oldest pair', solve([[N,N+1,N+2,N+3],2]), [[N+2,N+3],[N,N+1],[N+2,N+3],0])
check('zero bound', solve([[N,N+1],0]), [[],[N,N+1],[],0])
check('spare capacity', solve([[N],3]), [[N],[],[N,None,None],2])
check('same bound', solve([[N,N+1],2]), [[N,N+1],[],[N,N+1],0])
check('empty', solve([[],2]), [[],[],[None,None],2])
check('drop one of three', solve([[N,N+1,N+2],2]), [[N+1,N+2],[N],[N+1,N+2],0])
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 |
|---|---|---|---|
| drop oldest pair | [[3, 4], [1, 2], [3, 4], -2] | [[3, 4], [1, 2], [3, 4], 0] | Failed |
| zero bound | [[], [1, 2], [], -2] | [[], [1, 2], [], 0] | Failed |
| spare capacity | [[1], [], [1, None, None], 2] | [[1], [], [1, None, None], 2] | Passed |
| same bound | [[1, 2], [], [1, 2], 0] | [[1, 2], [], [1, 2], 0] | Passed |
| empty | [[], [], [None, None], 2] | [[], [], [None, None], 2] | Passed |
| drop one of three | [[2, 3], [1], [2, 3], -1] | [[2, 3], [1], [2, 3], 0] | Failed |
SHA-256 / c29d27245695afbd9056b02fe6bd96da931dc84a6f3296d17cebb97aef2da2a9
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
items, bound = x
lost = max(0, len(items) - bound)
evicted = items[:lost]
kept = items[lost:]
slots = kept + [None] * (bound - len(kept))
free = max(0, bound - len(items)) + lost
return [kept, evicted, slots, free]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('drop oldest pair', solve([[N,N+1,N+2,N+3],2]), [[N+2,N+3],[N,N+1],[N+2,N+3],0])
check('zero bound', solve([[N,N+1],0]), [[],[N,N+1],[],0])
check('spare capacity', solve([[N],3]), [[N],[],[N,None,None],2])
check('same bound', solve([[N,N+1],2]), [[N,N+1],[],[N,N+1],0])
check('empty', solve([[],2]), [[],[],[None,None],2])
check('drop one of three', solve([[N,N+1,N+2],2]), [[N+1,N+2],[N],[N+1,N+2],0])
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 |
|---|---|---|---|
| drop oldest pair | [[3, 4], [1, 2], [3, 4], 2] | [[3, 4], [1, 2], [3, 4], 0] | Failed |
| zero bound | [[], [1, 2], [], 2] | [[], [1, 2], [], 0] | Failed |
| spare capacity | [[1], [], [1, None, None], 2] | [[1], [], [1, None, None], 2] | Passed |
| same bound | [[1, 2], [], [1, 2], 0] | [[1, 2], [], [1, 2], 0] | Passed |
| empty | [[], [], [None, None], 2] | [[], [], [None, None], 2] | Passed |
| drop one of three | [[2, 3], [1], [2, 3], 1] | [[2, 3], [1], [2, 3], 0] | Failed |
SHA-256 / b8f5b78c788caa475c898830117ae7e34a74abe7a4446a6fdb4b1ee1cd3eff51
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:27.153197+00:00.
Case digest / 9bb6bef36c19512d7aebf2ddc979b6ef17f27e83172bf705645ee2f91ac2e706