FAILURE MAP
← Case archive

FA-32286 / Keyboard interactions / Open access

Deferred short shortcut versus longer key sequence: Partial shortcut deadline uses the epoch or survives after no candidates remain · case 01

The event trace violates the pending deadline rule and produces incorrect keyboard state or command output.

Verified by executionVariant 1 · 10 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Partial shortcut deadline uses the epoch or survives after no candidates remain.

VERIFIED REPAIR

Use the contract transition `deadline=now+timeout if candidates else None` at the pending deadline fault site; preserve the other state transitions.

Unsuccessful approach: The partial repair changes this transition to deadline=now+timeout, 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=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 fixtureActualExpectedOutcome
ambiguous-shortcut-prefix scenario 0[[[], [], None, None]][[[], [], None, None]]Passed
ambiguous-shortcut-prefix scenario 1[[[['short', 5]], [], None, None]][[[['short', 15]], [], None, None]]Failed
ambiguous-shortcut-prefix scenario 2[[[['short', 5]], [], None, None]][[[['short', 15]], [], None, None]]Failed
ambiguous-shortcut-prefix scenario 3[[[['short', 5]], [], None, None]][[[['long', 12]], [], None, None]]Failed
ambiguous-shortcut-prefix scenario 4[[[['short', 5], ['other', 12]], [], None, None]][[[['short', 12], ['other', 12]], [], None, None]]Failed
ambiguous-shortcut-prefix scenario 5[[[], [], None, None]][[[], [], None, None]]Passed
ambiguous-shortcut-prefix scenario 6[[[], [], None, None]][[[], ['A'], None, 15]]Failed
ambiguous-shortcut-prefix scenario 7[[[], [], None, None]][[[], ['A'], None, 15]]Failed
ambiguous-shortcut-prefix scenario 8[[[], [], None, None]][[[], [], None, None]]Passed
ambiguous-shortcut-prefix scenario 9[[[['short', 5]], [], None, None]][[[['short', 15]], [], None, None]]Failed

SHA-256 / 7723ba6b42bc85c31ff2337b9b6e2fbade18aa9c12feb30a8b11069c98b3f348

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][: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
        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 fixtureActualExpectedOutcome
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, 15]][[[], [], None, None]]Failed
ambiguous-shortcut-prefix scenario 9[[[['short', 15]], [], None, 20]][[[['short', 15]], [], None, None]]Failed

SHA-256 / b1f2bef68665ed0b3936ad4058135ee2b74a639adba0193d322c0d8fe0f070ca

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 fixtureActualExpectedOutcome
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.677072+00:00.

Case digest / 551d60fc5104af33d839914262db74841b657b713f798a14e2fdf640610b636c