FAILURE MAP
← Case archive

FA-31066 / Keyboard interactions / Open access

Owned repeat deadline scheduler: Initial timer drain omits exact-boundary or overdue deadlines · case 01

The event trace violates the first inclusive rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Initial timer drain omits exact-boundary or overdue deadlines.

VERIFIED REPAIR

Use the contract transition `ready=sorted((t,k) for k,t in next_due.items() if t<=now) while` at the first inclusive fault site; preserve the other state transitions.

Unsuccessful approach: The partial repair changes this transition to ready=sorted((t,k) for k,t in next_due.items() if t==now) while, which still violates the model contract on the explicit regression traces.

Case contract

Case [delay,period,events], events [kind,key,time]. First down per key emits immediately and schedules first repeat at time+delay. Tick drains every deadline at or before time, ordered by deadline then key. Up removes only that key, blur clears all. Return emissions [key,time] and sorted pending deadlines. Positive delay and period; times nondecreasing. 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):
        delay,period,events=c
        next_due={}; output=[]
        for kind,key,now in events:
            if kind=='down' and key not in next_due:
                output.append([key,now])
                next_due[key]=now+delay
            elif kind=='up':
                next_due.pop(key,None)
            elif kind=='blur':
                next_due.clear()
            elif kind=='tick':
                ready=sorted((t,k) for k,t in next_due.items() if t<now)
                while ready:
                    due,k=ready[0]
                    output.append([k,due])
                    next_due[k]=due+period
                    ready=sorted((t,k) for k,t in next_due.items() if t<=now)
        return [output,sorted([[k,v] for k,v in next_due.items()])]
    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-clock scenario 0', solve([[5, 2, []]] * N), [[[], []]] * N)
check('repeat-clock scenario 1', solve([[5, 2, [['down', 'A', 10], ['tick', '', 15]]]] * N), [[[['A', 10], ['A', 15]], [['A', 17]]]] * N)
check('repeat-clock scenario 2', solve([[5, 2, [['down', 'A', 10], ['down', 'A', 12], ['tick', '', 17]]]] * N), [[[['A', 10], ['A', 15], ['A', 17]], [['A', 19]]]] * N)
check('repeat-clock scenario 3', solve([[5, 2, [['down', 'Z', 0], ['down', 'A', 1], ['tick', '', 10]]]] * N), [[[['Z', 0], ['A', 1], ['Z', 5], ['A', 6], ['Z', 7], ['A', 8], ['Z', 9], ['A', 10]], [['A', 12], ['Z', 11]]]] * N)
check('repeat-clock scenario 4', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2], ['tick', '', 9]]]] * N), [[[['A', 0], ['B', 1], ['B', 6], ['B', 8]], [['B', 10]]]] * N)
check('repeat-clock scenario 5', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 1], ['blur', '', 3], ['tick', '', 10]]]] * N), [[[['A', 0], ['B', 1]], []]] * N)
check('repeat-clock scenario 6', solve([[5, 2, [['down', 'A', 0], ['tick', '', 12]]]] * N), [[[['A', 0], ['A', 5], ['A', 7], ['A', 9], ['A', 11]], [['A', 13]]]] * N)
check('repeat-clock scenario 7', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 0], ['tick', '', 5]]]] * N), [[[['A', 0], ['B', 0], ['A', 5], ['B', 5]], [['A', 7], ['B', 7]]]] * 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-clock scenario 0[[[], []]][[[], []]]Passed
repeat-clock scenario 1[[[['A', 10]], [['A', 15]]]][[[['A', 10], ['A', 15]], [['A', 17]]]]Failed
repeat-clock scenario 2[[[['A', 10], ['A', 15], ['A', 17]], [['A', 19]]]][[[['A', 10], ['A', 15], ['A', 17]], [['A', 19]]]]Passed
repeat-clock scenario 3[[[['Z', 0], ['A', 1], ['Z', 5], ['A', 6], ['Z', 7], ['A', 8], ['Z', 9], ['A', 10]], [['A', 12], ['Z', 11]]]][[[['Z', 0], ['A', 1], ['Z', 5], ['A', 6], ['Z', 7], ['A', 8], ['Z', 9], ['A', 10]], [['A', 12], ['Z', 11]]]]Passed
repeat-clock scenario 4[[[['A', 0], ['B', 1], ['B', 6], ['B', 8]], [['B', 10]]]][[[['A', 0], ['B', 1], ['B', 6], ['B', 8]], [['B', 10]]]]Passed
repeat-clock scenario 5[[[['A', 0], ['B', 1]], []]][[[['A', 0], ['B', 1]], []]]Passed
repeat-clock scenario 6[[[['A', 0], ['A', 5], ['A', 7], ['A', 9], ['A', 11]], [['A', 13]]]][[[['A', 0], ['A', 5], ['A', 7], ['A', 9], ['A', 11]], [['A', 13]]]]Passed
repeat-clock scenario 7[[[['A', 0], ['B', 0]], [['A', 5], ['B', 5]]]][[[['A', 0], ['B', 0], ['A', 5], ['B', 5]], [['A', 7], ['B', 7]]]]Failed

