FA-31236 / Keyboard interactions / Open access
Keyboard binding registration lifecycle: Resolution returns the last candidate or its scope instead of winning ID · case 01
The event trace violates the winner rule and produces incorrect keyboard state or command output.
ROOT CAUSE
Resolution returns the last candidate or its scope instead of winning ID.
VERIFIED REPAIR
Use the contract transition `eligible[0][0] if eligible else None` at the winner fault site; preserve the other state transitions.
Unsuccessful approach: The partial repair changes this transition to eligible[0][1][0] if eligible else None, 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[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[-1][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 | [[['b'], [['a', 'x', 'A', 2, 1], ['b', '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, 1], ['b', 'x', 'A', 1, 2]]]] | [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] | Failed |
| 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 / 24d79e82553dd9e0b30b9dde92526cf216e225ac6e14aeb20f1cb3444eeaec26
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[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][1][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 | [[['x'], [['a', 'x', 'A', 1, 1]]]] | [[['a'], [['a', 'x', 'A', 1, 1]]]] | Failed |
| binding-registry scenario 3 | [[['x'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] | [[['a'], [['a', 'x', 'A', 2, 1], ['b', 'x', 'A', 1, 2]]]] | Failed |
| binding-registry scenario 4 | [[['x'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] | [[['b'], [['a', 'x', 'A', 1, 1], ['b', 'x', 'A', 1, 2]]]] | Failed |
| binding-registry scenario 5 | [[['y'], [['a', '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]]]] | 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 / 13740953938e1e835a3a797b09d66cfaa57a5fe502a75c064df2d20591f7171d
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:42:00.212789+00:00.
Case digest / 77a7d246d441567781ac9be824b16160df2b0ad486c669121b71b2ebc0cd85e4