{"abstract":"The event trace violates the disconnect cache 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 cache={k:v for k,v in cache.items() if k[0]==device}\nreturn, which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-layout-cache-disconnect-cache","id":"FA-31286","implementations":{"attempt":{"sha256":"71edcfb8e05d0f9b15c57601925e7aa83cc0672d128ad1820ea2a99132699a54","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"},"broken":{"sha256":"5a7b6f45e1f0b1211e1aee25d129bc0e8579021e9c027b16aa8f52d4f6668e7e","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={}\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-disconnect-cache","generated_at":"2026-09-29T14:42:00.606176+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 `cache={k:v for k,v in cache.items() if k[0]!=device}\nreturn` at the disconnect cache fault site; preserve the other state transitions.","root_cause":"Disconnect preserves stale labels or erases another keyboard cache.","sha256":"0874cab5dd42c39aeb58b7060adf8254334dfa0ced39939c962a40b2b30f6855","title":"Keyboard layout mapping generations: Disconnect preserves stale labels or erases another keyboard cache · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":38.842,"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",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]],[["a","KeyA","x"]]]],"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\": [[[\"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]], [[\"a\", \"KeyA\", \"x\"]]]], \"expected\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.461,"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",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]],[]]],"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\": [[[\"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]], []]], \"expected\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":39.511,"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"}