FAILURE MAP
← Case archive

FA-4721 / Scoped mappings / Open access

Chainmap delete top scope only · case 01

The operation returns a result or retained state that violates this contract: Deletion removes a key only from the first scope; outer-only or missing keys report false without modifying any scope.

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

ROOT CAUSE

Searching all scopes allows deletion of an inherited binding.

VERIFIED REPAIR

Deletion removes a key only from the first scope; outer-only or missing keys report false without modifying any scope.

Unsuccessful approach: Deleting from every scope destroys shadowed parent bindings as well.

Case contract

Deletion removes a key only from the first scope; outer-only or missing keys report false without modifying any scope. 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):
    a=[dict(m) for m in x]; m=next((m for m in a if y in m),None); ok=m is not None
    if ok: del m[y]
    return [ok,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer binding protected', solve([{}, {'a': 1}], 'a'), [False, [{}, {'a': 1}]])
check('inner reveals outer', solve([{'a': 2}, {'a': 1}], 'a'), [True, [{}, {'a': 1}]])
check('missing untouched', solve([{}, {}], 'a'), [False, [{}, {}]])
check('single scope', solve([{'a': 1}], 'a'), [True, [{}]])
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
outer binding protected[True, [{}, {}]][False, [{}, {'a': 1}]]Failed
inner reveals outer[True, [{}, {'a': 1}]][True, [{}, {'a': 1}]]Passed
missing untouched[False, [{}, {}]][False, [{}, {}]]Passed
single scope[True, [{}]][True, [{}]]Passed

SHA-256 / e863768b1682551f6490e87ae835219f23e581638285340c8e4d15d6ff8d8476

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):
    a=[dict(m) for m in x]; ok=any(y in m for m in a)
    for m in a: m.pop(y,None)
    return [ok,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer binding protected', solve([{}, {'a': 1}], 'a'), [False, [{}, {'a': 1}]])
check('inner reveals outer', solve([{'a': 2}, {'a': 1}], 'a'), [True, [{}, {'a': 1}]])
check('missing untouched', solve([{}, {}], 'a'), [False, [{}, {}]])
check('single scope', solve([{'a': 1}], 'a'), [True, [{}]])
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
outer binding protected[True, [{}, {}]][False, [{}, {'a': 1}]]Failed
inner reveals outer[True, [{}, {}]][True, [{}, {'a': 1}]]Failed
missing untouched[False, [{}, {}]][False, [{}, {}]]Passed
single scope[True, [{}]][True, [{}]]Passed

SHA-256 / 12aa244646a17c8bec8e685a6d27fde13ae243e2189e3a814f3da408063ae45b

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):
    a=[dict(m) for m in x]; ok=y in a[0]
    if ok: del a[0][y]
    return [ok,a]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('outer binding protected', solve([{}, {'a': 1}], 'a'), [False, [{}, {'a': 1}]])
check('inner reveals outer', solve([{'a': 2}, {'a': 1}], 'a'), [True, [{}, {'a': 1}]])
check('missing untouched', solve([{}, {}], 'a'), [False, [{}, {}]])
check('single scope', solve([{'a': 1}], 'a'), [True, [{}]])
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
outer binding protected[False, [{}, {'a': 1}]][False, [{}, {'a': 1}]]Passed
inner reveals outer[True, [{}, {'a': 1}]][True, [{}, {'a': 1}]]Passed
missing untouched[False, [{}, {}]][False, [{}, {}]]Passed
single scope[True, [{}]][True, [{}]]Passed

SHA-256 / e91707a26be5c6f0a4f4de7ed6b76cc945243ee6f3fa195d74fb55fe04f6751b

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

Case digest / b3296f14e31e9b51bf0eb4876224f97d6595c5a3f0970b6ffeb515d50a9f3ef7