FAILURE MAP
← Case archive

FA-4341 / Container mutation / Open access

List replace one index · case 01

The operation returns a result or retained state that violates this contract: Replace exactly the selected valid positional item, not every equal item.

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

ROOT CAUSE

Replacement uses value equality instead of positional identity.

VERIFIED REPAIR

Replace exactly the selected valid positional item, not every equal item.

Unsuccessful approach: Insertion shifts the selected item instead of replacing it.

Case contract

Replace exactly the selected valid positional item, not every equal item. 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

N = 1
observations = []
def solve(x, y=None):
    return [y[1] if v==x[y[0]] else v for v in x]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicate identity', solve(['a', 'b', 'a'], [0, 'c']), ['c', 'b', 'a'])
check('negative index', solve(['a', 'b'], [-1, 'c']), ['a', 'c'])
check('singleton', solve(['a'], [0, 'c']), ['c'])
check('same replacement', solve(['a', 'b'], [1, 'b']), ['a', 'b'])
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
duplicate identity['c', 'b', 'c']['c', 'b', 'a']Failed
negative index['a', 'c']['a', 'c']Passed
singleton['c']['c']Passed
same replacement['a', 'b']['a', 'b']Passed

SHA-256 / 65ec87bef11565cd719f5e0ad828b539ca6724fe131443717a4068afa51c8b7a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x, y=None):
    a=list(x); a.insert(y[0],y[1]); return a
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicate identity', solve(['a', 'b', 'a'], [0, 'c']), ['c', 'b', 'a'])
check('negative index', solve(['a', 'b'], [-1, 'c']), ['a', 'c'])
check('singleton', solve(['a'], [0, 'c']), ['c'])
check('same replacement', solve(['a', 'b'], [1, 'b']), ['a', 'b'])
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
duplicate identity['c', 'a', 'b', 'a']['c', 'b', 'a']Failed
negative index['a', 'c', 'b']['a', 'c']Failed
singleton['c', 'a']['c']Failed
same replacement['a', 'b', 'b']['a', 'b']Failed

SHA-256 / 7f9288c4f2f7a12b3dca347f4fbe9060f47cfdf3bf7303a257df493adb2590ae

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x, y=None):
    a=list(x); a[y[0]]=y[1]; return a
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('duplicate identity', solve(['a', 'b', 'a'], [0, 'c']), ['c', 'b', 'a'])
check('negative index', solve(['a', 'b'], [-1, 'c']), ['a', 'c'])
check('singleton', solve(['a'], [0, 'c']), ['c'])
check('same replacement', solve(['a', 'b'], [1, 'b']), ['a', 'b'])
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
duplicate identity['c', 'b', 'a']['c', 'b', 'a']Passed
negative index['a', 'c']['a', 'c']Passed
singleton['c']['c']Passed
same replacement['a', 'b']['a', 'b']Passed

SHA-256 / b25ab91c1605b1bd400626eb8cf9fcbc169d14ca084d6400993f3debd1511c07

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

Case digest / 8193ea2440d1585f3ec69ac51b13c833b6ede628d74a8ea47077ff1d8c236293