FAILURE MAP
← Case archive

FA-4791 / Bounded deques / Open access

Deque copy retains bound and independent storage · case 01

The operation returns a result or retained state that violates this contract: Copy a bounded deque, append to the copy, and return [original,copy,copy capacity]; the copy preserves maxlen and does not mutate the original.

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

ROOT CAUSE

Assigning the same deque aliases storage instead of copying it.

VERIFIED REPAIR

Copy a bounded deque, append to the copy, and return [original,copy,copy capacity]; the copy preserves maxlen and does not mutate the original.

Unsuccessful approach: Reconstructing without maxlen loses the copy capacity and overflow policy.

Case contract

Copy a bounded deque, append to the copy, and return [original,copy,copy capacity]; the copy preserves maxlen and does not mutate the original. 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):
    a=deque(x,maxlen=y[0]); b=a; b.append(y[1]); return [list(a),list(b),b.maxlen]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full independent copy', solve(['a', 'b'], [2, 'c']), [['a', 'b'], ['b', 'c'], 2])
check('room remains', solve(['a'], [3, 'b']), [['a'], ['a', 'b'], 3])
check('zero bound', solve([], [0, 'a']), [[], [], 0])
check('empty copy', solve([], [2, 'a']), [[], ['a'], 2])
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
full independent copy[['b', 'c'], ['b', 'c'], 2][['a', 'b'], ['b', 'c'], 2]Failed
room remains[['a', 'b'], ['a', 'b'], 3][['a'], ['a', 'b'], 3]Failed
zero bound[[], [], 0][[], [], 0]Passed
empty copy[['a'], ['a'], 2][[], ['a'], 2]Failed

SHA-256 / 48d7c52eebddb72689619c28c1bff38b2e06e6ec594bf61eec579179c72263d2

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):
    a=deque(x,maxlen=y[0]); b=deque(a); b.append(y[1]); return [list(a),list(b),b.maxlen]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full independent copy', solve(['a', 'b'], [2, 'c']), [['a', 'b'], ['b', 'c'], 2])
check('room remains', solve(['a'], [3, 'b']), [['a'], ['a', 'b'], 3])
check('zero bound', solve([], [0, 'a']), [[], [], 0])
check('empty copy', solve([], [2, 'a']), [[], ['a'], 2])
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
full independent copy[['a', 'b'], ['a', 'b', 'c'], None][['a', 'b'], ['b', 'c'], 2]Failed
room remains[['a'], ['a', 'b'], None][['a'], ['a', 'b'], 3]Failed
zero bound[[], ['a'], None][[], [], 0]Failed
empty copy[[], ['a'], None][[], ['a'], 2]Failed

SHA-256 / 83daa449dc2dc23572430e246a1a1613d35fbb1ae142b151a9194e6f0e5a4f41

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,maxlen=y[0]); b=a.copy(); b.append(y[1]); return [list(a),list(b),b.maxlen]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('full independent copy', solve(['a', 'b'], [2, 'c']), [['a', 'b'], ['b', 'c'], 2])
check('room remains', solve(['a'], [3, 'b']), [['a'], ['a', 'b'], 3])
check('zero bound', solve([], [0, 'a']), [[], [], 0])
check('empty copy', solve([], [2, 'a']), [[], ['a'], 2])
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
full independent copy[['a', 'b'], ['b', 'c'], 2][['a', 'b'], ['b', 'c'], 2]Passed
room remains[['a'], ['a', 'b'], 3][['a'], ['a', 'b'], 3]Passed
zero bound[[], [], 0][[], [], 0]Passed
empty copy[[], ['a'], 2][[], ['a'], 2]Passed

SHA-256 / d4c9e2329bf411d6718c694c854ec21b7870b96d6931fedbec568cf2d92d85b1

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

Case digest / 154b7c3dc1861abddba3fffff1fbdd8391527d5098f36771d971b85db9f74a14