{"abstract":"The event trace violates the named pop rule and produces incorrect keyboard state or command output.","category":"Keyboard interactions","checks":8,"contract":"Case [layers,events]. layers maps layer names to key-to-output maps; None output blocks a key and empty string is valid output. Events [kind,a,b]. Push adds a known layer unless already active; pop removes named layer; key resolves from newest active layer defining the key, falling through transparent missing entries to original key. Clear removes layers. Return emitted strings and layer stack. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.","evaluation_group":"s3-keyboard-remap-layers","failed_approach":"The partial repair changes this transition to stack=[x for x in stack if x==a], which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-remap-layers-named-pop","id":"FA-31301","implementations":{"attempt":{"sha256":"2e4bb8aa318e4368416ae2454aa69a07ac3d75e3c4722ce064f64491503de18c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        layers,events=c\n        stack=[]; out=[]; blocked=0\n        for kind,a,b in events:\n            if kind=='push' and a in layers:\n                if a not in stack: stack.append(a)\n            elif kind=='pop':\n                stack=[x for x in stack if x==a]\n            elif kind=='clear':\n                stack=[]\n            elif kind=='key':\n                result=a\n                for layer in reversed(stack):\n                    if a in layers[layer]:\n                        result=layers[layer][a]\n                        break\n                if result is None: blocked+=1\n                else: out.append(result)\n        return [out,stack,blocked]\n    return [run(c) for c in cases]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('remap-layers scenario 0', solve([[{}, []]] * N), [[[], [], 0]] * N)\ncheck('remap-layers scenario 1', solve([[{'empty': {}}, [['push', 'empty', ''], ['key', 'A', 'x']]]] * N), [[['A'], ['empty'], 0]] * N)\ncheck('remap-layers scenario 2', solve([[{'one': {'A': 'X'}}, [['push', 'one', ''], ['push', 'one', ''], ['key', 'A', '']]]] * N), [[['X'], ['one'], 0]] * N)\ncheck('remap-layers scenario 3', solve([[{'one': {'A': 'X'}, 'two': {'A': 'Y'}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[['Y'], ['one', 'two'], 0]] * N)\ncheck('remap-layers scenario 4', solve([[{'one': {'A': 'X'}, 'two': {}}, [['push', 'one', ''], ['push', 'two', ''], ['pop', 'one', ''], ['key', 'A', '']]]] * N), [[['A'], ['two'], 0]] * N)\ncheck('remap-layers scenario 5', solve([[{'one': {'A': None, 'B': ''}}, [['push', 'one', ''], ['key', 'A', ''], ['key', 'B', ''], ['key', 'C', '']]]] * N), [[['', 'C'], ['one'], 1]] * N)\ncheck('remap-layers scenario 6', solve([[{'one': {}, 'two': {}, 'three': {}}, [['push', 'one', ''], ['push', 'two', ''], ['push', 'three', ''], ['clear', '', '']]]] * N), [[[], [], 0]] * N)\ncheck('remap-layers scenario 7', solve([[{'one': {'A': 'X'}, 'two': {'A': None}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[[], ['one', 'two'], 1]] * N)\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":"edf0439f979d9c8bb5204b5c9ecec969c6fdd4d1d360cded9e57e84486769ea7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        layers,events=c\n        stack=[]; out=[]; blocked=0\n        for kind,a,b in events:\n            if kind=='push' and a in layers:\n                if a not in stack: stack.append(a)\n            elif kind=='pop':\n                stack=stack[:-1]\n            elif kind=='clear':\n                stack=[]\n            elif kind=='key':\n                result=a\n                for layer in reversed(stack):\n                    if a in layers[layer]:\n                        result=layers[layer][a]\n                        break\n                if result is None: blocked+=1\n                else: out.append(result)\n        return [out,stack,blocked]\n    return [run(c) for c in cases]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('remap-layers scenario 0', solve([[{}, []]] * N), [[[], [], 0]] * N)\ncheck('remap-layers scenario 1', solve([[{'empty': {}}, [['push', 'empty', ''], ['key', 'A', 'x']]]] * N), [[['A'], ['empty'], 0]] * N)\ncheck('remap-layers scenario 2', solve([[{'one': {'A': 'X'}}, [['push', 'one', ''], ['push', 'one', ''], ['key', 'A', '']]]] * N), [[['X'], ['one'], 0]] * N)\ncheck('remap-layers scenario 3', solve([[{'one': {'A': 'X'}, 'two': {'A': 'Y'}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[['Y'], ['one', 'two'], 0]] * N)\ncheck('remap-layers scenario 4', solve([[{'one': {'A': 'X'}, 'two': {}}, [['push', 'one', ''], ['push', 'two', ''], ['pop', 'one', ''], ['key', 'A', '']]]] * N), [[['A'], ['two'], 0]] * N)\ncheck('remap-layers scenario 5', solve([[{'one': {'A': None, 'B': ''}}, [['push', 'one', ''], ['key', 'A', ''], ['key', 'B', ''], ['key', 'C', '']]]] * N), [[['', 'C'], ['one'], 1]] * N)\ncheck('remap-layers scenario 6', solve([[{'one': {}, 'two': {}, 'three': {}}, [['push', 'one', ''], ['push', 'two', ''], ['push', 'three', ''], ['clear', '', '']]]] * N), [[[], [], 0]] * N)\ncheck('remap-layers scenario 7', solve([[{'one': {'A': 'X'}, 'two': {'A': None}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[[], ['one', 'two'], 1]] * N)\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":"50d753f3bfd10902bbd72fff21f92faccf5f4c05da8c7c62b889e4f1ff5a022a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        layers,events=c\n        stack=[]; out=[]; blocked=0\n        for kind,a,b in events:\n            if kind=='push' and a in layers:\n                if a not in stack: stack.append(a)\n            elif kind=='pop':\n                stack=[x for x in stack if x!=a]\n            elif kind=='clear':\n                stack=[]\n            elif kind=='key':\n                result=a\n                for layer in reversed(stack):\n                    if a in layers[layer]:\n                        result=layers[layer][a]\n                        break\n                if result is None: blocked+=1\n                else: out.append(result)\n        return [out,stack,blocked]\n    return [run(c) for c in cases]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('remap-layers scenario 0', solve([[{}, []]] * N), [[[], [], 0]] * N)\ncheck('remap-layers scenario 1', solve([[{'empty': {}}, [['push', 'empty', ''], ['key', 'A', 'x']]]] * N), [[['A'], ['empty'], 0]] * N)\ncheck('remap-layers scenario 2', solve([[{'one': {'A': 'X'}}, [['push', 'one', ''], ['push', 'one', ''], ['key', 'A', '']]]] * N), [[['X'], ['one'], 0]] * N)\ncheck('remap-layers scenario 3', solve([[{'one': {'A': 'X'}, 'two': {'A': 'Y'}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[['Y'], ['one', 'two'], 0]] * N)\ncheck('remap-layers scenario 4', solve([[{'one': {'A': 'X'}, 'two': {}}, [['push', 'one', ''], ['push', 'two', ''], ['pop', 'one', ''], ['key', 'A', '']]]] * N), [[['A'], ['two'], 0]] * N)\ncheck('remap-layers scenario 5', solve([[{'one': {'A': None, 'B': ''}}, [['push', 'one', ''], ['key', 'A', ''], ['key', 'B', ''], ['key', 'C', '']]]] * N), [[['', 'C'], ['one'], 1]] * N)\ncheck('remap-layers scenario 6', solve([[{'one': {}, 'two': {}, 'three': {}}, [['push', 'one', ''], ['push', 'two', ''], ['push', 'three', ''], ['clear', '', '']]]] * N), [[[], [], 0]] * N)\ncheck('remap-layers scenario 7', solve([[{'one': {'A': 'X'}, 'two': {'A': None}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[[], ['one', 'two'], 1]] * N)\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 event model, not a browser implementation or web standard 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-keyboard-interactions-remap-layers-named-pop","generated_at":"2026-09-29T14:42:00.860873+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Controlled keyboard event processing model for debugging application event logic.","repair":"Use the contract transition `stack=[x for x in stack if x!=a]` at the named pop fault site; preserve the other state transitions.","root_cause":"Layer release pops the latest layer instead of the named one.","sha256":"31daecb64c5979a77a44287197c128003c9cf3aed55715f3b270ce04cc6d3976","title":"Layered physical keyboard remapping: Layer release pops the latest layer instead of the named one · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.536,"exit_code":1,"observations":[{"actual":[[[],[],0]],"check":"remap-layers scenario 0","expected":[[[],[],0]],"passed":true},{"actual":[[["A"],["empty"],0]],"check":"remap-layers scenario 1","expected":[[["A"],["empty"],0]],"passed":true},{"actual":[[["X"],["one"],0]],"check":"remap-layers scenario 2","expected":[[["X"],["one"],0]],"passed":true},{"actual":[[["Y"],["one","two"],0]],"check":"remap-layers scenario 3","expected":[[["Y"],["one","two"],0]],"passed":true},{"actual":[[["X"],["one"],0]],"check":"remap-layers scenario 4","expected":[[["A"],["two"],0]],"passed":false},{"actual":[[["","C"],["one"],1]],"check":"remap-layers scenario 5","expected":[[["","C"],["one"],1]],"passed":true},{"actual":[[[],[],0]],"check":"remap-layers scenario 6","expected":[[[],[],0]],"passed":true},{"actual":[[[],["one","two"],1]],"check":"remap-layers scenario 7","expected":[[[],["one","two"],1]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"remap-layers scenario 0\", \"actual\": [[[], [], 0]], \"expected\": [[[], [], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 1\", \"actual\": [[[\"A\"], [\"empty\"], 0]], \"expected\": [[[\"A\"], [\"empty\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 2\", \"actual\": [[[\"X\"], [\"one\"], 0]], \"expected\": [[[\"X\"], [\"one\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 3\", \"actual\": [[[\"Y\"], [\"one\", \"two\"], 0]], \"expected\": [[[\"Y\"], [\"one\", \"two\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 4\", \"actual\": [[[\"X\"], [\"one\"], 0]], \"expected\": [[[\"A\"], [\"two\"], 0]], \"passed\": false}, {\"check\": \"remap-layers scenario 5\", \"actual\": [[[\"\", \"C\"], [\"one\"], 1]], \"expected\": [[[\"\", \"C\"], [\"one\"], 1]], \"passed\": true}, {\"check\": \"remap-layers scenario 6\", \"actual\": [[[], [], 0]], \"expected\": [[[], [], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 7\", \"actual\": [[[], [\"one\", \"two\"], 1]], \"expected\": [[[], [\"one\", \"two\"], 1]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.513,"exit_code":1,"observations":[{"actual":[[[],[],0]],"check":"remap-layers scenario 0","expected":[[[],[],0]],"passed":true},{"actual":[[["A"],["empty"],0]],"check":"remap-layers scenario 1","expected":[[["A"],["empty"],0]],"passed":true},{"actual":[[["X"],["one"],0]],"check":"remap-layers scenario 2","expected":[[["X"],["one"],0]],"passed":true},{"actual":[[["Y"],["one","two"],0]],"check":"remap-layers scenario 3","expected":[[["Y"],["one","two"],0]],"passed":true},{"actual":[[["X"],["one"],0]],"check":"remap-layers scenario 4","expected":[[["A"],["two"],0]],"passed":false},{"actual":[[["","C"],["one"],1]],"check":"remap-layers scenario 5","expected":[[["","C"],["one"],1]],"passed":true},{"actual":[[[],[],0]],"check":"remap-layers scenario 6","expected":[[[],[],0]],"passed":true},{"actual":[[[],["one","two"],1]],"check":"remap-layers scenario 7","expected":[[[],["one","two"],1]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"remap-layers scenario 0\", \"actual\": [[[], [], 0]], \"expected\": [[[], [], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 1\", \"actual\": [[[\"A\"], [\"empty\"], 0]], \"expected\": [[[\"A\"], [\"empty\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 2\", \"actual\": [[[\"X\"], [\"one\"], 0]], \"expected\": [[[\"X\"], [\"one\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 3\", \"actual\": [[[\"Y\"], [\"one\", \"two\"], 0]], \"expected\": [[[\"Y\"], [\"one\", \"two\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 4\", \"actual\": [[[\"X\"], [\"one\"], 0]], \"expected\": [[[\"A\"], [\"two\"], 0]], \"passed\": false}, {\"check\": \"remap-layers scenario 5\", \"actual\": [[[\"\", \"C\"], [\"one\"], 1]], \"expected\": [[[\"\", \"C\"], [\"one\"], 1]], \"passed\": true}, {\"check\": \"remap-layers scenario 6\", \"actual\": [[[], [], 0]], \"expected\": [[[], [], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 7\", \"actual\": [[[], [\"one\", \"two\"], 1]], \"expected\": [[[], [\"one\", \"two\"], 1]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.601,"exit_code":0,"observations":[{"actual":[[[],[],0]],"check":"remap-layers scenario 0","expected":[[[],[],0]],"passed":true},{"actual":[[["A"],["empty"],0]],"check":"remap-layers scenario 1","expected":[[["A"],["empty"],0]],"passed":true},{"actual":[[["X"],["one"],0]],"check":"remap-layers scenario 2","expected":[[["X"],["one"],0]],"passed":true},{"actual":[[["Y"],["one","two"],0]],"check":"remap-layers scenario 3","expected":[[["Y"],["one","two"],0]],"passed":true},{"actual":[[["A"],["two"],0]],"check":"remap-layers scenario 4","expected":[[["A"],["two"],0]],"passed":true},{"actual":[[["","C"],["one"],1]],"check":"remap-layers scenario 5","expected":[[["","C"],["one"],1]],"passed":true},{"actual":[[[],[],0]],"check":"remap-layers scenario 6","expected":[[[],[],0]],"passed":true},{"actual":[[[],["one","two"],1]],"check":"remap-layers scenario 7","expected":[[[],["one","two"],1]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"remap-layers scenario 0\", \"actual\": [[[], [], 0]], \"expected\": [[[], [], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 1\", \"actual\": [[[\"A\"], [\"empty\"], 0]], \"expected\": [[[\"A\"], [\"empty\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 2\", \"actual\": [[[\"X\"], [\"one\"], 0]], \"expected\": [[[\"X\"], [\"one\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 3\", \"actual\": [[[\"Y\"], [\"one\", \"two\"], 0]], \"expected\": [[[\"Y\"], [\"one\", \"two\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 4\", \"actual\": [[[\"A\"], [\"two\"], 0]], \"expected\": [[[\"A\"], [\"two\"], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 5\", \"actual\": [[[\"\", \"C\"], [\"one\"], 1]], \"expected\": [[[\"\", \"C\"], [\"one\"], 1]], \"passed\": true}, {\"check\": \"remap-layers scenario 6\", \"actual\": [[[], [], 0]], \"expected\": [[[], [], 0]], \"passed\": true}, {\"check\": \"remap-layers scenario 7\", \"actual\": [[[], [\"one\", \"two\"], 1]], \"expected\": [[[], [\"one\", \"two\"], 1]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}