FA-46231 / Bounded deques / Open access
Undo fails to save the current deque for redo · case 01
Undo fails to save the current deque for redo.
ROOT CAUSE
Undo fails to save the current deque for redo.
THE FAILURE
Undo fails to save the current deque for redo.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
Bounded deque edits store the complete prior logical snapshot. Undo and redo transfer current snapshots between independent history stacks. A new edit invalidates redo history.
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,past,future,command,value,cap=x
if command=='edit':
new=(a+[value])[-cap:] if cap else []
return [new,past+[a],[]]
if command=='undo' and past:
return [past[-1],past[:-1],future]
if command=='redo' and future:
return [future[-1],past+[a],future[:-1]]
return [a,past,future]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('edit invalidates redo', solve([[N],[[N-1]],[[N+1]],"edit",N+2,3]), {1: [[1, 3], [[0], [1]], []], 2: [[2, 4], [[1], [2]], []], 3: [[3, 5], [[2], [3]], []], 4: [[4, 6], [[3], [4]], []], 5: [[5, 7], [[4], [5]], []]}[N])
check('undo latest', solve([[N+2],[[N],[N+1]],[],"undo",0,3]), {1: [[2], [[1]], [[3]]], 2: [[3], [[2]], [[4]]], 3: [[4], [[3]], [[5]]], 4: [[5], [[4]], [[6]]], 5: [[6], [[5]], [[7]]]}[N])
check('redo latest', solve([[N],[],[[N+2],[N+1]],"redo",0,3]), {1: [[2], [[1]], [[3]]], 2: [[3], [[2]], [[4]]], 3: [[4], [[3]], [[5]]], 4: [[5], [[4]], [[6]]], 5: [[6], [[5]], [[7]]]}[N])
check('empty undo', solve([[N],[],[],"undo",0,3]), {1: [[1], [], []], 2: [[2], [], []], 3: [[3], [], []], 4: [[4], [], []], 5: [[5], [], []]}[N])
check('overflow snapshot', solve([[N,N+1],[],[],"edit",N+2,2]), {1: [[2, 3], [[1, 2]], []], 2: [[3, 4], [[2, 3]], []], 3: [[4, 5], [[3, 4]], []], 4: [[5, 6], [[4, 5]], []], 5: [[6, 7], [[5, 6]], []]}[N])
check('zero bound edit', solve([[],[[N]],[],"edit",N+1,0]), {1: [[], [[1], []], []], 2: [[], [[2], []], []], 3: [[], [[3], []], []], 4: [[], [[4], []], []], 5: [[], [[5], []], []]}[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 |
|---|---|---|---|
| edit invalidates redo | [[1, 3], [[0], [1]], []] | [[1, 3], [[0], [1]], []] | Passed |
| undo latest | [[2], [[1]], []] | [[2], [[1]], [[3]]] | Failed |
| redo latest | [[2], [[1]], [[3]]] | [[2], [[1]], [[3]]] | Passed |
| empty undo | [[1], [], []] | [[1], [], []] | Passed |
| overflow snapshot | [[2, 3], [[1, 2]], []] | [[2, 3], [[1, 2]], []] | Passed |
| zero bound edit | [[], [[1], []], []] | [[], [[1], []], []] | Passed |
SHA-256 / 0b60ef03093d8d853288d1e877aab773317ceb7e2b7f14e6e86d819450f6b615
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,past,future,command,value,cap=x
if command=='edit':
new=(a+[value])[-cap:] if cap else []
return [new,past+[a],[]]
if command=='undo' and past:
return [past[-1],past[:-1],future+[a] if len(past)==1 else future]
if command=='redo' and future:
return [future[-1],past+[a],future[:-1]]
return [a,past,future]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('edit invalidates redo', solve([[N],[[N-1]],[[N+1]],"edit",N+2,3]), {1: [[1, 3], [[0], [1]], []], 2: [[2, 4], [[1], [2]], []], 3: [[3, 5], [[2], [3]], []], 4: [[4, 6], [[3], [4]], []], 5: [[5, 7], [[4], [5]], []]}[N])
check('undo latest', solve([[N+2],[[N],[N+1]],[],"undo",0,3]), {1: [[2], [[1]], [[3]]], 2: [[3], [[2]], [[4]]], 3: [[4], [[3]], [[5]]], 4: [[5], [[4]], [[6]]], 5: [[6], [[5]], [[7]]]}[N])
check('redo latest', solve([[N],[],[[N+2],[N+1]],"redo",0,3]), {1: [[2], [[1]], [[3]]], 2: [[3], [[2]], [[4]]], 3: [[4], [[3]], [[5]]], 4: [[5], [[4]], [[6]]], 5: [[6], [[5]], [[7]]]}[N])
check('empty undo', solve([[N],[],[],"undo",0,3]), {1: [[1], [], []], 2: [[2], [], []], 3: [[3], [], []], 4: [[4], [], []], 5: [[5], [], []]}[N])
check('overflow snapshot', solve([[N,N+1],[],[],"edit",N+2,2]), {1: [[2, 3], [[1, 2]], []], 2: [[3, 4], [[2, 3]], []], 3: [[4, 5], [[3, 4]], []], 4: [[5, 6], [[4, 5]], []], 5: [[6, 7], [[5, 6]], []]}[N])
check('zero bound edit', solve([[],[[N]],[],"edit",N+1,0]), {1: [[], [[1], []], []], 2: [[], [[2], []], []], 3: [[], [[3], []], []], 4: [[], [[4], []], []], 5: [[], [[5], []], []]}[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 |
|---|---|---|---|
| edit invalidates redo | [[1, 3], [[0], [1]], []] | [[1, 3], [[0], [1]], []] | Passed |
| undo latest | [[2], [[1]], []] | [[2], [[1]], [[3]]] | Failed |
| redo latest | [[2], [[1]], [[3]]] | [[2], [[1]], [[3]]] | Passed |
| empty undo | [[1], [], []] | [[1], [], []] | Passed |
| overflow snapshot | [[2, 3], [[1, 2]], []] | [[2, 3], [[1, 2]], []] | Passed |
| zero bound edit | [[], [[1], []], []] | [[], [[1], []], []] | Passed |
SHA-256 / ec91e3eeb3f029793ff285b95ef5031b0825e9e487a20f0f4cef12be06f1be23
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 6 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:30.126629+00:00.
Case digest / 2b40a707e9adfbe0158e7800e7a8f4aa295c73260d07681ae3b43753c084ddeb