FAILURE MAP
← Case archive

FA-32216 / Keyboard interactions / Open access

Keyboard matrix rectangle ghost quarantine: Multiple ambiguous rectangles do not accumulate their quarantined corners · case 01

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

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

ROOT CAUSE

Multiple ambiguous rectangles do not accumulate their quarantined corners.

VERIFIED REPAIR

Use the contract transition `ambiguous|=rectangle` at the rectangle union fault site; preserve the other state transitions.

Unsuccessful approach: The partial repair changes this transition to ambiguous&=rectangle, which still violates the model contract on the explicit regression traces.

Case contract

Case [rows,columns,reports]. Reports contain [row,column] cells. Ignore out-of-bounds coordinates. Any full observed rectangle with two distinct rows and columns makes its four corners ambiguous. Newly ambiguous presses are quarantined, but already accepted cells remain held while still observed. Emit sorted release edges then sorted press edges for each report. Return edges, accepted cells and final quarantined cells. 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):
        rows,columns,reports=c
        old=set(); output=[]; quarantined=set()
        for report in reports:
            raw={(r,col) for r,col in report if 0<=r<rows and 0<=col<columns}
            ambiguous=set()
            for r1 in range(rows):
                for r2 in range(r1+1,rows):
                    for c1 in range(columns):
                        for c2 in range(c1+1,columns):
                            rectangle={(r1,c1),(r1,c2),(r2,c1),(r2,c2)}
                            if rectangle<=raw: ambiguous=rectangle
            accepted=(raw-ambiguous)|(old&raw)
            for r,col in sorted(old-accepted): output.append(['up',r,col])
            for r,col in sorted(accepted-old): output.append(['down',r,col])
            quarantined=raw-accepted
            old=accepted
        return [output,[list(x) for x in sorted(old)],[list(x) for x in sorted(quarantined)]]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('matrix-ghost-quarantine scenario 0', solve([[2, 2, []]] * N), [[[], [], []]] * N)
