FAILURE MAP
← Case archive

FA-46271 / Bounded deques / Open access

Zip drain clears unmatched left entries · case 01

Zip drain clears unmatched left entries.

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

ROOT CAUSE

Zip drain clears unmatched left entries.

VERIFIED REPAIR

Restore the documented left remainder invariant in zip-drain.

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

Case contract

Consume paired entries from two bounded deques up to a limit, preserving each unmatched suffix. Return pairs, both remainders and pair count.

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,b,limit=x
    count=min(len(a),len(b),limit)
    pairs=[[a[i],b[i]] for i in range(count)]
    left=[]
    right=b[count:]
    return [pairs,left,right,count]
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],3]), {1: [[[1, 4], [2, 5]], [3], [], 2], 2: [[[2, 5], [3, 6]], [4], [], 2], 3: [[[3, 6], [4, 7]], [5], [], 2], 4: [[[4, 7], [5, 8]], [6], [], 2], 5: [[[5, 8], [6, 9]], [7], [], 2]}[N])
check('1', solve([[N],[N+1,N+2],3]), {1: [[[1, 2]], [], [3], 1], 2: [[[2, 3]], [], [4], 1], 3: [[[3, 4]], [], [5], 1], 4: [[[4, 5]], [], [6], 1], 5: [[[5, 6]], [], [7], 1]}[N])
check('2', solve([[N,N+1],[N+2,N+3],1]), {1: [[[1, 3]], [2], [4], 1], 2: [[[2, 4]], [3], [5], 1], 3: [[[3, 5]], [4], [6], 1], 4: [[[4, 6]], [5], [7], 1], 5: [[[5, 7]], [6], [8], 1]}[N])
check('3', solve([[],[N],2]), {1: [[], [], [1], 0], 2: [[], [], [2], 0], 3: [[], [], [3], 0], 4: [[], [], [4], 0], 5: [[], [], [5], 0]}[N])
check('4', solve([[N],[],2]), {1: [[], [1], [], 0], 2: [[], [2], [], 0], 3: [[], [3], [], 0], 4: [[], [4], [], 0], 5: [[], [5], [], 0]}[N])
check('5', solve([[N,N+1],[N+2,N+3],0]), {1: [[], [1, 2], [3, 4], 0], 2: [[], [2, 3], [4, 5], 0], 3: [[], [3, 4], [5, 6], 0], 4: [[], [4, 5], [6, 7], 0], 5: [[], [5, 6], [7, 8], 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[[[1, 4], [2, 5]], [], [], 2][[[1, 4], [2, 5]], [3], [], 2]Failed
1[[[1, 2]], [], [3], 1][[[1, 2]], [], [3], 1]Passed
2[[[1, 3]], [], [4], 1][[[1, 3]], [2], [4], 1]Failed
3[[], [], [1], 0][[], [], [1], 0]Passed
4[[], [], [], 0][[], [1], [], 0]Failed
5[[], [], [3, 4], 0][[], [1, 2], [3, 4], 0]Failed

SHA-256 / 7b74165f7da1a41b3f81eb6e8078b28e9971ee8e480dd05a1bd5d45652f45b82

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    a,b,limit=x
    count=min(len(a),len(b),limit)
    pairs=[[a[i],b[i]] for i in range(count)]
    left=a[count:] if count==0 else []
    right=b[count:]
    return [pairs,left,right,count]
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],3]), {1: [[[1, 4], [2, 5]], [3], [], 2], 2: [[[2, 5], [3, 6]], [4], [], 2], 3: [[[3, 6], [4, 7]], [5], [], 2], 4: [[[4, 7], [5, 8]], [6], [], 2], 5: [[[5, 8], [6, 9]], [7], [], 2]}[N])
check('1', solve([[N],[N+1,N+2],3]), {1: [[[1, 2]], [], [3], 1], 2: [[[2, 3]], [], [4], 1], 3: [[[3, 4]], [], [5], 1], 4: [[[4, 5]], [], [6], 1], 5: [[[5, 6]], [], [7], 1]}[N])
check('2', solve([[N,N+1],[N+2,N+3],1]), {1: [[[1, 3]], [2], [4], 1], 2: [[[2, 4]], [3], [5], 1], 3: [[[3, 5]], [4], [6], 1], 4: [[[4, 6]], [5], [7], 1], 5: [[[5, 7]], [6], [8], 1]}[N])
check('3', solve([[],[N],2]), {1: [[], [], [1], 0], 2: [[], [], [2], 0], 3: [[], [], [3], 0], 4: [[], [], [4], 0], 5: [[], [], [5], 0]}[N])
check('4', solve([[N],[],2]), {1: [[], [1], [], 0], 2: [[], [2], [], 0], 3: [[], [3], [], 0], 4: [[], [4], [], 0], 5: [[], [5], [], 0]}[N])
check('5', solve([[N,N+1],[N+2,N+3],0]), {1: [[], [1, 2], [3, 4], 0], 2: [[], [2, 3], [4, 5], 0], 3: [[], [3, 4], [5, 6], 0], 4: [[], [4, 5], [6, 7], 0], 5: [[], [5, 6], [7, 8], 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[[[1, 4], [2, 5]], [], [], 2][[[1, 4], [2, 5]], [3], [], 2]Failed
1[[[1, 2]], [], [3], 1][[[1, 2]], [], [3], 1]Passed
2[[[1, 3]], [], [4], 1][[[1, 3]], [2], [4], 1]Failed
3[[], [], [1], 0][[], [], [1], 0]Passed
4[[], [1], [], 0][[], [1], [], 0]Passed
5[[], [1, 2], [3, 4], 0][[], [1, 2], [3, 4], 0]Passed

SHA-256 / 54266dc681d1bb541584fd0c5915b5416bd57615c7b2b8706c38b9e1c03aef4d

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    a,b,limit=x
    count=min(len(a),len(b),limit)
    pairs=[[a[i],b[i]] for i in range(count)]
    left=a[count:]
    right=b[count:]
    return [pairs,left,right,count]
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],3]), {1: [[[1, 4], [2, 5]], [3], [], 2], 2: [[[2, 5], [3, 6]], [4], [], 2], 3: [[[3, 6], [4, 7]], [5], [], 2], 4: [[[4, 7], [5, 8]], [6], [], 2], 5: [[[5, 8], [6, 9]], [7], [], 2]}[N])
check('1', solve([[N],[N+1,N+2],3]), {1: [[[1, 2]], [], [3], 1], 2: [[[2, 3]], [], [4], 1], 3: [[[3, 4]], [], [5], 1], 4: [[[4, 5]], [], [6], 1], 5: [[[5, 6]], [], [7], 1]}[N])
check('2', solve([[N,N+1],[N+2,N+3],1]), {1: [[[1, 3]], [2], [4], 1], 2: [[[2, 4]], [3], [5], 1], 3: [[[3, 5]], [4], [6], 1], 4: [[[4, 6]], [5], [7], 1], 5: [[[5, 7]], [6], [8], 1]}[N])
check('3', solve([[],[N],2]), {1: [[], [], [1], 0], 2: [[], [], [2], 0], 3: [[], [], [3], 0], 4: [[], [], [4], 0], 5: [[], [], [5], 0]}[N])
check('4', solve([[N],[],2]), {1: [[], [1], [], 0], 2: [[], [2], [], 0], 3: [[], [3], [], 0], 4: [[], [4], [], 0], 5: [[], [5], [], 0]}[N])
check('5', solve([[N,N+1],[N+2,N+3],0]), {1: [[], [1, 2], [3, 4], 0], 2: [[], [2, 3], [4, 5], 0], 3: [[], [3, 4], [5, 6], 0], 4: [[], [4, 5], [6, 7], 0], 5: [[], [5, 6], [7, 8], 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[[[1, 4], [2, 5]], [3], [], 2][[[1, 4], [2, 5]], [3], [], 2]Passed
1[[[1, 2]], [], [3], 1][[[1, 2]], [], [3], 1]Passed
2[[[1, 3]], [2], [4], 1][[[1, 3]], [2], [4], 1]Passed
3[[], [], [1], 0][[], [], [1], 0]Passed
4[[], [1], [], 0][[], [1], [], 0]Passed
5[[], [1, 2], [3, 4], 0][[], [1, 2], [3, 4], 0]Passed

SHA-256 / eb7c7c21783fed8c59e134e974a1ee28f5c6a5b7a37e363dc380e10e8b58b10c

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

Case digest / eb00aeaa0583bd6112551676d42cb03b2efeda89ca73b5b37837b236136ccb47