FAILURE MAP
← Case archive

FA-31006 / Keyboard interactions / Open access

Release activated command binding: Orphan release accounting loses multiple unmatched transitions · case 01

The event trace violates the unmatched count rule and produces incorrect keyboard state or command output.

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

ROOT CAUSE

Orphan release accounting loses multiple unmatched transitions.

THE FAILURE

Orphan release accounting loses multiple unmatched transitions.

Unsuccessful approach: The partial repair changes this transition to else: unmatched+=len(pending), which still violates the model contract on the explicit regression traces.

Case contract

Events [kind,key,owner]. Down arms a key for its owner; repeated down preserves the original owner. Up emits key only for matching key and owner then always disarms that physical key. Cancel clears all pending keys; owner-left clears that owner. Return emitted key-owner pairs and sorted pending pairs. 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):
        pending={}; emitted=[]; cancelled=0; unmatched=0
        for kind,key,owner in c:
            if kind=='down':
                if key not in pending: pending[key]=owner
            elif kind=='up':
                if key in pending and pending[key]==owner:
                    emitted.append([key,owner])
                else: unmatched=1
                pending.pop(key,None)
            elif kind=='cancel':
                cancelled+=len(pending)
                pending.clear()
            elif kind=='owner-left':
                dropped=[k for k,v in pending.items() if v==owner]
                cancelled+=len(dropped)
                for k in dropped: pending.pop(k)
        return [emitted,sorted([[k,v] for k,v in pending.items()]),cancelled,unmatched]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('release-binding scenario 0', solve([[]] * N), [[[], [], 0, 0]] * N)
