FAILURE MAP
← Case archive

FA-38541 / Tree accessibility / Open access

Persisted hierarchical expansion restoration: Expansion snapshot crosses a tree instance boundary · case 01

Expansion snapshot crosses a tree instance boundary produces the wrong hierarchical widget state in a regression fixture.

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

ROOT CAUSE

The expansion-restore contract is violated at `d['saved_tree']==d['tree']` by replacing it with `True`.

THE FAILURE

The expansion-restore contract is violated at `d['saved_tree']==d['tree']` by replacing it with `True`.

Unsuccessful approach: The partial repair `False` still violates a boundary or preservation case.

Case contract

Only present branch IDs may be restored. Ancestors of restored open branches are opened unless explicitly blocked. Selection and focus restore independently: selection keeps present enabled rows; hidden focus falls back to nearest visible ancestor. The persisted root instance must match.

Why this case matters

Offline executable model of a hierarchical accessibility interaction; inputs are bounded and valid as stipulated. No browser, assistive technology, or normative ARIA conformance is claimed.

1 / The failure

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

N = 1
observations = []
def solve(d):
    valid=True
    wanted=set(d['saved_open']) if valid else set()
    branches=wanted & set(d['branches'])
    ancestors={a for x in branches for a in d['ancestors'].get(x,[])}
    expanded=(branches|ancestors)-set(d['blocked'])
    selected=[x for x in d['saved_selected'] if valid and x in d['present'] and x not in d['disabled']]
    visible=[x for x in d['present'] if all(a in expanded for a in d['ancestors'].get(x,[]))]
    candidate=d['saved_focus'] if valid else None
    fallback=next((a for a in reversed(d['ancestors'].get(candidate,[])) if a in visible),None)
    focus=candidate if candidate in visible else (fallback if fallback is not None else (visible[0] if visible else None))
    return [sorted(expanded),selected,visible,focus]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0'], 'leaf'])], 2: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1'], 'leaf'])], 3: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2'], 'leaf'])], 4: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2', 'v3'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2', 'v3'], 'leaf'])], 5: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2', 'v3', 'v4'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2', 'v3', 'v4'], 'leaf'])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
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
deep saved[['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf'][['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']Passed
deep branch alone[['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf'][['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']Passed
foreign snapshot[['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'other'][[], [], ['r', 'other'], 'r']Failed
blocked middle[['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b'][['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']Passed
blocked root[['a', 'b'], ['leaf'], ['r', 'other'], 'r'][['a', 'b'], ['leaf'], ['r', 'other'], 'r']Passed
no saved branch[[], ['leaf'], ['r', 'other'], 'r'][[], ['leaf'], ['r', 'other'], 'r']Passed
missing focus[['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r'][['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']Passed
deep varying chain[['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0'], 'leaf'][['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0'], 'leaf']Passed

SHA-256 / 7a482ae59ae9f6f86405dd64490d97d15cf37656ea45dafcfcd0ac1d3009c02f

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    valid=False
    wanted=set(d['saved_open']) if valid else set()
    branches=wanted & set(d['branches'])
    ancestors={a for x in branches for a in d['ancestors'].get(x,[])}
    expanded=(branches|ancestors)-set(d['blocked'])
    selected=[x for x in d['saved_selected'] if valid and x in d['present'] and x not in d['disabled']]
    visible=[x for x in d['present'] if all(a in expanded for a in d['ancestors'].get(x,[]))]
    candidate=d['saved_focus'] if valid else None
    fallback=next((a for a in reversed(d['ancestors'].get(candidate,[])) if a in visible),None)
    focus=candidate if candidate in visible else (fallback if fallback is not None else (visible[0] if visible else None))
    return [sorted(expanded),selected,visible,focus]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0'], 'leaf'])], 2: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1'], 'leaf'])], 3: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2'], 'leaf'])], 4: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2', 'v3'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2', 'v3'], 'leaf'])], 5: [('deep saved', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('deep branch alone', {'saved_tree': 't', 'tree': 't', 'saved_open': ['b'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']), ('foreign snapshot', {'saved_tree': 'other', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'other'}, [[], [], ['r', 'other'], 'r']), ('blocked middle', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['b'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']), ('blocked root', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': ['r'], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b'], ['leaf'], ['r', 'other'], 'r']), ('no saved branch', {'saved_tree': 't', 'tree': 't', 'saved_open': [], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [[], ['leaf'], ['r', 'other'], 'r']), ('missing focus', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf', 'gone', 'a'], 'present': ['r', 'a', 'b', 'leaf', 'other'], 'disabled': ['a'], 'saved_focus': 'gone'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']), ('deep varying chain', {'saved_tree': 't', 'tree': 't', 'saved_open': ['a', 'b', 'leaf', 'gone'], 'branches': ['r', 'a', 'b'], 'ancestors': {'r': [], 'a': ['r'], 'b': ['r', 'a'], 'leaf': ['r', 'a', 'b'], 'other': []}, 'blocked': [], 'saved_selected': ['leaf'], 'present': ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2', 'v3', 'v4'], 'disabled': ['a'], 'saved_focus': 'leaf'}, [['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0', 'v1', 'v2', 'v3', 'v4'], 'leaf'])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
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
deep saved[[], [], ['r', 'other'], 'r'][['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']Failed
deep branch alone[[], [], ['r', 'other'], 'r'][['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'leaf']Failed
foreign snapshot[[], [], ['r', 'other'], 'r'][[], [], ['r', 'other'], 'r']Passed
blocked middle[[], [], ['r', 'other'], 'r'][['a', 'r'], ['leaf'], ['r', 'a', 'b', 'other'], 'b']Failed
blocked root[[], [], ['r', 'other'], 'r'][['a', 'b'], ['leaf'], ['r', 'other'], 'r']Failed
no saved branch[[], [], ['r', 'other'], 'r'][[], ['leaf'], ['r', 'other'], 'r']Failed
missing focus[[], [], ['r', 'other'], 'r'][['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other'], 'r']Failed
deep varying chain[[], [], ['r', 'other', 'v0'], 'r'][['a', 'b', 'r'], ['leaf'], ['r', 'a', 'b', 'leaf', 'other', 'v0'], 'leaf']Failed

SHA-256 / db355c8a52434f1a85418f3cb9562103bd5bea9b0b3560e22e0721ce3e6fabe6

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

Synthetic deterministic hierarchical-widget data contract; not an implementation of a browser accessibility tree. 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:43:12.726576+00:00.

Case digest / 6945b1c2c26cb1592bc2aa7dc1a0cd4e1672fdf5d29b22d92a0f34350ba084c1