FAILURE MAP
← Case archive

FA-31731 / Keyboard interactions / Open access

Adjacent keyboard repeat batch coalescing: Raw barrier event identity or timestamp is corrupted during repeat coalescing · case 01

The event trace violates the raw payload rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Raw barrier event identity or timestamp is corrupted during repeat coalescing.

THE FAILURE

Raw barrier event identity or timestamp is corrupted during repeat coalescing.

Unsuccessful approach: The partial repair changes this transition to out.append(['raw',kind,device,code,0]), 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(['repeat']+batch)
                    batch=None
                out.append(['raw',kind,code,device,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 fixtureActualExpectedOutcome
repeat-coalescing scenario 0[[]][[]]Passed
repeat-coalescing scenario 1[[['raw', 'down', 'A', 'a', 10]]][[['raw', 'down', 'a', 'A', 10]]]Failed
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]]]Failed
repeat-coalescing scenario 6[[['raw', 'up', 'A', 'a', 10]]][[['raw', 'up', 'a', 'A', 10]]]Failed
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]]]Failed
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]]]Failed

SHA-256 / ad8e79495a9dd07c5b6c5d5830adef54cba1e5d2668362d57746646861758a3e

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:
                    out.append(['repeat']+batch)
                    batch=None
                out.append(['raw',kind,device,code,0])
        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 fixtureActualExpectedOutcome
repeat-coalescing scenario 0[[]][[]]Passed
repeat-coalescing scenario 1[[['raw', 'down', 'a', 'A', 0]]][[['raw', 'down', 'a', 'A', 10]]]Failed
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', 0], ['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', 0]]][[['raw', 'up', 'a', 'A', 10]]]Failed
repeat-coalescing scenario 7[[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 0]]][[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'text', 'a', 'A', 12]]]Failed
repeat-coalescing scenario 8[[['repeat', 'a', 'A', 10, 10, 1], ['raw', 'down', 'a', 'A', 0], ['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 / 564649137033b3f8df03f15790296bb969d273387630891338cdf6c363cd5af8

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 9 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:42:05.057461+00:00.

Case digest / f17119db4dd3533aa429b5ecd165024113bfb12b9065834c88e0db0d94205868