check('release-binding scenario 1', solve([[['down', 'A', 'one'], ['down', 'B', 'one'], ['cancel', '', '']]] * N), [[[], [], 2, 0]] * N)
check('release-binding scenario 2', solve([[['up', 'A', 'one'], ['up', 'B', 'one']]] * N), [[[], [], 0, 2]] * N)
check('release-binding scenario 3', solve([[['down', 'A', 'one'], ['down', 'A', 'two'], ['up', 'A', 'two']]] * N), [[[], [], 0, 1]] * N)
check('release-binding scenario 4', solve([[['down', 'A', 'one'], ['up', 'A', 'one'], ['up', 'A', 'one']]] * N), [[[['A', 'one']], [], 0, 1]] * N)
check('release-binding scenario 5', solve([[['down', 'A', 'one'], ['down', 'B', 'two'], ['up', 'A', 'one']]] * N), [[[['A', 'one']], [['B', 'two']], 0, 0]] * N)
check('release-binding scenario 6', solve([[['down', 'A', 'one'], ['down', 'B', 'one'], ['cancel', '', ''], ['cancel', '', '']]] * N), [[[], [], 2, 0]] * N)
check('release-binding scenario 7', solve([[['down', 'A', 'one'], ['down', 'B', 'one'], ['down', 'C', 'two'], ['owner-left', '', 'one']]] * N), [[[], [['C', 'two']], 2, 0]] * N)
check('release-binding scenario 8', solve([[['down', 'A', 'one'], ['owner-left', '', 'two']]] * N), [[[], [['A', 'one']], 0, 0]] * N)
check('release-binding scenario 9', solve([[['down', 'A', 'one'], ['cancel', '', ''], ['down', 'B', 'two'], ['cancel', '', '']]] * N), [[[], [], 2, 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 fixtureActualExpectedOutcome
release-binding scenario 0[[[], [], 0, 0]][[[], [], 0, 0]]Passed
release-binding scenario 1[[[], [], 2, 0]][[[], [], 2, 0]]Passed
release-binding scenario 2[[[], [], 0, 1]][[[], [], 0, 2]]Failed
release-binding scenario 3[[[], [], 0, 1]][[[], [], 0, 1]]Passed
release-binding scenario 4[[[['A', 'one']], [], 0, 1]][[[['A', 'one']], [], 0, 1]]Passed
release-binding scenario 5[[[['A', 'one']], [['B', 'two']], 0, 0]][[[['A', 'one']], [['B', 'two']], 0, 0]]Passed
release-binding scenario 6[[[], [], 2, 0]][[[], [], 2, 0]]Passed
release-binding scenario 7[[[], [['C', 'two']], 2, 0]][[[], [['C', 'two']], 2, 0]]Passed
release-binding scenario 8[[[], [['A', 'one']], 0, 0]][[[], [['A', 'one']], 0, 0]]Passed
release-binding scenario 9[[[], [], 2, 0]][[[], [], 2, 0]]Passed

SHA-256 / e30a6375f7980ccd2aafba053730431ab086a504e94755e54e96b44658b30594

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):
        pending={}; emitted=[]; cancelled=0; unmatched=0
        for kind,key,owner in c:
            if kind=='down':
                if key not in pending: pending[key]=owner
            elif kind=='up':
                if key in pending and pending[key]==owner:
                    emitted.append([key,owner])
                else: unmatched+=len(pending)
                pending.pop(key,None)
            elif kind=='cancel':
                cancelled+=len(pending)
                pending.clear()
            elif kind=='owner-left':
                dropped=[k for k,v in pending.items() if v==owner]
                cancelled+=len(dropped)
                for k in dropped: pending.pop(k)
        return [emitted,sorted([[k,v] for k,v in pending.items()]),cancelled,unmatched]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('release-binding scenario 0', solve([[]] * N), [[[], [], 0, 0]] * N)
check('release-binding scenario 1', solve([[['down', 'A', 'one'], ['down', 'B', 'one'], ['cancel', '', '']]] * N), [[[], [], 2, 0]] * N)
check('release-binding scenario 2', solve([[['up', 'A', 'one'], ['up', 'B', 'one']]] * N), [[[], [], 0, 2]] * N)
check('release-binding scenario 3', solve([[['down', 'A', 'one'], ['down', 'A', 'two'], ['up', 'A', 'two']]] * N), [[[], [], 0, 1]] * N)
check('release-binding scenario 4', solve([[['down', 'A', 'one'], ['up', 'A', 'one'], ['up', 'A', 'one']]] * N), [[[['A', 'one']], [], 0, 1]] * N)
check('release-binding scenario 5', solve([[['down', 'A', 'one'], ['down', 'B', 'two'], ['up', 'A', 'one']]] * N), [[[['A', 'one']], [['B', 'two']], 0, 0]] * N)
check('release-binding scenario 6', solve([[['down', 'A', 'one'], ['down', 'B', 'one'], ['cancel', '', ''], ['cancel', '', '']]] * N), [[[], [], 2, 0]] * N)
check('release-binding scenario 7', solve([[['down', 'A', 'one'], ['down', 'B', 'one'], ['down', 'C', 'two'], ['owner-left', '', 'one']]] * N), [[[], [['C', 'two']], 2, 0]] * N)
check('release-binding scenario 8', solve([[['down', 'A', 'one'], ['owner-left', '', 'two']]] * N), [[[], [['A', 'one']], 0, 0]] * N)
check('release-binding scenario 9', solve([[['down', 'A', 'one'], ['cancel', '', ''], ['down', 'B', 'two'], ['cancel', '', '']]] * N), [[[], [], 2, 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 fixtureActualExpectedOutcome
release-binding scenario 0[[[], [], 0, 0]][[[], [], 0, 0]]Passed
release-binding scenario 1[[[], [], 2, 0]][[[], [], 2, 0]]Passed
release-binding scenario 2[[[], [], 0, 0]][[[], [], 0, 2]]Failed
release-binding scenario 3[[[], [], 0, 1]][[[], [], 0, 1]]Passed
release-binding scenario 4[[[['A', 'one']], [], 0, 0]][[[['A', 'one']], [], 0, 1]]Failed
release-binding scenario 5[[[['A', 'one']], [['B', 'two']], 0, 0]][[[['A', 'one']], [['B', 'two']], 0, 0]]Passed
release-binding scenario 6[[[], [], 2, 0]][[[], [], 2, 0]]Passed
release-binding scenario 7[[[], [['C', 'two']], 2, 0]][[[], [['C', 'two']], 2, 0]]Passed
release-binding scenario 8[[[], [['A', 'one']], 0, 0]][[[], [['A', 'one']], 0, 0]]Passed
release-binding scenario 9[[[], [], 2, 0]][[[], [], 2, 0]]Passed

SHA-256 / 7b859107ba9c2cd07764ab58425bcc890db3fd88b396bce836c7fe7f3db1b325

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 10 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:41:58.374337+00:00.

Case digest / e9c5b3edbba250a954614b67b54a1f86619fb39ffb25cd8b1d0411fa32d7e6dd