FA-46306 / Bounded deques / Open access
Reverse returns bookmark mappings in new traversal order · case 01
Reverse returns bookmark mappings in new traversal order.
ROOT CAUSE
Reverse returns bookmark mappings in new traversal order.
VERIFIED REPAIR
Restore the documented mapping direction invariant in range-reverse.
Unsuccessful approach: The partial repair still applies the incorrect transition to an admitted boundary or multi-element case.
Case contract
Reverse a valid half-open range in a bounded deque and return an old-index to new-index mapping for stable bookmarks. Empty ranges leave all positions unchanged.
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,start,stop=x
result=a[:start]+a[start:stop][::-1]+a[stop:]
mapping=[]
for i in range(len(a)):
target=start+stop-1-i if start<=i<stop else i
mapping.insert(0,target)
return [result,mapping]
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],1,4]), {1: [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]], 2: [[2, 5, 4, 3, 6], [0, 3, 2, 1, 4]], 3: [[3, 6, 5, 4, 7], [0, 3, 2, 1, 4]], 4: [[4, 7, 6, 5, 8], [0, 3, 2, 1, 4]], 5: [[5, 8, 7, 6, 9], [0, 3, 2, 1, 4]]}[N])
check('1', solve([[N,N+1,N+2],0,3]), {1: [[3, 2, 1], [2, 1, 0]], 2: [[4, 3, 2], [2, 1, 0]], 3: [[5, 4, 3], [2, 1, 0]], 4: [[6, 5, 4], [2, 1, 0]], 5: [[7, 6, 5], [2, 1, 0]]}[N])
check('2', solve([[N,N+1],1,1]), {1: [[1, 2], [0, 1]], 2: [[2, 3], [0, 1]], 3: [[3, 4], [0, 1]], 4: [[4, 5], [0, 1]], 5: [[5, 6], [0, 1]]}[N])
check('3', solve([[N],0,1]), {1: [[1], [0]], 2: [[2], [0]], 3: [[3], [0]], 4: [[4], [0]], 5: [[5], [0]]}[N])
check('4', solve([[],0,0]), {1: [[], []], 2: [[], []], 3: [[], []], 4: [[], []], 5: [[], []]}[N])
check('5', solve([[N,N+1,N+2,N+3],2,4]), {1: [[1, 2, 4, 3], [0, 1, 3, 2]], 2: [[2, 3, 5, 4], [0, 1, 3, 2]], 3: [[3, 4, 6, 5], [0, 1, 3, 2]], 4: [[4, 5, 7, 6], [0, 1, 3, 2]], 5: [[5, 6, 8, 7], [0, 1, 3, 2]]}[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, 3, 2, 5], [4, 1, 2, 3, 0]] | [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]] | Failed |
| 1 | [[3, 2, 1], [0, 1, 2]] | [[3, 2, 1], [2, 1, 0]] | Failed |
| 2 | [[1, 2], [1, 0]] | [[1, 2], [0, 1]] | Failed |
| 3 | [[1], [0]] | [[1], [0]] | Passed |
| 4 | [[], []] | [[], []] | Passed |
| 5 | [[1, 2, 4, 3], [2, 3, 1, 0]] | [[1, 2, 4, 3], [0, 1, 3, 2]] | Failed |
SHA-256 / 398b3943e44a6c95d452db43c078a6ee53813666367b0be84c23ba553c0db65f
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,start,stop=x
result=a[:start]+a[start:stop][::-1]+a[stop:]
mapping=[]
for i in range(len(a)):
target=start+stop-1-i if start<=i<stop else i
mapping.append(target) if start==0 else mapping.insert(0,target)
return [result,mapping]
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],1,4]), {1: [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]], 2: [[2, 5, 4, 3, 6], [0, 3, 2, 1, 4]], 3: [[3, 6, 5, 4, 7], [0, 3, 2, 1, 4]], 4: [[4, 7, 6, 5, 8], [0, 3, 2, 1, 4]], 5: [[5, 8, 7, 6, 9], [0, 3, 2, 1, 4]]}[N])
check('1', solve([[N,N+1,N+2],0,3]), {1: [[3, 2, 1], [2, 1, 0]], 2: [[4, 3, 2], [2, 1, 0]], 3: [[5, 4, 3], [2, 1, 0]], 4: [[6, 5, 4], [2, 1, 0]], 5: [[7, 6, 5], [2, 1, 0]]}[N])
check('2', solve([[N,N+1],1,1]), {1: [[1, 2], [0, 1]], 2: [[2, 3], [0, 1]], 3: [[3, 4], [0, 1]], 4: [[4, 5], [0, 1]], 5: [[5, 6], [0, 1]]}[N])
check('3', solve([[N],0,1]), {1: [[1], [0]], 2: [[2], [0]], 3: [[3], [0]], 4: [[4], [0]], 5: [[5], [0]]}[N])
check('4', solve([[],0,0]), {1: [[], []], 2: [[], []], 3: [[], []], 4: [[], []], 5: [[], []]}[N])
check('5', solve([[N,N+1,N+2,N+3],2,4]), {1: [[1, 2, 4, 3], [0, 1, 3, 2]], 2: [[2, 3, 5, 4], [0, 1, 3, 2]], 3: [[3, 4, 6, 5], [0, 1, 3, 2]], 4: [[4, 5, 7, 6], [0, 1, 3, 2]], 5: [[5, 6, 8, 7], [0, 1, 3, 2]]}[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, 3, 2, 5], [4, 1, 2, 3, 0]] | [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]] | Failed |
| 1 | [[3, 2, 1], [2, 1, 0]] | [[3, 2, 1], [2, 1, 0]] | Passed |
| 2 | [[1, 2], [1, 0]] | [[1, 2], [0, 1]] | Failed |
| 3 | [[1], [0]] | [[1], [0]] | Passed |
| 4 | [[], []] | [[], []] | Passed |
| 5 | [[1, 2, 4, 3], [2, 3, 1, 0]] | [[1, 2, 4, 3], [0, 1, 3, 2]] | Failed |
SHA-256 / 0bdca09a0f3dca8f567e845eb694a15765a3ecbef71d47ea910cbc3520d25e60
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
a,start,stop=x
result=a[:start]+a[start:stop][::-1]+a[stop:]
mapping=[]
for i in range(len(a)):
target=start+stop-1-i if start<=i<stop else i
mapping.append(target)
return [result,mapping]
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],1,4]), {1: [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]], 2: [[2, 5, 4, 3, 6], [0, 3, 2, 1, 4]], 3: [[3, 6, 5, 4, 7], [0, 3, 2, 1, 4]], 4: [[4, 7, 6, 5, 8], [0, 3, 2, 1, 4]], 5: [[5, 8, 7, 6, 9], [0, 3, 2, 1, 4]]}[N])
check('1', solve([[N,N+1,N+2],0,3]), {1: [[3, 2, 1], [2, 1, 0]], 2: [[4, 3, 2], [2, 1, 0]], 3: [[5, 4, 3], [2, 1, 0]], 4: [[6, 5, 4], [2, 1, 0]], 5: [[7, 6, 5], [2, 1, 0]]}[N])
check('2', solve([[N,N+1],1,1]), {1: [[1, 2], [0, 1]], 2: [[2, 3], [0, 1]], 3: [[3, 4], [0, 1]], 4: [[4, 5], [0, 1]], 5: [[5, 6], [0, 1]]}[N])
check('3', solve([[N],0,1]), {1: [[1], [0]], 2: [[2], [0]], 3: [[3], [0]], 4: [[4], [0]], 5: [[5], [0]]}[N])
check('4', solve([[],0,0]), {1: [[], []], 2: [[], []], 3: [[], []], 4: [[], []], 5: [[], []]}[N])
check('5', solve([[N,N+1,N+2,N+3],2,4]), {1: [[1, 2, 4, 3], [0, 1, 3, 2]], 2: [[2, 3, 5, 4], [0, 1, 3, 2]], 3: [[3, 4, 6, 5], [0, 1, 3, 2]], 4: [[4, 5, 7, 6], [0, 1, 3, 2]], 5: [[5, 6, 8, 7], [0, 1, 3, 2]]}[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, 3, 2, 5], [0, 3, 2, 1, 4]] | [[1, 4, 3, 2, 5], [0, 3, 2, 1, 4]] | Passed |
| 1 | [[3, 2, 1], [2, 1, 0]] | [[3, 2, 1], [2, 1, 0]] | Passed |
| 2 | [[1, 2], [0, 1]] | [[1, 2], [0, 1]] | Passed |
| 3 | [[1], [0]] | [[1], [0]] | Passed |
| 4 | [[], []] | [[], []] | Passed |
| 5 | [[1, 2, 4, 3], [0, 1, 3, 2]] | [[1, 2, 4, 3], [0, 1, 3, 2]] | Passed |
SHA-256 / a402916bde8514081ee94dd3a1deb26b9bc994fc70b1a74f7c7c6cda2dafc95e
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.820647+00:00.
Case digest / 0b21d732b265f3c09e72d81f91587f2e2447ed0cd60c2ebe966c3b09874043de