FAILURE MAP
← Case archive

FA-31231 / Keyboard interactions / Open access

Keyboard binding registration lifecycle: Tie ordering is accidentally oldest-first outside a special scope · case 01

The event trace violates the tie recency rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Tie ordering is accidentally oldest-first outside a special scope.

THE FAILURE

Tie ordering is accidentally oldest-first outside a special scope.

Unsuccessful approach: The partial repair changes this transition to reverse=bool(scope=="global"), 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=False)
                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 fixtureActualExpectedOutcome
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 / 6c67988546fd7f8523672c45b5e8c37dba2d4e8bc277c274e2e24c84a9b0e9ef

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=bool(scope=="global"))
                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 fixtureActualExpectedOutcome
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 / 6126df95c575f6d9ad794034ffc35891ff96464dfbd75d87c768238d607adb2f

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 11 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:00.212789+00:00.

Case digest / a4a08d4f39fdc7c22a71dd03405509508c039cd779fdb4c29e60042d7ebd00fd