FAILURE MAP
← Case archive

FA-47236 / Bounded deques / Open access

Deque scatter drain reapplies full budget to every segment · case 01

Deque scatter drain reapplies full budget to every segment.

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

ROOT CAUSE

Deque scatter drain reapplies full budget to every segment.

VERIFIED REPAIR

Restore the documented remaining limit invariant in segmented-drain.

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

Case contract

Drain a bounded deque into caller-provided segment capacities, respecting a total delivery limit. Stop at the first zero-length segment, exhausted input or exhausted limit. Preserve undispatched suffix and report consumed count and unused total 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):
    a,capacities,limit=x
    segments=[]
    position=0
    for room in capacities:
        count=min(room,len(a)-position,limit)
        if count<=0:break
        segment=a[position:position+count]
        segments.append(segment)
        position+=count
    remaining=a[position:]
    return [segments,remaining,position,len(segments),limit-position]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2,N+3,N+4],[2,2,2],4]), {1: [[[1, 2], [3, 4]], [5], 4, 2, 0], 2: [[[2, 3], [4, 5]], [6], 4, 2, 0], 3: [[[3, 4], [5, 6]], [7], 4, 2, 0], 4: [[[4, 5], [6, 7]], [8], 4, 2, 0], 5: [[[5, 6], [7, 8]], [9], 4, 2, 0]}[N])
check('1', solve([[N,N+1,N+2],[1,0,2],3]), {1: [[[1]], [2, 3], 1, 1, 2], 2: [[[2]], [3, 4], 1, 1, 2], 3: [[[3]], [4, 5], 1, 1, 2], 4: [[[4]], [5, 6], 1, 1, 2], 5: [[[5]], [6, 7], 1, 1, 2]}[N])
check('2', solve([[N,N+1],[4,2],6]), {1: [[[1, 2]], [], 2, 1, 4], 2: [[[2, 3]], [], 2, 1, 4], 3: [[[3, 4]], [], 2, 1, 4], 4: [[[4, 5]], [], 2, 1, 4], 5: [[[5, 6]], [], 2, 1, 4]}[N])
check('3', solve([[],[2],3]), {1: [[], [], 0, 0, 3], 2: [[], [], 0, 0, 3], 3: [[], [], 0, 0, 3], 4: [[], [], 0, 0, 3], 5: [[], [], 0, 0, 3]}[N])
check('4', solve([[N,N+1],[1,2],0]), {1: [[], [1, 2], 0, 0, 0], 2: [[], [2, 3], 0, 0, 0], 3: [[], [3, 4], 0, 0, 0], 4: [[], [4, 5], 0, 0, 0], 5: [[], [5, 6], 0, 0, 0]}[N])
check('5', solve([[N,N+1,N+2,N+3],[1,2,1],4]), {1: [[[1], [2, 3], [4]], [], 4, 3, 0], 2: [[[2], [3, 4], [5]], [], 4, 3, 0], 3: [[[3], [4, 5], [6]], [], 4, 3, 0], 4: [[[4], [5, 6], [7]], [], 4, 3, 0], 5: [[[5], [6, 7], [8]], [], 4, 3, 0]}[N])
check('6', solve([[N,N+1],[1,1],3]), {1: [[[1], [2]], [], 2, 2, 1], 2: [[[2], [3]], [], 2, 2, 1], 3: [[[3], [4]], [], 2, 2, 1], 4: [[[4], [5]], [], 2, 2, 1], 5: [[[5], [6]], [], 2, 2, 1]}[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[[[1, 2], [3, 4], [5]], [], 5, 3, -1][[[1, 2], [3, 4]], [5], 4, 2, 0]Failed
1[[[1]], [2, 3], 1, 1, 2][[[1]], [2, 3], 1, 1, 2]Passed
2[[[1, 2]], [], 2, 1, 4][[[1, 2]], [], 2, 1, 4]Passed
3[[], [], 0, 0, 3][[], [], 0, 0, 3]Passed
4[[], [1, 2], 0, 0, 0][[], [1, 2], 0, 0, 0]Passed
5[[[1], [2, 3], [4]], [], 4, 3, 0][[[1], [2, 3], [4]], [], 4, 3, 0]Passed
6[[[1], [2]], [], 2, 2, 1][[[1], [2]], [], 2, 2, 1]Passed

SHA-256 / 55656cc347b5a41e883ec762a515173aea8edba00076c87b5fedebcb55297a5b

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    a,capacities,limit=x
    segments=[]
    position=0
    for room in capacities:
        count=min(room,len(a)-position,limit-position if position==0 else limit)
        if count<=0:break
        segment=a[position:position+count]
        segments.append(segment)
        position+=count
    remaining=a[position:]
    return [segments,remaining,position,len(segments),limit-position]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2,N+3,N+4],[2,2,2],4]), {1: [[[1, 2], [3, 4]], [5], 4, 2, 0], 2: [[[2, 3], [4, 5]], [6], 4, 2, 0], 3: [[[3, 4], [5, 6]], [7], 4, 2, 0], 4: [[[4, 5], [6, 7]], [8], 4, 2, 0], 5: [[[5, 6], [7, 8]], [9], 4, 2, 0]}[N])