check('matrix-ghost-quarantine scenario 1', solve([[2, 2, [[[0, 0], [0, 1], [1, 0]]]]] * N), [[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]] * N)
check('matrix-ghost-quarantine scenario 2', solve([[2, 2, [[[0, 0], [0, 1], [1, 0], [1, 1]]]]] * N), [[[], [], [[0, 0], [0, 1], [1, 0], [1, 1]]]] * N)
check('matrix-ghost-quarantine scenario 3', solve([[2, 2, [[[0, 0], [0, 1]], [[0, 0], [0, 1], [1, 0], [1, 1]]]]] * N), [[[['down', 0, 0], ['down', 0, 1]], [[0, 0], [0, 1]], [[1, 0], [1, 1]]]] * N)
check('matrix-ghost-quarantine scenario 4', solve([[2, 2, [[[0, 0]], []]]] * N), [[[['down', 0, 0], ['up', 0, 0]], [], []]] * N)
check('matrix-ghost-quarantine scenario 5', solve([[2, 2, [[[-1, 0], [0, -1], [2, 0], [0, 2], [1, 1]]]]] * N), [[[['down', 1, 1]], [[1, 1]], []]] * N)
check('matrix-ghost-quarantine scenario 6', solve([[3, 3, [[[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]]] * N), [[[], [], [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]] * N)
check('matrix-ghost-quarantine scenario 7', solve([[2, 2, [[[0, 0]], [[0, 0]], [[0, 1]]]]] * N), [[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]] * N)
check('matrix-ghost-quarantine scenario 8', solve([[3, 3, [[[0, 0], [0, 1], [1, 0], [1, 1], [2, 2]]]]] * N), [[[['down', 2, 2]], [[2, 2]], [[0, 0], [0, 1], [1, 0], [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
matrix-ghost-quarantine scenario 0[[[], [], []]][[[], [], []]]Passed
matrix-ghost-quarantine scenario 1[[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]][[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]]Passed
matrix-ghost-quarantine scenario 2[[[], [], [[0, 0], [0, 1], [1, 0], [1, 1]]]][[[], [], [[0, 0], [0, 1], [1, 0], [1, 1]]]]Passed
matrix-ghost-quarantine scenario 3[[[['down', 0, 0], ['down', 0, 1]], [[0, 0], [0, 1]], [[1, 0], [1, 1]]]][[[['down', 0, 0], ['down', 0, 1]], [[0, 0], [0, 1]], [[1, 0], [1, 1]]]]Passed
matrix-ghost-quarantine scenario 4[[[['down', 0, 0], ['up', 0, 0]], [], []]][[[['down', 0, 0], ['up', 0, 0]], [], []]]Passed
matrix-ghost-quarantine scenario 5[[[['down', 1, 1]], [[1, 1]], []]][[[['down', 1, 1]], [[1, 1]], []]]Passed
matrix-ghost-quarantine scenario 6[[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], [[1, 1], [1, 2], [2, 1], [2, 2]]]][[[], [], [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]]Failed
matrix-ghost-quarantine scenario 7[[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]][[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]]Passed
matrix-ghost-quarantine scenario 8[[[['down', 2, 2]], [[2, 2]], [[0, 0], [0, 1], [1, 0], [1, 1]]]][[[['down', 2, 2]], [[2, 2]], [[0, 0], [0, 1], [1, 0], [1, 1]]]]Passed

SHA-256 / 9c885b3608d67f12da5edced5f27095142c496722a9d7c2b687c13c4a815302e

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):
        rows,columns,reports=c
        old=set(); output=[]; quarantined=set()
        for report in reports:
            raw={(r,col) for r,col in report if 0<=r<rows and 0<=col<columns}
            ambiguous=set()
            for r1 in range(rows):
                for r2 in range(r1+1,rows):
                    for c1 in range(columns):
                        for c2 in range(c1+1,columns):
                            rectangle={(r1,c1),(r1,c2),(r2,c1),(r2,c2)}
                            if rectangle<=raw: ambiguous&=rectangle
            accepted=(raw-ambiguous)|(old&raw)
            for r,col in sorted(old-accepted): output.append(['up',r,col])
            for r,col in sorted(accepted-old): output.append(['down',r,col])
            quarantined=raw-accepted
            old=accepted
        return [output,[list(x) for x in sorted(old)],[list(x) for x in sorted(quarantined)]]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('matrix-ghost-quarantine scenario 0', solve([[2, 2, []]] * N), [[[], [], []]] * N)
check('matrix-ghost-quarantine scenario 1', solve([[2, 2, [[[0, 0], [0, 1], [1, 0]]]]] * N), [[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]] * N)
check('matrix-ghost-quarantine scenario 2', solve([[2, 2, [[[0, 0], [0, 1], [1, 0], [1, 1]]]]] * N), [[[], [], [[0, 0], [0, 1], [1, 0], [1, 1]]]] * N)
check('matrix-ghost-quarantine scenario 3', solve([[2, 2, [[[0, 0], [0, 1]], [[0, 0], [0, 1], [1, 0], [1, 1]]]]] * N), [[[['down', 0, 0], ['down', 0, 1]], [[0, 0], [0, 1]], [[1, 0], [1, 1]]]] * N)
check('matrix-ghost-quarantine scenario 4', solve([[2, 2, [[[0, 0]], []]]] * N), [[[['down', 0, 0], ['up', 0, 0]], [], []]] * N)
check('matrix-ghost-quarantine scenario 5', solve([[2, 2, [[[-1, 0], [0, -1], [2, 0], [0, 2], [1, 1]]]]] * N), [[[['down', 1, 1]], [[1, 1]], []]] * N)
check('matrix-ghost-quarantine scenario 6', solve([[3, 3, [[[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]]] * N), [[[], [], [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]] * N)
check('matrix-ghost-quarantine scenario 7', solve([[2, 2, [[[0, 0]], [[0, 0]], [[0, 1]]]]] * N), [[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]] * N)
check('matrix-ghost-quarantine scenario 8', solve([[3, 3, [[[0, 0], [0, 1], [1, 0], [1, 1], [2, 2]]]]] * N), [[[['down', 2, 2]], [[2, 2]], [[0, 0], [0, 1], [1, 0], [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
matrix-ghost-quarantine scenario 0[[[], [], []]][[[], [], []]]Passed
matrix-ghost-quarantine scenario 1[[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]][[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]]Passed
matrix-ghost-quarantine scenario 2[[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0], ['down', 1, 1]], [[0, 0], [0, 1], [1, 0], [1, 1]], []]][[[], [], [[0, 0], [0, 1], [1, 0], [1, 1]]]]Failed
matrix-ghost-quarantine scenario 3[[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0], ['down', 1, 1]], [[0, 0], [0, 1], [1, 0], [1, 1]], []]][[[['down', 0, 0], ['down', 0, 1]], [[0, 0], [0, 1]], [[1, 0], [1, 1]]]]Failed
matrix-ghost-quarantine scenario 4[[[['down', 0, 0], ['up', 0, 0]], [], []]][[[['down', 0, 0], ['up', 0, 0]], [], []]]Passed
matrix-ghost-quarantine scenario 5[[[['down', 1, 1]], [[1, 1]], []]][[[['down', 1, 1]], [[1, 1]], []]]Passed
matrix-ghost-quarantine scenario 6[[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0], ['down', 1, 1], ['down', 1, 2], ['down', 2, 1], ['down', 2, 2]], [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]], []]][[[], [], [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]]Failed
matrix-ghost-quarantine scenario 7[[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]][[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]]Passed
matrix-ghost-quarantine scenario 8[[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0], ['down', 1, 1], ['down', 2, 2]], [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2]], []]][[[['down', 2, 2]], [[2, 2]], [[0, 0], [0, 1], [1, 0], [1, 1]]]]Failed

SHA-256 / 526418c08a5b73b656370c7a8a88b8766b66dfbc721242b23a837f490804e06b

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):
        rows,columns,reports=c
        old=set(); output=[]; quarantined=set()
        for report in reports:
            raw={(r,col) for r,col in report if 0<=r<rows and 0<=col<columns}
            ambiguous=set()
            for r1 in range(rows):
                for r2 in range(r1+1,rows):
                    for c1 in range(columns):
                        for c2 in range(c1+1,columns):
                            rectangle={(r1,c1),(r1,c2),(r2,c1),(r2,c2)}
                            if rectangle<=raw: ambiguous|=rectangle
            accepted=(raw-ambiguous)|(old&raw)
            for r,col in sorted(old-accepted): output.append(['up',r,col])
            for r,col in sorted(accepted-old): output.append(['down',r,col])
            quarantined=raw-accepted
            old=accepted
        return [output,[list(x) for x in sorted(old)],[list(x) for x in sorted(quarantined)]]
    return [run(c) for c in cases]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('matrix-ghost-quarantine scenario 0', solve([[2, 2, []]] * N), [[[], [], []]] * N)
check('matrix-ghost-quarantine scenario 1', solve([[2, 2, [[[0, 0], [0, 1], [1, 0]]]]] * N), [[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]] * N)
check('matrix-ghost-quarantine scenario 2', solve([[2, 2, [[[0, 0], [0, 1], [1, 0], [1, 1]]]]] * N), [[[], [], [[0, 0], [0, 1], [1, 0], [1, 1]]]] * N)
check('matrix-ghost-quarantine scenario 3', solve([[2, 2, [[[0, 0], [0, 1]], [[0, 0], [0, 1], [1, 0], [1, 1]]]]] * N), [[[['down', 0, 0], ['down', 0, 1]], [[0, 0], [0, 1]], [[1, 0], [1, 1]]]] * N)
check('matrix-ghost-quarantine scenario 4', solve([[2, 2, [[[0, 0]], []]]] * N), [[[['down', 0, 0], ['up', 0, 0]], [], []]] * N)
check('matrix-ghost-quarantine scenario 5', solve([[2, 2, [[[-1, 0], [0, -1], [2, 0], [0, 2], [1, 1]]]]] * N), [[[['down', 1, 1]], [[1, 1]], []]] * N)
check('matrix-ghost-quarantine scenario 6', solve([[3, 3, [[[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]]] * N), [[[], [], [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]] * N)
check('matrix-ghost-quarantine scenario 7', solve([[2, 2, [[[0, 0]], [[0, 0]], [[0, 1]]]]] * N), [[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]] * N)
check('matrix-ghost-quarantine scenario 8', solve([[3, 3, [[[0, 0], [0, 1], [1, 0], [1, 1], [2, 2]]]]] * N), [[[['down', 2, 2]], [[2, 2]], [[0, 0], [0, 1], [1, 0], [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
matrix-ghost-quarantine scenario 0[[[], [], []]][[[], [], []]]Passed
matrix-ghost-quarantine scenario 1[[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]][[[['down', 0, 0], ['down', 0, 1], ['down', 1, 0]], [[0, 0], [0, 1], [1, 0]], []]]Passed
matrix-ghost-quarantine scenario 2[[[], [], [[0, 0], [0, 1], [1, 0], [1, 1]]]][[[], [], [[0, 0], [0, 1], [1, 0], [1, 1]]]]Passed
matrix-ghost-quarantine scenario 3[[[['down', 0, 0], ['down', 0, 1]], [[0, 0], [0, 1]], [[1, 0], [1, 1]]]][[[['down', 0, 0], ['down', 0, 1]], [[0, 0], [0, 1]], [[1, 0], [1, 1]]]]Passed
matrix-ghost-quarantine scenario 4[[[['down', 0, 0], ['up', 0, 0]], [], []]][[[['down', 0, 0], ['up', 0, 0]], [], []]]Passed
matrix-ghost-quarantine scenario 5[[[['down', 1, 1]], [[1, 1]], []]][[[['down', 1, 1]], [[1, 1]], []]]Passed
matrix-ghost-quarantine scenario 6[[[], [], [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]][[[], [], [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]]]Passed
matrix-ghost-quarantine scenario 7[[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]][[[['down', 0, 0], ['up', 0, 0], ['down', 0, 1]], [[0, 1]], []]]Passed
matrix-ghost-quarantine scenario 8[[[['down', 2, 2]], [[2, 2]], [[0, 0], [0, 1], [1, 0], [1, 1]]]][[[['down', 2, 2]], [[2, 2]], [[0, 0], [0, 1], [1, 0], [1, 1]]]]Passed

SHA-256 / 56ecec69d4038d34b336d75e6dbd9c4962025c0f95449131c2a0f52b5e18037e

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

Case digest / 608d1346fbd2cdbb53466accc7f59076cad2bc87cd20c938c35c31ea5bb32f08