FA-4406 / Mapping semantics / Open access
Map first key removal order · case 01
The operation returns a result or retained state that violates this contract: Remove and return the earliest inserted item, or None if empty; return [item,remainder items].
ROOT CAUSE
The standard last-item pop operation removes the opposite end.
VERIFIED REPAIR
Remove and return the earliest inserted item, or None if empty; return [item,remainder items].
Unsuccessful approach: Lexical key ordering replaces insertion ordering.
Case contract
Remove and return the earliest 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); 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}), [['b', 2], [['a', 1]]])
check('empty', solve({}), [None, []])
check('singleton', solve({'a': 1}), [['a', 1], []])
check('three items', solve({'c': 3, 'a': 1, 'b': 2}), [['c', 3], [['a', 1], ['b', 2]]])
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]]] | [['b', 2], [['a', 1]]] | Failed |
| empty | [None, []] | [None, []] | Passed |
| singleton | [['a', 1], []] | [['a', 1], []] | Passed |
| three items | [['b', 2], [['c', 3], ['a', 1]]] | [['c', 3], [['a', 1], ['b', 2]]] | Failed |
SHA-256 / a463566798636b71e730792c129ff83169946bd512a201e84fde3755f7db348a
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=min(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}), [['b', 2], [['a', 1]]])
check('empty', solve({}), [None, []])
check('singleton', solve({'a': 1}), [['a', 1], []])
check('three items', solve({'c': 3, 'a': 1, 'b': 2}), [['c', 3], [['a', 1], ['b', 2]]])
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]]] | [['b', 2], [['a', 1]]] | Failed |
| empty | [None, []] | [None, []] | Passed |
| singleton | [['a', 1], []] | [['a', 1], []] | Passed |
| three items | [['a', 1], [['c', 3], ['b', 2]]] | [['c', 3], [['a', 1], ['b', 2]]] | Failed |
SHA-256 / acf0354b7886af25fe098abf1fa4dc4d9e506c79c00eecdc05e0e75e0fd1fbdd
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=[next(iter(a)),a[next(iter(a))]] if a else None
if a: del a[next(iter(a))]
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}), [['b', 2], [['a', 1]]])
check('empty', solve({}), [None, []])
check('singleton', solve({'a': 1}), [['a', 1], []])
check('three items', solve({'c': 3, 'a': 1, 'b': 2}), [['c', 3], [['a', 1], ['b', 2]]])
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]]] | [['b', 2], [['a', 1]]] | Passed |
| empty | [None, []] | [None, []] | Passed |
| singleton | [['a', 1], []] | [['a', 1], []] | Passed |
| three items | [['c', 3], [['a', 1], ['b', 2]]] | [['c', 3], [['a', 1], ['b', 2]]] | Passed |
SHA-256 / d91c8bccd0b363ba41c3bd35825de91c035d83d1005d2d0836191944898600b5
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.842126+00:00.
Case digest / 380d94665d035ce9bf0db10aaefdc13690e57e233c4dc1b8fe162978d78616a3