broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    nearest=next((x[1] for x in d['path'] if x[0]=='tree'),None)
    owned=nearest==d['tree']
    row=next((x[1] for x in reversed(d['path']) if x[0]=='row'),None)
    editor=any(x[0]=='editor' for x in d['path'][:next((i for i,x in enumerate(d['path']) if x[0]=='row'),len(d['path']))])
    already=d['handled']
    command=owned and row in d['rows'] and not already and not editor
    activate=command and d['event']=='activate' and row not in d['disabled']
    inspect=command and d['event']=='inspect'
    stop=command and (activate or inspect)
    focus=row if activate else d['focus']
    return [owned,row,editor,activate,inspect,stop,focus]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 2: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 3: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 4: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 5: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])]}
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    nearest=next((x[1] for x in d['path'] if x[0]=='tree'),None)
    owned=nearest==d['tree']
    row=d['rows'][0] if d['rows'] else None
    editor=any(x[0]=='editor' for x in d['path'][:next((i for i,x in enumerate(d['path']) if x[0]=='row'),len(d['path']))])
    already=d['handled']
    command=owned and row in d['rows'] and not already and not editor
    activate=command and d['event']=='activate' and row not in d['disabled']
    inspect=command and d['event']=='inspect'
    stop=command and (activate or inspect)
    focus=row if activate else d['focus']
    return [owned,row,editor,activate,inspect,stop,focus]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 2: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 3: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 4: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 5: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])]}
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)

prompt:
Event uses ancestor row instead of innermost row produces the wrong hierarchical widget state in a regression fixture.

A nested tree handles row events only for its nearest owning tree. Composed event paths may contain row editors and embedded widgets. Editing-origin keys remain with the editor; handled child-tree events do not bubble into ancestor tree commands. Disabled rows suppress activation but still permit context inspection.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    nearest=next((x[1] for x in d['path'] if x[0]=='tree'),None)
    owned=nearest==d['tree']
    row=next((x[1] for x in d['path'] if x[0]=='row'),None)
    editor=any(x[0]=='editor' for x in d['path'])
    already=d['handled']
    command=owned and row in d['rows'] and not already and not editor
    activate=command and d['event']=='activate' and row not in d['disabled']
    inspect=command and d['event']=='inspect'
    stop=command and (activate or inspect)
    focus=row if activate else d['focus']
    return [owned,row,editor,activate,inspect,stop,focus]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 2: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 3: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 4: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 5: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])]}
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    nearest=next((x[1] for x in d['path'] if x[0]=='tree'),None)
    owned=nearest==d['tree']
    row=next((x[1] for x in d['path'] if x[0]=='row'),None)
    editor=any(x[0]=='editor' for x in [])
    already=d['handled']
    command=owned and row in d['rows'] and not already and not editor
    activate=command and d['event']=='activate' and row not in d['disabled']
    inspect=command and d['event']=='inspect'
    stop=command and (activate or inspect)
    focus=row if activate else d['focus']
    return [owned,row,editor,activate,inspect,stop,focus]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 2: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 3: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 4: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 5: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])]}
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)

prompt:
Editor boundary is scanned outside the owning row produces the wrong hierarchical widget state in a regression fixture.

A nested tree handles row events only for its nearest owning tree. Composed event paths may contain row editors and embedded widgets. Editing-origin keys remain with the editor; handled child-tree events do not bubble into ancestor tree commands. Disabled rows suppress activation but still permit context inspection.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    nearest=next((x[1] for x in d['path'] if x[0]=='tree'),None)
    owned=nearest==d['tree']
    row=next((x[1] for x in d['path'] if x[0]=='row'),None)
    editor=any(x[0]=='editor' for x in d['path'][:next((i for i,x in enumerate(d['path']) if x[0]=='row'),len(d['path']))])
    already=False
    command=owned and row in d['rows'] and not already and not editor
    activate=command and d['event']=='activate' and row not in d['disabled']
    inspect=command and d['event']=='inspect'
    stop=command and (activate or inspect)
    focus=row if activate else d['focus']
    return [owned,row,editor,activate,inspect,stop,focus]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 2: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 3: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 4: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 5: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])]}
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    nearest=next((x[1] for x in d['path'] if x[0]=='tree'),None)
    owned=nearest==d['tree']
    row=next((x[1] for x in d['path'] if x[0]=='row'),None)
    editor=any(x[0]=='editor' for x in d['path'][:next((i for i,x in enumerate(d['path']) if x[0]=='row'),len(d['path']))])
    already=True
    command=owned and row in d['rows'] and not already and not editor
    activate=command and d['event']=='activate' and row not in d['disabled']
    inspect=command and d['event']=='inspect'
    stop=command and (activate or inspect)
    focus=row if activate else d['focus']
    return [owned,row,editor,activate,inspect,stop,focus]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 2: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 3: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 4: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])], 5: [('inner activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('outer listener', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'outer', 'rows': ['outerrow'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [False, 'b', False, False, False, False, 'a']), ('editor origin', {'path': [['editor', 'e'], ['row', 'b'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', True, False, False, False, 'a']), ('editor outside row', {'path': [['row', 'b'], ['editor', 'outer'], ['tree', 'inner']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, True, False, True, 'b']), ('handled child', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': True, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled activation', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'activate', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('disabled inspect', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'inspect', 'disabled': ['b'], 'focus': 'a'}, [True, 'b', False, False, True, True, 'a']), ('unregistered row', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a'], 'handled': False, 'event': 'activate', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a']), ('other event', {'path': [['row', 'b'], ['tree', 'inner'], ['row', 'outerrow'], ['tree', 'outer']], 'tree': 'inner', 'rows': ['a', 'b', 'v0', 'v1', 'v2', 'v3', 'v4'], 'handled': False, 'event': 'hover', 'disabled': [], 'focus': 'a'}, [True, 'b', False, False, False, False, 'a'])]}
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)

prompt:
Previously handled nested event is processed twice produces the wrong hierarchical widget state in a regression fixture.

A nested tree handles row events only for its nearest owning tree. Composed event paths may contain row editors and embedded widgets. Editing-origin keys remain with the editor; handled child-tree events do not bubble into ancestor tree commands. Disabled rows suppress activation but still permit context inspection.

split: open-access