FAILURE MAP
← Case archive

FA-31151 / Keyboard interactions / Open access

Per-key double tap recognizer: The matched release transition removes unrelated keys · case 01

The event trace violates the release remove rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

The matched release transition removes unrelated keys.

THE FAILURE

The matched release transition removes unrelated keys.

Unsuccessful approach: The partial repair changes this transition to held.clear() taps, which still violates the model contract on the explicit regression traces.

Case contract

Case [window,events] with nondecreasing timestamps and events [kind,key,time]. Down repeats do not count. A matched up produces tap and may complete a double if the prior release of the same key is within the inclusive window. Completing a double consumes that prior release. Cancel clears that key, blur clears all state. Return doubles [key,time], held keys and remembered release times. 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):
        window,events=c
        held=set(); last={}; doubles=[]; taps=0
        for kind,key,now in events:
            if kind=='down': held.add(key)
            elif kind=='up' and key in held:
                pass
                taps+=1
                previous=last.get(key)
                if previous is not None and now-previous<=window:
                    doubles.append([key,now])
                    last.pop(key,None)
                else:
                    last[key]=now
            elif kind=='cancel':
                held.discard(key); last.pop(key,None)
            elif kind=='blur':
                held.clear(); last.clear()
        return [doubles,sorted(held),sorted([[k,v] for k,v in last.items()]),taps]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('double-tap scenario 0', solve([[4, []]] * N), [[[], [], [], 0]] * N)
