FA-46111 / Bounded deques / Open access
Weighted deque enforces element count as its weight · case 01
Weighted deque enforces element count as its weight.
ROOT CAUSE
Weighted deque enforces element count as its weight.
VERIFIED REPAIR
Restore the documented weight vs count invariant in weighted-eviction.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
Deque entries have nonnegative weights. Evict the shortest oldest prefix sufficient to satisfy the weight budget; preserve zero-weight entries unless preceding a required eviction. Return survivors, releases, weight and free budget.
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,budget=x
keep=items[:]
weight=len(keep)
dropped=[]
while weight>budget and keep:
victim=keep.pop(0)
dropped.append(victim)
weight-=victim[1]
return [keep,dropped,weight,budget-weight]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiple evictions', solve([[[N,3],[N+1,4],[N+2,2]],3]), {1: [[[3, 2]], [[1, 3], [2, 4]], 2, 1], 2: [[[4, 2]], [[2, 3], [3, 4]], 2, 1], 3: [[[5, 2]], [[3, 3], [4, 4]], 2, 1], 4: [[[6, 2]], [[4, 3], [5, 4]], 2, 1], 5: [[[7, 2]], [[5, 3], [6, 4]], 2, 1]}[N])
check('exact budget', solve([[[N,2],[N+1,3]],5]), {1: [[[1, 2], [2, 3]], [], 5, 0], 2: [[[2, 2], [3, 3]], [], 5, 0], 3: [[[3, 2], [4, 3]], [], 5, 0], 4: [[[4, 2], [5, 3]], [], 5, 0], 5: [[[5, 2], [6, 3]], [], 5, 0]}[N])
check('zero weights', solve([[[N,0],[N+1,4],[N+2,0]],0]), {1: [[[3, 0]], [[1, 0], [2, 4]], 0, 0], 2: [[[4, 0]], [[2, 0], [3, 4]], 0, 0], 3: [[[5, 0]], [[3, 0], [4, 4]], 0, 0], 4: [[[6, 0]], [[4, 0], [5, 4]], 0, 0], 5: [[[7, 0]], [[5, 0], [6, 4]], 0, 0]}[N])
check('empty', solve([[],4]), {1: [[], [], 0, 4], 2: [[], [], 0, 4], 3: [[], [], 0, 4], 4: [[], [], 0, 4], 5: [[], [], 0, 4]}[N])
check('retain suffix', solve([[[N,2],[N+1,1],[N+2,3]],4]), {1: [[[2, 1], [3, 3]], [[1, 2]], 4, 0], 2: [[[3, 1], [4, 3]], [[2, 2]], 4, 0], 3: [[[4, 1], [5, 3]], [[3, 2]], 4, 0], 4: [[[5, 1], [6, 3]], [[4, 2]], 4, 0], 5: [[[6, 1], [7, 3]], [[5, 2]], 4, 0]}[N])
check('heavy singleton', solve([[[N,8]],2]), {1: [[], [[1, 8]], 0, 2], 2: [[], [[2, 8]], 0, 2], 3: [[], [[3, 8]], 0, 2], 4: [[], [[4, 8]], 0, 2], 5: [[], [[5, 8]], 0, 2]}[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 |
|---|---|---|---|
| multiple evictions | [[[1, 3], [2, 4], [3, 2]], [], 3, 0] | [[[3, 2]], [[1, 3], [2, 4]], 2, 1] | Failed |
| exact budget | [[[1, 2], [2, 3]], [], 2, 3] | [[[1, 2], [2, 3]], [], 5, 0] | Failed |
| zero weights | [[[3, 0]], [[1, 0], [2, 4]], -1, 1] | [[[3, 0]], [[1, 0], [2, 4]], 0, 0] | Failed |
| empty | [[], [], 0, 4] | [[], [], 0, 4] | Passed |
| retain suffix | [[[1, 2], [2, 1], [3, 3]], [], 3, 1] | [[[2, 1], [3, 3]], [[1, 2]], 4, 0] | Failed |
| heavy singleton | [[[1, 8]], [], 1, 1] | [[], [[1, 8]], 0, 2] | Failed |
SHA-256 / 01607ad54cdcebb21482c987d3bd02f303948e57b8952dbe62d622e80cac079a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
items,budget=x
keep=items[:]
weight=sum(v[1] for v in keep) if len(keep)<2 else len(keep)
dropped=[]
while weight>budget and keep:
victim=keep.pop(0)
dropped.append(victim)
weight-=victim[1]
return [keep,dropped,weight,budget-weight]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiple evictions', solve([[[N,3],[N+1,4],[N+2,2]],3]), {1: [[[3, 2]], [[1, 3], [2, 4]], 2, 1], 2: [[[4, 2]], [[2, 3], [3, 4]], 2, 1], 3: [[[5, 2]], [[3, 3], [4, 4]], 2, 1], 4: [[[6, 2]], [[4, 3], [5, 4]], 2, 1], 5: [[[7, 2]], [[5, 3], [6, 4]], 2, 1]}[N])
check('exact budget', solve([[[N,2],[N+1,3]],5]), {1: [[[1, 2], [2, 3]], [], 5, 0], 2: [[[2, 2], [3, 3]], [], 5, 0], 3: [[[3, 2], [4, 3]], [], 5, 0], 4: [[[4, 2], [5, 3]], [], 5, 0], 5: [[[5, 2], [6, 3]], [], 5, 0]}[N])
check('zero weights', solve([[[N,0],[N+1,4],[N+2,0]],0]), {1: [[[3, 0]], [[1, 0], [2, 4]], 0, 0], 2: [[[4, 0]], [[2, 0], [3, 4]], 0, 0], 3: [[[5, 0]], [[3, 0], [4, 4]], 0, 0], 4: [[[6, 0]], [[4, 0], [5, 4]], 0, 0], 5: [[[7, 0]], [[5, 0], [6, 4]], 0, 0]}[N])
check('empty', solve([[],4]), {1: [[], [], 0, 4], 2: [[], [], 0, 4], 3: [[], [], 0, 4], 4: [[], [], 0, 4], 5: [[], [], 0, 4]}[N])
check('retain suffix', solve([[[N,2],[N+1,1],[N+2,3]],4]), {1: [[[2, 1], [3, 3]], [[1, 2]], 4, 0], 2: [[[3, 1], [4, 3]], [[2, 2]], 4, 0], 3: [[[4, 1], [5, 3]], [[3, 2]], 4, 0], 4: [[[5, 1], [6, 3]], [[4, 2]], 4, 0], 5: [[[6, 1], [7, 3]], [[5, 2]], 4, 0]}[N])
check('heavy singleton', solve([[[N,8]],2]), {1: [[], [[1, 8]], 0, 2], 2: [[], [[2, 8]], 0, 2], 3: [[], [[3, 8]], 0, 2], 4: [[], [[4, 8]], 0, 2], 5: [[], [[5, 8]], 0, 2]}[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 |
|---|---|---|---|
| multiple evictions | [[[1, 3], [2, 4], [3, 2]], [], 3, 0] | [[[3, 2]], [[1, 3], [2, 4]], 2, 1] | Failed |
| exact budget | [[[1, 2], [2, 3]], [], 2, 3] | [[[1, 2], [2, 3]], [], 5, 0] | Failed |
| zero weights | [[[3, 0]], [[1, 0], [2, 4]], -1, 1] | [[[3, 0]], [[1, 0], [2, 4]], 0, 0] | Failed |
| empty | [[], [], 0, 4] | [[], [], 0, 4] | Passed |
| retain suffix | [[[1, 2], [2, 1], [3, 3]], [], 3, 1] | [[[2, 1], [3, 3]], [[1, 2]], 4, 0] | Failed |
| heavy singleton | [[], [[1, 8]], 0, 2] | [[], [[1, 8]], 0, 2] | Passed |
SHA-256 / d90e4aec445bb3e1d7b99caba4e59e3d9542ecbe6f561f352efca14a7d1eba1c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
items,budget=x
keep=items[:]
weight=sum(v[1] for v in keep)
dropped=[]
while weight>budget and keep:
victim=keep.pop(0)
dropped.append(victim)
weight-=victim[1]
return [keep,dropped,weight,budget-weight]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('multiple evictions', solve([[[N,3],[N+1,4],[N+2,2]],3]), {1: [[[3, 2]], [[1, 3], [2, 4]], 2, 1], 2: [[[4, 2]], [[2, 3], [3, 4]], 2, 1], 3: [[[5, 2]], [[3, 3], [4, 4]], 2, 1], 4: [[[6, 2]], [[4, 3], [5, 4]], 2, 1], 5: [[[7, 2]], [[5, 3], [6, 4]], 2, 1]}[N])
check('exact budget', solve([[[N,2],[N+1,3]],5]), {1: [[[1, 2], [2, 3]], [], 5, 0], 2: [[[2, 2], [3, 3]], [], 5, 0], 3: [[[3, 2], [4, 3]], [], 5, 0], 4: [[[4, 2], [5, 3]], [], 5, 0], 5: [[[5, 2], [6, 3]], [], 5, 0]}[N])
check('zero weights', solve([[[N,0],[N+1,4],[N+2,0]],0]), {1: [[[3, 0]], [[1, 0], [2, 4]], 0, 0], 2: [[[4, 0]], [[2, 0], [3, 4]], 0, 0], 3: [[[5, 0]], [[3, 0], [4, 4]], 0, 0], 4: [[[6, 0]], [[4, 0], [5, 4]], 0, 0], 5: [[[7, 0]], [[5, 0], [6, 4]], 0, 0]}[N])
check('empty', solve([[],4]), {1: [[], [], 0, 4], 2: [[], [], 0, 4], 3: [[], [], 0, 4], 4: [[], [], 0, 4], 5: [[], [], 0, 4]}[N])
check('retain suffix', solve([[[N,2],[N+1,1],[N+2,3]],4]), {1: [[[2, 1], [3, 3]], [[1, 2]], 4, 0], 2: [[[3, 1], [4, 3]], [[2, 2]], 4, 0], 3: [[[4, 1], [5, 3]], [[3, 2]], 4, 0], 4: [[[5, 1], [6, 3]], [[4, 2]], 4, 0], 5: [[[6, 1], [7, 3]], [[5, 2]], 4, 0]}[N])
check('heavy singleton', solve([[[N,8]],2]), {1: [[], [[1, 8]], 0, 2], 2: [[], [[2, 8]], 0, 2], 3: [[], [[3, 8]], 0, 2], 4: [[], [[4, 8]], 0, 2], 5: [[], [[5, 8]], 0, 2]}[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 |
|---|---|---|---|
| multiple evictions | [[[3, 2]], [[1, 3], [2, 4]], 2, 1] | [[[3, 2]], [[1, 3], [2, 4]], 2, 1] | Passed |
| exact budget | [[[1, 2], [2, 3]], [], 5, 0] | [[[1, 2], [2, 3]], [], 5, 0] | Passed |
| zero weights | [[[3, 0]], [[1, 0], [2, 4]], 0, 0] | [[[3, 0]], [[1, 0], [2, 4]], 0, 0] | Passed |
| empty | [[], [], 0, 4] | [[], [], 0, 4] | Passed |
| retain suffix | [[[2, 1], [3, 3]], [[1, 2]], 4, 0] | [[[2, 1], [3, 3]], [[1, 2]], 4, 0] | Passed |
| heavy singleton | [[], [[1, 8]], 0, 2] | [[], [[1, 8]], 0, 2] | Passed |
SHA-256 / 057455ee2271685ee13d84aee6fd213f48ad858c337a2c8eea74ebcc1dc97eb8
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:28.941043+00:00.
Case digest / bf6310e1e4208ab838b7bfd7883a80095c32e1f4f62ab9af561ab46d79de5876