{"abstract":"The event trace violates the unlock removal rule and produces incorrect keyboard state or command output.","category":"Keyboard interactions","checks":9,"contract":"Events [kind,key]. Tap of modifier cycles absent -> once -> locked -> absent. Modifier down/up sets physical state independently. Character emits [key,sorted effective modifiers] then consumes all once latches but preserves locked and physical modifiers. Cancel clears latches only; blur clears both. Return emitted events, latches and physical state. 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-sticky-modifiers","failed_approach":"The partial repair changes this transition to else: latches[key]=0, which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-sticky-modifiers-unlock-removal","id":"FA-31351","implementations":{"attempt":{"sha256":"59fe619549e4f048632753d0f0398fc6f2801bc4b9fe08b595340c0fe447df74","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        latches={}; physical=set(); out=[]\n        for kind,key in c:\n            if kind=='tap':\n                state=latches.get(key,0)\n                next_state=(state+1)%3\n                if next_state: latches[key]=next_state\n                else: latches[key]=0\n            elif kind=='down': physical.add(key)\n            elif kind=='up': physical.discard(key)\n            elif kind=='char':\n                effective=physical | set(latches)\n                out.append([key,sorted(effective)])\n                latches={k:v for k,v in latches.items() if v==2}\n            elif kind=='cancel': latches.clear()\n            elif kind=='blur':\n                latches.clear(); physical.clear()\n        return [out,sorted([[k,v] for k,v in latches.items()]),sorted(physical)]\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('sticky-modifiers scenario 0', solve([[]] * N), [[[], [], []]] * N)\ncheck('sticky-modifiers scenario 1', solve([[['tap', 'Shift'], ['char', 'A'], ['char', 'B']]] * N), [[[['A', ['Shift']], ['B', []]], [], []]] * N)\ncheck('sticky-modifiers scenario 2', solve([[['tap', 'Shift'], ['tap', 'Shift'], ['char', 'A'], ['char', 'B']]] * N), [[[['A', ['Shift']], ['B', ['Shift']]], [['Shift', 2]], []]] * N)\ncheck('sticky-modifiers scenario 3', solve([[['tap', 'Shift'], ['tap', 'Shift'], ['tap', 'Alt'], ['tap', 'Shift'], ['char', 'A']]] * N), [[[['A', ['Alt']]], [], []]] * N)\ncheck('sticky-modifiers scenario 4', solve([[['down', 'Control'], ['down', 'Alt'], ['down', 'Alt'], ['char', 'A']]] * N), [[[['A', ['Alt', 'Control']]], [], ['Alt', 'Control']]] * N)\ncheck('sticky-modifiers scenario 5', solve([[['down', 'Control'], ['down', 'Alt'], ['up', 'Alt'], ['char', 'A']]] * N), [[[['A', ['Control']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 6', solve([[['down', 'Control'], ['tap', 'Shift'], ['char', 'A']]] * N), [[[['A', ['Control', 'Shift']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 7', solve([[['down', 'Control'], ['tap', 'Shift'], ['cancel', ''], ['char', 'A']]] * N), [[[['A', ['Control']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 8', solve([[['down', 'Control'], ['tap', 'Shift'], ['blur', '']]] * N), [[[], [], []]] * 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":"c8d4a26117f18ecfe863660cf238146922647e91f0c4425dbf41776207f4c819","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        latches={}; physical=set(); out=[]\n        for kind,key in c:\n            if kind=='tap':\n                state=latches.get(key,0)\n                next_state=(state+1)%3\n                if next_state: latches[key]=next_state\n                else: latches.clear()\n            elif kind=='down': physical.add(key)\n            elif kind=='up': physical.discard(key)\n            elif kind=='char':\n                effective=physical | set(latches)\n                out.append([key,sorted(effective)])\n                latches={k:v for k,v in latches.items() if v==2}\n            elif kind=='cancel': latches.clear()\n            elif kind=='blur':\n                latches.clear(); physical.clear()\n        return [out,sorted([[k,v] for k,v in latches.items()]),sorted(physical)]\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('sticky-modifiers scenario 0', solve([[]] * N), [[[], [], []]] * N)\ncheck('sticky-modifiers scenario 1', solve([[['tap', 'Shift'], ['char', 'A'], ['char', 'B']]] * N), [[[['A', ['Shift']], ['B', []]], [], []]] * N)\ncheck('sticky-modifiers scenario 2', solve([[['tap', 'Shift'], ['tap', 'Shift'], ['char', 'A'], ['char', 'B']]] * N), [[[['A', ['Shift']], ['B', ['Shift']]], [['Shift', 2]], []]] * N)\ncheck('sticky-modifiers scenario 3', solve([[['tap', 'Shift'], ['tap', 'Shift'], ['tap', 'Alt'], ['tap', 'Shift'], ['char', 'A']]] * N), [[[['A', ['Alt']]], [], []]] * N)\ncheck('sticky-modifiers scenario 4', solve([[['down', 'Control'], ['down', 'Alt'], ['down', 'Alt'], ['char', 'A']]] * N), [[[['A', ['Alt', 'Control']]], [], ['Alt', 'Control']]] * N)\ncheck('sticky-modifiers scenario 5', solve([[['down', 'Control'], ['down', 'Alt'], ['up', 'Alt'], ['char', 'A']]] * N), [[[['A', ['Control']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 6', solve([[['down', 'Control'], ['tap', 'Shift'], ['char', 'A']]] * N), [[[['A', ['Control', 'Shift']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 7', solve([[['down', 'Control'], ['tap', 'Shift'], ['cancel', ''], ['char', 'A']]] * N), [[[['A', ['Control']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 8', solve([[['down', 'Control'], ['tap', 'Shift'], ['blur', '']]] * N), [[[], [], []]] * 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":"44669353d0bf76253c49ddc9a65ea6e0f914c3a6987af48e8f08857354bc93bb","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        latches={}; physical=set(); out=[]\n        for kind,key in c:\n            if kind=='tap':\n                state=latches.get(key,0)\n                next_state=(state+1)%3\n                if next_state: latches[key]=next_state\n                else: latches.pop(key,None)\n            elif kind=='down': physical.add(key)\n            elif kind=='up': physical.discard(key)\n            elif kind=='char':\n                effective=physical | set(latches)\n                out.append([key,sorted(effective)])\n                latches={k:v for k,v in latches.items() if v==2}\n            elif kind=='cancel': latches.clear()\n            elif kind=='blur':\n                latches.clear(); physical.clear()\n        return [out,sorted([[k,v] for k,v in latches.items()]),sorted(physical)]\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('sticky-modifiers scenario 0', solve([[]] * N), [[[], [], []]] * N)\ncheck('sticky-modifiers scenario 1', solve([[['tap', 'Shift'], ['char', 'A'], ['char', 'B']]] * N), [[[['A', ['Shift']], ['B', []]], [], []]] * N)\ncheck('sticky-modifiers scenario 2', solve([[['tap', 'Shift'], ['tap', 'Shift'], ['char', 'A'], ['char', 'B']]] * N), [[[['A', ['Shift']], ['B', ['Shift']]], [['Shift', 2]], []]] * N)\ncheck('sticky-modifiers scenario 3', solve([[['tap', 'Shift'], ['tap', 'Shift'], ['tap', 'Alt'], ['tap', 'Shift'], ['char', 'A']]] * N), [[[['A', ['Alt']]], [], []]] * N)\ncheck('sticky-modifiers scenario 4', solve([[['down', 'Control'], ['down', 'Alt'], ['down', 'Alt'], ['char', 'A']]] * N), [[[['A', ['Alt', 'Control']]], [], ['Alt', 'Control']]] * N)\ncheck('sticky-modifiers scenario 5', solve([[['down', 'Control'], ['down', 'Alt'], ['up', 'Alt'], ['char', 'A']]] * N), [[[['A', ['Control']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 6', solve([[['down', 'Control'], ['tap', 'Shift'], ['char', 'A']]] * N), [[[['A', ['Control', 'Shift']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 7', solve([[['down', 'Control'], ['tap', 'Shift'], ['cancel', ''], ['char', 'A']]] * N), [[[['A', ['Control']]], [], ['Control']]] * N)\ncheck('sticky-modifiers scenario 8', solve([[['down', 'Control'], ['tap', 'Shift'], ['blur', '']]] * N), [[[], [], []]] * 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-sticky-modifiers-unlock-removal","generated_at":"2026-09-29T14:42:01.230864+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 `else: latches.pop(key,None)` at the unlock removal fault site; preserve the other state transitions.","root_cause":"Unlocking one modifier erases unrelated latches or retains a false entry.","sha256":"53945fc7fd5fd3747f7869724816367bc1ce7365de537f8240197d752e612ab9","title":"Sticky modifier latch lifecycle: Unlocking one modifier erases unrelated latches or retains a false entry · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":37.508,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"sticky-modifiers scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[["A",["Shift"]],["B",[]]],[],[]]],"check":"sticky-modifiers scenario 1","expected":[[[["A",["Shift"]],["B",[]]],[],[]]],"passed":true},{"actual":[[[["A",["Shift"]],["B",["Shift"]]],[["Shift",2]],[]]],"check":"sticky-modifiers scenario 2","expected":[[[["A",["Shift"]],["B",["Shift"]]],[["Shift",2]],[]]],"passed":true},{"actual":[[[["A",["Alt","Shift"]]],[],[]]],"check":"sticky-modifiers scenario 3","expected":[[[["A",["Alt"]]],[],[]]],"passed":false},{"actual":[[[["A",["Alt","Control"]]],[],["Alt","Control"]]],"check":"sticky-modifiers scenario 4","expected":[[[["A",["Alt","Control"]]],[],["Alt","Control"]]],"passed":true},{"actual":[[[["A",["Control"]]],[],["Control"]]],"check":"sticky-modifiers scenario 5","expected":[[[["A",["Control"]]],[],["Control"]]],"passed":true},{"actual":[[[["A",["Control","Shift"]]],[],["Control"]]],"check":"sticky-modifiers scenario 6","expected":[[[["A",["Control","Shift"]]],[],["Control"]]],"passed":true},{"actual":[[[["A",["Control"]]],[],["Control"]]],"check":"sticky-modifiers scenario 7","expected":[[[["A",["Control"]]],[],["Control"]]],"passed":true},{"actual":[[[],[],[]]],"check":"sticky-modifiers scenario 8","expected":[[[],[],[]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"sticky-modifiers scenario 0\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 1\", \"actual\": [[[[\"A\", [\"Shift\"]], [\"B\", []]], [], []]], \"expected\": [[[[\"A\", [\"Shift\"]], [\"B\", []]], [], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 2\", \"actual\": [[[[\"A\", [\"Shift\"]], [\"B\", [\"Shift\"]]], [[\"Shift\", 2]], []]], \"expected\": [[[[\"A\", [\"Shift\"]], [\"B\", [\"Shift\"]]], [[\"Shift\", 2]], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 3\", \"actual\": [[[[\"A\", [\"Alt\", \"Shift\"]]], [], []]], \"expected\": [[[[\"A\", [\"Alt\"]]], [], []]], \"passed\": false}, {\"check\": \"sticky-modifiers scenario 4\", \"actual\": [[[[\"A\", [\"Alt\", \"Control\"]]], [], [\"Alt\", \"Control\"]]], \"expected\": [[[[\"A\", [\"Alt\", \"Control\"]]], [], [\"Alt\", \"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 5\", \"actual\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 6\", \"actual\": [[[[\"A\", [\"Control\", \"Shift\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\", \"Shift\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 7\", \"actual\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 8\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.914,"exit_code":1,"observations":[{"actual":[[[],[],[]]],"check":"sticky-modifiers scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[["A",["Shift"]],["B",[]]],[],[]]],"check":"sticky-modifiers scenario 1","expected":[[[["A",["Shift"]],["B",[]]],[],[]]],"passed":true},{"actual":[[[["A",["Shift"]],["B",["Shift"]]],[["Shift",2]],[]]],"check":"sticky-modifiers scenario 2","expected":[[[["A",["Shift"]],["B",["Shift"]]],[["Shift",2]],[]]],"passed":true},{"actual":[[[["A",[]]],[],[]]],"check":"sticky-modifiers scenario 3","expected":[[[["A",["Alt"]]],[],[]]],"passed":false},{"actual":[[[["A",["Alt","Control"]]],[],["Alt","Control"]]],"check":"sticky-modifiers scenario 4","expected":[[[["A",["Alt","Control"]]],[],["Alt","Control"]]],"passed":true},{"actual":[[[["A",["Control"]]],[],["Control"]]],"check":"sticky-modifiers scenario 5","expected":[[[["A",["Control"]]],[],["Control"]]],"passed":true},{"actual":[[[["A",["Control","Shift"]]],[],["Control"]]],"check":"sticky-modifiers scenario 6","expected":[[[["A",["Control","Shift"]]],[],["Control"]]],"passed":true},{"actual":[[[["A",["Control"]]],[],["Control"]]],"check":"sticky-modifiers scenario 7","expected":[[[["A",["Control"]]],[],["Control"]]],"passed":true},{"actual":[[[],[],[]]],"check":"sticky-modifiers scenario 8","expected":[[[],[],[]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"sticky-modifiers scenario 0\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 1\", \"actual\": [[[[\"A\", [\"Shift\"]], [\"B\", []]], [], []]], \"expected\": [[[[\"A\", [\"Shift\"]], [\"B\", []]], [], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 2\", \"actual\": [[[[\"A\", [\"Shift\"]], [\"B\", [\"Shift\"]]], [[\"Shift\", 2]], []]], \"expected\": [[[[\"A\", [\"Shift\"]], [\"B\", [\"Shift\"]]], [[\"Shift\", 2]], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 3\", \"actual\": [[[[\"A\", []]], [], []]], \"expected\": [[[[\"A\", [\"Alt\"]]], [], []]], \"passed\": false}, {\"check\": \"sticky-modifiers scenario 4\", \"actual\": [[[[\"A\", [\"Alt\", \"Control\"]]], [], [\"Alt\", \"Control\"]]], \"expected\": [[[[\"A\", [\"Alt\", \"Control\"]]], [], [\"Alt\", \"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 5\", \"actual\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 6\", \"actual\": [[[[\"A\", [\"Control\", \"Shift\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\", \"Shift\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 7\", \"actual\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 8\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":38.025,"exit_code":0,"observations":[{"actual":[[[],[],[]]],"check":"sticky-modifiers scenario 0","expected":[[[],[],[]]],"passed":true},{"actual":[[[["A",["Shift"]],["B",[]]],[],[]]],"check":"sticky-modifiers scenario 1","expected":[[[["A",["Shift"]],["B",[]]],[],[]]],"passed":true},{"actual":[[[["A",["Shift"]],["B",["Shift"]]],[["Shift",2]],[]]],"check":"sticky-modifiers scenario 2","expected":[[[["A",["Shift"]],["B",["Shift"]]],[["Shift",2]],[]]],"passed":true},{"actual":[[[["A",["Alt"]]],[],[]]],"check":"sticky-modifiers scenario 3","expected":[[[["A",["Alt"]]],[],[]]],"passed":true},{"actual":[[[["A",["Alt","Control"]]],[],["Alt","Control"]]],"check":"sticky-modifiers scenario 4","expected":[[[["A",["Alt","Control"]]],[],["Alt","Control"]]],"passed":true},{"actual":[[[["A",["Control"]]],[],["Control"]]],"check":"sticky-modifiers scenario 5","expected":[[[["A",["Control"]]],[],["Control"]]],"passed":true},{"actual":[[[["A",["Control","Shift"]]],[],["Control"]]],"check":"sticky-modifiers scenario 6","expected":[[[["A",["Control","Shift"]]],[],["Control"]]],"passed":true},{"actual":[[[["A",["Control"]]],[],["Control"]]],"check":"sticky-modifiers scenario 7","expected":[[[["A",["Control"]]],[],["Control"]]],"passed":true},{"actual":[[[],[],[]]],"check":"sticky-modifiers scenario 8","expected":[[[],[],[]]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"sticky-modifiers scenario 0\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 1\", \"actual\": [[[[\"A\", [\"Shift\"]], [\"B\", []]], [], []]], \"expected\": [[[[\"A\", [\"Shift\"]], [\"B\", []]], [], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 2\", \"actual\": [[[[\"A\", [\"Shift\"]], [\"B\", [\"Shift\"]]], [[\"Shift\", 2]], []]], \"expected\": [[[[\"A\", [\"Shift\"]], [\"B\", [\"Shift\"]]], [[\"Shift\", 2]], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 3\", \"actual\": [[[[\"A\", [\"Alt\"]]], [], []]], \"expected\": [[[[\"A\", [\"Alt\"]]], [], []]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 4\", \"actual\": [[[[\"A\", [\"Alt\", \"Control\"]]], [], [\"Alt\", \"Control\"]]], \"expected\": [[[[\"A\", [\"Alt\", \"Control\"]]], [], [\"Alt\", \"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 5\", \"actual\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 6\", \"actual\": [[[[\"A\", [\"Control\", \"Shift\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\", \"Shift\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 7\", \"actual\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"expected\": [[[[\"A\", [\"Control\"]]], [], [\"Control\"]]], \"passed\": true}, {\"check\": \"sticky-modifiers scenario 8\", \"actual\": [[[], [], []]], \"expected\": [[[], [], []]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}