{"abstract":"The event trace violates the map 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=='map' and device not in generations:, which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-layout-cache-map-lifecycle","id":"FA-31251","implementations":{"attempt":{"sha256":"1fd4b745e416c58e7e31e1a7f8b8930e69e7be8ebabb5fd37a4c79c8f81732da","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 not 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":"f02afe14646bcf2e5b5e916bba25d78a5b6b68c8075b94939b3654e8f020aadd","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':\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-map-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":"Mapping entries are accepted before a keyboard layout is established.","sha256":"4b29f013fc6bbe4778f7ea8a28cbc0db4257dc865af98b7c55ee774ebb0676d9","title":"Keyboard layout mapping generations: Mapping entries are accepted before a keyboard layout is established · 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":41.013,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"layout-cache scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[],[],[["a","KeyA","x"]]]],"check":"layout-cache scenario 1","expected":[[[],[],[]]],"passed":false},{"actual":[[["KeyA"],[["a",1]],[]]],"check":"layout-cache scenario 2","expected":[[["x"],[["a",1]],[["a","KeyA","x"]]]],"passed":false},{"actual":[[["KeyA"],[["a",1]],[]]],"check":"layout-cache scenario 3","expected":[[["y"],[["a",1]],[["a","KeyA","y"]]]],"passed":false},{"actual":[[["KeyA"],[["a",2]],[]]],"check":"layout-cache scenario 4","expected":[[["KeyA"],[["a",2]],[]]],"passed":true},{"actual":[[[],[["a",3],["b",2]],[]]],"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]],[]]],"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\": [[[], [], [[\"a\", \"KeyA\", \"x\"]]]], \"expected\": [[[], [], []]], \"passed\": false}, {\"check\": \"layout-cache scenario 2\", \"actual\": [[[\"KeyA\"], [[\"a\", 1]], []]], \"expected\": [[[\"x\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"x\"]]]], \"passed\": false}, {\"check\": \"layout-cache scenario 3\", \"actual\": [[[\"KeyA\"], [[\"a\", 1]], []]], \"expected\": [[[\"y\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"y\"]]]], \"passed\": false}, {\"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]], []]], \"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]], []]], \"expected\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.83,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"layout-cache scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[],[],[["a","KeyA","x"]]]],"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":[[[],[["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\": [[[], [], [[\"a\", \"KeyA\", \"x\"]]]], \"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\": [[[], [[\"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"}},"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."}}