FA-46666 / Bounded deques / Open access
Deque iterator rereads the beginning on subsequent batches · case 01
Deque iterator rereads the beginning on subsequent batches.
ROOT CAUSE
Deque iterator rereads the beginning on subsequent batches.
THE FAILURE
Deque iterator rereads the beginning on subsequent batches.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
A fail-fast deque iterator tracks consumed logical count, captured structural epoch and traversal direction. Read at most limit elements; stale iterators emit no items and preserve position.
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,pos,limit,saved,current,reverse=x
if saved!=current:return ['stale',pos,[],saved]
remaining=max(0,len(a)-pos)
count=min(limit,remaining)
sequence=a[::-1] if reverse else a
values=sequence[:count]
next_pos=pos+count
return ['ok',next_pos,values,saved]
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],1,2,3,3,False]), {1: ['ok', 3, [2, 3], 3], 2: ['ok', 3, [3, 4], 3], 3: ['ok', 3, [4, 5], 3], 4: ['ok', 3, [5, 6], 3], 5: ['ok', 3, [6, 7], 3]}[N])
check('1', solve([[N,N+1,N+2],0,2,2,2,True]), {1: ['ok', 2, [3, 2], 2], 2: ['ok', 2, [4, 3], 2], 3: ['ok', 2, [5, 4], 2], 4: ['ok', 2, [6, 5], 2], 5: ['ok', 2, [7, 6], 2]}[N])
check('2', solve([[N,N+1],1,5,4,4,False]), {1: ['ok', 2, [2], 4], 2: ['ok', 2, [3], 4], 3: ['ok', 2, [4], 4], 4: ['ok', 2, [5], 4], 5: ['ok', 2, [6], 4]}[N])
check('3', solve([[N],0,3,1,2,False]), {1: ['stale', 0, [], 1], 2: ['stale', 0, [], 1], 3: ['stale', 0, [], 1], 4: ['stale', 0, [], 1], 5: ['stale', 0, [], 1]}[N])
check('4', solve([[],0,2,0,0,True]), {1: ['ok', 0, [], 0], 2: ['ok', 0, [], 0], 3: ['ok', 0, [], 0], 4: ['ok', 0, [], 0], 5: ['ok', 0, [], 0]}[N])
check('5', solve([[N,N+1],1,0,5,5,True]), {1: ['ok', 1, [], 5], 2: ['ok', 1, [], 5], 3: ['ok', 1, [], 5], 4: ['ok', 1, [], 5], 5: ['ok', 1, [], 5]}[N])
check('6', solve([[N,N+1],0,1,3,2,False]), {1: ['stale', 0, [], 3], 2: ['stale', 0, [], 3], 3: ['stale', 0, [], 3], 4: ['stale', 0, [], 3], 5: ['stale', 0, [], 3]}[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 | ['ok', 3, [1, 2], 3] | ['ok', 3, [2, 3], 3] | Failed |
| 1 | ['ok', 2, [3, 2], 2] | ['ok', 2, [3, 2], 2] | Passed |
| 2 | ['ok', 2, [1], 4] | ['ok', 2, [2], 4] | Failed |
| 3 | ['stale', 0, [], 1] | ['stale', 0, [], 1] | Passed |
| 4 | ['ok', 0, [], 0] | ['ok', 0, [], 0] | Passed |
| 5 | ['ok', 1, [], 5] | ['ok', 1, [], 5] | Passed |
| 6 | ['stale', 0, [], 3] | ['stale', 0, [], 3] | Passed |
SHA-256 / 35990f66c34dc4d61e2fd21d6f853d2efc74e68122777f1728f26bdb9f31d224
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,pos,limit,saved,current,reverse=x
if saved!=current:return ['stale',pos,[],saved]
remaining=max(0,len(a)-pos)
count=min(limit,remaining)
sequence=a[::-1] if reverse else a
values=sequence[pos:pos+count] if pos<=0 else sequence[:count]
next_pos=pos+count
return ['ok',next_pos,values,saved]
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],1,2,3,3,False]), {1: ['ok', 3, [2, 3], 3], 2: ['ok', 3, [3, 4], 3], 3: ['ok', 3, [4, 5], 3], 4: ['ok', 3, [5, 6], 3], 5: ['ok', 3, [6, 7], 3]}[N])
check('1', solve([[N,N+1,N+2],0,2,2,2,True]), {1: ['ok', 2, [3, 2], 2], 2: ['ok', 2, [4, 3], 2], 3: ['ok', 2, [5, 4], 2], 4: ['ok', 2, [6, 5], 2], 5: ['ok', 2, [7, 6], 2]}[N])
check('2', solve([[N,N+1],1,5,4,4,False]), {1: ['ok', 2, [2], 4], 2: ['ok', 2, [3], 4], 3: ['ok', 2, [4], 4], 4: ['ok', 2, [5], 4], 5: ['ok', 2, [6], 4]}[N])
check('3', solve([[N],0,3,1,2,False]), {1: ['stale', 0, [], 1], 2: ['stale', 0, [], 1], 3: ['stale', 0, [], 1], 4: ['stale', 0, [], 1], 5: ['stale', 0, [], 1]}[N])
check('4', solve([[],0,2,0,0,True]), {1: ['ok', 0, [], 0], 2: ['ok', 0, [], 0], 3: ['ok', 0, [], 0], 4: ['ok', 0, [], 0], 5: ['ok', 0, [], 0]}[N])
check('5', solve([[N,N+1],1,0,5,5,True]), {1: ['ok', 1, [], 5], 2: ['ok', 1, [], 5], 3: ['ok', 1, [], 5], 4: ['ok', 1, [], 5], 5: ['ok', 1, [], 5]}[N])
check('6', solve([[N,N+1],0,1,3,2,False]), {1: ['stale', 0, [], 3], 2: ['stale', 0, [], 3], 3: ['stale', 0, [], 3], 4: ['stale', 0, [], 3], 5: ['stale', 0, [], 3]}[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 | ['ok', 3, [1, 2], 3] | ['ok', 3, [2, 3], 3] | Failed |
| 1 | ['ok', 2, [3, 2], 2] | ['ok', 2, [3, 2], 2] | Passed |
| 2 | ['ok', 2, [1], 4] | ['ok', 2, [2], 4] | Failed |
| 3 | ['stale', 0, [], 1] | ['stale', 0, [], 1] | Passed |
| 4 | ['ok', 0, [], 0] | ['ok', 0, [], 0] | Passed |
| 5 | ['ok', 1, [], 5] | ['ok', 1, [], 5] | Passed |
| 6 | ['stale', 0, [], 3] | ['stale', 0, [], 3] | Passed |
SHA-256 / 1b00a5843fd7c62a8f8c9da0df4d61c26f6f867c799c2583028176ae18926a67
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:34.315747+00:00.
Case digest / 8bd2c7dd39c7bff1e0d2c8a552aac90c973883a8ec40795c99aed58ce8cdf8d0