FAILURE MAP
← Case archive

FA-31331 / Keyboard interactions / Open access

Layered physical keyboard remapping: Empty output and blocked output have their meanings conflated · case 01

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

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

ROOT CAUSE

Empty output and blocked output have their meanings conflated.

VERIFIED REPAIR

Use the contract transition `if result is None: blocked+=1` at the blocked output fault site; preserve the other state transitions.

Unsuccessful approach: The partial repair changes this transition to if result=="": blocked+=1, which still violates the model contract on the explicit regression traces.

Case contract

Case [layers,events]. layers maps layer names to key-to-output maps; None output blocks a key and empty string is valid output. Events [kind,a,b]. Push adds a known layer unless already active; pop removes named layer; key resolves from newest active layer defining the key, falling through transparent missing entries to original key. Clear removes layers. Return emitted strings and layer stack. 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):
        layers,events=c
        stack=[]; out=[]; blocked=0
        for kind,a,b in events:
            if kind=='push' and a in layers:
                if a not in stack: stack.append(a)
            elif kind=='pop':
                stack=[x for x in stack if x!=a]
            elif kind=='clear':
                stack=[]
            elif kind=='key':
                result=a
                for layer in reversed(stack):
                    if a in layers[layer]:
                        result=layers[layer][a]
                        break
                if not result: blocked+=1
                else: out.append(result)
        return [out,stack,blocked]
    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-layers scenario 0', solve([[{}, []]] * N), [[[], [], 0]] * N)
