FAILURE MAP
← Case archive

FA-4376 / Container mutation / Open access

List clear preserves alias reference · case 01

The operation returns a result or retained state that violates this contract: Clear the list in place so an existing alias observes an empty list; return [target,alias].

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

ROOT CAUSE

Rebinding the local name leaves aliases pointing at the populated original list.

VERIFIED REPAIR

Clear the list in place so an existing alias observes an empty list; return [target,alias].

Unsuccessful approach: An empty slice creates another list rather than clearing the aliased object.

Case contract

Clear the list in place so an existing alias observes an empty list; return [target,alias]. 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):
    a=list(x); alias=a; a=[]; return [a,alias]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('populated alias', solve(['a', 'b']), [[], []])
check('singleton alias', solve(['a']), [[], []])
check('already empty', solve([]), [[], []])
check('duplicates', solve(['a', 'a']), [[], []])
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
populated alias[[], ['a', 'b']][[], []]Failed
singleton alias[[], ['a']][[], []]Failed
already empty[[], []][[], []]Passed
duplicates[[], ['a', 'a']][[], []]Failed

SHA-256 / c267ba390e1ac0d18846b1871dc65ecbe3609a33f92ee138d141f3a5ecdc16fa

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); alias=a; a=a[:0]; return [a,alias]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('populated alias', solve(['a', 'b']), [[], []])
check('singleton alias', solve(['a']), [[], []])
check('already empty', solve([]), [[], []])
check('duplicates', solve(['a', 'a']), [[], []])
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
populated alias[[], ['a', 'b']][[], []]Failed
singleton alias[[], ['a']][[], []]Failed
already empty[[], []][[], []]Passed
duplicates[[], ['a', 'a']][[], []]Failed

SHA-256 / 1ab813ebb450491f1b5a1df4f70f2aae22acd2285dcef3968e052e1d2ca37009

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); alias=a; a.clear(); return [a,alias]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('populated alias', solve(['a', 'b']), [[], []])
check('singleton alias', solve(['a']), [[], []])
check('already empty', solve([]), [[], []])
check('duplicates', solve(['a', 'a']), [[], []])
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
populated alias[[], []][[], []]Passed
singleton alias[[], []][[], []]Passed
already empty[[], []][[], []]Passed
duplicates[[], []][[], []]Passed

SHA-256 / d81f91842dfaff9ed8a99fdcc494323e6482d083322406a6d8a0f20b4454cbe3

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

Case digest / 0d391bf1c41bd694f63b65f73fe87f0ff12321b52fbf223bf0be99c890393aa9