{"abstract":"The event trace violates the generation replace rule and produces incorrect keyboard state or command output.","category":"Keyboard interactions","checks":9,"contract":"Events [kind,device,a,b]. layout replaces device generation a and clears cached labels; map caches physical code a to label b in current generation; lookup emits cached label or code a as fallback. Disconnect removes generation and cache. Maps and lookups before layout are ignored. Return emitted labels, generations and cached [device,code,label] rows. 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-layout-cache","failed_approach":"The partial repair changes this transition to generations[a]=device, which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-layout-cache-generation-replace","id":"FA-31241","implementations":{"attempt":{"sha256":"30e0903901b386c3c2026e1e2bda17922f5e1a843baf596dbb3b131fbf915a47","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        generations={}; cache={}; out=[]\n        for kind,device,a,b in c:\n            if kind=='layout':\n                generations[a]=device\n                cache={k:v for k,v in cache.items() if k[0]!=device}\n            elif kind=='map' and device in generations:\n                cache[(device,a)]=b\n            elif kind=='lookup' and device in generations:\n                out.append(cache.get((device,a),a))\n            elif kind=='disconnect':\n                generations.pop(device,None)\n                cache={k:v for k,v in cache.items() if k[0]!=device}\n        return [out,sorted([[k,v] for k,v in generations.items()]),sorted([[d,k,v] for (d,k),v in cache.items()])]\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('layout-cache scenario 0', solve([[]] * N), [[[], [], []]] * N)\ncheck('layout-cache scenario 1', solve([[['map', 'a', 'KeyA', 'x'], ['lookup', 'a', 'KeyA', '']]] * N), [[[], [], []]] * N)\ncheck('layout-cache scenario 2', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['lookup', 'a', 'KeyA', '']]] * N), [[['x'], [['a', 1]], [['a', 'KeyA', 'x']]]] * N)\ncheck('layout-cache scenario 3', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'a', 'KeyA', 'y'], ['lookup', 'a', 'KeyA', '']]] * N), [[['y'], [['a', 1]], [['a', 'KeyA', 'y']]]] * N)\ncheck('layout-cache scenario 4', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['layout', 'a', 2, ''], ['lookup', 'a', 'KeyA', '']]] * N), [[['KeyA'], [['a', 2]], []]] * N)\ncheck('layout-cache scenario 5', solve([[['layout', 'a', 1, ''], ['layout', 'b', 2, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'b', 'KeyB', 'y'], ['layout', 'a', 3, '']]] * N), [[[], [['a', 3], ['b', 2]], [['b', 'KeyB', 'y']]]] * N)\ncheck('layout-cache scenario 6', solve([[['layout', 'a', 1, ''], ['lookup', 'b', 'KeyA', '']]] * N), [[[], [['a', 1]], []]] * N)\ncheck('layout-cache scenario 7', solve([[['layout', 'a', 1, ''], ['lookup', 'a', 'Unknown', 'fallback']]] * N), [[['Unknown'], [['a', 1]], []]] * N)\ncheck('layout-cache scenario 8', solve([[['layout', 'a', 1, ''], ['layout', 'b', 2, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'b', 'KeyB', 'y'], ['disconnect', 'a', '', '']]] * N), [[[], [['b', 2]], [['b', 'KeyB', 'y']]]] * 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":"3e3676d0050ccc93446c633f109930ce38b647508f5390f106af7470b70ac5ab","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        generations={}; cache={}; out=[]\n        for kind,device,a,b in c:\n            if kind=='layout':\n                generations.setdefault(device,a)\n                cache={k:v for k,v in cache.items() if k[0]!=device}\n            elif kind=='map' and device in generations:\n                cache[(device,a)]=b\n            elif kind=='lookup' and device in generations:\n                out.append(cache.get((device,a),a))\n            elif kind=='disconnect':\n                generations.pop(device,None)\n                cache={k:v for k,v in cache.items() if k[0]!=device}\n        return [out,sorted([[k,v] for k,v in generations.items()]),sorted([[d,k,v] for (d,k),v in cache.items()])]\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('layout-cache scenario 0', solve([[]] * N), [[[], [], []]] * N)\ncheck('layout-cache scenario 1', solve([[['map', 'a', 'KeyA', 'x'], ['lookup', 'a', 'KeyA', '']]] * N), [[[], [], []]] * N)\ncheck('layout-cache scenario 2', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['lookup', 'a', 'KeyA', '']]] * N), [[['x'], [['a', 1]], [['a', 'KeyA', 'x']]]] * N)\ncheck('layout-cache scenario 3', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'a', 'KeyA', 'y'], ['lookup', 'a', 'KeyA', '']]] * N), [[['y'], [['a', 1]], [['a', 'KeyA', 'y']]]] * N)\ncheck('layout-cache scenario 4', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['layout', 'a', 2, ''], ['lookup', 'a', 'KeyA', '']]] * N), [[['KeyA'], [['a', 2]], []]] * N)\ncheck('layout-cache scenario 5', solve([[['layout', 'a', 1, ''], ['layout', 'b', 2, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'b', 'KeyB', 'y'], ['layout', 'a', 3, '']]] * N), [[[], [['a', 3], ['b', 2]], [['b', 'KeyB', 'y']]]] * N)\ncheck('layout-cache scenario 6', solve([[['layout', 'a', 1, ''], ['lookup', 'b', 'KeyA', '']]] * N), [[[], [['a', 1]], []]] * N)\ncheck('layout-cache scenario 7', solve([[['layout', 'a', 1, ''], ['lookup', 'a', 'Unknown', 'fallback']]] * N), [[['Unknown'], [['a', 1]], []]] * N)\ncheck('layout-cache scenario 8', solve([[['layout', 'a', 1, ''], ['layout', 'b', 2, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'b', 'KeyB', 'y'], ['disconnect', 'a', '', '']]] * N), [[[], [['b', 2]], [['b', 'KeyB', 'y']]]] * 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":"81957e9e152d851f1942bafe5f3b7fdc8d346d726d7b19d2110c209673b8efed","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        generations={}; cache={}; out=[]\n        for kind,device,a,b in c:\n            if kind=='layout':\n                generations[device]=a\n                cache={k:v for k,v in cache.items() if k[0]!=device}\n            elif kind=='map' and device in generations:\n                cache[(device,a)]=b\n            elif kind=='lookup' and device in generations:\n                out.append(cache.get((device,a),a))\n            elif kind=='disconnect':\n                generations.pop(device,None)\n                cache={k:v for k,v in cache.items() if k[0]!=device}\n        return [out,sorted([[k,v] for k,v in generations.items()]),sorted([[d,k,v] for (d,k),v in cache.items()])]\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('layout-cache scenario 0', solve([[]] * N), [[[], [], []]] * N)\ncheck('layout-cache scenario 1', solve([[['map', 'a', 'KeyA', 'x'], ['lookup', 'a', 'KeyA', '']]] * N), [[[], [], []]] * N)\ncheck('layout-cache scenario 2', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['lookup', 'a', 'KeyA', '']]] * N), [[['x'], [['a', 1]], [['a', 'KeyA', 'x']]]] * N)\ncheck('layout-cache scenario 3', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'a', 'KeyA', 'y'], ['lookup', 'a', 'KeyA', '']]] * N), [[['y'], [['a', 1]], [['a', 'KeyA', 'y']]]] * N)\ncheck('layout-cache scenario 4', solve([[['layout', 'a', 1, ''], ['map', 'a', 'KeyA', 'x'], ['layout', 'a', 2, ''], ['lookup', 'a', 'KeyA', '']]] * N), [[['KeyA'], [['a', 2]], []]] * N)\ncheck('layout-cache scenario 5', solve([[['layout', 'a', 1, ''], ['layout', 'b', 2, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'b', 'KeyB', 'y'], ['layout', 'a', 3, '']]] * N), [[[], [['a', 3], ['b', 2]], [['b', 'KeyB', 'y']]]] * N)\ncheck('layout-cache scenario 6', solve([[['layout', 'a', 1, ''], ['lookup', 'b', 'KeyA', '']]] * N), [[[], [['a', 1]], []]] * N)\ncheck('layout-cache scenario 7', solve([[['layout', 'a', 1, ''], ['lookup', 'a', 'Unknown', 'fallback']]] * N), [[['Unknown'], [['a', 1]], []]] * N)\ncheck('layout-cache scenario 8', solve([[['layout', 'a', 1, ''], ['layout', 'b', 2, ''], ['map', 'a', 'KeyA', 'x'], ['map', 'b', 'KeyB', 'y'], ['disconnect', 'a', '', '']]] * N), [[[], [['b', 2]], [['b', 'KeyB', 'y']]]] * 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-layout-cache-generation-replace","generated_at":"2026-09-29T14:42:00.297337+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 `generations[device]=a` at the generation replace fault site; preserve the other state transitions.","root_cause":"Layout switch keeps the previous generation or reverses generation ownership.","sha256":"5e8f41445ad98ea948bde7310cbfdbe8e166639a66263043c05d58f3942c149c","title":"Keyboard layout mapping generations: Layout switch keeps the previous generation or reverses generation ownership · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.842,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"layout-cache scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[],[],[]]],"check":"layout-cache scenario 1","expected":[[[],[],[]]],"passed":true},{"actual":[[[],[[1,"a"]],[]]],"check":"layout-cache scenario 2","expected":[[["x"],[["a",1]],[["a","KeyA","x"]]]],"passed":false},{"actual":[[[],[[1,"a"]],[]]],"check":"layout-cache scenario 3","expected":[[["y"],[["a",1]],[["a","KeyA","y"]]]],"passed":false},{"actual":[[[],[[1,"a"],[2,"a"]],[]]],"check":"layout-cache scenario 4","expected":[[["KeyA"],[["a",2]],[]]],"passed":false},{"actual":[[[],[[1,"a"],[2,"b"],[3,"a"]],[]]],"check":"layout-cache scenario 5","expected":[[[],[["a",3],["b",2]],[["b","KeyB","y"]]]],"passed":false},{"actual":[[[],[[1,"a"]],[]]],"check":"layout-cache scenario 6","expected":[[[],[["a",1]],[]]],"passed":false},{"actual":[[[],[[1,"a"]],[]]],"check":"layout-cache scenario 7","expected":[[["Unknown"],[["a",1]],[]]],"passed":false},{"actual":[[[],[[1,"a"],[2,"b"]],[]]],"check":"layout-cache scenario 8","expected":[[[],[["b",2]],[["b","KeyB","y"]]]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"layout-cache scenario 0\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 1\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 2\", \"actual\": [[[], [[1, \"a\"]], []]], \"expected\": [[[\"x\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"x\"]]]], \"passed\": false}, {\"check\": \"layout-cache scenario 3\", \"actual\": [[[], [[1, \"a\"]], []]], \"expected\": [[[\"y\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"y\"]]]], \"passed\": false}, {\"check\": \"layout-cache scenario 4\", \"actual\": [[[], [[1, \"a\"], [2, \"a\"]], []]], \"expected\": [[[\"KeyA\"], [[\"a\", 2]], []]], \"passed\": false}, {\"check\": \"layout-cache scenario 5\", \"actual\": [[[], [[1, \"a\"], [2, \"b\"], [3, \"a\"]], []]], \"expected\": [[[], [[\"a\", 3], [\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": false}, {\"check\": \"layout-cache scenario 6\", \"actual\": [[[], [[1, \"a\"]], []]], \"expected\": [[[], [[\"a\", 1]], []]], \"passed\": false}, {\"check\": \"layout-cache scenario 7\", \"actual\": [[[], [[1, \"a\"]], []]], \"expected\": [[[\"Unknown\"], [[\"a\", 1]], []]], \"passed\": false}, {\"check\": \"layout-cache scenario 8\", \"actual\": [[[], [[1, \"a\"], [2, \"b\"]], []]], \"expected\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":37.931,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"layout-cache scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[],[],[]]],"check":"layout-cache scenario 1","expected":[[[],[],[]]],"passed":true},{"actual":[[["x"],[["a",1]],[["a","KeyA","x"]]]],"check":"layout-cache scenario 2","expected":[[["x"],[["a",1]],[["a","KeyA","x"]]]],"passed":true},{"actual":[[["y"],[["a",1]],[["a","KeyA","y"]]]],"check":"layout-cache scenario 3","expected":[[["y"],[["a",1]],[["a","KeyA","y"]]]],"passed":true},{"actual":[[["KeyA"],[["a",1]],[]]],"check":"layout-cache scenario 4","expected":[[["KeyA"],[["a",2]],[]]],"passed":false},{"actual":[[[],[["a",1],["b",2]],[["b","KeyB","y"]]]],"check":"layout-cache scenario 5","expected":[[[],[["a",3],["b",2]],[["b","KeyB","y"]]]],"passed":false},{"actual":[[[],[["a",1]],[]]],"check":"layout-cache scenario 6","expected":[[[],[["a",1]],[]]],"passed":true},{"actual":[[["Unknown"],[["a",1]],[]]],"check":"layout-cache scenario 7","expected":[[["Unknown"],[["a",1]],[]]],"passed":true},{"actual":[[[],[["b",2]],[["b","KeyB","y"]]]],"check":"layout-cache scenario 8","expected":[[[],[["b",2]],[["b","KeyB","y"]]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"layout-cache scenario 0\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 1\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 2\", \"actual\": [[[\"x\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"x\"]]]], \"expected\": [[[\"x\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"x\"]]]], \"passed\": true}, {\"check\": \"layout-cache scenario 3\", \"actual\": [[[\"y\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"y\"]]]], \"expected\": [[[\"y\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"y\"]]]], \"passed\": true}, {\"check\": \"layout-cache scenario 4\", \"actual\": [[[\"KeyA\"], [[\"a\", 1]], []]], \"expected\": [[[\"KeyA\"], [[\"a\", 2]], []]], \"passed\": false}, {\"check\": \"layout-cache scenario 5\", \"actual\": [[[], [[\"a\", 1], [\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"expected\": [[[], [[\"a\", 3], [\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": false}, {\"check\": \"layout-cache scenario 6\", \"actual\": [[[], [[\"a\", 1]], []]], \"expected\": [[[], [[\"a\", 1]], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 7\", \"actual\": [[[\"Unknown\"], [[\"a\", 1]], []]], \"expected\": [[[\"Unknown\"], [[\"a\", 1]], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 8\", \"actual\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"expected\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.599,"exit_code":0,"observations":[{"actual":[[[],[],[]]],"check":"layout-cache scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[],[],[]]],"check":"layout-cache scenario 1","expected":[[[],[],[]]],"passed":true},{"actual":[[["x"],[["a",1]],[["a","KeyA","x"]]]],"check":"layout-cache scenario 2","expected":[[["x"],[["a",1]],[["a","KeyA","x"]]]],"passed":true},{"actual":[[["y"],[["a",1]],[["a","KeyA","y"]]]],"check":"layout-cache scenario 3","expected":[[["y"],[["a",1]],[["a","KeyA","y"]]]],"passed":true},{"actual":[[["KeyA"],[["a",2]],[]]],"check":"layout-cache scenario 4","expected":[[["KeyA"],[["a",2]],[]]],"passed":true},{"actual":[[[],[["a",3],["b",2]],[["b","KeyB","y"]]]],"check":"layout-cache scenario 5","expected":[[[],[["a",3],["b",2]],[["b","KeyB","y"]]]],"passed":true},{"actual":[[[],[["a",1]],[]]],"check":"layout-cache scenario 6","expected":[[[],[["a",1]],[]]],"passed":true},{"actual":[[["Unknown"],[["a",1]],[]]],"check":"layout-cache scenario 7","expected":[[["Unknown"],[["a",1]],[]]],"passed":true},{"actual":[[[],[["b",2]],[["b","KeyB","y"]]]],"check":"layout-cache scenario 8","expected":[[[],[["b",2]],[["b","KeyB","y"]]]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"layout-cache scenario 0\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 1\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 2\", \"actual\": [[[\"x\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"x\"]]]], \"expected\": [[[\"x\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"x\"]]]], \"passed\": true}, {\"check\": \"layout-cache scenario 3\", \"actual\": [[[\"y\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"y\"]]]], \"expected\": [[[\"y\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"y\"]]]], \"passed\": true}, {\"check\": \"layout-cache scenario 4\", \"actual\": [[[\"KeyA\"], [[\"a\", 2]], []]], \"expected\": [[[\"KeyA\"], [[\"a\", 2]], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 5\", \"actual\": [[[], [[\"a\", 3], [\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"expected\": [[[], [[\"a\", 3], [\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": true}, {\"check\": \"layout-cache scenario 6\", \"actual\": [[[], [[\"a\", 1]], []]], \"expected\": [[[], [[\"a\", 1]], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 7\", \"actual\": [[[\"Unknown\"], [[\"a\", 1]], []]], \"expected\": [[[\"Unknown\"], [[\"a\", 1]], []]], \"passed\": true}, {\"check\": \"layout-cache scenario 8\", \"actual\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"expected\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}