FAILURE MAP
← Case archive

FA-4786 / Bounded deques / Open access

Deque rotate reduces large and negative offsets · case 01

The operation returns a result or retained state that violates this contract: Positive rotation moves elements right, negative rotation moves left, and offsets reduce modulo length; empty remains empty.

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

ROOT CAUSE

The slicing direction implements left rotation for positive offsets.

VERIFIED REPAIR

Positive rotation moves elements right, negative rotation moves left, and offsets reduce modulo length; empty remains empty.

Unsuccessful approach: Unnormalized slicing fails when offsets exceed collection length.

Case contract

Positive rotation moves elements right, negative rotation moves left, and offsets reduce modulo length; empty remains empty. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.

Why this case matters

A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return x[y:]+x[:y]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive right', solve(['a', 'b', 'c'], 1), ['c', 'a', 'b'])
check('large offset', solve(['a', 'b', 'c'], 7), ['c', 'a', 'b'])
check('negative left', solve(['a', 'b', 'c'], -1), ['b', 'c', 'a'])
check('empty', solve([], 3), [])
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
positive right['b', 'c', 'a']['c', 'a', 'b']Failed
large offset['a', 'b', 'c']['c', 'a', 'b']Failed
negative left['c', 'a', 'b']['b', 'c', 'a']Failed
empty[][]Passed

SHA-256 / f07dc748789b8d3cbf738fb3fd76dc63b517d994c07be4dd2df342264e84a43f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    return x[-y:]+x[:-y] if y else list(x)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive right', solve(['a', 'b', 'c'], 1), ['c', 'a', 'b'])
check('large offset', solve(['a', 'b', 'c'], 7), ['c', 'a', 'b'])
check('negative left', solve(['a', 'b', 'c'], -1), ['b', 'c', 'a'])
check('empty', solve([], 3), [])
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
positive right['c', 'a', 'b']['c', 'a', 'b']Passed
large offset['a', 'b', 'c']['c', 'a', 'b']Failed
negative left['b', 'c', 'a']['b', 'c', 'a']Passed
empty[][]Passed

SHA-256 / 623fe522b0fd3c6da3a73280108886a6c6f81d54bf74b08573f4436e3c469afb

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
    a=deque(x); a.rotate(y); return list(a)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive right', solve(['a', 'b', 'c'], 1), ['c', 'a', 'b'])
check('large offset', solve(['a', 'b', 'c'], 7), ['c', 'a', 'b'])
check('negative left', solve(['a', 'b', 'c'], -1), ['b', 'c', 'a'])
check('empty', solve([], 3), [])
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
positive right['c', 'a', 'b']['c', 'a', 'b']Passed
large offset['c', 'a', 'b']['c', 'a', 'b']Passed
negative left['b', 'c', 'a']['b', 'c', 'a']Passed
empty[][]Passed

SHA-256 / c4b53d51ae6517dfaa3780db1326887fbe4f7b3f07792193302eba80404a491d

Verification & scope

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:37:42.878524+00:00.

Case digest / a0e35395f8fd52ffacaf496acf8c31444dad584eb03343ad292277e20dfda8ea