{"abstract":"The event trace violates the input notification rule and produces incorrect keyboard state or command output.","category":"Keyboard interactions","checks":13,"contract":"Case [text,lo,hi,key,prevent_down,prevent_before,cancelable,readonly]. Selection is a valid half-open code-point interval. Printable single characters replace selection, Backspace deletes previous point and Delete deletes next point for collapsed selections. Other keys do not edit. A cancelable prevented keydown stops editing; readonly suppresses beforeinput. A changed candidate fires beforeinput, cancellation suppresses mutation; successful edit fires input. Always log keydown and keyup. Return text, selection endpoints and event log. 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-key-default-edit","failed_approach":"The partial repair changes this transition to log.append('change'), which still violates the model contract on the explicit regression traces.","family":"s3-keyboard-interactions-key-default-edit-input-notification","id":"FA-31436","implementations":{"attempt":{"sha256":"98184298a10dc21cfebffbc911eab48e018758920d1bebfdff59ce2465bb4185","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        text,lo,hi,key,prevent_down,prevent_before,cancelable,readonly=c\n        log=['keydown']; original=[text,lo,hi]\n        if prevent_down and cancelable:\n            return original+[log+['keyup']]\n        if readonly or not (len(key)==1 or key in ('Backspace','Delete')):\n            return original+[log+['keyup']]\n        insert=key if len(key)==1 else ''\n        if key=='Backspace' and lo==hi: lo=max(0,lo-1)\n        elif key=='Delete' and lo==hi: hi=min(len(text),hi+1)\n        changed=text[:lo]+insert+text[hi:]\n        if changed==text:\n            return original+[log+['keyup']]\n        log.append('beforeinput')\n        if prevent_before:\n            return original+[log+['keyup']]\n        text=changed\n        hi=lo+len(insert); lo=hi\n        log.append('change')\n        return [text,lo,hi,log+['keyup']]\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('key-default-edit scenario 0', solve([['abc', 1, 1, 'X', False, False, True, False]] * N), [['aXbc', 2, 2, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 1', solve([['abc', 1, 2, 'XY', False, False, True, False]] * N), [['abc', 1, 2, ['keydown', 'keyup']]] * N)\ncheck('key-default-edit scenario 2', solve([['abcd', 1, 3, 'Z', False, False, True, False]] * N), [['aZd', 2, 2, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 3', solve([['abcd', 1, 3, 'Backspace', False, False, True, False]] * N), [['ad', 1, 1, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 4', solve([['abcd', 1, 3, 'Delete', False, False, True, False]] * N), [['ad', 1, 1, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 5', solve([['abcd', 2, 2, 'Backspace', False, False, True, False]] * N), [['acd', 1, 1, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 6', solve([['abcd', 1, 1, 'Delete', False, False, True, False]] * N), [['acd', 1, 1, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 7', solve([['abc', 0, 0, 'Backspace', False, False, True, False]] * N), [['abc', 0, 0, ['keydown', 'keyup']]] * N)\ncheck('key-default-edit scenario 8', solve([['abc', 0, 3, 'Delete', False, False, True, False]] * N), [['', 0, 0, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 9', solve([['abc', 1, 1, 'X', True, False, False, False]] * N), [['aXbc', 2, 2, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 10', solve([['abc', 1, 1, 'X', True, False, True, False]] * N), [['abc', 1, 1, ['keydown', 'keyup']]] * N)\ncheck('key-default-edit scenario 11', solve([['abc', 1, 1, 'X', False, True, False, False]] * N), [['abc', 1, 1, ['keydown', 'beforeinput', 'keyup']]] * N)\ncheck('key-default-edit scenario 12', solve([['abc', 1, 1, 'X', False, False, True, True]] * N), [['abc', 1, 1, ['keydown', 'keyup']]] * 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":"74e16de91049537a4b7ca2129ce46ef9807e07bbbebed2c45f167b4a4873a7c9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(cases):\n    def run(c):\n        text,lo,hi,key,prevent_down,prevent_before,cancelable,readonly=c\n        log=['keydown']; original=[text,lo,hi]\n        if prevent_down and cancelable:\n            return original+[log+['keyup']]\n        if readonly or not (len(key)==1 or key in ('Backspace','Delete')):\n            return original+[log+['keyup']]\n        insert=key if len(key)==1 else ''\n        if key=='Backspace' and lo==hi: lo=max(0,lo-1)\n        elif key=='Delete' and lo==hi: hi=min(len(text),hi+1)\n        changed=text[:lo]+insert+text[hi:]\n        if changed==text:\n            return original+[log+['keyup']]\n        log.append('beforeinput')\n        if prevent_before:\n            return original+[log+['keyup']]\n        text=changed\n        hi=lo+len(insert); lo=hi\n        log.append('beforeinput')\n        return [text,lo,hi,log+['keyup']]\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('key-default-edit scenario 0', solve([['abc', 1, 1, 'X', False, False, True, False]] * N), [['aXbc', 2, 2, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 1', solve([['abc', 1, 2, 'XY', False, False, True, False]] * N), [['abc', 1, 2, ['keydown', 'keyup']]] * N)\ncheck('key-default-edit scenario 2', solve([['abcd', 1, 3, 'Z', False, False, True, False]] * N), [['aZd', 2, 2, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 3', solve([['abcd', 1, 3, 'Backspace', False, False, True, False]] * N), [['ad', 1, 1, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 4', solve([['abcd', 1, 3, 'Delete', False, False, True, False]] * N), [['ad', 1, 1, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 5', solve([['abcd', 2, 2, 'Backspace', False, False, True, False]] * N), [['acd', 1, 1, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 6', solve([['abcd', 1, 1, 'Delete', False, False, True, False]] * N), [['acd', 1, 1, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 7', solve([['abc', 0, 0, 'Backspace', False, False, True, False]] * N), [['abc', 0, 0, ['keydown', 'keyup']]] * N)\ncheck('key-default-edit scenario 8', solve([['abc', 0, 3, 'Delete', False, False, True, False]] * N), [['', 0, 0, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 9', solve([['abc', 1, 1, 'X', True, False, False, False]] * N), [['aXbc', 2, 2, ['keydown', 'beforeinput', 'input', 'keyup']]] * N)\ncheck('key-default-edit scenario 10', solve([['abc', 1, 1, 'X', True, False, True, False]] * N), [['abc', 1, 1, ['keydown', 'keyup']]] * N)\ncheck('key-default-edit scenario 11', solve([['abc', 1, 1, 'X', False, True, False, False]] * N), [['abc', 1, 1, ['keydown', 'beforeinput', 'keyup']]] * N)\ncheck('key-default-edit scenario 12', solve([['abc', 1, 1, 'X', False, False, True, True]] * N), [['abc', 1, 1, ['keydown', 'keyup']]] * 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-key-default-edit-input-notification","generated_at":"2026-09-29T14:42:02.025624+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 completed keyboard default edit publishes the wrong mutation event.","sha256":"992ede992e3c88d05eb0ff8f7992c3b84fc0b8ae83440d002f3e13ed34a347d7","title":"Keyboard default edit cancellation pipeline: A completed keyboard default edit publishes the wrong mutation event · 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":44.27,"exit_code":1,"observations":[{"actual":[["aXbc",2,2,["keydown","beforeinput","change","keyup"]]],"check":"key-default-edit scenario 0","expected":[["aXbc",2,2,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["abc",1,2,["keydown","keyup"]]],"check":"key-default-edit scenario 1","expected":[["abc",1,2,["keydown","keyup"]]],"passed":true},{"actual":[["aZd",2,2,["keydown","beforeinput","change","keyup"]]],"check":"key-default-edit scenario 2","expected":[["aZd",2,2,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["ad",1,1,["keydown","beforeinput","change","keyup"]]],"check":"key-default-edit scenario 3","expected":[["ad",1,1,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["ad",1,1,["keydown","beforeinput","change","keyup"]]],"check":"key-default-edit scenario 4","expected":[["ad",1,1,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["acd",1,1,["keydown","beforeinput","change","keyup"]]],"check":"key-default-edit scenario 5","expected":[["acd",1,1,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["acd",1,1,["keydown","beforeinput","change","keyup"]]],"check":"key-default-edit scenario 6","expected":[["acd",1,1,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["abc",0,0,["keydown","keyup"]]],"check":"key-default-edit scenario 7","expected":[["abc",0,0,["keydown","keyup"]]],"passed":true},{"actual":[["",0,0,["keydown","beforeinput","change","keyup"]]],"check":"key-default-edit scenario 8","expected":[["",0,0,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["aXbc",2,2,["keydown","beforeinput","change","keyup"]]],"check":"key-default-edit scenario 9","expected":[["aXbc",2,2,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["abc",1,1,["keydown","keyup"]]],"check":"key-default-edit scenario 10","expected":[["abc",1,1,["keydown","keyup"]]],"passed":true},{"actual":[["abc",1,1,["keydown","beforeinput","keyup"]]],"check":"key-default-edit scenario 11","expected":[["abc",1,1,["keydown","beforeinput","keyup"]]],"passed":true},{"actual":[["abc",1,1,["keydown","keyup"]]],"check":"key-default-edit scenario 12","expected":[["abc",1,1,["keydown","keyup"]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"key-default-edit scenario 0\", \"actual\": [[\"aXbc\", 2, 2, [\"keydown\", \"beforeinput\", \"change\", \"keyup\"]]], \"expected\": [[\"aXbc\", 2, 2, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 1\", \"actual\": [[\"abc\", 1, 2, [\"keydown\", \"keyup\"]]], \"expected\": [[\"abc\", 1, 2, [\"keydown\", \"keyup\"]]], \"passed\": true}, {\"check\": \"key-default-edit scenario 2\", \"actual\": [[\"aZd\", 2, 2, [\"keydown\", \"beforeinput\", \"change\", \"keyup\"]]], \"expected\": [[\"aZd\", 2, 2, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 3\", \"actual\": [[\"ad\", 1, 1, [\"keydown\", \"beforeinput\", \"change\", \"keyup\"]]], \"expected\": [[\"ad\", 1, 1, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 4\", \"actual\": [[\"ad\", 1, 1, [\"keydown\", \"beforeinput\", \"change\", \"keyup\"]]], \"expected\": [[\"ad\", 1, 1, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 5\", \"actual\": [[\"acd\", 1, 1, [\"keydown\", \"beforeinput\", \"change\", \"keyup\"]]], \"expected\": [[\"acd\", 1, 1, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 6\", \"actual\": [[\"acd\", 1, 1, [\"keydown\", \"beforeinput\", \"change\", \"keyup\"]]], \"expected\": [[\"acd\", 1, 1, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 7\", \"actual\": [[\"abc\", 0, 0, [\"keydown\", \"keyup\"]]], \"expected\": [[\"abc\", 0, 0, [\"keydown\", \"keyup\"]]], \"passed\": true}, {\"check\": \"key-default-edit scenario 8\", \"actual\": [[\"\", 0, 0, [\"keydown\", \"beforeinput\", \"change\", \"keyup\"]]], \"expected\": [[\"\", 0, 0, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 9\", \"actual\": [[\"aXbc\", 2, 2, [\"keydown\", \"beforeinput\", \"change\", \"keyup\"]]], \"expected\": [[\"aXbc\", 2, 2, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 10\", \"actual\": [[\"abc\", 1, 1, [\"keydown\", \"keyup\"]]], \"expected\": [[\"abc\", 1, 1, [\"keydown\", \"keyup\"]]], \"passed\": true}, {\"check\": \"key-default-edit scenario 11\", \"actual\": [[\"abc\", 1, 1, [\"keydown\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"abc\", 1, 1, [\"keydown\", \"beforeinput\", \"keyup\"]]], \"passed\": true}, {\"check\": \"key-default-edit scenario 12\", \"actual\": [[\"abc\", 1, 1, [\"keydown\", \"keyup\"]]], \"expected\": [[\"abc\", 1, 1, [\"keydown\", \"keyup\"]]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.013,"exit_code":1,"observations":[{"actual":[["aXbc",2,2,["keydown","beforeinput","beforeinput","keyup"]]],"check":"key-default-edit scenario 0","expected":[["aXbc",2,2,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["abc",1,2,["keydown","keyup"]]],"check":"key-default-edit scenario 1","expected":[["abc",1,2,["keydown","keyup"]]],"passed":true},{"actual":[["aZd",2,2,["keydown","beforeinput","beforeinput","keyup"]]],"check":"key-default-edit scenario 2","expected":[["aZd",2,2,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["ad",1,1,["keydown","beforeinput","beforeinput","keyup"]]],"check":"key-default-edit scenario 3","expected":[["ad",1,1,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["ad",1,1,["keydown","beforeinput","beforeinput","keyup"]]],"check":"key-default-edit scenario 4","expected":[["ad",1,1,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["acd",1,1,["keydown","beforeinput","beforeinput","keyup"]]],"check":"key-default-edit scenario 5","expected":[["acd",1,1,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["acd",1,1,["keydown","beforeinput","beforeinput","keyup"]]],"check":"key-default-edit scenario 6","expected":[["acd",1,1,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["abc",0,0,["keydown","keyup"]]],"check":"key-default-edit scenario 7","expected":[["abc",0,0,["keydown","keyup"]]],"passed":true},{"actual":[["",0,0,["keydown","beforeinput","beforeinput","keyup"]]],"check":"key-default-edit scenario 8","expected":[["",0,0,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["aXbc",2,2,["keydown","beforeinput","beforeinput","keyup"]]],"check":"key-default-edit scenario 9","expected":[["aXbc",2,2,["keydown","beforeinput","input","keyup"]]],"passed":false},{"actual":[["abc",1,1,["keydown","keyup"]]],"check":"key-default-edit scenario 10","expected":[["abc",1,1,["keydown","keyup"]]],"passed":true},{"actual":[["abc",1,1,["keydown","beforeinput","keyup"]]],"check":"key-default-edit scenario 11","expected":[["abc",1,1,["keydown","beforeinput","keyup"]]],"passed":true},{"actual":[["abc",1,1,["keydown","keyup"]]],"check":"key-default-edit scenario 12","expected":[["abc",1,1,["keydown","keyup"]]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"key-default-edit scenario 0\", \"actual\": [[\"aXbc\", 2, 2, [\"keydown\", \"beforeinput\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"aXbc\", 2, 2, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 1\", \"actual\": [[\"abc\", 1, 2, [\"keydown\", \"keyup\"]]], \"expected\": [[\"abc\", 1, 2, [\"keydown\", \"keyup\"]]], \"passed\": true}, {\"check\": \"key-default-edit scenario 2\", \"actual\": [[\"aZd\", 2, 2, [\"keydown\", \"beforeinput\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"aZd\", 2, 2, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 3\", \"actual\": [[\"ad\", 1, 1, [\"keydown\", \"beforeinput\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"ad\", 1, 1, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 4\", \"actual\": [[\"ad\", 1, 1, [\"keydown\", \"beforeinput\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"ad\", 1, 1, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 5\", \"actual\": [[\"acd\", 1, 1, [\"keydown\", \"beforeinput\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"acd\", 1, 1, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 6\", \"actual\": [[\"acd\", 1, 1, [\"keydown\", \"beforeinput\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"acd\", 1, 1, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 7\", \"actual\": [[\"abc\", 0, 0, [\"keydown\", \"keyup\"]]], \"expected\": [[\"abc\", 0, 0, [\"keydown\", \"keyup\"]]], \"passed\": true}, {\"check\": \"key-default-edit scenario 8\", \"actual\": [[\"\", 0, 0, [\"keydown\", \"beforeinput\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"\", 0, 0, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 9\", \"actual\": [[\"aXbc\", 2, 2, [\"keydown\", \"beforeinput\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"aXbc\", 2, 2, [\"keydown\", \"beforeinput\", \"input\", \"keyup\"]]], \"passed\": false}, {\"check\": \"key-default-edit scenario 10\", \"actual\": [[\"abc\", 1, 1, [\"keydown\", \"keyup\"]]], \"expected\": [[\"abc\", 1, 1, [\"keydown\", \"keyup\"]]], \"passed\": true}, {\"check\": \"key-default-edit scenario 11\", \"actual\": [[\"abc\", 1, 1, [\"keydown\", \"beforeinput\", \"keyup\"]]], \"expected\": [[\"abc\", 1, 1, [\"keydown\", \"beforeinput\", \"keyup\"]]], \"passed\": true}, {\"check\": \"key-default-edit scenario 12\", \"actual\": [[\"abc\", 1, 1, [\"keydown\", \"keyup\"]]], \"expected\": [[\"abc\", 1, 1, [\"keydown\", \"keyup\"]]], \"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."}}