FAILURE MAP
← Case archive

FA-47161 / Bounded deques / Open access

Deque shrink retains pre-shrink free-slot accounting · case 01

Deque shrink retains pre-shrink free-slot accounting.

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

ROOT CAUSE

Deque shrink retains pre-shrink free-slot accounting.

THE FAILURE

Deque shrink retains pre-shrink free-slot accounting.

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

Case contract

A bounded deque shrinks by half, floored by live size and a minimum allocation, only at or below low occupancy, with no borrows and with resulting capacity at least the configured high watermark. Unchanged allocations keep epoch.

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,minimum,low,high,pins,epoch=x
    target=max(minimum,max(size,cap//2))
    allowed=size<=low and cap>minimum and not pins and target>=high
    capacity=target if allowed else cap
    version=epoch+allowed
    free=cap-size
    return [capacity,allowed,version,free,low,high,pins]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([16,3,4,4,7,0,N]), {1: [8, True, 2, 5, 4, 7, 0], 2: [8, True, 3, 5, 4, 7, 0], 3: [8, True, 4, 5, 4, 7, 0], 4: [8, True, 5, 5, 4, 7, 0], 5: [8, True, 6, 5, 4, 7, 0]}[N])
check('1', solve([16,4,4,4,8,0,N]), {1: [8, True, 2, 4, 4, 8, 0], 2: [8, True, 3, 4, 4, 8, 0], 3: [8, True, 4, 4, 4, 8, 0], 4: [8, True, 5, 4, 4, 8, 0], 5: [8, True, 6, 4, 4, 8, 0]}[N])
check('2', solve([16,3,4,4,9,0,N]), {1: [16, False, 1, 13, 4, 9, 0], 2: [16, False, 2, 13, 4, 9, 0], 3: [16, False, 3, 13, 4, 9, 0], 4: [16, False, 4, 13, 4, 9, 0], 5: [16, False, 5, 13, 4, 9, 0]}[N])
check('3', solve([16,3,4,4,7,1,N]), {1: [16, False, 1, 13, 4, 7, 1], 2: [16, False, 2, 13, 4, 7, 1], 3: [16, False, 3, 13, 4, 7, 1], 4: [16, False, 4, 13, 4, 7, 1], 5: [16, False, 5, 13, 4, 7, 1]}[N])
check('4', solve([4,1,4,2,2,0,N]), {1: [4, False, 1, 3, 2, 2, 0], 2: [4, False, 2, 3, 2, 2, 0], 3: [4, False, 3, 3, 2, 2, 0], 4: [4, False, 4, 3, 2, 2, 0], 5: [4, False, 5, 3, 2, 2, 0]}[N])
check('5', solve([12,7,4,8,6,0,N]), {1: [7, True, 2, 0, 8, 6, 0], 2: [7, True, 3, 0, 8, 6, 0], 3: [7, True, 4, 0, 8, 6, 0], 4: [7, True, 5, 0, 8, 6, 0], 5: [7, True, 6, 0, 8, 6, 0]}[N])
check('6', solve([12,2,8,3,7,0,N]), {1: [8, True, 2, 6, 3, 7, 0], 2: [8, True, 3, 6, 3, 7, 0], 3: [8, True, 4, 6, 3, 7, 0], 4: [8, True, 5, 6, 3, 7, 0], 5: [8, True, 6, 6, 3, 7, 0]}[N])
check('7', solve([16,5,4,4,6,0,N]), {1: [16, False, 1, 11, 4, 6, 0], 2: [16, False, 2, 11, 4, 6, 0], 3: [16, False, 3, 11, 4, 6, 0], 4: [16, False, 4, 11, 4, 6, 0], 5: [16, False, 5, 11, 4, 6, 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
0[8, True, 2, 13, 4, 7, 0][8, True, 2, 5, 4, 7, 0]Failed
1[8, True, 2, 12, 4, 8, 0][8, True, 2, 4, 4, 8, 0]Failed
2[16, False, 1, 13, 4, 9, 0][16, False, 1, 13, 4, 9, 0]Passed
3[16, False, 1, 13, 4, 7, 1][16, False, 1, 13, 4, 7, 1]Passed
4[4, False, 1, 3, 2, 2, 0][4, False, 1, 3, 2, 2, 0]Passed
5[7, True, 2, 5, 8, 6, 0][7, True, 2, 0, 8, 6, 0]Failed
6[8, True, 2, 10, 3, 7, 0][8, True, 2, 6, 3, 7, 0]Failed
7[16, False, 1, 11, 4, 6, 0][16, False, 1, 11, 4, 6, 0]Passed

SHA-256 / fbfccd0332e1788d5a390551d4f5e3c9cd9ce5e1e016c91527b78e4da1009068

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    cap,size,minimum,low,high,pins,epoch=x
    target=max(minimum,max(size,cap//2))
    allowed=size<=low and cap>minimum and not pins and target>=high
    capacity=target if allowed else cap
    version=epoch+allowed
    free=capacity-size if not allowed else cap-size
    return [capacity,allowed,version,free,low,high,pins]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([16,3,4,4,7,0,N]), {1: [8, True, 2, 5, 4, 7, 0], 2: [8, True, 3, 5, 4, 7, 0], 3: [8, True, 4, 5, 4, 7, 0], 4: [8, True, 5, 5, 4, 7, 0], 5: [8, True, 6, 5, 4, 7, 0]}[N])
check('1', solve([16,4,4,4,8,0,N]), {1: [8, True, 2, 4, 4, 8, 0], 2: [8, True, 3, 4, 4, 8, 0], 3: [8, True, 4, 4, 4, 8, 0], 4: [8, True, 5, 4, 4, 8, 0], 5: [8, True, 6, 4, 4, 8, 0]}[N])
check('2', solve([16,3,4,4,9,0,N]), {1: [16, False, 1, 13, 4, 9, 0], 2: [16, False, 2, 13, 4, 9, 0], 3: [16, False, 3, 13, 4, 9, 0], 4: [16, False, 4, 13, 4, 9, 0], 5: [16, False, 5, 13, 4, 9, 0]}[N])
check('3', solve([16,3,4,4,7,1,N]), {1: [16, False, 1, 13, 4, 7, 1], 2: [16, False, 2, 13, 4, 7, 1], 3: [16, False, 3, 13, 4, 7, 1], 4: [16, False, 4, 13, 4, 7, 1], 5: [16, False, 5, 13, 4, 7, 1]}[N])
check('4', solve([4,1,4,2,2,0,N]), {1: [4, False, 1, 3, 2, 2, 0], 2: [4, False, 2, 3, 2, 2, 0], 3: [4, False, 3, 3, 2, 2, 0], 4: [4, False, 4, 3, 2, 2, 0], 5: [4, False, 5, 3, 2, 2, 0]}[N])
check('5', solve([12,7,4,8,6,0,N]), {1: [7, True, 2, 0, 8, 6, 0], 2: [7, True, 3, 0, 8, 6, 0], 3: [7, True, 4, 0, 8, 6, 0], 4: [7, True, 5, 0, 8, 6, 0], 5: [7, True, 6, 0, 8, 6, 0]}[N])
check('6', solve([12,2,8,3,7,0,N]), {1: [8, True, 2, 6, 3, 7, 0], 2: [8, True, 3, 6, 3, 7, 0], 3: [8, True, 4, 6, 3, 7, 0], 4: [8, True, 5, 6, 3, 7, 0], 5: [8, True, 6, 6, 3, 7, 0]}[N])
check('7', solve([16,5,4,4,6,0,N]), {1: [16, False, 1, 11, 4, 6, 0], 2: [16, False, 2, 11, 4, 6, 0], 3: [16, False, 3, 11, 4, 6, 0], 4: [16, False, 4, 11, 4, 6, 0], 5: [16, False, 5, 11, 4, 6, 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
0[8, True, 2, 13, 4, 7, 0][8, True, 2, 5, 4, 7, 0]Failed
1[8, True, 2, 12, 4, 8, 0][8, True, 2, 4, 4, 8, 0]Failed
2[16, False, 1, 13, 4, 9, 0][16, False, 1, 13, 4, 9, 0]Passed
3[16, False, 1, 13, 4, 7, 1][16, False, 1, 13, 4, 7, 1]Passed
4[4, False, 1, 3, 2, 2, 0][4, False, 1, 3, 2, 2, 0]Passed
5[7, True, 2, 5, 8, 6, 0][7, True, 2, 0, 8, 6, 0]Failed
6[8, True, 2, 10, 3, 7, 0][8, True, 2, 6, 3, 7, 0]Failed
7[16, False, 1, 11, 4, 6, 0][16, False, 1, 11, 4, 6, 0]Passed

SHA-256 / ccdb979f2afcd451c4b383eb5357a0b9340f1df6f1f51981dd2faa3dd7ed5888

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 8 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:38.899452+00:00.

Case digest / 7548cbd5aa0986db5ad02329beb2bfd0b7b9b37dc3f29e66a8012597ea542078