FAILURE MAP
← Case archive

FA-45926 / Bounded deques / Open access

Shrink keeps stale evicted references in free slots · case 01

Shrink keeps stale evicted references in free slots.

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

ROOT CAUSE

Vacant slots are not cleared to the stipulated null marker.

VERIFIED REPAIR

Restore the documented slack clear invariant in ring-shrink.

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 + [0] * (bound - len(kept))
    free = bound - len(kept)
    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 fixtureActualExpectedOutcome
drop oldest pair[[3, 4], [1, 2], [3, 4], 0][[3, 4], [1, 2], [3, 4], 0]Passed
zero bound[[], [1, 2], [], 0][[], [1, 2], [], 0]Passed
spare capacity[[1], [], [1, 0, 0], 2][[1], [], [1, None, None], 2]Failed
same bound[[1, 2], [], [1, 2], 0][[1, 2], [], [1, 2], 0]Passed
empty[[], [], [0, 0], 2][[], [], [None, None], 2]Failed
drop one of three[[2, 3], [1], [2, 3], 0][[2, 3], [1], [2, 3], 0]Passed

SHA-256 / 19bc9db53dccc452b61fec1b669508d879763a2da5c5551f043c4e7a50fa7d67

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 if not kept else kept[-1]] * (bound - len(kept))
    free = bound - len(kept)
    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 fixtureActualExpectedOutcome
drop oldest pair[[3, 4], [1, 2], [3, 4], 0][[3, 4], [1, 2], [3, 4], 0]Passed
zero bound[[], [1, 2], [], 0][[], [1, 2], [], 0]Passed
spare capacity[[1], [], [1, 1, 1], 2][[1], [], [1, None, None], 2]Failed
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], 0][[2, 3], [1], [2, 3], 0]Passed

SHA-256 / 0cf7ce009e4c7d128c9fabe296ef92066d8fff8b99598e2d3b8b9e88700ed19e

3 / The verified repair

Exit 0
"""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(kept)
    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 fixtureActualExpectedOutcome
drop oldest pair[[3, 4], [1, 2], [3, 4], 0][[3, 4], [1, 2], [3, 4], 0]Passed
zero bound[[], [1, 2], [], 0][[], [1, 2], [], 0]Passed
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], 0][[2, 3], [1], [2, 3], 0]Passed

SHA-256 / e177ee7c52852ab57671bec37ef4707a6a3004f09b1466111f2b41edb51aff2e

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

Case digest / 9d5a7e3a9f92a374eb3689b5cc1b1d87a056bfb5a1c08615ef359210f444af41