SHA-256 / 255dcdb0f6737559c032c0698e0b5256691c647d142eb39c75199e7738c69a04

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):
        delay,period,events=c
        next_due={}; output=[]
        for kind,key,now in events:
            if kind=='down' and key not in next_due:
                output.append([key,now])
                next_due[key]=now+delay
            elif kind=='up':
                next_due.pop(key,None)
            elif kind=='blur':
                next_due.clear()
            elif kind=='tick':
                ready=sorted((t,k) for k,t in next_due.items() if t==now)
                while ready:
                    due,k=ready[0]
                    output.append([k,due])
                    next_due[k]=due+period
                    ready=sorted((t,k) for k,t in next_due.items() if t<=now)
        return [output,sorted([[k,v] for k,v in next_due.items()])]
    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-clock scenario 0', solve([[5, 2, []]] * N), [[[], []]] * N)
check('repeat-clock scenario 1', solve([[5, 2, [['down', 'A', 10], ['tick', '', 15]]]] * N), [[[['A', 10], ['A', 15]], [['A', 17]]]] * N)
check('repeat-clock scenario 2', solve([[5, 2, [['down', 'A', 10], ['down', 'A', 12], ['tick', '', 17]]]] * N), [[[['A', 10], ['A', 15], ['A', 17]], [['A', 19]]]] * N)
check('repeat-clock scenario 3', solve([[5, 2, [['down', 'Z', 0], ['down', 'A', 1], ['tick', '', 10]]]] * N), [[[['Z', 0], ['A', 1], ['Z', 5], ['A', 6], ['Z', 7], ['A', 8], ['Z', 9], ['A', 10]], [['A', 12], ['Z', 11]]]] * N)
check('repeat-clock scenario 4', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2], ['tick', '', 9]]]] * N), [[[['A', 0], ['B', 1], ['B', 6], ['B', 8]], [['B', 10]]]] * N)
check('repeat-clock scenario 5', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 1], ['blur', '', 3], ['tick', '', 10]]]] * N), [[[['A', 0], ['B', 1]], []]] * N)
check('repeat-clock scenario 6', solve([[5, 2, [['down', 'A', 0], ['tick', '', 12]]]] * N), [[[['A', 0], ['A', 5], ['A', 7], ['A', 9], ['A', 11]], [['A', 13]]]] * N)
check('repeat-clock scenario 7', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 0], ['tick', '', 5]]]] * N), [[[['A', 0], ['B', 0], ['A', 5], ['B', 5]], [['A', 7], ['B', 7]]]] * 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-clock scenario 0[[[], []]][[[], []]]Passed
repeat-clock scenario 1[[[['A', 10], ['A', 15]], [['A', 17]]]][[[['A', 10], ['A', 15]], [['A', 17]]]]Passed
repeat-clock scenario 2[[[['A', 10]], [['A', 15]]]][[[['A', 10], ['A', 15], ['A', 17]], [['A', 19]]]]Failed
repeat-clock scenario 3[[[['Z', 0], ['A', 1]], [['A', 6], ['Z', 5]]]][[[['Z', 0], ['A', 1], ['Z', 5], ['A', 6], ['Z', 7], ['A', 8], ['Z', 9], ['A', 10]], [['A', 12], ['Z', 11]]]]Failed
repeat-clock scenario 4[[[['A', 0], ['B', 1]], [['B', 6]]]][[[['A', 0], ['B', 1], ['B', 6], ['B', 8]], [['B', 10]]]]Failed
repeat-clock scenario 5[[[['A', 0], ['B', 1]], []]][[[['A', 0], ['B', 1]], []]]Passed
repeat-clock scenario 6[[[['A', 0]], [['A', 5]]]][[[['A', 0], ['A', 5], ['A', 7], ['A', 9], ['A', 11]], [['A', 13]]]]Failed
repeat-clock scenario 7[[[['A', 0], ['B', 0], ['A', 5], ['B', 5]], [['A', 7], ['B', 7]]]][[[['A', 0], ['B', 0], ['A', 5], ['B', 5]], [['A', 7], ['B', 7]]]]Passed

