{"abstract":"The operation returns a result or retained state that violates this contract: setdefault returns an existing binding from any scope without inserting into the first scope; only an absent key is inserted.","category":"Scoped mappings","checks":4,"contract":"setdefault returns an existing binding from any scope without inserting into the first scope; only an absent key is inserted. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","contract_signature":"x, y=None","evaluation_group":"model-3afdb5965e13bae1","failed_approach":"Boolean fallback overwrites falsy inherited values and inserts unnecessary shadows.","family":"xr-chainmap-setdefault-observes-outer-binding","id":"FA-4746","implementations":{"attempt":{"sha256":"0072b7eeeee66ce77d7c344334f24d2529b8a080f3e0c1823efcf362db817d77","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom collections import Counter, ChainMap, deque\nimport heapq\nN = 1\nobservations = []\ndef solve(x, y=None):\n    c=ChainMap(*[dict(m) for m in x]); v=c.get(y[0]) or y[1]; c[y[0]]=v; return [v,c.maps]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('outer binding remains outer', solve([{}, {'a': 1}], ['a', 2]), [1, [{}, {'a': 1}]])\ncheck('outer None retained', solve([{}, {'a': None}], ['a', 2]), [None, [{}, {'a': None}]])\ncheck('absent inserted', solve([{}, {}], ['a', 2]), [2, [{'a': 2}, {}]])\ncheck('inner existing', solve([{'a': 1}], ['a', 2]), [1, [{'a': 1}]])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"06d30ce4a95345efce083816c7a15539f74f513074b624d63a19ec70ebb6e954","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom collections import Counter, ChainMap, deque\nimport heapq\nN = 1\nobservations = []\ndef solve(x, y=None):\n    a=[dict(m) for m in x]; v=a[0].setdefault(y[0],y[1]); return [v,a]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('outer binding remains outer', solve([{}, {'a': 1}], ['a', 2]), [1, [{}, {'a': 1}]])\ncheck('outer None retained', solve([{}, {'a': None}], ['a', 2]), [None, [{}, {'a': None}]])\ncheck('absent inserted', solve([{}, {}], ['a', 2]), [2, [{'a': 2}, {}]])\ncheck('inner existing', solve([{'a': 1}], ['a', 2]), [1, [{'a': 1}]])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":" 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"xr-chainmap-setdefault-observes-outer-binding","generated_at":"2026-09-29T14:37:42.190518+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.","root_cause":"Applying setdefault directly to the first map ignores inherited bindings.","sha256":"18615e61d9ae58a5bbeed44b3328a0b04e75eccca92c29499ab5ba8dd863e99e","title":"Chainmap setdefault observes outer binding · case 01","variant":1,"variant_policy":"Five execution reruns of a fixed adversarial fixture suite; variant number does not alter semantic inputs.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":42.535,"exit_code":1,"observations":[{"actual":[1,[{"a":1},{"a":1}]],"check":"outer binding remains outer","expected":[1,[{},{"a":1}]],"passed":false},{"actual":[2,[{"a":2},{"a":null}]],"check":"outer None retained","expected":[null,[{},{"a":null}]],"passed":false},{"actual":[2,[{"a":2},{}]],"check":"absent inserted","expected":[2,[{"a":2},{}]],"passed":true},{"actual":[1,[{"a":1}]],"check":"inner existing","expected":[1,[{"a":1}]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"outer binding remains outer\", \"actual\": [1, [{\"a\": 1}, {\"a\": 1}]], \"expected\": [1, [{}, {\"a\": 1}]], \"passed\": false}, {\"check\": \"outer None retained\", \"actual\": [2, [{\"a\": 2}, {\"a\": null}]], \"expected\": [null, [{}, {\"a\": null}]], \"passed\": false}, {\"check\": \"absent inserted\", \"actual\": [2, [{\"a\": 2}, {}]], \"expected\": [2, [{\"a\": 2}, {}]], \"passed\": true}, {\"check\": \"inner existing\", \"actual\": [1, [{\"a\": 1}]], \"expected\": [1, [{\"a\": 1}]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":37.15,"exit_code":1,"observations":[{"actual":[2,[{"a":2},{"a":1}]],"check":"outer binding remains outer","expected":[1,[{},{"a":1}]],"passed":false},{"actual":[2,[{"a":2},{"a":null}]],"check":"outer None retained","expected":[null,[{},{"a":null}]],"passed":false},{"actual":[2,[{"a":2},{}]],"check":"absent inserted","expected":[2,[{"a":2},{}]],"passed":true},{"actual":[1,[{"a":1}]],"check":"inner existing","expected":[1,[{"a":1}]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"outer binding remains outer\", \"actual\": [2, [{\"a\": 2}, {\"a\": 1}]], \"expected\": [1, [{}, {\"a\": 1}]], \"passed\": false}, {\"check\": \"outer None retained\", \"actual\": [2, [{\"a\": 2}, {\"a\": null}]], \"expected\": [null, [{}, {\"a\": null}]], \"passed\": false}, {\"check\": \"absent inserted\", \"actual\": [2, [{\"a\": 2}, {}]], \"expected\": [2, [{\"a\": 2}, {}]], \"passed\": true}, {\"check\": \"inner existing\", \"actual\": [1, [{\"a\": 1}]], \"expected\": [1, [{\"a\": 1}]], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}