FAILURE MAP
← Case archive

FA-47131 / Bounded deques / Open access

Deque shrink ignores the minimum backing allocation · case 01

Deque shrink ignores the minimum backing allocation.

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

ROOT CAUSE

Deque shrink ignores the minimum backing allocation.

VERIFIED REPAIR

Restore the documented allocation floor invariant in shrink-hysteresis.

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(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
    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, 5, 4, 7, 0][8, True, 2, 5, 4, 7, 0]Passed
1[8, True, 2, 4, 4, 8, 0][8, True, 2, 4, 4, 8, 0]Passed
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, 0, 8, 6, 0][7, True, 2, 0, 8, 6, 0]Passed
6[12, False, 1, 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 / 6709bc4d04d4af4967f58a920d12e736c2d70e0b428ece738aa3d80ac9939e4e

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)) if size>minimum else 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
    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, 5, 4, 7, 0][8, True, 2, 5, 4, 7, 0]Passed
1[8, True, 2, 4, 4, 8, 0][8, True, 2, 4, 4, 8, 0]Passed
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, 0, 8, 6, 0][7, True, 2, 0, 8, 6, 0]Passed
6[12, False, 1, 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 / 809bb7d662bff824479e4552d87381aa68740f7dbc692c66ec53f6b7077060a0

3 / The verified repair

Exit 0
"""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
    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, 5, 4, 7, 0][8, True, 2, 5, 4, 7, 0]Passed
1[8, True, 2, 4, 4, 8, 0][8, True, 2, 4, 4, 8, 0]Passed
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, 0, 8, 6, 0][7, True, 2, 0, 8, 6, 0]Passed
6[8, True, 2, 6, 3, 7, 0][8, True, 2, 6, 3, 7, 0]Passed
7[16, False, 1, 11, 4, 6, 0][16, False, 1, 11, 4, 6, 0]Passed

SHA-256 / c62e80d93b4e73aede69140174f127703762da34f36904ccee3ba0505734b7ca

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

Case digest / 6336fe87070694b75bb15d79e246a04e52cb742aa3d6f731b7fbee290fbeca66