{"abstract":"Opening a query block overwrites its parent CTE dictionary.","category":"Data systems","checks":7,"contract":"Interpret nested query blocks using actions push(definitions), pop, and read(name). Every push opens a new CTE scope; reads search innermost scope first then outer scopes. Empty inner scopes still hide nothing, popping restores outer definitions, and unresolved names yield MISSING. Definitions are already evaluated row lists.","evaluation_group":"s3-data-systems-cte-lexical-environments","failed_approach":"Aliasing the parent dictionary still leaks inner definitions after pop.","family":"s3-data-systems-cte-lexical-environments-push-overwrite","id":"FA-45606","implementations":{"attempt":{"sha256":"0a91d5c535414624fee27ff5ca5c80244dfe0ea153bf9f012f050fb362406893","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        scopes=[{}]; out=[]\n        for action,arg in d:\n            if action=='push': scopes.append(scopes[-1]); scopes[-1].update(arg)\n            elif action=='pop': scopes.pop()\n            else:\n                found='MISSING'\n                for scope in reversed(scopes):\n                    if arg in scope: found=scope[arg]; break\n                out.append(found)\n        return out\n    except (IndexError, KeyError, ValueError, StopIteration) as exc:\n        return {\"representation_error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nif N == 1:\n    check('inner shadow', solve([['push', {'x': [1]}], ['push', {'x': [2]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[2], [1]])\n    check('outer fallback', solve([['push', {'x': [1]}], ['push', {}], ['read', 'x']]), [[1]])\n    check('empty shadow', solve([['push', {'x': [1]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [1]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [1]}], ['push', {'x': [2]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[1]])\n    check('no actions', solve([]), [])\nelif N == 2:\n    check('inner shadow', solve([['push', {'x': [2]}], ['push', {'x': [3]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[3], [2]])\n    check('outer fallback', solve([['push', {'x': [2]}], ['push', {}], ['read', 'x']]), [[2]])\n    check('empty shadow', solve([['push', {'x': [2]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [2]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [2]}], ['push', {'x': [3]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[2]])\n    check('no actions', solve([]), [])\nelif N == 3:\n    check('inner shadow', solve([['push', {'x': [3]}], ['push', {'x': [4]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[4], [3]])\n    check('outer fallback', solve([['push', {'x': [3]}], ['push', {}], ['read', 'x']]), [[3]])\n    check('empty shadow', solve([['push', {'x': [3]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [3]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [3]}], ['push', {'x': [4]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[3]])\n    check('no actions', solve([]), [])\nelif N == 4:\n    check('inner shadow', solve([['push', {'x': [4]}], ['push', {'x': [5]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[5], [4]])\n    check('outer fallback', solve([['push', {'x': [4]}], ['push', {}], ['read', 'x']]), [[4]])\n    check('empty shadow', solve([['push', {'x': [4]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [4]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [4]}], ['push', {'x': [5]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[4]])\n    check('no actions', solve([]), [])\nelif N == 5:\n    check('inner shadow', solve([['push', {'x': [5]}], ['push', {'x': [6]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[6], [5]])\n    check('outer fallback', solve([['push', {'x': [5]}], ['push', {}], ['read', 'x']]), [[5]])\n    check('empty shadow', solve([['push', {'x': [5]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [5]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [5]}], ['push', {'x': [6]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[5]])\n    check('no actions', solve([]), [])\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":"deb66eb83086a8522374658458a243bf2ed1578832d6bcb569cd3f5d8e0d0afa","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        scopes=[{}]; out=[]\n        for action,arg in d:\n            if action=='push': scopes[-1].update(arg); scopes.append({})\n            elif action=='pop': scopes.pop()\n            else:\n                found='MISSING'\n                for scope in reversed(scopes):\n                    if arg in scope: found=scope[arg]; break\n                out.append(found)\n        return out\n    except (IndexError, KeyError, ValueError, StopIteration) as exc:\n        return {\"representation_error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nif N == 1:\n    check('inner shadow', solve([['push', {'x': [1]}], ['push', {'x': [2]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[2], [1]])\n    check('outer fallback', solve([['push', {'x': [1]}], ['push', {}], ['read', 'x']]), [[1]])\n    check('empty shadow', solve([['push', {'x': [1]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [1]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [1]}], ['push', {'x': [2]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[1]])\n    check('no actions', solve([]), [])\nelif N == 2:\n    check('inner shadow', solve([['push', {'x': [2]}], ['push', {'x': [3]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[3], [2]])\n    check('outer fallback', solve([['push', {'x': [2]}], ['push', {}], ['read', 'x']]), [[2]])\n    check('empty shadow', solve([['push', {'x': [2]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [2]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [2]}], ['push', {'x': [3]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[2]])\n    check('no actions', solve([]), [])\nelif N == 3:\n    check('inner shadow', solve([['push', {'x': [3]}], ['push', {'x': [4]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[4], [3]])\n    check('outer fallback', solve([['push', {'x': [3]}], ['push', {}], ['read', 'x']]), [[3]])\n    check('empty shadow', solve([['push', {'x': [3]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [3]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [3]}], ['push', {'x': [4]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[3]])\n    check('no actions', solve([]), [])\nelif N == 4:\n    check('inner shadow', solve([['push', {'x': [4]}], ['push', {'x': [5]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[5], [4]])\n    check('outer fallback', solve([['push', {'x': [4]}], ['push', {}], ['read', 'x']]), [[4]])\n    check('empty shadow', solve([['push', {'x': [4]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [4]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [4]}], ['push', {'x': [5]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[4]])\n    check('no actions', solve([]), [])\nelif N == 5:\n    check('inner shadow', solve([['push', {'x': [5]}], ['push', {'x': [6]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[6], [5]])\n    check('outer fallback', solve([['push', {'x': [5]}], ['push', {}], ['read', 'x']]), [[5]])\n    check('empty shadow', solve([['push', {'x': [5]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [5]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [5]}], ['push', {'x': [6]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[5]])\n    check('no actions', solve([]), [])\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"},"fixed":{"sha256":"6f6534aa1ff2c258ca2015af67b08f8ac06efa282c875621256588015773afb8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(d):\n    try:\n        scopes=[{}]; out=[]\n        for action,arg in d:\n            if action=='push': scopes.append(dict(arg))\n            elif action=='pop': scopes.pop()\n            else:\n                found='MISSING'\n                for scope in reversed(scopes):\n                    if arg in scope: found=scope[arg]; break\n                out.append(found)\n        return out\n    except (IndexError, KeyError, ValueError, StopIteration) as exc:\n        return {\"representation_error\": type(exc).__name__}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nif N == 1:\n    check('inner shadow', solve([['push', {'x': [1]}], ['push', {'x': [2]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[2], [1]])\n    check('outer fallback', solve([['push', {'x': [1]}], ['push', {}], ['read', 'x']]), [[1]])\n    check('empty shadow', solve([['push', {'x': [1]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [1]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [1]}], ['push', {'x': [2]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[1]])\n    check('no actions', solve([]), [])\nelif N == 2:\n    check('inner shadow', solve([['push', {'x': [2]}], ['push', {'x': [3]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[3], [2]])\n    check('outer fallback', solve([['push', {'x': [2]}], ['push', {}], ['read', 'x']]), [[2]])\n    check('empty shadow', solve([['push', {'x': [2]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [2]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [2]}], ['push', {'x': [3]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[2]])\n    check('no actions', solve([]), [])\nelif N == 3:\n    check('inner shadow', solve([['push', {'x': [3]}], ['push', {'x': [4]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[4], [3]])\n    check('outer fallback', solve([['push', {'x': [3]}], ['push', {}], ['read', 'x']]), [[3]])\n    check('empty shadow', solve([['push', {'x': [3]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [3]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [3]}], ['push', {'x': [4]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[3]])\n    check('no actions', solve([]), [])\nelif N == 4:\n    check('inner shadow', solve([['push', {'x': [4]}], ['push', {'x': [5]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[5], [4]])\n    check('outer fallback', solve([['push', {'x': [4]}], ['push', {}], ['read', 'x']]), [[4]])\n    check('empty shadow', solve([['push', {'x': [4]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [4]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [4]}], ['push', {'x': [5]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[4]])\n    check('no actions', solve([]), [])\nelif N == 5:\n    check('inner shadow', solve([['push', {'x': [5]}], ['push', {'x': [6]}], ['read', 'x'], ['pop', None], ['read', 'x']]), [[6], [5]])\n    check('outer fallback', solve([['push', {'x': [5]}], ['push', {}], ['read', 'x']]), [[5]])\n    check('empty shadow', solve([['push', {'x': [5]}], ['push', {'x': []}], ['read', 'x']]), [[]])\n    check('missing name', solve([['read', 'x']]), ['MISSING'])\n    check('restore missing', solve([['push', {'x': [5]}], ['pop', None], ['read', 'x']]), ['MISSING'])\n    check('nested pops', solve([['push', {'x': [5]}], ['push', {'x': [6]}], ['push', {}], ['pop', None], ['pop', None], ['read', 'x']]), [[5]])\n    check('no actions', solve([]), [])\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":"Offline stipulated semantics over valid small inputs; no performance, concurrency, or production-engine conformance claim. 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":"s3-data-systems-cte-lexical-environments-push-overwrite","generated_at":"2026-09-29T14:44:23.962572+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A bounded deterministic data engine model makes representation and changelog faults reproducible.","repair":"Preserve the stated physical representation and operation order: Interpret nested query blocks using actions push(definitions), pop, and read(name). Every push opens a new CTE scope; reads search innermost scope first then outer scopes. Empty inner scopes still hide nothing, popping restores outer definitions, and unresolved names yield MISSING. Definitions are already evaluated row lists.","root_cause":"cte-lexical-environments: Opening a query block overwrites its parent CTE dictionary.","sha256":"ccc86440f83c3c14a1db0e932b544925bcdf470ec0701654b84e064cf20ea3f4","title":"Opening a query block overwrites its parent CTE dictionary · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.32,"exit_code":1,"observations":[{"actual":[[2],[2]],"check":"inner shadow","expected":[[2],[1]],"passed":false},{"actual":[[1]],"check":"outer fallback","expected":[[1]],"passed":true},{"actual":[[]],"check":"empty shadow","expected":[[]],"passed":true},{"actual":["MISSING"],"check":"missing name","expected":["MISSING"],"passed":true},{"actual":[[1]],"check":"restore missing","expected":["MISSING"],"passed":false},{"actual":[[2]],"check":"nested pops","expected":[[1]],"passed":false},{"actual":[],"check":"no actions","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"inner shadow\", \"actual\": [[2], [2]], \"expected\": [[2], [1]], \"passed\": false}, {\"check\": \"outer fallback\", \"actual\": [[1]], \"expected\": [[1]], \"passed\": true}, {\"check\": \"empty shadow\", \"actual\": [[]], \"expected\": [[]], \"passed\": true}, {\"check\": \"missing name\", \"actual\": [\"MISSING\"], \"expected\": [\"MISSING\"], \"passed\": true}, {\"check\": \"restore missing\", \"actual\": [[1]], \"expected\": [\"MISSING\"], \"passed\": false}, {\"check\": \"nested pops\", \"actual\": [[2]], \"expected\": [[1]], \"passed\": false}, {\"check\": \"no actions\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.703,"exit_code":1,"observations":[{"actual":[[2],[2]],"check":"inner shadow","expected":[[2],[1]],"passed":false},{"actual":[[1]],"check":"outer fallback","expected":[[1]],"passed":true},{"actual":[[]],"check":"empty shadow","expected":[[]],"passed":true},{"actual":["MISSING"],"check":"missing name","expected":["MISSING"],"passed":true},{"actual":[[1]],"check":"restore missing","expected":["MISSING"],"passed":false},{"actual":[[2]],"check":"nested pops","expected":[[1]],"passed":false},{"actual":[],"check":"no actions","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"inner shadow\", \"actual\": [[2], [2]], \"expected\": [[2], [1]], \"passed\": false}, {\"check\": \"outer fallback\", \"actual\": [[1]], \"expected\": [[1]], \"passed\": true}, {\"check\": \"empty shadow\", \"actual\": [[]], \"expected\": [[]], \"passed\": true}, {\"check\": \"missing name\", \"actual\": [\"MISSING\"], \"expected\": [\"MISSING\"], \"passed\": true}, {\"check\": \"restore missing\", \"actual\": [[1]], \"expected\": [\"MISSING\"], \"passed\": false}, {\"check\": \"nested pops\", \"actual\": [[2]], \"expected\": [[1]], \"passed\": false}, {\"check\": \"no actions\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":46.1,"exit_code":0,"observations":[{"actual":[[2],[1]],"check":"inner shadow","expected":[[2],[1]],"passed":true},{"actual":[[1]],"check":"outer fallback","expected":[[1]],"passed":true},{"actual":[[]],"check":"empty shadow","expected":[[]],"passed":true},{"actual":["MISSING"],"check":"missing name","expected":["MISSING"],"passed":true},{"actual":["MISSING"],"check":"restore missing","expected":["MISSING"],"passed":true},{"actual":[[1]],"check":"nested pops","expected":[[1]],"passed":true},{"actual":[],"check":"no actions","expected":[],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"inner shadow\", \"actual\": [[2], [1]], \"expected\": [[2], [1]], \"passed\": true}, {\"check\": \"outer fallback\", \"actual\": [[1]], \"expected\": [[1]], \"passed\": true}, {\"check\": \"empty shadow\", \"actual\": [[]], \"expected\": [[]], \"passed\": true}, {\"check\": \"missing name\", \"actual\": [\"MISSING\"], \"expected\": [\"MISSING\"], \"passed\": true}, {\"check\": \"restore missing\", \"actual\": [\"MISSING\"], \"expected\": [\"MISSING\"], \"passed\": true}, {\"check\": \"nested pops\", \"actual\": [[1]], \"expected\": [[1]], \"passed\": true}, {\"check\": \"no actions\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}