FA-4351 / Container mutation / Open access
List pop returns value and remainder · case 01
The operation returns a result or retained state that violates this contract: Pop a valid index and return [removed value, remaining list].
ROOT CAUSE
Removing by returned value deletes the first equal item instead of the requested index.
VERIFIED REPAIR
Pop a valid index and return [removed value, remaining list].
Unsuccessful approach: Popping the final position ignores the requested index.
Case contract
Pop a valid index and return [removed value, remaining list]. 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); v=a[y]; a.remove(v); return [v,a]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('pop second duplicate', solve(['a', 'b', 'a'], 2), ['a', ['a', 'b']])
check('pop front', solve(['a', 'b'], 0), ['a', ['b']])
check('negative index', solve(['a', 'b'], -1), ['b', ['a']])
check('singleton', solve(['a'], 0), ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| pop second duplicate | ['a', ['b', 'a']] | ['a', ['a', 'b']] | Failed |
| pop front | ['a', ['b']] | ['a', ['b']] | Passed |
| negative index | ['b', ['a']] | ['b', ['a']] | Passed |
| singleton | ['a', []] | ['a', []] | Passed |
SHA-256 / df14a737014f5a95a48a0a66e2d76daee6de9c8442ec10a2c16dcd18f6f67d0b
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); v=a.pop(); return [v,a]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('pop second duplicate', solve(['a', 'b', 'a'], 2), ['a', ['a', 'b']])
check('pop front', solve(['a', 'b'], 0), ['a', ['b']])
check('negative index', solve(['a', 'b'], -1), ['b', ['a']])
check('singleton', solve(['a'], 0), ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| pop second duplicate | ['a', ['a', 'b']] | ['a', ['a', 'b']] | Passed |
| pop front | ['b', ['a']] | ['a', ['b']] | Failed |
| negative index | ['b', ['a']] | ['b', ['a']] | Passed |
| singleton | ['a', []] | ['a', []] | Passed |
SHA-256 / fc35937d0791e5c3f9e42f109f16b992b7d5f93fd2a0eb130e5e6ff8fcd66648
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); v=a.pop(y); return [v,a]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('pop second duplicate', solve(['a', 'b', 'a'], 2), ['a', ['a', 'b']])
check('pop front', solve(['a', 'b'], 0), ['a', ['b']])
check('negative index', solve(['a', 'b'], -1), ['b', ['a']])
check('singleton', solve(['a'], 0), ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| pop second duplicate | ['a', ['a', 'b']] | ['a', ['a', 'b']] | Passed |
| pop front | ['a', ['b']] | ['a', ['b']] | Passed |
| negative index | ['b', ['a']] | ['b', ['a']] | Passed |
| singleton | ['a', []] | ['a', []] | Passed |
SHA-256 / a10f08f4253d80b5f96e41a6af686d14e6925f7b3edb50aac682b8bc5e350cd6
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.309969+00:00.
Case digest / 062dd0d5f0bc5ced7def5c8b745ae1b9fafb61ebb3d267ed8fb791c042ba482b