FA-46266 / Bounded deques / Open access
Zip drain pairs opposite-end entries · case 01
Zip drain pairs opposite-end entries.
ROOT CAUSE
Zip drain pairs opposite-end entries.
VERIFIED REPAIR
Restore the documented pair association 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-1]] 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 0 | [[[1, 5], [2, 4]], [3], [], 2] | [[[1, 4], [2, 5]], [3], [], 2] | Failed |
| 1 | [[[1, 3]], [], [3], 1] | [[[1, 2]], [], [3], 1] | Failed |
| 2 | [[[1, 4]], [2], [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 / 4ae2c68b7740104c6dbb8f25e1d4f03b2d9fede55e4d018ea7ab2af0a381b946
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 if count==1 else -i-1]] 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 0 | [[[1, 5], [2, 4]], [3], [], 2] | [[[1, 4], [2, 5]], [3], [], 2] | Failed |
| 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 / 83ff56e404ce7e7f62310ad4b3ed72338841e91bc34970ce87318380f3c05bc5
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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.511557+00:00.
Case digest / 4f9c424d98cb8fd1863795c23c874918e38503678769f0be062da3f3351e54ed