FA-47146 / Bounded deques / Open access
Deque shrink reallocates while a storage borrow exists · case 01
Deque shrink reallocates while a storage borrow exists.
ROOT CAUSE
Deque shrink reallocates while a storage borrow exists.
VERIFIED REPAIR
Restore the documented pin barrier 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(minimum,max(size,cap//2))
allowed=size<=low and cap>minimum and True 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 | [8, True, 2, 5, 4, 7, 1] | [16, False, 1, 13, 4, 7, 1] | Failed |
| 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 / 7c8a2e595242fa8a19b8503780c525fae3f0e07e6eb0a36a63e4e557ff7047bc
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 or size<low) 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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 | [8, True, 2, 5, 4, 7, 1] | [16, False, 1, 13, 4, 7, 1] | Failed |
| 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 / 77c6a5ea2cb702cbb43f34e35ea39e01abce260662966108277722531d577682
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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.742518+00:00.
Case digest / be10b8b121f8eede31061bf5cddcb962ac8970da3412af9b7c4a55c09965e172