FA-30841 / Keyboard interactions / Open access
Physical press ownership registry: Device identity is discarded while identifying a held physical key · case 01
The event trace violates the device token rule and produces incorrect keyboard state or command output.
ROOT CAUSE
Device identity is discarded while identifying a held physical key.
VERIFIED REPAIR
Use the contract transition `token=(device,code,location)` at the device token fault site; preserve the other state transitions.
Unsuccessful approach: The partial repair changes this transition to token=(code,code,location), which still violates the model contract on the explicit regression traces.
Case contract
Events are [kind,device,code,location]. Down inserts a unique physical token; up removes exactly that token; disconnect clears that device; blur clears all. Track maximum simultaneous held count, accepted presses, releases, orphan ups and sorted held tokens. 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):
held=set(); peak=0; presses=0; releases=0; orphan=0
for kind,device,code,location in c:
token=("all",code,location)
if kind=='down':
fresh=token not in held
if fresh: presses+=1
held.add(token)
peak=max(peak,len(held))
elif kind=='up':
if token in held:
held.remove(token)
releases+=1
else: orphan+=1
elif kind=='disconnect':
held={x for x in held if x[0]!=device}
elif kind=='blur':
held.clear()
return [sorted([list(x) for x in held]),peak,presses,releases,orphan]
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('physical-registry scenario 0', solve([[]] * N), [[[], 0, 0, 0, 0]] * N)
check('physical-registry scenario 1', solve([[['up', 'a', 'A', 0], ['up', 'a', 'B', 0]]] * N), [[[], 0, 0, 0, 2]] * N)
check('physical-registry scenario 2', solve([[['down', 'a', 'A', 0], ['down', 'a', 'A', 0], ['down', 'a', 'A', 0]]] * N), [[[['a', 'A', 0]], 1, 1, 0, 0]] * N)
check('physical-registry scenario 3', solve([[['down', 'a', 'A', 0], ['down', 'b', 'A', 0], ['up', 'a', 'A', 0]]] * N), [[[['b', 'A', 0]], 2, 2, 1, 0]] * N)
check('physical-registry scenario 4', solve([[['down', 'a', 'S', 1], ['down', 'a', 'S', 3], ['up', 'a', 'S', 1]]] * N), [[[['a', 'S', 3]], 2, 2, 1, 0]] * N)
check('physical-registry scenario 5', solve([[['down', 'a', 'A', 0], ['down', 'a', 'B', 0], ['up', 'a', 'A', 0], ['down', 'a', 'C', 0], ['up', 'a', 'B', 0], ['up', 'a', 'C', 0], ['down', 'a', 'D', 0]]] * N), [[[['a', 'D', 0]], 2, 4, 3, 0]] * N)
check('physical-registry scenario 6', solve([[['down', 'a', 'A', 0], ['down', 'b', 'B', 0], ['disconnect', 'a', '', 0]]] * N), [[[['b', 'B', 0]], 2, 2, 0, 0]] * N)
check('physical-registry scenario 7', solve([[['down', 'a', 'A', 0], ['down', 'a', 'B', 1], ['blur', '', '', 0]]] * N), [[[], 2, 2, 0, 0]] * 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 |
|---|---|---|---|
| physical-registry scenario 0 | [[[], 0, 0, 0, 0]] | [[[], 0, 0, 0, 0]] | Passed |
| physical-registry scenario 1 | [[[], 0, 0, 0, 2]] | [[[], 0, 0, 0, 2]] | Passed |
| physical-registry scenario 2 | [[[['all', 'A', 0]], 1, 1, 0, 0]] | [[[['a', 'A', 0]], 1, 1, 0, 0]] | Failed |
| physical-registry scenario 3 | [[[], 1, 1, 1, 0]] | [[[['b', 'A', 0]], 2, 2, 1, 0]] | Failed |
| physical-registry scenario 4 | [[[['all', 'S', 3]], 2, 2, 1, 0]] | [[[['a', 'S', 3]], 2, 2, 1, 0]] | Failed |
| physical-registry scenario 5 | [[[['all', 'D', 0]], 2, 4, 3, 0]] | [[[['a', 'D', 0]], 2, 4, 3, 0]] | Failed |
| physical-registry scenario 6 | [[[['all', 'A', 0], ['all', 'B', 0]], 2, 2, 0, 0]] | [[[['b', 'B', 0]], 2, 2, 0, 0]] | Failed |
| physical-registry scenario 7 | [[[], 2, 2, 0, 0]] | [[[], 2, 2, 0, 0]] | Passed |
SHA-256 / e90e2b269a5c979ae64f60f83e96628ae20c2385225552b03732bdaf0ac0d1fd
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):
held=set(); peak=0; presses=0; releases=0; orphan=0
for kind,device,code,location in c:
token=(code,code,location)
if kind=='down':
fresh=token not in held
if fresh: presses+=1
held.add(token)
peak=max(peak,len(held))
elif kind=='up':
if token in held:
held.remove(token)
releases+=1
else: orphan+=1
elif kind=='disconnect':
held={x for x in held if x[0]!=device}
elif kind=='blur':
held.clear()
return [sorted([list(x) for x in held]),peak,presses,releases,orphan]
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('physical-registry scenario 0', solve([[]] * N), [[[], 0, 0, 0, 0]] * N)
check('physical-registry scenario 1', solve([[['up', 'a', 'A', 0], ['up', 'a', 'B', 0]]] * N), [[[], 0, 0, 0, 2]] * N)
check('physical-registry scenario 2', solve([[['down', 'a', 'A', 0], ['down', 'a', 'A', 0], ['down', 'a', 'A', 0]]] * N), [[[['a', 'A', 0]], 1, 1, 0, 0]] * N)
check('physical-registry scenario 3', solve([[['down', 'a', 'A', 0], ['down', 'b', 'A', 0], ['up', 'a', 'A', 0]]] * N), [[[['b', 'A', 0]], 2, 2, 1, 0]] * N)
check('physical-registry scenario 4', solve([[['down', 'a', 'S', 1], ['down', 'a', 'S', 3], ['up', 'a', 'S', 1]]] * N), [[[['a', 'S', 3]], 2, 2, 1, 0]] * N)
check('physical-registry scenario 5', solve([[['down', 'a', 'A', 0], ['down', 'a', 'B', 0], ['up', 'a', 'A', 0], ['down', 'a', 'C', 0], ['up', 'a', 'B', 0], ['up', 'a', 'C', 0], ['down', 'a', 'D', 0]]] * N), [[[['a', 'D', 0]], 2, 4, 3, 0]] * N)
check('physical-registry scenario 6', solve([[['down', 'a', 'A', 0], ['down', 'b', 'B', 0], ['disconnect', 'a', '', 0]]] * N), [[[['b', 'B', 0]], 2, 2, 0, 0]] * N)
check('physical-registry scenario 7', solve([[['down', 'a', 'A', 0], ['down', 'a', 'B', 1], ['blur', '', '', 0]]] * N), [[[], 2, 2, 0, 0]] * 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 |
|---|---|---|---|
| physical-registry scenario 0 | [[[], 0, 0, 0, 0]] | [[[], 0, 0, 0, 0]] | Passed |
| physical-registry scenario 1 | [[[], 0, 0, 0, 2]] | [[[], 0, 0, 0, 2]] | Passed |
| physical-registry scenario 2 | [[[['A', 'A', 0]], 1, 1, 0, 0]] | [[[['a', 'A', 0]], 1, 1, 0, 0]] | Failed |
| physical-registry scenario 3 | [[[], 1, 1, 1, 0]] | [[[['b', 'A', 0]], 2, 2, 1, 0]] | Failed |
| physical-registry scenario 4 | [[[['S', 'S', 3]], 2, 2, 1, 0]] | [[[['a', 'S', 3]], 2, 2, 1, 0]] | Failed |
| physical-registry scenario 5 | [[[['D', 'D', 0]], 2, 4, 3, 0]] | [[[['a', 'D', 0]], 2, 4, 3, 0]] | Failed |
| physical-registry scenario 6 | [[[['A', 'A', 0], ['B', 'B', 0]], 2, 2, 0, 0]] | [[[['b', 'B', 0]], 2, 2, 0, 0]] | Failed |
| physical-registry scenario 7 | [[[], 2, 2, 0, 0]] | [[[], 2, 2, 0, 0]] | Passed |
SHA-256 / 7cdd706ec7d0c7799be19a95fa3b7c0ef840a9b7393f2adc8fb10264697b438f
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):
held=set(); peak=0; presses=0; releases=0; orphan=0
for kind,device,code,location in c:
token=(device,code,location)
if kind=='down':
fresh=token not in held
if fresh: presses+=1
held.add(token)
peak=max(peak,len(held))
elif kind=='up':
if token in held:
held.remove(token)
releases+=1
else: orphan+=1
elif kind=='disconnect':
held={x for x in held if x[0]!=device}
elif kind=='blur':
held.clear()
return [sorted([list(x) for x in held]),peak,presses,releases,orphan]
return [run(c) for c in cases]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('physical-registry scenario 0', solve([[]] * N), [[[], 0, 0, 0, 0]] * N)
check('physical-registry scenario 1', solve([[['up', 'a', 'A', 0], ['up', 'a', 'B', 0]]] * N), [[[], 0, 0, 0, 2]] * N)
check('physical-registry scenario 2', solve([[['down', 'a', 'A', 0], ['down', 'a', 'A', 0], ['down', 'a', 'A', 0]]] * N), [[[['a', 'A', 0]], 1, 1, 0, 0]] * N)
check('physical-registry scenario 3', solve([[['down', 'a', 'A', 0], ['down', 'b', 'A', 0], ['up', 'a', 'A', 0]]] * N), [[[['b', 'A', 0]], 2, 2, 1, 0]] * N)
check('physical-registry scenario 4', solve([[['down', 'a', 'S', 1], ['down', 'a', 'S', 3], ['up', 'a', 'S', 1]]] * N), [[[['a', 'S', 3]], 2, 2, 1, 0]] * N)
check('physical-registry scenario 5', solve([[['down', 'a', 'A', 0], ['down', 'a', 'B', 0], ['up', 'a', 'A', 0], ['down', 'a', 'C', 0], ['up', 'a', 'B', 0], ['up', 'a', 'C', 0], ['down', 'a', 'D', 0]]] * N), [[[['a', 'D', 0]], 2, 4, 3, 0]] * N)
check('physical-registry scenario 6', solve([[['down', 'a', 'A', 0], ['down', 'b', 'B', 0], ['disconnect', 'a', '', 0]]] * N), [[[['b', 'B', 0]], 2, 2, 0, 0]] * N)
check('physical-registry scenario 7', solve([[['down', 'a', 'A', 0], ['down', 'a', 'B', 1], ['blur', '', '', 0]]] * N), [[[], 2, 2, 0, 0]] * 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 |
|---|---|---|---|
| physical-registry scenario 0 | [[[], 0, 0, 0, 0]] | [[[], 0, 0, 0, 0]] | Passed |
| physical-registry scenario 1 | [[[], 0, 0, 0, 2]] | [[[], 0, 0, 0, 2]] | Passed |
| physical-registry scenario 2 | [[[['a', 'A', 0]], 1, 1, 0, 0]] | [[[['a', 'A', 0]], 1, 1, 0, 0]] | Passed |
| physical-registry scenario 3 | [[[['b', 'A', 0]], 2, 2, 1, 0]] | [[[['b', 'A', 0]], 2, 2, 1, 0]] | Passed |
| physical-registry scenario 4 | [[[['a', 'S', 3]], 2, 2, 1, 0]] | [[[['a', 'S', 3]], 2, 2, 1, 0]] | Passed |
| physical-registry scenario 5 | [[[['a', 'D', 0]], 2, 4, 3, 0]] | [[[['a', 'D', 0]], 2, 4, 3, 0]] | Passed |
| physical-registry scenario 6 | [[[['b', 'B', 0]], 2, 2, 0, 0]] | [[[['b', 'B', 0]], 2, 2, 0, 0]] | Passed |
| physical-registry scenario 7 | [[[], 2, 2, 0, 0]] | [[[], 2, 2, 0, 0]] | Passed |
SHA-256 / 592cef79bd0ae8b0ac9411ebd78f708c26e1f71da8d8cc5fcd554bea01d1b1cd
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:56.558818+00:00.
Case digest / 6357b5e0407bb009827f38dc64e35264bb6b962bccda8a9a1296720e17f724fd