SHA-256 / 0f20e81a3a4ec2fee35dd82e0d02e99fe3c09a0a68ec9cc9c8f0175dfca8c55a

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):
        delay,period,events=c
        next_due={}; output=[]
        for kind,key,now in events:
            if kind=='down' and key not in next_due:
                output.append([key,now])
                next_due[key]=now+delay
            elif kind=='up':
                next_due.pop(key,None)
            elif kind=='blur':
                next_due.clear()
            elif kind=='tick':
                ready=sorted((t,k) for k,t in next_due.items() if t<=now)
                while ready:
                    due,k=ready[0]
                    output.append([k,due])
                    next_due[k]=due+period
                    ready=sorted((t,k) for k,t in next_due.items() if t<=now)
        return [output,sorted([[k,v] for k,v in next_due.items()])]
    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-clock scenario 0', solve([[5, 2, []]] * N), [[[], []]] * N)
check('repeat-clock scenario 1', solve([[5, 2, [['down', 'A', 10], ['tick', '', 15]]]] * N), [[[['A', 10], ['A', 15]], [['A', 17]]]] * N)
check('repeat-clock scenario 2', solve([[5, 2, [['down', 'A', 10], ['down', 'A', 12], ['tick', '', 17]]]] * N), [[[['A', 10], ['A', 15], ['A', 17]], [['A', 19]]]] * N)
check('repeat-clock scenario 3', solve([[5, 2, [['down', 'Z', 0], ['down', 'A', 1], ['tick', '', 10]]]] * N), [[[['Z', 0], ['A', 1], ['Z', 5], ['A', 6], ['Z', 7], ['A', 8], ['Z', 9], ['A', 10]], [['A', 12], ['Z', 11]]]] * N)
check('repeat-clock scenario 4', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 1], ['up', 'A', 2], ['tick', '', 9]]]] * N), [[[['A', 0], ['B', 1], ['B', 6], ['B', 8]], [['B', 10]]]] * N)
check('repeat-clock scenario 5', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 1], ['blur', '', 3], ['tick', '', 10]]]] * N), [[[['A', 0], ['B', 1]], []]] * N)
check('repeat-clock scenario 6', solve([[5, 2, [['down', 'A', 0], ['tick', '', 12]]]] * N), [[[['A', 0], ['A', 5], ['A', 7], ['A', 9], ['A', 11]], [['A', 13]]]] * N)
check('repeat-clock scenario 7', solve([[5, 2, [['down', 'A', 0], ['down', 'B', 0], ['tick', '', 5]]]] * N), [[[['A', 0], ['B', 0], ['A', 5], ['B', 5]], [['A', 7], ['B', 7]]]] * 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-clock scenario 0[[[], []]][[[], []]]Passed
repeat-clock scenario 1[[[['A', 10], ['A', 15]], [['A', 17]]]][[[['A', 10], ['A', 15]], [['A', 17]]]]Passed
repeat-clock scenario 2[[[['A', 10], ['A', 15], ['A', 17]], [['A', 19]]]][[[['A', 10], ['A', 15], ['A', 17]], [['A', 19]]]]Passed
repeat-clock scenario 3[[[['Z', 0], ['A', 1], ['Z', 5], ['A', 6], ['Z', 7], ['A', 8], ['Z', 9], ['A', 10]], [['A', 12], ['Z', 11]]]][[[['Z', 0], ['A', 1], ['Z', 5], ['A', 6], ['Z', 7], ['A', 8], ['Z', 9], ['A', 10]], [['A', 12], ['Z', 11]]]]Passed
repeat-clock scenario 4[[[['A', 0], ['B', 1], ['B', 6], ['B', 8]], [['B', 10]]]][[[['A', 0], ['B', 1], ['B', 6], ['B', 8]], [['B', 10]]]]Passed
repeat-clock scenario 5[[[['A', 0], ['B', 1]], []]][[[['A', 0], ['B', 1]], []]]Passed
repeat-clock scenario 6[[[['A', 0], ['A', 5], ['A', 7], ['A', 9], ['A', 11]], [['A', 13]]]][[[['A', 0], ['A', 5], ['A', 7], ['A', 9], ['A', 11]], [['A', 13]]]]Passed
repeat-clock scenario 7[[[['A', 0], ['B', 0], ['A', 5], ['B', 5]], [['A', 7], ['B', 7]]]][[[['A', 0], ['B', 0], ['A', 5], ['B', 5]], [['A', 7], ['B', 7]]]]Passed

SHA-256 / 918e78dde2188835289176e5100f5ef0368da2c6990bf43874e92fc713ff776c

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

Case digest / ec4ce069f32de1826133452d5cd03d97c39c55a877ab6e781f821d16c0427ff1