FAILURE MAP
← Case archive

FA-46286 / Bounded deques / Open access

Range reverse reverses the prefix through its stop · case 01

Range reverse reverses the prefix through its stop.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Range reverse reverses the prefix through its stop.

VERIFIED REPAIR

Restore the documented range origin 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[: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 fixtureActualExpectedOutcome
0[[4, 3, 2, 1, 5], [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[[4, 3, 2, 1], [0, 1, 3, 2]][[1, 2, 4, 3], [0, 1, 3, 2]]Failed

SHA-256 / 6ca7115a731a36fa3cbf130ace279dfeae073c65d089050ecfc2376588e053c5

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[: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 fixtureActualExpectedOutcome
0[[4, 3, 2, 1, 5], [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[[4, 3, 2, 1], [0, 1, 3, 2]][[1, 2, 4, 3], [0, 1, 3, 2]]Failed

SHA-256 / 2b7f677c9199270f299f5014ded7677834c1339ebdf1efe99a0ac67fda740baf

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 fixtureActualExpectedOutcome
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.581940+00:00.

Case digest / 61b5b3378bd501896a857eb632f862db4a369d78a98c1a8310bfa9df9c0397ef