FAILURE MAP
← Case archive

FA-8391 / Tree accessibility / Open access

Tree keyboard expansion: Left-arrow collapses unrelated branches · case 01

Left-arrow collapses unrelated branches.

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

ROOT CAUSE

The collapse left operation uses `expanded.clear()` where the contract requires `expanded.remove(node)`.

THE FAILURE

The collapse left operation uses `expanded.clear()` where the contract requires `expanded.remove(node)`.

Unsuccessful approach: Adding the node keeps the current branch expanded.

Case contract

Right expands then enters the first child; Left collapses only the current branch or focuses its parent; roots retain focus; collapse-all clears every expansion.

Why this case matters

A deterministic model of tree keyboard expansion; this isolates one interface invariant without requiring a browser.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(node, expanded, parents, children, key):
    expanded = set(expanded)
    kids = children.get(node, [])
    if key == 'Right' and kids:
        if node not in expanded: expanded.add(node)
        else: node = kids[0]
    elif key == 'Left':
        if node in expanded: expanded.clear()
        else: node = parents.get(node, node)
    elif key == 'CollapseAll': expanded.clear()
    return (node, sorted(expanded))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expand', solve('a', ['z'], {}, {'a':['b','c']}, 'Right'), ('a', ['a', 'z']))
check('descend', solve('a', ['a'], {}, {'a':['b','c']}, 'Right'), ('b', ['a']))
check('collapse', solve('a', ['a','z'], {}, {'a':['b']}, 'Left'), ('a', ['z']))
check('parent', solve('b', [], {'b':'a'}, {}, 'Left'), ('a', []))
check('root', solve('a', [], {}, {}, 'Left'), ('a', []))
check('all', solve('a', ['a','z'], {}, {}, 'CollapseAll'), ('a', []))
check('parameterized child count', solve('a', [], {}, {'a':list(range(N))}, 'Right'), ('a',['a']))
for repetition in range(N):
    check('repeat all', solve('a', ['a','z'], {}, {}, 'CollapseAll'), ('a', []))
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
expand['a', ['a', 'z']]['a', ['a', 'z']]Passed
descend['b', ['a']]['b', ['a']]Passed
collapse['a', []]['a', ['z']]Failed
parent['a', []]['a', []]Passed
root['a', []]['a', []]Passed
all['a', []]['a', []]Passed
parameterized child count['a', ['a']]['a', ['a']]Passed
repeat all['a', []]['a', []]Passed

SHA-256 / a4dffe91163f7deee6ebc436d7c2d23e4a674b12f976fb7f26467031c027c260

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(node, expanded, parents, children, key):
    expanded = set(expanded)
    kids = children.get(node, [])
    if key == 'Right' and kids:
        if node not in expanded: expanded.add(node)
        else: node = kids[0]
    elif key == 'Left':
        if node in expanded: expanded.add(node)
        else: node = parents.get(node, node)
    elif key == 'CollapseAll': expanded.clear()
    return (node, sorted(expanded))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expand', solve('a', ['z'], {}, {'a':['b','c']}, 'Right'), ('a', ['a', 'z']))
check('descend', solve('a', ['a'], {}, {'a':['b','c']}, 'Right'), ('b', ['a']))
check('collapse', solve('a', ['a','z'], {}, {'a':['b']}, 'Left'), ('a', ['z']))
check('parent', solve('b', [], {'b':'a'}, {}, 'Left'), ('a', []))
check('root', solve('a', [], {}, {}, 'Left'), ('a', []))
check('all', solve('a', ['a','z'], {}, {}, 'CollapseAll'), ('a', []))
check('parameterized child count', solve('a', [], {}, {'a':list(range(N))}, 'Right'), ('a',['a']))
for repetition in range(N):
    check('repeat all', solve('a', ['a','z'], {}, {}, 'CollapseAll'), ('a', []))
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
expand['a', ['a', 'z']]['a', ['a', 'z']]Passed
descend['b', ['a']]['b', ['a']]Passed
collapse['a', ['a', 'z']]['a', ['z']]Failed
parent['a', []]['a', []]Passed
root['a', []]['a', []]Passed
all['a', []]['a', []]Passed
parameterized child count['a', ['a']]['a', ['a']]Passed
repeat all['a', []]['a', []]Passed

SHA-256 / 2dc72109ef26af633f232dd8f37bf75121a12f0edcf3c526a09ac1bdaec12cde

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 8 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

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

Case digest / f5aaed029819b970649dc3389febc040f4a95473066c7088f7f9685169c3fc00