FAILURE MAP
← Case archive

FA-31761 / Keyboard interactions / Open access

Press-time remapping and logical key reference counts: Disabled output is counted as a logical key or empty-string targets are lost · case 01

The event trace violates the disabled target rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Disabled output is counted as a logical key or empty-string targets are lost.

THE FAILURE

Disabled output is counted as a logical key or empty-string targets are lost.

Unsuccessful approach: The partial repair changes this transition to if logical: count=, which still violates the model contract on the explicit regression traces.

Case contract

Events [kind,key,value]. Map replaces future press mapping; None disables output. Down captures current mapping once per physical key. Several physical keys mapping to one logical key share a reference count: emit logical down at 0->1 and up at 1->0. Release uses captured mapping even after remap. Reset emits sorted ups for all logical held keys and clears presses. Return events, captured physical map and logical counts. 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):
        mapping={}; active={}; counts={}; out=[]
        for kind,key,value in c:
            if kind=='map': mapping[key]=value
            elif kind=='down' and key not in active:
                logical=mapping.get(key,key)
                active[key]=logical
                if True:
                    count=counts.get(logical,0)
                    counts[logical]=count+1
                    if count==0: out.append(['down',logical])
            elif kind=='up' and key in active:
                logical=active.pop(key)
                if logical is not None:
                    counts[logical]=counts.get(logical,0)-1
                    if counts[logical]==0:
                        out.append(['up',logical])
                        counts.pop(logical,None)
            elif kind=='reset':
                for logical in sorted(counts): out.append(['up',logical])
                active.clear(); counts.clear()
        return [out,sorted([[k,v] for k,v in active.items()]),sorted([[k,v] for k,v in counts.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('remap-release-ownership scenario 0', solve([[]] * N), [[[], [], []]] * N)
check('remap-release-ownership scenario 1', solve([[['down', 'A', None], ['up', 'A', None]]] * N), [[[['down', 'A'], ['up', 'A']], [], []]] * N)
check('remap-release-ownership scenario 2', solve([[['map', 'A', 'X'], ['map', 'A', 'Y'], ['down', 'A', None]]] * N), [[[['down', 'Y']], [['A', 'Y']], [['Y', 1]]]] * N)
check('remap-release-ownership scenario 3', solve([[['map', 'A', 'X'], ['down', 'A', None], ['map', 'A', 'Y'], ['up', 'A', None]]] * N), [[[['down', 'X'], ['up', 'X']], [], []]] * N)
check('remap-release-ownership scenario 4', solve([[['map', 'A', 'X'], ['map', 'B', 'X'], ['down', 'A', None], ['down', 'B', None], ['up', 'A', None]]] * N), [[[['down', 'X']], [['B', 'X']], [['X', 1]]]] * N)
check('remap-release-ownership scenario 5', solve([[['map', 'A', 'X'], ['down', 'A', None], ['down', 'A', None], ['up', 'A', None]]] * N), [[[['down', 'X'], ['up', 'X']], [], []]] * N)
check('remap-release-ownership scenario 6', solve([[['map', 'A', None], ['down', 'A', None]]] * N), [[[], [['A', None]], []]] * N)
check('remap-release-ownership scenario 7', solve([[['map', 'A', ''], ['down', 'A', None]]] * N), [[[['down', '']], [['A', '']], [['', 1]]]] * N)
check('remap-release-ownership scenario 8', solve([[['map', 'A', 'X'], ['down', 'A', None], ['reset', '', None]]] * N), [[[['down', 'X'], ['up', 'X']], [], []]] * 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
remap-release-ownership scenario 0[[[], [], []]][[[], [], []]]Passed
remap-release-ownership scenario 1[[[['down', 'A'], ['up', 'A']], [], []]][[[['down', 'A'], ['up', 'A']], [], []]]Passed
remap-release-ownership scenario 2[[[['down', 'Y']], [['A', 'Y']], [['Y', 1]]]][[[['down', 'Y']], [['A', 'Y']], [['Y', 1]]]]Passed
remap-release-ownership scenario 3[[[['down', 'X'], ['up', 'X']], [], []]][[[['down', 'X'], ['up', 'X']], [], []]]Passed
remap-release-ownership scenario 4[[[['down', 'X']], [['B', 'X']], [['X', 1]]]][[[['down', 'X']], [['B', 'X']], [['X', 1]]]]Passed
remap-release-ownership scenario 5[[[['down', 'X'], ['up', 'X']], [], []]][[[['down', 'X'], ['up', 'X']], [], []]]Passed
remap-release-ownership scenario 6[[[['down', None]], [['A', None]], [[None, 1]]]][[[], [['A', None]], []]]Failed
remap-release-ownership scenario 7[[[['down', '']], [['A', '']], [['', 1]]]][[[['down', '']], [['A', '']], [['', 1]]]]Passed
remap-release-ownership scenario 8[[[['down', 'X'], ['up', 'X']], [], []]][[[['down', 'X'], ['up', 'X']], [], []]]Passed

SHA-256 / 7e0f6d62bfc38f3db2a8a543114c08a1fec304c5b55c78e2517b0f5e301acfd8

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):
        mapping={}; active={}; counts={}; out=[]
        for kind,key,value in c:
            if kind=='map': mapping[key]=value
            elif kind=='down' and key not in active:
                logical=mapping.get(key,key)
                active[key]=logical
                if logical:
                    count=counts.get(logical,0)
                    counts[logical]=count+1
                    if count==0: out.append(['down',logical])
            elif kind=='up' and key in active:
                logical=active.pop(key)
                if logical is not None:
                    counts[logical]=counts.get(logical,0)-1
                    if counts[logical]==0:
                        out.append(['up',logical])
                        counts.pop(logical,None)
            elif kind=='reset':
                for logical in sorted(counts): out.append(['up',logical])
                active.clear(); counts.clear()
        return [out,sorted([[k,v] for k,v in active.items()]),sorted([[k,v] for k,v in counts.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('remap-release-ownership scenario 0', solve([[]] * N), [[[], [], []]] * N)
check('remap-release-ownership scenario 1', solve([[['down', 'A', None], ['up', 'A', None]]] * N), [[[['down', 'A'], ['up', 'A']], [], []]] * N)
check('remap-release-ownership scenario 2', solve([[['map', 'A', 'X'], ['map', 'A', 'Y'], ['down', 'A', None]]] * N), [[[['down', 'Y']], [['A', 'Y']], [['Y', 1]]]] * N)
check('remap-release-ownership scenario 3', solve([[['map', 'A', 'X'], ['down', 'A', None], ['map', 'A', 'Y'], ['up', 'A', None]]] * N), [[[['down', 'X'], ['up', 'X']], [], []]] * N)
check('remap-release-ownership scenario 4', solve([[['map', 'A', 'X'], ['map', 'B', 'X'], ['down', 'A', None], ['down', 'B', None], ['up', 'A', None]]] * N), [[[['down', 'X']], [['B', 'X']], [['X', 1]]]] * N)
check('remap-release-ownership scenario 5', solve([[['map', 'A', 'X'], ['down', 'A', None], ['down', 'A', None], ['up', 'A', None]]] * N), [[[['down', 'X'], ['up', 'X']], [], []]] * N)
check('remap-release-ownership scenario 6', solve([[['map', 'A', None], ['down', 'A', None]]] * N), [[[], [['A', None]], []]] * N)
check('remap-release-ownership scenario 7', solve([[['map', 'A', ''], ['down', 'A', None]]] * N), [[[['down', '']], [['A', '']], [['', 1]]]] * N)
check('remap-release-ownership scenario 8', solve([[['map', 'A', 'X'], ['down', 'A', None], ['reset', '', None]]] * N), [[[['down', 'X'], ['up', 'X']], [], []]] * 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
remap-release-ownership scenario 0[[[], [], []]][[[], [], []]]Passed
remap-release-ownership scenario 1[[[['down', 'A'], ['up', 'A']], [], []]][[[['down', 'A'], ['up', 'A']], [], []]]Passed
remap-release-ownership scenario 2[[[['down', 'Y']], [['A', 'Y']], [['Y', 1]]]][[[['down', 'Y']], [['A', 'Y']], [['Y', 1]]]]Passed
remap-release-ownership scenario 3[[[['down', 'X'], ['up', 'X']], [], []]][[[['down', 'X'], ['up', 'X']], [], []]]Passed
remap-release-ownership scenario 4[[[['down', 'X']], [['B', 'X']], [['X', 1]]]][[[['down', 'X']], [['B', 'X']], [['X', 1]]]]Passed
remap-release-ownership scenario 5[[[['down', 'X'], ['up', 'X']], [], []]][[[['down', 'X'], ['up', 'X']], [], []]]Passed
remap-release-ownership scenario 6[[[], [['A', None]], []]][[[], [['A', None]], []]]Passed
remap-release-ownership scenario 7[[[], [['A', '']], []]][[[['down', '']], [['A', '']], [['', 1]]]]Failed
remap-release-ownership scenario 8[[[['down', 'X'], ['up', 'X']], [], []]][[[['down', 'X'], ['up', 'X']], [], []]]Passed

SHA-256 / 34456a9f8d4d52dce51300708ba785468086b29605510d441c8a33ef68eb56f6

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 9 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:05.536428+00:00.

Case digest / e2dd9986048615a0c7a950c76e16df7e1cb3d575d18cd5901b2a921bfa841c4d