{"abstract":"The operation returns a result or retained state that violates this contract: ChainMap key iteration begins with the last scope and appends previously unseen keys from inner scopes; lookup values still favor inner scopes.","category":"Scoped mappings","checks":4,"contract":"ChainMap key iteration begins with the last scope and appends previously unseen keys from inner scopes; lookup values still favor inner scopes. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","contract_signature":"x, y=None","evaluation_group":"model-d1b1c65ee524bf7b","failed_approach":"Sorting keys discards scope encounter order.","family":"xr-chainmap-iteration-order-comes-from-outer-scopes","id":"FA-4726","implementations":{"attempt":{"sha256":"b637c278b88d863b789d90757b6b18a402a70551c99aaafb123f1ac3899cff91","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(*x); return [[k,c[k]] for k in sorted(c)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('outer order with inner values', solve([{'a': 2, 'c': 3}, {'b': 1, 'a': 1}]), [['b', 1], ['a', 2], ['c', 3]])\ncheck('one scope order', solve([{'b': 2, 'a': 1}]), [['b', 2], ['a', 1]])\ncheck('empty scopes', solve([{}, {}]), [])\ncheck('inner only key', solve([{'a': 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":"c8701c68eebb8ca46920683047fc27a704cac3ddd42fd711c3661ec61362d0f6","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(*x); return [[k,c[k]] for k in dict.fromkeys(k for m in x for k in m)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('outer order with inner values', solve([{'a': 2, 'c': 3}, {'b': 1, 'a': 1}]), [['b', 1], ['a', 2], ['c', 3]])\ncheck('one scope order', solve([{'b': 2, 'a': 1}]), [['b', 2], ['a', 1]])\ncheck('empty scopes', solve([{}, {}]), [])\ncheck('inner only key', solve([{'a': 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-iteration-order-comes-from-outer-scopes","generated_at":"2026-09-29T14:37:42.142658+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":"Inner-first key traversal differs from the ChainMap outer-first key-order rule.","sha256":"420a52d9f63eb523b97441917992e42366fd4ebf10bf454c8a92d006a62f08c8","title":"Chainmap iteration order comes from outer scopes · 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":37.868,"exit_code":1,"observations":[{"actual":[["a",2],["b",1],["c",3]],"check":"outer order with inner values","expected":[["b",1],["a",2],["c",3]],"passed":false},{"actual":[["a",1],["b",2]],"check":"one scope order","expected":[["b",2],["a",1]],"passed":false},{"actual":[],"check":"empty scopes","expected":[],"passed":true},{"actual":[["a",1]],"check":"inner only key","expected":[["a",1]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"outer order with inner values\", \"actual\": [[\"a\", 2], [\"b\", 1], [\"c\", 3]], \"expected\": [[\"b\", 1], [\"a\", 2], [\"c\", 3]], \"passed\": false}, {\"check\": \"one scope order\", \"actual\": [[\"a\", 1], [\"b\", 2]], \"expected\": [[\"b\", 2], [\"a\", 1]], \"passed\": false}, {\"check\": \"empty scopes\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"inner only key\", \"actual\": [[\"a\", 1]], \"expected\": [[\"a\", 1]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.28,"exit_code":1,"observations":[{"actual":[["a",2],["c",3],["b",1]],"check":"outer order with inner values","expected":[["b",1],["a",2],["c",3]],"passed":false},{"actual":[["b",2],["a",1]],"check":"one scope order","expected":[["b",2],["a",1]],"passed":true},{"actual":[],"check":"empty scopes","expected":[],"passed":true},{"actual":[["a",1]],"check":"inner only key","expected":[["a",1]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"outer order with inner values\", \"actual\": [[\"a\", 2], [\"c\", 3], [\"b\", 1]], \"expected\": [[\"b\", 1], [\"a\", 2], [\"c\", 3]], \"passed\": false}, {\"check\": \"one scope order\", \"actual\": [[\"b\", 2], [\"a\", 1]], \"expected\": [[\"b\", 2], [\"a\", 1]], \"passed\": true}, {\"check\": \"empty scopes\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"inner only key\", \"actual\": [[\"a\", 1]], \"expected\": [[\"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."}}