FA-32266 / Keyboard interactions / Open access
Deferred short shortcut versus longer key sequence: Shortcut candidates use suffix matching or require a completed binding too early · case 01
The event trace violates the prefix candidate rule and produces incorrect keyboard state or command output.
ROOT CAUSE
Shortcut candidates use suffix matching or require a completed binding too early.
VERIFIED REPAIR
Use the contract transition `b[0][:len(candidate)]==candidate` at the prefix candidate fault site; preserve the other state transitions.
Unsuccessful approach: The partial repair changes this transition to b[0]==candidate, which still violates the model contract on the explicit regression traces.
Case contract
Case [bindings,timeout,events]. Binding [nonempty_key_sequence,action] has unique sequence. Events [kind,key,time]. Down extends prefix. Exact match with longer candidates is delayed until deadline; exact unambiguous match dispatches immediately. Tick or next event at deadline emits pending exact match and clears prefix. Mismatch dispatches pending match then retries only current key as fresh prefix. Cancel drops pending without dispatch. Return [action,time] dispatches,buffer,pending action,deadline. Inputs are finite ordered event traces; return the stated deterministic state. Batch entries are independent. N varies the number of independent input transactions.
Why this case matters
Controlled keyboard event processing model for debugging application event logic.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cases):
def run(c):
bindings,timeout,events=c
buffer=[]; pending=None; deadline=None; out=[]
for kind,key,now in events:
if kind=='cancel':
buffer=[]; pending=None; deadline=None
continue
if deadline is not None and now>=deadline:
if pending is not None: out.append([pending,deadline])
buffer=[]; pending=None; deadline=None
if kind!='down': continue
candidate=buffer+[key]
candidates=[b for b in bindings if b[0][-len(candidate):]==candidate]
if not candidates:
if pending is not None: out.append([pending,now])
candidate=[key]
candidates=[b for b in bindings if b[0][:1]==candidate]
pending=None
buffer=candidate if candidates else []
exact=[b for b in candidates if len(b[0])==len(buffer)]
longer=[b for b in candidates if len(b[0])>len(buffer)]
if exact and not longer:
out.append([exact[0][1],now])
buffer=[]; pending=None; deadline=None
else:
pending=exact[0][1] if exact else None
deadline=now+timeout if candidates else None
return [out,buffer,pending,deadline]
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ambiguous-shortcut-prefix scenario 0', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, []]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 1', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, [['down', 'A', 10], ['tick', '', 15]]]] * N), [[[['short', 15]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 2', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['tick', '', 20]]]] * N), [[[['short', 15]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 3', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['down', 'B', 12]]]] * N), [[[['long', 12]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 4', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, [['down', 'A', 10], ['down', 'C', 12]]]] * N), [[[['short', 12], ['other', 12]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 5', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['cancel', '', 11]]]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 6', solve([[[[['A', 'B'], 'long']], 5, [['down', 'A', 10], ['up', 'B', 11]]]] * N), [[[], ['A'], None, 15]] * N)
check('ambiguous-shortcut-prefix scenario 7', solve([[[[['A', 'B'], 'long']], 5, [['down', 'A', 10], ['tick', 'B', 11]]]] * N), [[[], ['A'], None, 15]] * N)
check('ambiguous-shortcut-prefix scenario 8', solve([[[[['A', 'B'], 'long']], 5, [['down', 'Z', 10]]]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 9', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['down', 'B', 15]]]] * N), [[[['short', 15]], [], None, None]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| ambiguous-shortcut-prefix scenario 0 | [[[], [], None, None]] | [[[], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 1 | [[[['short', 10]], [], None, None]] | [[[['short', 15]], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 2 | [[[['short', 10]], [], None, None]] | [[[['short', 15]], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 3 | [[[['short', 10]], ['B'], None, 17]] | [[[['long', 12]], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 4 | [[[['short', 10], ['other', 12]], [], None, None]] | [[[['short', 12], ['other', 12]], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 5 | [[[['short', 10]], [], None, None]] | [[[], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 6 | [[[], ['A'], None, 15]] | [[[], ['A'], None, 15]] | Passed |
| ambiguous-shortcut-prefix scenario 7 | [[[], ['A'], None, 15]] | [[[], ['A'], None, 15]] | Passed |
| ambiguous-shortcut-prefix scenario 8 | [[[], [], None, None]] | [[[], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 9 | [[[['short', 10]], ['B'], None, 20]] | [[[['short', 15]], [], None, None]] | Failed |
SHA-256 / e7045d1e08893226ebbba232f8d010350dc8455f1467044486e1b340d9bbf3c2
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cases):
def run(c):
bindings,timeout,events=c
buffer=[]; pending=None; deadline=None; out=[]
for kind,key,now in events:
if kind=='cancel':
buffer=[]; pending=None; deadline=None
continue
if deadline is not None and now>=deadline:
if pending is not None: out.append([pending,deadline])
buffer=[]; pending=None; deadline=None
if kind!='down': continue
candidate=buffer+[key]
candidates=[b for b in bindings if b[0]==candidate]
if not candidates:
if pending is not None: out.append([pending,now])
candidate=[key]
candidates=[b for b in bindings if b[0][:1]==candidate]
pending=None
buffer=candidate if candidates else []
exact=[b for b in candidates if len(b[0])==len(buffer)]
longer=[b for b in candidates if len(b[0])>len(buffer)]
if exact and not longer:
out.append([exact[0][1],now])
buffer=[]; pending=None; deadline=None
else:
pending=exact[0][1] if exact else None
deadline=now+timeout if candidates else None
return [out,buffer,pending,deadline]
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ambiguous-shortcut-prefix scenario 0', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, []]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 1', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, [['down', 'A', 10], ['tick', '', 15]]]] * N), [[[['short', 15]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 2', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['tick', '', 20]]]] * N), [[[['short', 15]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 3', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['down', 'B', 12]]]] * N), [[[['long', 12]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 4', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, [['down', 'A', 10], ['down', 'C', 12]]]] * N), [[[['short', 12], ['other', 12]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 5', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['cancel', '', 11]]]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 6', solve([[[[['A', 'B'], 'long']], 5, [['down', 'A', 10], ['up', 'B', 11]]]] * N), [[[], ['A'], None, 15]] * N)
check('ambiguous-shortcut-prefix scenario 7', solve([[[[['A', 'B'], 'long']], 5, [['down', 'A', 10], ['tick', 'B', 11]]]] * N), [[[], ['A'], None, 15]] * N)
check('ambiguous-shortcut-prefix scenario 8', solve([[[[['A', 'B'], 'long']], 5, [['down', 'Z', 10]]]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 9', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['down', 'B', 15]]]] * N), [[[['short', 15]], [], None, None]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| ambiguous-shortcut-prefix scenario 0 | [[[], [], None, None]] | [[[], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 1 | [[[['short', 10]], [], None, None]] | [[[['short', 15]], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 2 | [[[['short', 10]], [], None, None]] | [[[['short', 15]], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 3 | [[[['short', 10]], [], None, None]] | [[[['long', 12]], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 4 | [[[['short', 10], ['other', 12]], [], None, None]] | [[[['short', 12], ['other', 12]], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 5 | [[[['short', 10]], [], None, None]] | [[[], [], None, None]] | Failed |
| ambiguous-shortcut-prefix scenario 6 | [[[], ['A'], None, 15]] | [[[], ['A'], None, 15]] | Passed |
| ambiguous-shortcut-prefix scenario 7 | [[[], ['A'], None, 15]] | [[[], ['A'], None, 15]] | Passed |
| ambiguous-shortcut-prefix scenario 8 | [[[], [], None, None]] | [[[], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 9 | [[[['short', 10]], [], None, None]] | [[[['short', 15]], [], None, None]] | Failed |
SHA-256 / 3c2cd6fd92aeb341e2db2ad069b678df585bc10f10763ce758abe422ac20a960
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(cases):
def run(c):
bindings,timeout,events=c
buffer=[]; pending=None; deadline=None; out=[]
for kind,key,now in events:
if kind=='cancel':
buffer=[]; pending=None; deadline=None
continue
if deadline is not None and now>=deadline:
if pending is not None: out.append([pending,deadline])
buffer=[]; pending=None; deadline=None
if kind!='down': continue
candidate=buffer+[key]
candidates=[b for b in bindings if b[0][:len(candidate)]==candidate]
if not candidates:
if pending is not None: out.append([pending,now])
candidate=[key]
candidates=[b for b in bindings if b[0][:1]==candidate]
pending=None
buffer=candidate if candidates else []
exact=[b for b in candidates if len(b[0])==len(buffer)]
longer=[b for b in candidates if len(b[0])>len(buffer)]
if exact and not longer:
out.append([exact[0][1],now])
buffer=[]; pending=None; deadline=None
else:
pending=exact[0][1] if exact else None
deadline=now+timeout if candidates else None
return [out,buffer,pending,deadline]
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ambiguous-shortcut-prefix scenario 0', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, []]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 1', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, [['down', 'A', 10], ['tick', '', 15]]]] * N), [[[['short', 15]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 2', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['tick', '', 20]]]] * N), [[[['short', 15]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 3', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['down', 'B', 12]]]] * N), [[[['long', 12]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 4', solve([[[[['A'], 'short'], [['A', 'B'], 'long'], [['C'], 'other']], 5, [['down', 'A', 10], ['down', 'C', 12]]]] * N), [[[['short', 12], ['other', 12]], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 5', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['cancel', '', 11]]]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 6', solve([[[[['A', 'B'], 'long']], 5, [['down', 'A', 10], ['up', 'B', 11]]]] * N), [[[], ['A'], None, 15]] * N)
check('ambiguous-shortcut-prefix scenario 7', solve([[[[['A', 'B'], 'long']], 5, [['down', 'A', 10], ['tick', 'B', 11]]]] * N), [[[], ['A'], None, 15]] * N)
check('ambiguous-shortcut-prefix scenario 8', solve([[[[['A', 'B'], 'long']], 5, [['down', 'Z', 10]]]] * N), [[[], [], None, None]] * N)
check('ambiguous-shortcut-prefix scenario 9', solve([[[[['A'], 'short'], [['A', 'B'], 'long']], 5, [['down', 'A', 10], ['down', 'B', 15]]]] * N), [[[['short', 15]], [], None, None]] * N)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| ambiguous-shortcut-prefix scenario 0 | [[[], [], None, None]] | [[[], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 1 | [[[['short', 15]], [], None, None]] | [[[['short', 15]], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 2 | [[[['short', 15]], [], None, None]] | [[[['short', 15]], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 3 | [[[['long', 12]], [], None, None]] | [[[['long', 12]], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 4 | [[[['short', 12], ['other', 12]], [], None, None]] | [[[['short', 12], ['other', 12]], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 5 | [[[], [], None, None]] | [[[], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 6 | [[[], ['A'], None, 15]] | [[[], ['A'], None, 15]] | Passed |
| ambiguous-shortcut-prefix scenario 7 | [[[], ['A'], None, 15]] | [[[], ['A'], None, 15]] | Passed |
| ambiguous-shortcut-prefix scenario 8 | [[[], [], None, None]] | [[[], [], None, None]] | Passed |
| ambiguous-shortcut-prefix scenario 9 | [[[['short', 15]], [], None, None]] | [[[['short', 15]], [], None, None]] | Passed |
SHA-256 / 543e8289857c0b5820dfb4131a69911eb7b8eed4fd528582b853401cb51b16a7
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:42:10.444655+00:00.
Case digest / d6e479e6b6d641aa807a1c6186e018c891dd995912050461b0706603df49d16e