FA-31721 / Keyboard interactions / Open access
Adjacent keyboard repeat batch coalescing: A raw key barrier loses or misclassifies the accumulated repeat batch · case 01
The event trace violates the barrier flush rule and produces incorrect keyboard state or command output.
ROOT CAUSE
A raw key barrier loses or misclassifies the accumulated repeat batch.
VERIFIED REPAIR
Use the contract transition `out.append(['repeat']+batch) batch=None` at the barrier flush fault site; preserve the other state transitions.
Unsuccessful approach: The partial repair changes this transition to pass batch=None, which still violates the model contract on the explicit regression traces.
Case contract
Events [kind,device,code,time,repeat]. Consecutive repeated down events for the same device/code coalesce into [device,code,first,last,count]; any nonrepeat or non-down event flushes the batch and is emitted as a raw event. A repeated down for a different token flushes and starts another. Return ordered entries tagged repeat or raw. 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):
out=[]; batch=None
for kind,device,code,now,repeat in c:
eligible=kind=='down' and repeat
if eligible:
if batch is not None and batch[0]==device and batch[1]==code:
batch[3]=now
batch[4]+=1
else:
if batch is not None: out.append(['repeat']+batch)
batch=[device,code,now,now,1]
else:
if batch is not None:
out.append(['raw']+batch)
batch=None
out.append(['raw',kind,device,code,now])
if batch is not None: out.append(['repeat']+batch)
return out
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat-coalescing scenario 0', solve([[]] * N), [[]] * N)
check('repeat-coalescing scenario 1', solve([[['down', 'a', 'A', 10, False]]] * N), [[['raw', 'down', 'a', 'A', 10]]] * N)
check('repeat-coalescing scenario 2', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'A', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 12, 2]]] * N)
check('repeat-coalescing scenario 3', solve([[['down', 'a', 'A', 10, True], ['down', 'b', 'A', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] * N)
check('repeat-coalescing scenario 4', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'B', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] * N)
check('repeat-coalescing scenario 5', solve([[['down', 'a', 'A', 10, True], ['up', 'a', 'A', 12, False], ['down', 'a', 'A', 14, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] * N)
check('repeat-coalescing scenario 6', solve([[['up', 'a', 'A', 10, True]]] * N), [[['raw', 'up', 'a', 'A', 10]]] * N)
check('repeat-coalescing scenario 7', solve([[['down', 'a', 'A', 10, True], ['text', 'a', 'A', 12, False]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]] * N)
check('repeat-coalescing scenario 8', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'A', 12, False], ['down', 'a', 'A', 14, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| repeat-coalescing scenario 0 | [[]] | [[]] | Passed |
| repeat-coalescing scenario 1 | [[['raw', 'down', 'a', 'A', 10]]] | [[['raw', 'down', 'a', 'A', 10]]] | Passed |
| repeat-coalescing scenario 2 | [[['repeat', 'a', 'A', 10, 12, 2]]] | [[['repeat', 'a', 'A', 10, 12, 2]]] | Passed |
| repeat-coalescing scenario 3 | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] | Passed |
| repeat-coalescing scenario 4 | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] | Passed |
| repeat-coalescing scenario 5 | [[['raw', 'a', 'A', 10, 10, 1], ['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | Failed |
| repeat-coalescing scenario 6 | [[['raw', 'up', 'a', 'A', 10]]] | [[['raw', 'up', 'a', 'A', 10]]] | Passed |
| repeat-coalescing scenario 7 | [[['raw', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]] | Failed |
| repeat-coalescing scenario 8 | [[['raw', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | Failed |
SHA-256 / e5259587f1db2f5b33fb1beaeda754d8840e4250bd5e1bffa0643b15912f7836
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):
out=[]; batch=None
for kind,device,code,now,repeat in c:
eligible=kind=='down' and repeat
if eligible:
if batch is not None and batch[0]==device and batch[1]==code:
batch[3]=now
batch[4]+=1
else:
if batch is not None: out.append(['repeat']+batch)
batch=[device,code,now,now,1]
else:
if batch is not None:
pass
batch=None
out.append(['raw',kind,device,code,now])
if batch is not None: out.append(['repeat']+batch)
return out
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat-coalescing scenario 0', solve([[]] * N), [[]] * N)
check('repeat-coalescing scenario 1', solve([[['down', 'a', 'A', 10, False]]] * N), [[['raw', 'down', 'a', 'A', 10]]] * N)
check('repeat-coalescing scenario 2', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'A', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 12, 2]]] * N)
check('repeat-coalescing scenario 3', solve([[['down', 'a', 'A', 10, True], ['down', 'b', 'A', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] * N)
check('repeat-coalescing scenario 4', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'B', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] * N)
check('repeat-coalescing scenario 5', solve([[['down', 'a', 'A', 10, True], ['up', 'a', 'A', 12, False], ['down', 'a', 'A', 14, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] * N)
check('repeat-coalescing scenario 6', solve([[['up', 'a', 'A', 10, True]]] * N), [[['raw', 'up', 'a', 'A', 10]]] * N)
check('repeat-coalescing scenario 7', solve([[['down', 'a', 'A', 10, True], ['text', 'a', 'A', 12, False]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]] * N)
check('repeat-coalescing scenario 8', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'A', 12, False], ['down', 'a', 'A', 14, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| repeat-coalescing scenario 0 | [[]] | [[]] | Passed |
| repeat-coalescing scenario 1 | [[['raw', 'down', 'a', 'A', 10]]] | [[['raw', 'down', 'a', 'A', 10]]] | Passed |
| repeat-coalescing scenario 2 | [[['repeat', 'a', 'A', 10, 12, 2]]] | [[['repeat', 'a', 'A', 10, 12, 2]]] | Passed |
| repeat-coalescing scenario 3 | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] | Passed |
| repeat-coalescing scenario 4 | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] | Passed |
| repeat-coalescing scenario 5 | [[['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | Failed |
| repeat-coalescing scenario 6 | [[['raw', 'up', 'a', 'A', 10]]] | [[['raw', 'up', 'a', 'A', 10]]] | Passed |
| repeat-coalescing scenario 7 | [[['raw', 'text', 'a', 'A', 12]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]] | Failed |
| repeat-coalescing scenario 8 | [[['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | Failed |
SHA-256 / d72c5e261d0b8e7a5247027a494f6325a2300715009a1753e0f78c7413283a7e
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):
out=[]; batch=None
for kind,device,code,now,repeat in c:
eligible=kind=='down' and repeat
if eligible:
if batch is not None and batch[0]==device and batch[1]==code:
batch[3]=now
batch[4]+=1
else:
if batch is not None: out.append(['repeat']+batch)
batch=[device,code,now,now,1]
else:
if batch is not None:
out.append(['repeat']+batch)
batch=None
out.append(['raw',kind,device,code,now])
if batch is not None: out.append(['repeat']+batch)
return out
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeat-coalescing scenario 0', solve([[]] * N), [[]] * N)
check('repeat-coalescing scenario 1', solve([[['down', 'a', 'A', 10, False]]] * N), [[['raw', 'down', 'a', 'A', 10]]] * N)
check('repeat-coalescing scenario 2', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'A', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 12, 2]]] * N)
check('repeat-coalescing scenario 3', solve([[['down', 'a', 'A', 10, True], ['down', 'b', 'A', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] * N)
check('repeat-coalescing scenario 4', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'B', 12, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] * N)
check('repeat-coalescing scenario 5', solve([[['down', 'a', 'A', 10, True], ['up', 'a', 'A', 12, False], ['down', 'a', 'A', 14, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] * N)
check('repeat-coalescing scenario 6', solve([[['up', 'a', 'A', 10, True]]] * N), [[['raw', 'up', 'a', 'A', 10]]] * N)
check('repeat-coalescing scenario 7', solve([[['down', 'a', 'A', 10, True], ['text', 'a', 'A', 12, False]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]] * N)
check('repeat-coalescing scenario 8', solve([[['down', 'a', 'A', 10, True], ['down', 'a', 'A', 12, False], ['down', 'a', 'A', 14, True]]] * N), [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| repeat-coalescing scenario 0 | [[]] | [[]] | Passed |
| repeat-coalescing scenario 1 | [[['raw', 'down', 'a', 'A', 10]]] | [[['raw', 'down', 'a', 'A', 10]]] | Passed |
| repeat-coalescing scenario 2 | [[['repeat', 'a', 'A', 10, 12, 2]]] | [[['repeat', 'a', 'A', 10, 12, 2]]] | Passed |
| repeat-coalescing scenario 3 | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'b', 'A', 12, 12, 1]]] | Passed |
| repeat-coalescing scenario 4 | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['repeat', 'a', 'B', 12, 12, 1]]] | Passed |
| repeat-coalescing scenario 5 | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'up', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | Passed |
| repeat-coalescing scenario 6 | [[['raw', 'up', 'a', 'A', 10]]] | [[['raw', 'up', 'a', 'A', 10]]] | Passed |
| repeat-coalescing scenario 7 | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]] | Passed |
| repeat-coalescing scenario 8 | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | [[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 12], ['repeat', 'a', 'A', 14, 14, 1]]] | Passed |
SHA-256 / f87e5892d5f30c2cf4572ebc9d0b187087480175a0e6084fce3466c98404e4ca
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:04.964903+00:00.
Case digest / 664a70932edce2681ef98b49488aefe7d22620a452cf1b51d8bb62392fc2fb5b