FAILURE MAP
← Case archive

FA-4366 / Container mutation / Open access

List append keeps nested value · case 01

The operation returns a result or retained state that violates this contract: Append the provided value as one item, even if it is a list.

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

ROOT CAUSE

Extending expands a nested value that should remain one list item.

VERIFIED REPAIR

Append the provided value as one item, even if it is a list.

Unsuccessful approach: A truthiness guard drops valid empty values.

Case contract

Append the provided value as one item, even if it is a 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):
    return list(x)+list(y)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested list', solve(['a'], ['b', 'c']), ['a', ['b', 'c']])
check('empty nested list', solve([], []), [[]])
check('string is one item', solve([], 'ab'), ['ab'])
check('empty string retained', 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
nested list['a', 'b', 'c']['a', ['b', 'c']]Failed
empty nested list[][[]]Failed
string is one item['a', 'b']['ab']Failed
empty string retained['a']['a', '']Failed

SHA-256 / bb99dd780344825a3b4efc3f208cd9646c060fd82cd3370a2c3a1595f1706986

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)+([y] if y else [])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested list', solve(['a'], ['b', 'c']), ['a', ['b', 'c']])
check('empty nested list', solve([], []), [[]])
check('string is one item', solve([], 'ab'), ['ab'])
check('empty string retained', 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
nested list['a', ['b', 'c']]['a', ['b', 'c']]Passed
empty nested list[][[]]Failed
string is one item['ab']['ab']Passed
empty string retained['a']['a', '']Failed

SHA-256 / 3c6a5e76959dfea4c35a080b1c51c27a99533e5c263ffef49bc239858a9c9b0e

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)+[y]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested list', solve(['a'], ['b', 'c']), ['a', ['b', 'c']])
check('empty nested list', solve([], []), [[]])
check('string is one item', solve([], 'ab'), ['ab'])
check('empty string retained', 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
nested list['a', ['b', 'c']]['a', ['b', 'c']]Passed
empty nested list[[]][[]]Passed
string is one item['ab']['ab']Passed
empty string retained['a', '']['a', '']Passed

SHA-256 / ad346d558945e4bf761aa42a8f72b81a36a79497599d39e129cde67c7bce4534

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

Case digest / 3808ff7d6ccfe2cc8b19f54f2bc4d88a5ce23293b6637ebc05ca921eebe52f73