FA-4371 / Container mutation / Open access
List extend expands one level · case 01
The operation returns a result or retained state that violates this contract: Extend by the iterable elements, without recursively flattening nested elements.
ROOT CAUSE
Appending keeps the iterable container as a single element.
VERIFIED REPAIR
Extend by the iterable elements, without recursively flattening nested elements.
Unsuccessful approach: Recursive flattening destroys nested elements below the requested level.
Case contract
Extend by the iterable elements, without recursively flattening nested elements. 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 list(x)+[y]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('flat extension', solve(['a'], ['b', 'c']), ['a', 'b', 'c'])
check('nested stays nested', solve([], [['a'], 'b']), [['a'], 'b'])
check('empty extension', solve(['a'], []), ['a'])
check('string iteration', solve([], 'ab'), ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| flat extension | ['a', ['b', 'c']] | ['a', 'b', 'c'] | Failed |
| nested stays nested | [[['a'], 'b']] | [['a'], 'b'] | Failed |
| empty extension | ['a', []] | ['a'] | Failed |
| string iteration | ['ab'] | ['a', 'b'] | Failed |
SHA-256 / c2ea590cc9bb5384dae1b61b8e7cdd3558252e47881d31340adeafae5bfd7cbb
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x, y=None):
return list(x)+[z for v in y for z in (v if isinstance(v,list) else [v])]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('flat extension', solve(['a'], ['b', 'c']), ['a', 'b', 'c'])
check('nested stays nested', solve([], [['a'], 'b']), [['a'], 'b'])
check('empty extension', solve(['a'], []), ['a'])
check('string iteration', solve([], 'ab'), ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| flat extension | ['a', 'b', 'c'] | ['a', 'b', 'c'] | Passed |
| nested stays nested | ['a', 'b'] | [['a'], 'b'] | Failed |
| empty extension | ['a'] | ['a'] | Passed |
| string iteration | ['a', 'b'] | ['a', 'b'] | Passed |
SHA-256 / 0454d543326d85b03ae49819e002873977810b0f6ee9b2835043c3e47a8ec126
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x, y=None):
return list(x)+list(y)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('flat extension', solve(['a'], ['b', 'c']), ['a', 'b', 'c'])
check('nested stays nested', solve([], [['a'], 'b']), [['a'], 'b'])
check('empty extension', solve(['a'], []), ['a'])
check('string iteration', solve([], 'ab'), ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| flat extension | ['a', 'b', 'c'] | ['a', 'b', 'c'] | Passed |
| nested stays nested | [['a'], 'b'] | [['a'], 'b'] | Passed |
| empty extension | ['a'] | ['a'] | Passed |
| string iteration | ['a', 'b'] | ['a', 'b'] | Passed |
SHA-256 / 5051166d6f7b402769b2a001aeb1ca39fa39b57fd6bd5187210fe43702cb8010
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.470273+00:00.
Case digest / 5259e57c92bb59fea69c37d050f4c9f5002b19602f9922b00fddb22836cbc302