check('remap-layers scenario 1', solve([[{'empty': {}}, [['push', 'empty', ''], ['key', 'A', 'x']]]] * N), [[['A'], ['empty'], 0]] * N)
check('remap-layers scenario 2', solve([[{'one': {'A': 'X'}}, [['push', 'one', ''], ['push', 'one', ''], ['key', 'A', '']]]] * N), [[['X'], ['one'], 0]] * N)
check('remap-layers scenario 3', solve([[{'one': {'A': 'X'}, 'two': {'A': 'Y'}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[['Y'], ['one', 'two'], 0]] * N)
check('remap-layers scenario 4', solve([[{'one': {'A': 'X'}, 'two': {}}, [['push', 'one', ''], ['push', 'two', ''], ['pop', 'one', ''], ['key', 'A', '']]]] * N), [[['A'], ['two'], 0]] * N)
check('remap-layers scenario 5', solve([[{'one': {'A': None, 'B': ''}}, [['push', 'one', ''], ['key', 'A', ''], ['key', 'B', ''], ['key', 'C', '']]]] * N), [[['', 'C'], ['one'], 1]] * N)
check('remap-layers scenario 6', solve([[{'one': {}, 'two': {}, 'three': {}}, [['push', 'one', ''], ['push', 'two', ''], ['push', 'three', ''], ['clear', '', '']]]] * N), [[[], [], 0]] * N)
check('remap-layers scenario 7', solve([[{'one': {'A': 'X'}, 'two': {'A': None}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[[], ['one', 'two'], 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
remap-layers scenario 0[[[], [], 0]][[[], [], 0]]Passed
remap-layers scenario 1[[['A'], ['empty'], 0]][[['A'], ['empty'], 0]]Passed
remap-layers scenario 2[[['X'], ['one'], 0]][[['X'], ['one'], 0]]Passed
remap-layers scenario 3[[['Y'], ['one', 'two'], 0]][[['Y'], ['one', 'two'], 0]]Passed
remap-layers scenario 4[[['A'], ['two'], 0]][[['A'], ['two'], 0]]Passed
remap-layers scenario 5[[['C'], ['one'], 2]][[['', 'C'], ['one'], 1]]Failed
remap-layers scenario 6[[[], [], 0]][[[], [], 0]]Passed
remap-layers scenario 7[[[], ['one', 'two'], 1]][[[], ['one', 'two'], 1]]Passed

SHA-256 / f3be63005e68b3a61c748dd4c1fcd6939c6b32aa0cff468e929f68917fdb4adc

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):
        layers,events=c
        stack=[]; out=[]; blocked=0
        for kind,a,b in events:
            if kind=='push' and a in layers:
                if a not in stack: stack.append(a)
            elif kind=='pop':
                stack=[x for x in stack if x!=a]
            elif kind=='clear':
                stack=[]
            elif kind=='key':
                result=a
                for layer in reversed(stack):
                    if a in layers[layer]:
                        result=layers[layer][a]
                        break
                if result=="": blocked+=1
                else: out.append(result)
        return [out,stack,blocked]
    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-layers scenario 0', solve([[{}, []]] * N), [[[], [], 0]] * N)
check('remap-layers scenario 1', solve([[{'empty': {}}, [['push', 'empty', ''], ['key', 'A', 'x']]]] * N), [[['A'], ['empty'], 0]] * N)
check('remap-layers scenario 2', solve([[{'one': {'A': 'X'}}, [['push', 'one', ''], ['push', 'one', ''], ['key', 'A', '']]]] * N), [[['X'], ['one'], 0]] * N)
check('remap-layers scenario 3', solve([[{'one': {'A': 'X'}, 'two': {'A': 'Y'}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[['Y'], ['one', 'two'], 0]] * N)
check('remap-layers scenario 4', solve([[{'one': {'A': 'X'}, 'two': {}}, [['push', 'one', ''], ['push', 'two', ''], ['pop', 'one', ''], ['key', 'A', '']]]] * N), [[['A'], ['two'], 0]] * N)
check('remap-layers scenario 5', solve([[{'one': {'A': None, 'B': ''}}, [['push', 'one', ''], ['key', 'A', ''], ['key', 'B', ''], ['key', 'C', '']]]] * N), [[['', 'C'], ['one'], 1]] * N)
check('remap-layers scenario 6', solve([[{'one': {}, 'two': {}, 'three': {}}, [['push', 'one', ''], ['push', 'two', ''], ['push', 'three', ''], ['clear', '', '']]]] * N), [[[], [], 0]] * N)
check('remap-layers scenario 7', solve([[{'one': {'A': 'X'}, 'two': {'A': None}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[[], ['one', 'two'], 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
remap-layers scenario 0[[[], [], 0]][[[], [], 0]]Passed
remap-layers scenario 1[[['A'], ['empty'], 0]][[['A'], ['empty'], 0]]Passed
remap-layers scenario 2[[['X'], ['one'], 0]][[['X'], ['one'], 0]]Passed
remap-layers scenario 3[[['Y'], ['one', 'two'], 0]][[['Y'], ['one', 'two'], 0]]Passed
remap-layers scenario 4[[['A'], ['two'], 0]][[['A'], ['two'], 0]]Passed
remap-layers scenario 5[[[None, 'C'], ['one'], 1]][[['', 'C'], ['one'], 1]]Failed
remap-layers scenario 6[[[], [], 0]][[[], [], 0]]Passed
remap-layers scenario 7[[[None], ['one', 'two'], 0]][[[], ['one', 'two'], 1]]Failed

SHA-256 / 94ea1b9186232b270286898729f486841e4583a502f87345a63d7dd5b45e20ee

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):
        layers,events=c
        stack=[]; out=[]; blocked=0
        for kind,a,b in events:
            if kind=='push' and a in layers:
                if a not in stack: stack.append(a)
            elif kind=='pop':
                stack=[x for x in stack if x!=a]
            elif kind=='clear':
                stack=[]
            elif kind=='key':
                result=a
                for layer in reversed(stack):
                    if a in layers[layer]:
                        result=layers[layer][a]
                        break
                if result is None: blocked+=1
                else: out.append(result)
        return [out,stack,blocked]
    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-layers scenario 0', solve([[{}, []]] * N), [[[], [], 0]] * N)
check('remap-layers scenario 1', solve([[{'empty': {}}, [['push', 'empty', ''], ['key', 'A', 'x']]]] * N), [[['A'], ['empty'], 0]] * N)
check('remap-layers scenario 2', solve([[{'one': {'A': 'X'}}, [['push', 'one', ''], ['push', 'one', ''], ['key', 'A', '']]]] * N), [[['X'], ['one'], 0]] * N)
check('remap-layers scenario 3', solve([[{'one': {'A': 'X'}, 'two': {'A': 'Y'}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[['Y'], ['one', 'two'], 0]] * N)
check('remap-layers scenario 4', solve([[{'one': {'A': 'X'}, 'two': {}}, [['push', 'one', ''], ['push', 'two', ''], ['pop', 'one', ''], ['key', 'A', '']]]] * N), [[['A'], ['two'], 0]] * N)
check('remap-layers scenario 5', solve([[{'one': {'A': None, 'B': ''}}, [['push', 'one', ''], ['key', 'A', ''], ['key', 'B', ''], ['key', 'C', '']]]] * N), [[['', 'C'], ['one'], 1]] * N)
check('remap-layers scenario 6', solve([[{'one': {}, 'two': {}, 'three': {}}, [['push', 'one', ''], ['push', 'two', ''], ['push', 'three', ''], ['clear', '', '']]]] * N), [[[], [], 0]] * N)
check('remap-layers scenario 7', solve([[{'one': {'A': 'X'}, 'two': {'A': None}}, [['push', 'one', ''], ['push', 'two', ''], ['key', 'A', '']]]] * N), [[[], ['one', 'two'], 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
remap-layers scenario 0[[[], [], 0]][[[], [], 0]]Passed
remap-layers scenario 1[[['A'], ['empty'], 0]][[['A'], ['empty'], 0]]Passed
remap-layers scenario 2[[['X'], ['one'], 0]][[['X'], ['one'], 0]]Passed
remap-layers scenario 3[[['Y'], ['one', 'two'], 0]][[['Y'], ['one', 'two'], 0]]Passed
remap-layers scenario 4[[['A'], ['two'], 0]][[['A'], ['two'], 0]]Passed
remap-layers scenario 5[[['', 'C'], ['one'], 1]][[['', 'C'], ['one'], 1]]Passed
remap-layers scenario 6[[[], [], 0]][[[], [], 0]]Passed
remap-layers scenario 7[[[], ['one', 'two'], 1]][[[], ['one', 'two'], 1]]Passed

SHA-256 / 50d753f3bfd10902bbd72fff21f92faccf5f4c05da8c7c62b889e4f1ff5a022a

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:01.034924+00:00.

Case digest / 4854e6d4f86fcfafc4d3c510a2c925b4e35729172ec47a3233850446ec5d9369