FA-47151 / Bounded deques / Open access
Deque shrink ignores post-shrink high watermark headroom · case 01
Deque shrink ignores post-shrink high watermark headroom.
ROOT CAUSE
Deque shrink ignores post-shrink high watermark headroom.
VERIFIED REPAIR
Restore the documented high watermark 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 not pins and target>=minimum
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 | [8, True, 2, 5, 4, 9, 0] | [16, False, 1, 13, 4, 9, 0] | Failed |
| 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 / acb3da6ea750c252d0d3514053055988ffef3cad98beec583c5cead2e6aa8075
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 or size<low)
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 | [8, True, 2, 5, 4, 9, 0] | [16, False, 1, 13, 4, 9, 0] | Failed |
| 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 / 58dd2f8bc29d0fe1f5c5eab563842df5ad6de919a14bbcb9abd51bdca067a1a5
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.771960+00:00.
Case digest / 740d7833766faca5b4e259cbdc719eead8a17f9dec6f6f9f85a115d0b17e7e39