FA-4401 / Mapping semantics / Open access
Map delete reinsert moves key · case 01
The operation returns a result or retained state that violates this contract: Delete a key if present, then insert its new value at the end of insertion order.
ROOT CAUSE
Updating a binding in place retains its original insertion position.
VERIFIED REPAIR
Delete a key if present, then insert its new value at the end of insertion order.
Unsuccessful approach: Deleting without reinserting loses the new binding.
Case contract
Delete a key if present, then insert its new value at the end of insertion order. 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); a[y[0]]=y[1]; return list(map(list,a.items()))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing first moves', solve({'a': 1, 'b': 2}, ['a', 3]), [['b', 2], ['a', 3]])
check('absent appends', solve({'a': 1}, ['b', 2]), [['a', 1], ['b', 2]])
check('empty inserts', solve({}, ['a', 1]), [['a', 1]])
check('last replaces', solve({'a': 1}, ['a', 2]), [['a', 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 |
|---|---|---|---|
| existing first moves | [['a', 3], ['b', 2]] | [['b', 2], ['a', 3]] | Failed |
| absent appends | [['a', 1], ['b', 2]] | [['a', 1], ['b', 2]] | Passed |
| empty inserts | [['a', 1]] | [['a', 1]] | Passed |
| last replaces | [['a', 2]] | [['a', 2]] | Passed |
SHA-256 / 5c42835504862c92b00b2a83d7f58c6cee54f227d3c53d5656048da52117cbba
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); a.pop(y[0],None); return list(map(list,a.items()))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing first moves', solve({'a': 1, 'b': 2}, ['a', 3]), [['b', 2], ['a', 3]])
check('absent appends', solve({'a': 1}, ['b', 2]), [['a', 1], ['b', 2]])
check('empty inserts', solve({}, ['a', 1]), [['a', 1]])
check('last replaces', solve({'a': 1}, ['a', 2]), [['a', 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 |
|---|---|---|---|
| existing first moves | [['b', 2]] | [['b', 2], ['a', 3]] | Failed |
| absent appends | [['a', 1]] | [['a', 1], ['b', 2]] | Failed |
| empty inserts | [] | [['a', 1]] | Failed |
| last replaces | [] | [['a', 2]] | Failed |
SHA-256 / ae4c96a6a26fbd4a92c0f1a67026e55cb25c8d67d41d7969c67d0b282efeb230
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); a.pop(y[0],None); a[y[0]]=y[1]; return list(map(list,a.items()))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('existing first moves', solve({'a': 1, 'b': 2}, ['a', 3]), [['b', 2], ['a', 3]])
check('absent appends', solve({'a': 1}, ['b', 2]), [['a', 1], ['b', 2]])
check('empty inserts', solve({}, ['a', 1]), [['a', 1]])
check('last replaces', solve({'a': 1}, ['a', 2]), [['a', 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 |
|---|---|---|---|
| existing first moves | [['b', 2], ['a', 3]] | [['b', 2], ['a', 3]] | Passed |
| absent appends | [['a', 1], ['b', 2]] | [['a', 1], ['b', 2]] | Passed |
| empty inserts | [['a', 1]] | [['a', 1]] | Passed |
| last replaces | [['a', 2]] | [['a', 2]] | Passed |
SHA-256 / 28c88f30b6d51b96282561a88720a0c69354ebff7d16dc78378bd89ae4324d62
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.594200+00:00.
Case digest / 6e48d36ac3b5eaa01d2f27d0ef394b2cf294484fa91ee08d60748e8b5a087f9a