check('double-tap scenario 1', solve([[4, [['down', 'A', 0], ['up', 'B', 1]]]] * N), [[[], ['A'], [], 0]] * N)
check('double-tap scenario 2', solve([[4, [['up', 'A', 1]]]] * N), [[[], [], [], 0]] * N)
check('double-tap scenario 3', solve([[4, [['down', 'A', 0], ['up', 'A', 0], ['down', 'A', 2], ['up', 'A', 4]]]] * N), [[[['A', 4]], [], [], 2]] * N)
check('double-tap scenario 4', solve([[4, [['down', 'A', 10], ['up', 'A', 11], ['down', 'B', 12], ['up', 'B', 13]]]] * N), [[[], [], [['A', 11], ['B', 13]], 2]] * N)
check('double-tap scenario 5', solve([[4, [['down', 'A', 1], ['down', 'A', 1], ['up', 'A', 2]]]] * N), [[[], [], [['A', 2]], 1]] * N)
check('double-tap scenario 6', solve([[4, [['down', 'A', 0], ['up', 'A', 1], ['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 12], ['up', 'A', 13]]]] * N), [[[['A', 13]], [], [], 3]] * N)
check('double-tap scenario 7', solve([[4, [['down', 'A', 0], ['up', 'A', 1], ['down', 'A', 2], ['up', 'A', 3], ['down', 'A', 4], ['up', 'A', 5]]]] * N), [[[['A', 3]], [], [['A', 5]], 3]] * N)
check('double-tap scenario 8', solve([[4, [['down', 'A', 0], ['up', 'A', 1], ['down', 'B', 2], ['up', 'B', 3], ['down', 'A', 3], ['up', 'A', 4]]]] * N), [[[['A', 4]], [], [['B', 3]], 3]] * N)
check('double-tap scenario 9', solve([[4, [['down', 'A', 0], ['up', 'A', 1], ['down', 'B', 2], ['blur', '', 3]]]] * N), [[[], [], [], 1]] * N)
check('double-tap scenario 10', solve([[4, [['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]]]] * N), [[[], ['B'], [['A', 2]], 1]] * 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
double-tap scenario 0[[[], [], [], 0]][[[], [], [], 0]]Passed
double-tap scenario 1[[[], ['A'], [], 0]][[[], ['A'], [], 0]]Passed
double-tap scenario 2[[[], [], [], 0]][[[], [], [], 0]]Passed
double-tap scenario 3[[[['A', 4]], ['A'], [], 2]][[[['A', 4]], [], [], 2]]Failed
double-tap scenario 4[[[], ['A', 'B'], [['A', 11], ['B', 13]], 2]][[[], [], [['A', 11], ['B', 13]], 2]]Failed
double-tap scenario 5[[[], ['A'], [['A', 2]], 1]][[[], [], [['A', 2]], 1]]Failed
double-tap scenario 6[[[['A', 13]], ['A'], [], 3]][[[['A', 13]], [], [], 3]]Failed
double-tap scenario 7[[[['A', 3]], ['A'], [['A', 5]], 3]][[[['A', 3]], [], [['A', 5]], 3]]Failed
double-tap scenario 8[[[['A', 4]], ['A', 'B'], [['B', 3]], 3]][[[['A', 4]], [], [['B', 3]], 3]]Failed
double-tap scenario 9[[[], [], [], 1]][[[], [], [], 1]]Passed
double-tap scenario 10[[[], ['A', 'B'], [['A', 2]], 1]][[[], ['B'], [['A', 2]], 1]]Failed

SHA-256 / 22399e53157925117dc8854d15a667d711ddad4bbf52c8c368aadc21905fc8ab

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):
        window,events=c
        held=set(); last={}; doubles=[]; taps=0
        for kind,key,now in events:
            if kind=='down': held.add(key)
            elif kind=='up' and key in held:
                held.clear()
                taps+=1
                previous=last.get(key)
                if previous is not None and now-previous<=window:
                    doubles.append([key,now])
                    last.pop(key,None)
                else:
                    last[key]=now
            elif kind=='cancel':
                held.discard(key); last.pop(key,None)
            elif kind=='blur':
                held.clear(); last.clear()
        return [doubles,sorted(held),sorted([[k,v] for k,v in last.items()]),taps]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('double-tap scenario 0', solve([[4, []]] * N), [[[], [], [], 0]] * N)
check('double-tap scenario 1', solve([[4, [['down', 'A', 0], ['up', 'B', 1]]]] * N), [[[], ['A'], [], 0]] * N)
check('double-tap scenario 2', solve([[4, [['up', 'A', 1]]]] * N), [[[], [], [], 0]] * N)
check('double-tap scenario 3', solve([[4, [['down', 'A', 0], ['up', 'A', 0], ['down', 'A', 2], ['up', 'A', 4]]]] * N), [[[['A', 4]], [], [], 2]] * N)
check('double-tap scenario 4', solve([[4, [['down', 'A', 10], ['up', 'A', 11], ['down', 'B', 12], ['up', 'B', 13]]]] * N), [[[], [], [['A', 11], ['B', 13]], 2]] * N)
check('double-tap scenario 5', solve([[4, [['down', 'A', 1], ['down', 'A', 1], ['up', 'A', 2]]]] * N), [[[], [], [['A', 2]], 1]] * N)
check('double-tap scenario 6', solve([[4, [['down', 'A', 0], ['up', 'A', 1], ['down', 'A', 10], ['up', 'A', 11], ['down', 'A', 12], ['up', 'A', 13]]]] * N), [[[['A', 13]], [], [], 3]] * N)
check('double-tap scenario 7', solve([[4, [['down', 'A', 0], ['up', 'A', 1], ['down', 'A', 2], ['up', 'A', 3], ['down', 'A', 4], ['up', 'A', 5]]]] * N), [[[['A', 3]], [], [['A', 5]], 3]] * N)
check('double-tap scenario 8', solve([[4, [['down', 'A', 0], ['up', 'A', 1], ['down', 'B', 2], ['up', 'B', 3], ['down', 'A', 3], ['up', 'A', 4]]]] * N), [[[['A', 4]], [], [['B', 3]], 3]] * N)
check('double-tap scenario 9', solve([[4, [['down', 'A', 0], ['up', 'A', 1], ['down', 'B', 2], ['blur', '', 3]]]] * N), [[[], [], [], 1]] * N)
check('double-tap scenario 10', solve([[4, [['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2]]]] * N), [[[], ['B'], [['A', 2]], 1]] * 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
double-tap scenario 0[[[], [], [], 0]][[[], [], [], 0]]Passed
double-tap scenario 1[[[], ['A'], [], 0]][[[], ['A'], [], 0]]Passed
double-tap scenario 2[[[], [], [], 0]][[[], [], [], 0]]Passed
double-tap scenario 3[[[['A', 4]], [], [], 2]][[[['A', 4]], [], [], 2]]Passed
double-tap scenario 4[[[], [], [['A', 11], ['B', 13]], 2]][[[], [], [['A', 11], ['B', 13]], 2]]Passed
double-tap scenario 5[[[], [], [['A', 2]], 1]][[[], [], [['A', 2]], 1]]Passed
double-tap scenario 6[[[['A', 13]], [], [], 3]][[[['A', 13]], [], [], 3]]Passed
double-tap scenario 7[[[['A', 3]], [], [['A', 5]], 3]][[[['A', 3]], [], [['A', 5]], 3]]Passed
double-tap scenario 8[[[['A', 4]], [], [['B', 3]], 3]][[[['A', 4]], [], [['B', 3]], 3]]Passed
double-tap scenario 9[[[], [], [], 1]][[[], [], [], 1]]Passed
double-tap scenario 10[[[], [], [['A', 2]], 1]][[[], ['B'], [['A', 2]], 1]]Failed

SHA-256 / 3e2e0ca3a0a1ffbe30304e0a00480ef74bc2d359719ca7ddbe52582c0c4ef059

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 11 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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:41:59.706245+00:00.

Case digest / 600152e7a69ad6e3e3a968b6a675c05df644f468907a492db10bb32d6f0927f5