{"abstract":"The event trace violates the lookup lifecycle 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.","contract_signature":"cases","evaluation_group":"s3-keyboard-layout-cache","failed_approach":"The partial repair changes this transition to elif kind=='lookup' and bool(generations):, which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-layout-cache-lookup-lifecycle","id":"FA-31266","implementations":{"attempt":{"sha256":"5a8375d061b8778e7d276775529811786463fcad2f978e14c010fdef312c81ea","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 bool(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":"e2cb85a3ffae7ca42c3c8c9a53c012628a6f4c9c760c0cb02175182bd8f8d904","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':\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-lookup-lifecycle","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.","root_cause":"A lookup on an uninitialized device emits labels from an unrelated layout lifecycle.","sha256":"adf82af5af81afd0f0e9b357b24d57ef7670caf8d088dfc11824e68dd667561e","title":"Keyboard layout mapping generations: A lookup on an uninitialized device emits labels from an unrelated layout lifecycle · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":39.544,"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":[[["KeyA"],[["a",1]],[]]],"check":"layout-cache scenario 6","expected":[[[],[["a",1]],[]]],"passed":false},{"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\", 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\": [[[\"KeyA\"], [[\"a\", 1]], []]], \"expected\": [[[], [[\"a\", 1]], []]], \"passed\": false}, {\"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"},"broken":{"elapsed_ms":42.111,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"layout-cache scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[["KeyA"],[],[]]],"check":"layout-cache scenario 1","expected":[[[],[],[]]],"passed":false},{"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":[[["KeyA"],[["a",1]],[]]],"check":"layout-cache scenario 6","expected":[[[],[["a",1]],[]]],"passed":false},{"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\": [[[\"KeyA\"], [], []]], \"expected\": [[[], [], []]], \"passed\": false}, {\"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\": [[[\"KeyA\"], [[\"a\", 1]], []]], \"expected\": [[[], [[\"a\", 1]], []]], \"passed\": false}, {\"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"}},"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."}}