{"abstract":"The event trace violates the map key 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 cache[(device,b)]=a, which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-layout-cache-map-key","id":"FA-31256","implementations":{"attempt":{"sha256":"540ab2ff0922751b015c9e07e32a8c37868f25fc5f3f34726921197bbeb2d91d","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,b)]=a\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":"52024a6d2fe0bd3614619245cba7dd255c6da5fe0f796c8a6dc1c365f7780183","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[(a,device)]=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-key","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":"Physical code and device identity are misplaced in the layout cache key.","sha256":"9bd67b6b05e59459236747b90db7d6c6cd28b1003efd3f601091b1578016034b","title":"Keyboard layout mapping generations: Physical code and device identity are misplaced in the layout cache key · 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.485,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"layout-cache scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[],[],[]]],"check":"layout-cache scenario 1","expected":[[[],[],[]]],"passed":true},{"actual":[[["KeyA"],[["a",1]],[["a","x","KeyA"]]]],"check":"layout-cache scenario 2","expected":[[["x"],[["a",1]],[["a","KeyA","x"]]]],"passed":false},{"actual":[[["KeyA"],[["a",1]],[["a","x","KeyA"],["a","y","KeyA"]]]],"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]],[["b","y","KeyB"]]]],"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","y","KeyB"]]]],"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\": [[[\"KeyA\"], [[\"a\", 1]], [[\"a\", \"x\", \"KeyA\"]]]], \"expected\": [[[\"x\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"x\"]]]], \"passed\": false}, {\"check\": \"layout-cache scenario 3\", \"actual\": [[[\"KeyA\"], [[\"a\", 1]], [[\"a\", \"x\", \"KeyA\"], [\"a\", \"y\", \"KeyA\"]]]], \"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]], [[\"b\", \"y\", \"KeyB\"]]]], \"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\", \"y\", \"KeyB\"]]]], \"expected\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.254,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"layout-cache scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[],[],[]]],"check":"layout-cache scenario 1","expected":[[[],[],[]]],"passed":true},{"actual":[[["KeyA"],[["a",1]],[["KeyA","a","x"]]]],"check":"layout-cache scenario 2","expected":[[["x"],[["a",1]],[["a","KeyA","x"]]]],"passed":false},{"actual":[[["KeyA"],[["a",1]],[["KeyA","a","y"]]]],"check":"layout-cache scenario 3","expected":[[["y"],[["a",1]],[["a","KeyA","y"]]]],"passed":false},{"actual":[[["KeyA"],[["a",2]],[["KeyA","a","x"]]]],"check":"layout-cache scenario 4","expected":[[["KeyA"],[["a",2]],[]]],"passed":false},{"actual":[[[],[["a",3],["b",2]],[["KeyA","a","x"],["KeyB","b","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]],[["KeyA","a","x"],["KeyB","b","y"]]]],"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\": [[[\"KeyA\"], [[\"a\", 1]], [[\"KeyA\", \"a\", \"x\"]]]], \"expected\": [[[\"x\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"x\"]]]], \"passed\": false}, {\"check\": \"layout-cache scenario 3\", \"actual\": [[[\"KeyA\"], [[\"a\", 1]], [[\"KeyA\", \"a\", \"y\"]]]], \"expected\": [[[\"y\"], [[\"a\", 1]], [[\"a\", \"KeyA\", \"y\"]]]], \"passed\": false}, {\"check\": \"layout-cache scenario 4\", \"actual\": [[[\"KeyA\"], [[\"a\", 2]], [[\"KeyA\", \"a\", \"x\"]]]], \"expected\": [[[\"KeyA\"], [[\"a\", 2]], []]], \"passed\": false}, {\"check\": \"layout-cache scenario 5\", \"actual\": [[[], [[\"a\", 3], [\"b\", 2]], [[\"KeyA\", \"a\", \"x\"], [\"KeyB\", \"b\", \"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]], [[\"KeyA\", \"a\", \"x\"], [\"KeyB\", \"b\", \"y\"]]]], \"expected\": [[[], [[\"b\", 2]], [[\"b\", \"KeyB\", \"y\"]]]], \"passed\": false}], \"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."}}