check('1', solve([[N,N+1,N+2],[1,0,2],3]), {1: [[[1]], [2, 3], 1, 1, 2], 2: [[[2]], [3, 4], 1, 1, 2], 3: [[[3]], [4, 5], 1, 1, 2], 4: [[[4]], [5, 6], 1, 1, 2], 5: [[[5]], [6, 7], 1, 1, 2]}[N])
check('2', solve([[N,N+1],[4,2],6]), {1: [[[1, 2]], [], 2, 1, 4], 2: [[[2, 3]], [], 2, 1, 4], 3: [[[3, 4]], [], 2, 1, 4], 4: [[[4, 5]], [], 2, 1, 4], 5: [[[5, 6]], [], 2, 1, 4]}[N])
check('3', solve([[],[2],3]), {1: [[], [], 0, 0, 3], 2: [[], [], 0, 0, 3], 3: [[], [], 0, 0, 3], 4: [[], [], 0, 0, 3], 5: [[], [], 0, 0, 3]}[N])
check('4', solve([[N,N+1],[1,2],0]), {1: [[], [1, 2], 0, 0, 0], 2: [[], [2, 3], 0, 0, 0], 3: [[], [3, 4], 0, 0, 0], 4: [[], [4, 5], 0, 0, 0], 5: [[], [5, 6], 0, 0, 0]}[N])
check('5', solve([[N,N+1,N+2,N+3],[1,2,1],4]), {1: [[[1], [2, 3], [4]], [], 4, 3, 0], 2: [[[2], [3, 4], [5]], [], 4, 3, 0], 3: [[[3], [4, 5], [6]], [], 4, 3, 0], 4: [[[4], [5, 6], [7]], [], 4, 3, 0], 5: [[[5], [6, 7], [8]], [], 4, 3, 0]}[N])
check('6', solve([[N,N+1],[1,1],3]), {1: [[[1], [2]], [], 2, 2, 1], 2: [[[2], [3]], [], 2, 2, 1], 3: [[[3], [4]], [], 2, 2, 1], 4: [[[4], [5]], [], 2, 2, 1], 5: [[[5], [6]], [], 2, 2, 1]}[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[[[1, 2], [3, 4], [5]], [], 5, 3, -1][[[1, 2], [3, 4]], [5], 4, 2, 0]Failed
1[[[1]], [2, 3], 1, 1, 2][[[1]], [2, 3], 1, 1, 2]Passed
2[[[1, 2]], [], 2, 1, 4][[[1, 2]], [], 2, 1, 4]Passed
3[[], [], 0, 0, 3][[], [], 0, 0, 3]Passed
4[[], [1, 2], 0, 0, 0][[], [1, 2], 0, 0, 0]Passed
5[[[1], [2, 3], [4]], [], 4, 3, 0][[[1], [2, 3], [4]], [], 4, 3, 0]Passed
6[[[1], [2]], [], 2, 2, 1][[[1], [2]], [], 2, 2, 1]Passed

SHA-256 / cbf1f4b384dadccd518dba8e27d1e3def23045a1d7dd31a192b737c4a1658b20

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    a,capacities,limit=x
    segments=[]
    position=0
    for room in capacities:
        count=min(room,len(a)-position,limit-position)
        if count<=0:break
        segment=a[position:position+count]
        segments.append(segment)
        position+=count
    remaining=a[position:]
    return [segments,remaining,position,len(segments),limit-position]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('0', solve([[N,N+1,N+2,N+3,N+4],[2,2,2],4]), {1: [[[1, 2], [3, 4]], [5], 4, 2, 0], 2: [[[2, 3], [4, 5]], [6], 4, 2, 0], 3: [[[3, 4], [5, 6]], [7], 4, 2, 0], 4: [[[4, 5], [6, 7]], [8], 4, 2, 0], 5: [[[5, 6], [7, 8]], [9], 4, 2, 0]}[N])
check('1', solve([[N,N+1,N+2],[1,0,2],3]), {1: [[[1]], [2, 3], 1, 1, 2], 2: [[[2]], [3, 4], 1, 1, 2], 3: [[[3]], [4, 5], 1, 1, 2], 4: [[[4]], [5, 6], 1, 1, 2], 5: [[[5]], [6, 7], 1, 1, 2]}[N])
check('2', solve([[N,N+1],[4,2],6]), {1: [[[1, 2]], [], 2, 1, 4], 2: [[[2, 3]], [], 2, 1, 4], 3: [[[3, 4]], [], 2, 1, 4], 4: [[[4, 5]], [], 2, 1, 4], 5: [[[5, 6]], [], 2, 1, 4]}[N])
check('3', solve([[],[2],3]), {1: [[], [], 0, 0, 3], 2: [[], [], 0, 0, 3], 3: [[], [], 0, 0, 3], 4: [[], [], 0, 0, 3], 5: [[], [], 0, 0, 3]}[N])
check('4', solve([[N,N+1],[1,2],0]), {1: [[], [1, 2], 0, 0, 0], 2: [[], [2, 3], 0, 0, 0], 3: [[], [3, 4], 0, 0, 0], 4: [[], [4, 5], 0, 0, 0], 5: [[], [5, 6], 0, 0, 0]}[N])
check('5', solve([[N,N+1,N+2,N+3],[1,2,1],4]), {1: [[[1], [2, 3], [4]], [], 4, 3, 0], 2: [[[2], [3, 4], [5]], [], 4, 3, 0], 3: [[[3], [4, 5], [6]], [], 4, 3, 0], 4: [[[4], [5, 6], [7]], [], 4, 3, 0], 5: [[[5], [6, 7], [8]], [], 4, 3, 0]}[N])
check('6', solve([[N,N+1],[1,1],3]), {1: [[[1], [2]], [], 2, 2, 1], 2: [[[2], [3]], [], 2, 2, 1], 3: [[[3], [4]], [], 2, 2, 1], 4: [[[4], [5]], [], 2, 2, 1], 5: [[[5], [6]], [], 2, 2, 1]}[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[[[1, 2], [3, 4]], [5], 4, 2, 0][[[1, 2], [3, 4]], [5], 4, 2, 0]Passed
1[[[1]], [2, 3], 1, 1, 2][[[1]], [2, 3], 1, 1, 2]Passed
2[[[1, 2]], [], 2, 1, 4][[[1, 2]], [], 2, 1, 4]Passed
3[[], [], 0, 0, 3][[], [], 0, 0, 3]Passed
4[[], [1, 2], 0, 0, 0][[], [1, 2], 0, 0, 0]Passed
5[[[1], [2, 3], [4]], [], 4, 3, 0][[[1], [2, 3], [4]], [], 4, 3, 0]Passed
6[[[1], [2]], [], 2, 2, 1][[[1], [2]], [], 2, 2, 1]Passed

SHA-256 / 65f1b933eadc060bf6da4f1dcc29c02366d11963d7e09e0f459ee62b87696f14

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

Case digest / 866224dabc12fd7df06a1d172d20289734a7ac23aaaf0b901f1f5a7b0ebc8aa6