FA-46291 / Bounded deques / Open access
Range reverse drops the first element after the range · case 01
Range reverse drops the first element after the range.
ROOT CAUSE
Range reverse drops the first element after the range.
VERIFIED REPAIR
Restore the documented range tail 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+1:]
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], [0, 3, 2, 1, 4]] | [[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], [0, 1]] | [[1, 2], [0, 1]] | Failed |
| 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 / 88dd1a6552e22a38c6e1fd25dd307948c546c25e76a75492c6c00b8ac718d0e2
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 if start==stop else a[:start]+a[start:stop][::-1]+a[stop+1:]
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], [0, 3, 2, 1, 4]] | [[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], [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 / c1be1ec1311a901a8c83cbbb12ecd8b14cbd956ce9140c8ce6db23b72036551f
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.599996+00:00.
Case digest / df3651bc531edbcb7bf08d226f64d6239f0f52a878d9ea645cbd5a0ed9f316e0