{"abstract":"The event trace violates the single hold rule and produces incorrect keyboard state or command output.","category":"Keyboard interactions","checks":9,"contract":"Case [threshold,events]. Events [kind,key,time]. Down arms an unarmed key. Tick emits hold once when age >= threshold. Up before threshold emits tap, at or after threshold emits hold if not yet emitted. Cancel removes just one key silently. Return output and pending [key,start,held] entries. 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-hold-threshold","failed_approach":"The partial repair changes this transition to if (not sent or now>start) and now-start, which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-hold-threshold-single-hold","id":"FA-31106","implementations":{"attempt":{"sha256":"4a0c83700b8f2d78a13d5737dccf8eba84b182759b91d376df99295769e23f30","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        threshold,events=c\n        pending={}; output=[]\n        for kind,key,now in events:\n            if kind=='down' and key not in pending:\n                pending[key]=[now,False]\n            elif kind=='tick':\n                for k in sorted(pending):\n                    start,sent=pending[k]\n                    if (not sent or now>start) and now-start>=threshold:\n                        output.append(['hold',k])\n                        pending[k][1]=True\n            elif kind=='up' and key in pending:\n                start,sent=pending[key]\n                if not sent:\n                    output.append(['hold' if now-start>=threshold else 'tap',key])\n                del pending[key]\n            elif kind=='cancel':\n                pending.pop(key,None)\n        return [output,sorted([[k]+v for k,v in pending.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('hold-threshold scenario 0', solve([[5, []]] * N), [[[], []]] * N)\ncheck('hold-threshold scenario 1', solve([[5, [['down', 'A', 10], ['tick', '', 12]]]] * N), [[[], [['A', 10, False]]]] * N)\ncheck('hold-threshold scenario 2', solve([[5, [['down', 'A', 10], ['up', 'A', 12]]]] * N), [[[['tap', 'A']], []]] * N)\ncheck('hold-threshold scenario 3', solve([[5, [['down', 'A', 10], ['up', 'A', 15]]]] * N), [[[['hold', 'A']], []]] * N)\ncheck('hold-threshold scenario 4', solve([[5, [['down', 'A', 10], ['tick', '', 15], ['tick', '', 16], ['up', 'A', 17]]]] * N), [[[['hold', 'A']], []]] * N)\ncheck('hold-threshold scenario 5', solve([[5, [['down', 'A', 10], ['down', 'A', 13], ['tick', '', 15]]]] * N), [[[['hold', 'A']], [['A', 10, True]]]] * N)\ncheck('hold-threshold scenario 6', solve([[5, [['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12]]]] * N), [[[['tap', 'A']], [['B', 11, False]]]] * N)\ncheck('hold-threshold scenario 7', solve([[5, [['down', 'A', 10], ['down', 'B', 11], ['cancel', 'A', 12], ['tick', '', 16]]]] * N), [[[['hold', 'B']], [['B', 11, True]]]] * N)\ncheck('hold-threshold scenario 8', solve([[5, [['up', 'A', 100]]]] * 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":"22e06018c42378ecfb0de53afa04db1c0873ef2eb1a7664cdf8e6815d784f226","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        threshold,events=c\n        pending={}; output=[]\n        for kind,key,now in events:\n            if kind=='down' and key not in pending:\n                pending[key]=[now,False]\n            elif kind=='tick':\n                for k in sorted(pending):\n                    start,sent=pending[k]\n                    if now-start>=threshold:\n                        output.append(['hold',k])\n                        pending[k][1]=True\n            elif kind=='up' and key in pending:\n                start,sent=pending[key]\n                if not sent:\n                    output.append(['hold' if now-start>=threshold else 'tap',key])\n                del pending[key]\n            elif kind=='cancel':\n                pending.pop(key,None)\n        return [output,sorted([[k]+v for k,v in pending.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('hold-threshold scenario 0', solve([[5, []]] * N), [[[], []]] * N)\ncheck('hold-threshold scenario 1', solve([[5, [['down', 'A', 10], ['tick', '', 12]]]] * N), [[[], [['A', 10, False]]]] * N)\ncheck('hold-threshold scenario 2', solve([[5, [['down', 'A', 10], ['up', 'A', 12]]]] * N), [[[['tap', 'A']], []]] * N)\ncheck('hold-threshold scenario 3', solve([[5, [['down', 'A', 10], ['up', 'A', 15]]]] * N), [[[['hold', 'A']], []]] * N)\ncheck('hold-threshold scenario 4', solve([[5, [['down', 'A', 10], ['tick', '', 15], ['tick', '', 16], ['up', 'A', 17]]]] * N), [[[['hold', 'A']], []]] * N)\ncheck('hold-threshold scenario 5', solve([[5, [['down', 'A', 10], ['down', 'A', 13], ['tick', '', 15]]]] * N), [[[['hold', 'A']], [['A', 10, True]]]] * N)\ncheck('hold-threshold scenario 6', solve([[5, [['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12]]]] * N), [[[['tap', 'A']], [['B', 11, False]]]] * N)\ncheck('hold-threshold scenario 7', solve([[5, [['down', 'A', 10], ['down', 'B', 11], ['cancel', 'A', 12], ['tick', '', 16]]]] * N), [[[['hold', 'B']], [['B', 11, True]]]] * N)\ncheck('hold-threshold scenario 8', solve([[5, [['up', 'A', 100]]]] * 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":"3559c584388395b9ad7f21e5c69727bd641bfedebef31b5afa7ed39ccfc09a19","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        threshold,events=c\n        pending={}; output=[]\n        for kind,key,now in events:\n            if kind=='down' and key not in pending:\n                pending[key]=[now,False]\n            elif kind=='tick':\n                for k in sorted(pending):\n                    start,sent=pending[k]\n                    if not sent and now-start>=threshold:\n                        output.append(['hold',k])\n                        pending[k][1]=True\n            elif kind=='up' and key in pending:\n                start,sent=pending[key]\n                if not sent:\n                    output.append(['hold' if now-start>=threshold else 'tap',key])\n                del pending[key]\n            elif kind=='cancel':\n                pending.pop(key,None)\n        return [output,sorted([[k]+v for k,v in pending.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('hold-threshold scenario 0', solve([[5, []]] * N), [[[], []]] * N)\ncheck('hold-threshold scenario 1', solve([[5, [['down', 'A', 10], ['tick', '', 12]]]] * N), [[[], [['A', 10, False]]]] * N)\ncheck('hold-threshold scenario 2', solve([[5, [['down', 'A', 10], ['up', 'A', 12]]]] * N), [[[['tap', 'A']], []]] * N)\ncheck('hold-threshold scenario 3', solve([[5, [['down', 'A', 10], ['up', 'A', 15]]]] * N), [[[['hold', 'A']], []]] * N)\ncheck('hold-threshold scenario 4', solve([[5, [['down', 'A', 10], ['tick', '', 15], ['tick', '', 16], ['up', 'A', 17]]]] * N), [[[['hold', 'A']], []]] * N)\ncheck('hold-threshold scenario 5', solve([[5, [['down', 'A', 10], ['down', 'A', 13], ['tick', '', 15]]]] * N), [[[['hold', 'A']], [['A', 10, True]]]] * N)\ncheck('hold-threshold scenario 6', solve([[5, [['down', 'A', 10], ['down', 'B', 11], ['up', 'A', 12]]]] * N), [[[['tap', 'A']], [['B', 11, False]]]] * N)\ncheck('hold-threshold scenario 7', solve([[5, [['down', 'A', 10], ['down', 'B', 11], ['cancel', 'A', 12], ['tick', '', 16]]]] * N), [[[['hold', 'B']], [['B', 11, True]]]] * N)\ncheck('hold-threshold scenario 8', solve([[5, [['up', 'A', 100]]]] * 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-hold-threshold-single-hold","generated_at":"2026-09-29T14:41:59.010138+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 `if not sent and now-start` at the single hold fault site; preserve the other state transitions.","root_cause":"Repeated ticks emit the hold command more than once.","sha256":"3ca590671a9b8d5dc7dc21fb2e5c0bbc9682493a31eb9486d2bacea5c7b09ee7","title":"Tap versus hold command arbitration: Repeated ticks emit the hold command more than once · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.979,"exit_code":1,"observations":[{"actual":[[[],[]]],"check":"hold-threshold scenario 0","expected":[[[],[]]],"passed":true},{"actual":[[[],[["A",10,false]]]],"check":"hold-threshold scenario 1","expected":[[[],[["A",10,false]]]],"passed":true},{"actual":[[[["tap","A"]],[]]],"check":"hold-threshold scenario 2","expected":[[[["tap","A"]],[]]],"passed":true},{"actual":[[[["hold","A"]],[]]],"check":"hold-threshold scenario 3","expected":[[[["hold","A"]],[]]],"passed":true},{"actual":[[[["hold","A"],["hold","A"]],[]]],"check":"hold-threshold scenario 4","expected":[[[["hold","A"]],[]]],"passed":false},{"actual":[[[["hold","A"]],[["A",10,true]]]],"check":"hold-threshold scenario 5","expected":[[[["hold","A"]],[["A",10,true]]]],"passed":true},{"actual":[[[["tap","A"]],[["B",11,false]]]],"check":"hold-threshold scenario 6","expected":[[[["tap","A"]],[["B",11,false]]]],"passed":true},{"actual":[[[["hold","B"]],[["B",11,true]]]],"check":"hold-threshold scenario 7","expected":[[[["hold","B"]],[["B",11,true]]]],"passed":true},{"actual":[[[],[]]],"check":"hold-threshold scenario 8","expected":[[[],[]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"hold-threshold scenario 0\", \"actual\": [[[], []]], \"expected\": [[[], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 1\", \"actual\": [[[], [[\"A\", 10, false]]]], \"expected\": [[[], [[\"A\", 10, false]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 2\", \"actual\": [[[[\"tap\", \"A\"]], []]], \"expected\": [[[[\"tap\", \"A\"]], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 3\", \"actual\": [[[[\"hold\", \"A\"]], []]], \"expected\": [[[[\"hold\", \"A\"]], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 4\", \"actual\": [[[[\"hold\", \"A\"], [\"hold\", \"A\"]], []]], \"expected\": [[[[\"hold\", \"A\"]], []]], \"passed\": false}, {\"check\": \"hold-threshold scenario 5\", \"actual\": [[[[\"hold\", \"A\"]], [[\"A\", 10, true]]]], \"expected\": [[[[\"hold\", \"A\"]], [[\"A\", 10, true]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 6\", \"actual\": [[[[\"tap\", \"A\"]], [[\"B\", 11, false]]]], \"expected\": [[[[\"tap\", \"A\"]], [[\"B\", 11, false]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 7\", \"actual\": [[[[\"hold\", \"B\"]], [[\"B\", 11, true]]]], \"expected\": [[[[\"hold\", \"B\"]], [[\"B\", 11, true]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 8\", \"actual\": [[[], []]], \"expected\": [[[], []]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":36.237,"exit_code":1,"observations":[{"actual":[[[],[]]],"check":"hold-threshold scenario 0","expected":[[[],[]]],"passed":true},{"actual":[[[],[["A",10,false]]]],"check":"hold-threshold scenario 1","expected":[[[],[["A",10,false]]]],"passed":true},{"actual":[[[["tap","A"]],[]]],"check":"hold-threshold scenario 2","expected":[[[["tap","A"]],[]]],"passed":true},{"actual":[[[["hold","A"]],[]]],"check":"hold-threshold scenario 3","expected":[[[["hold","A"]],[]]],"passed":true},{"actual":[[[["hold","A"],["hold","A"]],[]]],"check":"hold-threshold scenario 4","expected":[[[["hold","A"]],[]]],"passed":false},{"actual":[[[["hold","A"]],[["A",10,true]]]],"check":"hold-threshold scenario 5","expected":[[[["hold","A"]],[["A",10,true]]]],"passed":true},{"actual":[[[["tap","A"]],[["B",11,false]]]],"check":"hold-threshold scenario 6","expected":[[[["tap","A"]],[["B",11,false]]]],"passed":true},{"actual":[[[["hold","B"]],[["B",11,true]]]],"check":"hold-threshold scenario 7","expected":[[[["hold","B"]],[["B",11,true]]]],"passed":true},{"actual":[[[],[]]],"check":"hold-threshold scenario 8","expected":[[[],[]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"hold-threshold scenario 0\", \"actual\": [[[], []]], \"expected\": [[[], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 1\", \"actual\": [[[], [[\"A\", 10, false]]]], \"expected\": [[[], [[\"A\", 10, false]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 2\", \"actual\": [[[[\"tap\", \"A\"]], []]], \"expected\": [[[[\"tap\", \"A\"]], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 3\", \"actual\": [[[[\"hold\", \"A\"]], []]], \"expected\": [[[[\"hold\", \"A\"]], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 4\", \"actual\": [[[[\"hold\", \"A\"], [\"hold\", \"A\"]], []]], \"expected\": [[[[\"hold\", \"A\"]], []]], \"passed\": false}, {\"check\": \"hold-threshold scenario 5\", \"actual\": [[[[\"hold\", \"A\"]], [[\"A\", 10, true]]]], \"expected\": [[[[\"hold\", \"A\"]], [[\"A\", 10, true]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 6\", \"actual\": [[[[\"tap\", \"A\"]], [[\"B\", 11, false]]]], \"expected\": [[[[\"tap\", \"A\"]], [[\"B\", 11, false]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 7\", \"actual\": [[[[\"hold\", \"B\"]], [[\"B\", 11, true]]]], \"expected\": [[[[\"hold\", \"B\"]], [[\"B\", 11, true]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 8\", \"actual\": [[[], []]], \"expected\": [[[], []]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.605,"exit_code":0,"observations":[{"actual":[[[],[]]],"check":"hold-threshold scenario 0","expected":[[[],[]]],"passed":true},{"actual":[[[],[["A",10,false]]]],"check":"hold-threshold scenario 1","expected":[[[],[["A",10,false]]]],"passed":true},{"actual":[[[["tap","A"]],[]]],"check":"hold-threshold scenario 2","expected":[[[["tap","A"]],[]]],"passed":true},{"actual":[[[["hold","A"]],[]]],"check":"hold-threshold scenario 3","expected":[[[["hold","A"]],[]]],"passed":true},{"actual":[[[["hold","A"]],[]]],"check":"hold-threshold scenario 4","expected":[[[["hold","A"]],[]]],"passed":true},{"actual":[[[["hold","A"]],[["A",10,true]]]],"check":"hold-threshold scenario 5","expected":[[[["hold","A"]],[["A",10,true]]]],"passed":true},{"actual":[[[["tap","A"]],[["B",11,false]]]],"check":"hold-threshold scenario 6","expected":[[[["tap","A"]],[["B",11,false]]]],"passed":true},{"actual":[[[["hold","B"]],[["B",11,true]]]],"check":"hold-threshold scenario 7","expected":[[[["hold","B"]],[["B",11,true]]]],"passed":true},{"actual":[[[],[]]],"check":"hold-threshold scenario 8","expected":[[[],[]]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"hold-threshold scenario 0\", \"actual\": [[[], []]], \"expected\": [[[], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 1\", \"actual\": [[[], [[\"A\", 10, false]]]], \"expected\": [[[], [[\"A\", 10, false]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 2\", \"actual\": [[[[\"tap\", \"A\"]], []]], \"expected\": [[[[\"tap\", \"A\"]], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 3\", \"actual\": [[[[\"hold\", \"A\"]], []]], \"expected\": [[[[\"hold\", \"A\"]], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 4\", \"actual\": [[[[\"hold\", \"A\"]], []]], \"expected\": [[[[\"hold\", \"A\"]], []]], \"passed\": true}, {\"check\": \"hold-threshold scenario 5\", \"actual\": [[[[\"hold\", \"A\"]], [[\"A\", 10, true]]]], \"expected\": [[[[\"hold\", \"A\"]], [[\"A\", 10, true]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 6\", \"actual\": [[[[\"tap\", \"A\"]], [[\"B\", 11, false]]]], \"expected\": [[[[\"tap\", \"A\"]], [[\"B\", 11, false]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 7\", \"actual\": [[[[\"hold\", \"B\"]], [[\"B\", 11, true]]]], \"expected\": [[[[\"hold\", \"B\"]], [[\"B\", 11, true]]]], \"passed\": true}, {\"check\": \"hold-threshold scenario 8\", \"actual\": [[[], []]], \"expected\": [[[], []]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}