FA-4411 / Mapping semantics / Open access
Map last key removal order · case 01
The operation returns a result or retained state that violates this contract: Remove and return the most recently inserted item, or None if empty; return [item,remainder items].
ROOT CAUSE
Removing the first iterated key selects the oldest insertion.
VERIFIED REPAIR
Remove and return the most recently inserted item, or None if empty; return [item,remainder items].
Unsuccessful approach: The greatest lexical key need not be the newest insertion.
Case contract
Remove and return the most recently inserted item, or None if empty; return [item,remainder items]. 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=dict(x); k=next(iter(a)) if a else None; v=[k,a.pop(k)] if a else None; return [v,list(map(list,a.items()))]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('insertion beats lexical', solve({'b': 2, 'a': 1}), [['a', 1], [['b', 2]]])
check('empty', solve({}), [None, []])
check('singleton', solve({'a': 1}), [['a', 1], []])
check('three items', solve({'c': 3, 'a': 1, 'b': 2}), [['b', 2], [['c', 3], ['a', 1]]])
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 |
|---|---|---|---|
| insertion beats lexical | [['b', 2], [['a', 1]]] | [['a', 1], [['b', 2]]] | Failed |
| empty | [None, []] | [None, []] | Passed |
| singleton | [['a', 1], []] | [['a', 1], []] | Passed |
| three items | [['c', 3], [['a', 1], ['b', 2]]] | [['b', 2], [['c', 3], ['a', 1]]] | Failed |
SHA-256 / e6378ff5eaba0af6b754a8d0ccf7f4ec3087851a64bbcd35c7a3c1327d4f69ed
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=dict(x); k=max(a) if a else None; v=[k,a.pop(k)] if a else None; return [v,list(map(list,a.items()))]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('insertion beats lexical', solve({'b': 2, 'a': 1}), [['a', 1], [['b', 2]]])
check('empty', solve({}), [None, []])
check('singleton', solve({'a': 1}), [['a', 1], []])
check('three items', solve({'c': 3, 'a': 1, 'b': 2}), [['b', 2], [['c', 3], ['a', 1]]])
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 |
|---|---|---|---|
| insertion beats lexical | [['b', 2], [['a', 1]]] | [['a', 1], [['b', 2]]] | Failed |
| empty | [None, []] | [None, []] | Passed |
| singleton | [['a', 1], []] | [['a', 1], []] | Passed |
| three items | [['c', 3], [['a', 1], ['b', 2]]] | [['b', 2], [['c', 3], ['a', 1]]] | Failed |
SHA-256 / 988c54c1b4977352f5490612d6474c3509db54f6eefac91aaf90ce8e7002b0e3
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=dict(x); v=list(a.popitem()) if a else None; return [v,list(map(list,a.items()))]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('insertion beats lexical', solve({'b': 2, 'a': 1}), [['a', 1], [['b', 2]]])
check('empty', solve({}), [None, []])
check('singleton', solve({'a': 1}), [['a', 1], []])
check('three items', solve({'c': 3, 'a': 1, 'b': 2}), [['b', 2], [['c', 3], ['a', 1]]])
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 |
|---|---|---|---|
| insertion beats lexical | [['a', 1], [['b', 2]]] | [['a', 1], [['b', 2]]] | Passed |
| empty | [None, []] | [None, []] | Passed |
| singleton | [['a', 1], []] | [['a', 1], []] | Passed |
| three items | [['b', 2], [['c', 3], ['a', 1]]] | [['b', 2], [['c', 3], ['a', 1]]] | Passed |
SHA-256 / a69c3c8de6aed918ffa09110c29913bbd290d7e4182fd5d7b1d644a7dc690ae7
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.923219+00:00.
Case digest / 13e0d62436dbc207bf5758c234d05169835ba280a77fa622fb06105670d4c022