FA-31311 / Keyboard interactions / Open access
Layered physical keyboard remapping: An unmapped key loses its original identity in transparent layers · case 01
The event trace violates the fallback key rule and produces incorrect keyboard state or command output.
ROOT CAUSE
An unmapped key loses its original identity in transparent layers.
VERIFIED REPAIR
Use the contract transition `result=a` at the fallback key fault site; preserve the other state transitions.
Unsuccessful approach: The partial repair changes this transition to result=None, 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=b
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| remap-layers scenario 0 | [[[], [], 0]] | [[[], [], 0]] | Passed |
| remap-layers scenario 1 | [[['x'], ['empty'], 0]] | [[['A'], ['empty'], 0]] | Failed |
| 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 | [[[''], ['two'], 0]] | [[['A'], ['two'], 0]] | Failed |
| remap-layers scenario 5 | [[['', ''], ['one'], 1]] | [[['', 'C'], ['one'], 1]] | Failed |
| remap-layers scenario 6 | [[[], [], 0]] | [[[], [], 0]] | Passed |
| remap-layers scenario 7 | [[[], ['one', 'two'], 1]] | [[[], ['one', 'two'], 1]] | Passed |
SHA-256 / fd9cb9949124ff034ccee9ebc58d9fa44a5f9b115076fe1e8059aeb0173230fb
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=None
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| remap-layers scenario 0 | [[[], [], 0]] | [[[], [], 0]] | Passed |
| remap-layers scenario 1 | [[[], ['empty'], 1]] | [[['A'], ['empty'], 0]] | Failed |
| 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 | [[[], ['two'], 1]] | [[['A'], ['two'], 0]] | Failed |
| remap-layers scenario 5 | [[[''], ['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 / ea0cc0f130fad84b439b7caae0801eaa589fda07a54cf6e41c410161474f7ffb
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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:00.937949+00:00.
Case digest / 411d6c260dab8ed6dcf94f1e4144fe498ff27ee822f7f1dd361415901ff96635