FA-31196 / Keyboard interactions / Open access
Keyboard binding registration lifecycle: Re-registering an ID keeps stale binding data or keys storage by chord · case 01
The event trace violates the replace id rule and produces incorrect keyboard state or command output.
ROOT CAUSE
Re-registering an ID keeps stale binding data or keys storage by chord.
VERIFIED REPAIR
Use the contract transition `registry[ident]=[scope,chord,priority,serial]` at the replace id fault site; preserve the other state transitions.
Unsuccessful approach: The partial repair changes this transition to registry[chord]=[scope,chord,priority,serial], which still violates the model contract on the explicit regression traces.
Case contract
Events [kind,id,scope,chord,priority]. Register replaces the same id with a fresh serial. Remove deletes id; clear deletes a scope. Resolve returns highest priority matching scope/chord, breaking ties by newest registration. Empty chord never resolves. Return resolution IDs and live registrations [id,scope,chord,priority,serial]. 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):
registry={}; serial=0; resolved=[]
for kind,ident,scope,chord,priority in c:
if kind=='register':
serial+=1
registry.setdefault(ident,[scope,chord,priority,serial])
elif kind=='remove':
registry.pop(ident,None)
elif kind=='clear':
registry={k:v for k,v in registry.items() if v[0]!=scope}
elif kind=='resolve':
eligible=[(k,v) for k,v in registry.items() if v[0]==scope and v[1]==chord and chord!='']
eligible.sort(key=lambda pair:(pair[1][2],pair[1][3]),reverse=True)
resolved.append(eligible[0][0] if eligible else None)
return [resolved,sorted([[k]+v for k,v in registry.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('binding-registry scenario 0', solve([[]] * N), [[[], []]] * N)
check('binding-registry scenario 1', solve([[['resolve', '', 'x', 'A', 0]]] * N), [[[None], []]] * N)
check('binding-registry scenario 2', solve([[['register', 'a', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['a'], [['a', 'x', 'A', 1, 1]]]] * N)
check('binding-registry scenario 3', solve([[['register', 'a', 'x', 'A', 2], ['register', 'b', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] * N)
check('binding-registry scenario 4', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] * N)
check('binding-registry scenario 5', solve([[['register', 'a', 'x', 'A', 1], ['register', 'a', 'y', 'B', 3], ['resolve', '', 'y', 'B', 0]]] * N), [[['a'], [['a', 'y', 'B', 3, 2]]]] * N)
check('binding-registry scenario 6', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'y', 'B', 1], ['clear', '', 'x', '', 0]]] * N), [[[], [['b', 'y', 'B', 1, 2]]]] * N)
check('binding-registry scenario 7', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'x', 'B', 1], ['remove', 'a', '', '', 0]]] * N), [[[], [['b', 'x', 'B', 1, 2]]]] * N)
check('binding-registry scenario 8', solve([[['register', 'a', 'x', 'AB', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[[None], [['a', 'x', 'AB', 1, 1]]]] * N)
check('binding-registry scenario 9', solve([[['register', 'a', 'y', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[[None], [['a', 'y', 'A', 1, 1]]]] * N)
check('binding-registry scenario 10', solve([[['register', 'a', 'x', '', 1], ['resolve', '', 'x', '', 0]]] * N), [[[None], [['a', 'x', '', 1, 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 |
|---|---|---|---|
| binding-registry scenario 0 | [[[], []]] | [[[], []]] | Passed |
| binding-registry scenario 1 | [[[None], []]] | [[[None], []]] | Passed |
| binding-registry scenario 2 | [[['a'], [['a', 'x', 'A', 1, 1]]]] | [[['a'], [['a', 'x', 'A', 1, 1]]]] | Passed |
| binding-registry scenario 3 | [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] | [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] | Passed |
| binding-registry scenario 4 | [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] | [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] | Passed |
| binding-registry scenario 5 | [[[None], [['a', 'x', 'A', 1, 1]]]] | [[['a'], [['a', 'y', 'B', 3, 2]]]] | Failed |
| binding-registry scenario 6 | [[[], [['b', 'y', 'B', 1, 2]]]] | [[[], [['b', 'y', 'B', 1, 2]]]] | Passed |
| binding-registry scenario 7 | [[[], [['b', 'x', 'B', 1, 2]]]] | [[[], [['b', 'x', 'B', 1, 2]]]] | Passed |
| binding-registry scenario 8 | [[[None], [['a', 'x', 'AB', 1, 1]]]] | [[[None], [['a', 'x', 'AB', 1, 1]]]] | Passed |
| binding-registry scenario 9 | [[[None], [['a', 'y', 'A', 1, 1]]]] | [[[None], [['a', 'y', 'A', 1, 1]]]] | Passed |
| binding-registry scenario 10 | [[[None], [['a', 'x', '', 1, 1]]]] | [[[None], [['a', 'x', '', 1, 1]]]] | Passed |
SHA-256 / 76e40e8abb5286ad3747aedbfe3d4ba57c8f1f4af45ecc4101bd09bbfb7a55b8
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):
registry={}; serial=0; resolved=[]
for kind,ident,scope,chord,priority in c:
if kind=='register':
serial+=1
registry[chord]=[scope,chord,priority,serial]
elif kind=='remove':
registry.pop(ident,None)
elif kind=='clear':
registry={k:v for k,v in registry.items() if v[0]!=scope}
elif kind=='resolve':
eligible=[(k,v) for k,v in registry.items() if v[0]==scope and v[1]==chord and chord!='']
eligible.sort(key=lambda pair:(pair[1][2],pair[1][3]),reverse=True)
resolved.append(eligible[0][0] if eligible else None)
return [resolved,sorted([[k]+v for k,v in registry.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('binding-registry scenario 0', solve([[]] * N), [[[], []]] * N)
check('binding-registry scenario 1', solve([[['resolve', '', 'x', 'A', 0]]] * N), [[[None], []]] * N)
check('binding-registry scenario 2', solve([[['register', 'a', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['a'], [['a', 'x', 'A', 1, 1]]]] * N)
check('binding-registry scenario 3', solve([[['register', 'a', 'x', 'A', 2], ['register', 'b', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] * N)
check('binding-registry scenario 4', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] * N)
check('binding-registry scenario 5', solve([[['register', 'a', 'x', 'A', 1], ['register', 'a', 'y', 'B', 3], ['resolve', '', 'y', 'B', 0]]] * N), [[['a'], [['a', 'y', 'B', 3, 2]]]] * N)
check('binding-registry scenario 6', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'y', 'B', 1], ['clear', '', 'x', '', 0]]] * N), [[[], [['b', 'y', 'B', 1, 2]]]] * N)
check('binding-registry scenario 7', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'x', 'B', 1], ['remove', 'a', '', '', 0]]] * N), [[[], [['b', 'x', 'B', 1, 2]]]] * N)
check('binding-registry scenario 8', solve([[['register', 'a', 'x', 'AB', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[[None], [['a', 'x', 'AB', 1, 1]]]] * N)
check('binding-registry scenario 9', solve([[['register', 'a', 'y', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[[None], [['a', 'y', 'A', 1, 1]]]] * N)
check('binding-registry scenario 10', solve([[['register', 'a', 'x', '', 1], ['resolve', '', 'x', '', 0]]] * N), [[[None], [['a', 'x', '', 1, 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 |
|---|---|---|---|
| binding-registry scenario 0 | [[[], []]] | [[[], []]] | Passed |
| binding-registry scenario 1 | [[[None], []]] | [[[None], []]] | Passed |
| binding-registry scenario 2 | [[['A'], [['A', 'x', 'A', 1, 1]]]] | [[['a'], [['a', 'x', 'A', 1, 1]]]] | Failed |
| binding-registry scenario 3 | [[['A'], [['A', 'x', 'A', 1, 2]]]] | [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] | Failed |
| binding-registry scenario 4 | [[['A'], [['A', 'x', 'A', 1, 2]]]] | [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] | Failed |
| binding-registry scenario 5 | [[['B'], [['A', 'x', 'A', 1, 1], ['B', 'y', 'B', 3, 2]]]] | [[['a'], [['a', 'y', 'B', 3, 2]]]] | Failed |
| binding-registry scenario 6 | [[[], [['B', 'y', 'B', 1, 2]]]] | [[[], [['b', 'y', 'B', 1, 2]]]] | Failed |
| binding-registry scenario 7 | [[[], [['A', 'x', 'A', 1, 1], ['B', 'x', 'B', 1, 2]]]] | [[[], [['b', 'x', 'B', 1, 2]]]] | Failed |
| binding-registry scenario 8 | [[[None], [['AB', 'x', 'AB', 1, 1]]]] | [[[None], [['a', 'x', 'AB', 1, 1]]]] | Failed |
| binding-registry scenario 9 | [[[None], [['A', 'y', 'A', 1, 1]]]] | [[[None], [['a', 'y', 'A', 1, 1]]]] | Failed |
| binding-registry scenario 10 | [[[None], [['', 'x', '', 1, 1]]]] | [[[None], [['a', 'x', '', 1, 1]]]] | Failed |
SHA-256 / dd8a5dbcc4f51ba14e5fc59f1fa1d74529c65c5a104832137d5c918e522ccdb5
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):
registry={}; serial=0; resolved=[]
for kind,ident,scope,chord,priority in c:
if kind=='register':
serial+=1
registry[ident]=[scope,chord,priority,serial]
elif kind=='remove':
registry.pop(ident,None)
elif kind=='clear':
registry={k:v for k,v in registry.items() if v[0]!=scope}
elif kind=='resolve':
eligible=[(k,v) for k,v in registry.items() if v[0]==scope and v[1]==chord and chord!='']
eligible.sort(key=lambda pair:(pair[1][2],pair[1][3]),reverse=True)
resolved.append(eligible[0][0] if eligible else None)
return [resolved,sorted([[k]+v for k,v in registry.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('binding-registry scenario 0', solve([[]] * N), [[[], []]] * N)
check('binding-registry scenario 1', solve([[['resolve', '', 'x', 'A', 0]]] * N), [[[None], []]] * N)
check('binding-registry scenario 2', solve([[['register', 'a', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['a'], [['a', 'x', 'A', 1, 1]]]] * N)
check('binding-registry scenario 3', solve([[['register', 'a', 'x', 'A', 2], ['register', 'b', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] * N)
check('binding-registry scenario 4', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'x', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] * N)
check('binding-registry scenario 5', solve([[['register', 'a', 'x', 'A', 1], ['register', 'a', 'y', 'B', 3], ['resolve', '', 'y', 'B', 0]]] * N), [[['a'], [['a', 'y', 'B', 3, 2]]]] * N)
check('binding-registry scenario 6', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'y', 'B', 1], ['clear', '', 'x', '', 0]]] * N), [[[], [['b', 'y', 'B', 1, 2]]]] * N)
check('binding-registry scenario 7', solve([[['register', 'a', 'x', 'A', 1], ['register', 'b', 'x', 'B', 1], ['remove', 'a', '', '', 0]]] * N), [[[], [['b', 'x', 'B', 1, 2]]]] * N)
check('binding-registry scenario 8', solve([[['register', 'a', 'x', 'AB', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[[None], [['a', 'x', 'AB', 1, 1]]]] * N)
check('binding-registry scenario 9', solve([[['register', 'a', 'y', 'A', 1], ['resolve', '', 'x', 'A', 0]]] * N), [[[None], [['a', 'y', 'A', 1, 1]]]] * N)
check('binding-registry scenario 10', solve([[['register', 'a', 'x', '', 1], ['resolve', '', 'x', '', 0]]] * N), [[[None], [['a', 'x', '', 1, 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 |
|---|---|---|---|
| binding-registry scenario 0 | [[[], []]] | [[[], []]] | Passed |
| binding-registry scenario 1 | [[[None], []]] | [[[None], []]] | Passed |
| binding-registry scenario 2 | [[['a'], [['a', 'x', 'A', 1, 1]]]] | [[['a'], [['a', 'x', 'A', 1, 1]]]] | Passed |
| binding-registry scenario 3 | [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] | [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] | Passed |
| binding-registry scenario 4 | [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] | [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] | Passed |
| binding-registry scenario 5 | [[['a'], [['a', 'y', 'B', 3, 2]]]] | [[['a'], [['a', 'y', 'B', 3, 2]]]] | Passed |
| binding-registry scenario 6 | [[[], [['b', 'y', 'B', 1, 2]]]] | [[[], [['b', 'y', 'B', 1, 2]]]] | Passed |
| binding-registry scenario 7 | [[[], [['b', 'x', 'B', 1, 2]]]] | [[[], [['b', 'x', 'B', 1, 2]]]] | Passed |
| binding-registry scenario 8 | [[[None], [['a', 'x', 'AB', 1, 1]]]] | [[[None], [['a', 'x', 'AB', 1, 1]]]] | Passed |
| binding-registry scenario 9 | [[[None], [['a', 'y', 'A', 1, 1]]]] | [[[None], [['a', 'y', 'A', 1, 1]]]] | Passed |
| binding-registry scenario 10 | [[[None], [['a', 'x', '', 1, 1]]]] | [[[None], [['a', 'x', '', 1, 1]]]] | Passed |
SHA-256 / 0ef8ddddc20512d9714b2c91e32ce370d8586d10601425fc30790a1c5c0cf2e0
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.870585+00:00.
Case digest / 6c22b40767ecdf5077e31583af361a3a5ff95f6cf86130b69261aefb0a53aa89