FA-4736 / Scoped mappings / Open access
Chainmap parents drops exactly one scope · case 01
The operation returns a result or retained state that violates this contract: The parents view removes only the current first scope and retains remaining scope boundaries; an empty parent chain exposes one empty map.
ROOT CAUSE
The current scope remains in the parents view.
VERIFIED REPAIR
The parents view removes only the current first scope and retains remaining scope boundaries; an empty parent chain exposes one empty map.
Unsuccessful approach: Flattening all bindings loses both parent-only membership and scope boundaries.
Case contract
The parents view removes only the current first scope and retains remaining scope boundaries; an empty parent chain exposes one empty map. 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
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
return x
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two scopes', solve([{'a': 1}, {'a': 2}]), [{'a': 2}])
check('three scopes', solve([{'a': 1}, {'b': 2}, {'c': 3}]), [{'b': 2}, {'c': 3}])
check('one scope', solve([{'a': 1}]), [{}])
check('one empty scope', solve([{}]), [{}])
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 |
|---|---|---|---|
| two scopes | [{'a': 1}, {'a': 2}] | [{'a': 2}] | Failed |
| three scopes | [{'a': 1}, {'b': 2}, {'c': 3}] | [{'b': 2}, {'c': 3}] | Failed |
| one scope | [{'a': 1}] | [{}] | Failed |
| one empty scope | [{}] | [{}] | Passed |
SHA-256 / f56dff541d748a9d94088dff63d2889b23d2aac7f1a5ffd8125f572bf3411320
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
return [dict(ChainMap(*x))]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two scopes', solve([{'a': 1}, {'a': 2}]), [{'a': 2}])
check('three scopes', solve([{'a': 1}, {'b': 2}, {'c': 3}]), [{'b': 2}, {'c': 3}])
check('one scope', solve([{'a': 1}]), [{}])
check('one empty scope', solve([{}]), [{}])
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 |
|---|---|---|---|
| two scopes | [{'a': 1}] | [{'a': 2}] | Failed |
| three scopes | [{'a': 1, 'b': 2, 'c': 3}] | [{'b': 2}, {'c': 3}] | Failed |
| one scope | [{'a': 1}] | [{}] | Failed |
| one empty scope | [{}] | [{}] | Passed |
SHA-256 / 6789e006983d01774e7c4c3d5982a3dba2df02d86fd3d2b5c52bafde6007cbcc
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from collections import Counter, ChainMap, deque
import heapq
N = 1
observations = []
def solve(x, y=None):
return ChainMap(*x).parents.maps
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two scopes', solve([{'a': 1}, {'a': 2}]), [{'a': 2}])
check('three scopes', solve([{'a': 1}, {'b': 2}, {'c': 3}]), [{'b': 2}, {'c': 3}])
check('one scope', solve([{'a': 1}]), [{}])
check('one empty scope', solve([{}]), [{}])
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 |
|---|---|---|---|
| two scopes | [{'a': 2}] | [{'a': 2}] | Passed |
| three scopes | [{'b': 2}, {'c': 3}] | [{'b': 2}, {'c': 3}] | Passed |
| one scope | [{}] | [{}] | Passed |
| one empty scope | [{}] | [{}] | Passed |
SHA-256 / cd3bdfc2f8f89cbb60e91255195afcd49cab3f6d9adb153d51c6170498b25bdb
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:42.187593+00:00.
Case digest / 22ebd34fd5f4f5753357aa7550678bd292397bd917e3fe57bd9adb5f0d3c337f