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

N = 1
observations = []
def solve(s):
    return {
        'capture': s['path'][:-1],
        'bubble': list(reversed(s['path'][:-1])) if s['bubbles'] else [],
        'target': s['path'][-1] if s['path'] else None,
        'next_node': not s['stopped'] and not s['immediate'],
        'siblings': 0 if s['immediate'] else s['siblings'],
        'default_prevented': s['prevented'] or (s['prevent'] and s['cancelable'] and not s['passive']),
        'default_run': not s['prevented'] and not(s['prevent'] and s['cancelable'] and not s['passive']),
        'current_target': s['current'],
        'path_copy': list(s['path']),
        'prevent_ignored': s['prevent'] and not s['cancelable'],
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 3, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 3, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': False, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 3, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 0, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': False, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': False}), ({'path': ['target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 3, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})], 2: [({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 6, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 6, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 6, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 6, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': False, 'prevented': False, 'siblings': 6, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 6, 'default_prevented': False, 'default_run': True, 'current_target': 'target', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': [], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': False, 'prevented': True, 'siblings': 6, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 6, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})], 3: [({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 9, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 9, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 9, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': True, 'prevented': False, 'siblings': 9, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['target'], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 0, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 9, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': True, 'prevented': False, 'siblings': 9, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 9, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})], 4: [({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 12, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 12, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 12, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': False, 'passive': True, 'prevent': False, 'prevented': True, 'siblings': 12, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 0, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': False, 'prevented': False, 'siblings': 12, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 12, 'default_prevented': False, 'default_run': True, 'current_target': 'target', 'path_copy': [], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': True, 'prevented': False, 'siblings': 12, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': [], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 12, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})], 5: [({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 15, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 15, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 15, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': False, 'prevented': False, 'siblings': 15, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 15, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': True, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 15, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': True, 'siblings': 15, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': ['target'], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': False, 'prevented': True, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': True, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 15, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})]}
for i,(state,expected) in enumerate(fixtures[N]):
    check("transition "+str(i), solve(state), 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(s):
    return {
        'capture': s['path'][:-1],
        'bubble': list(reversed(s['path'][:-1])) if s['bubbles'] else [],
        'target': s['path'][-1] if s['path'] else None,
        'next_node': not s['stopped'] and not s['immediate'],
        'siblings': 0 if s['immediate'] else s['siblings'],
        'default_prevented': s['prevented'] or (s['prevent'] and s['cancelable'] and not s['passive']),
        'default_run': not s['prevented'] and not(s['prevent'] and s['cancelable'] and not s['passive']),
        'current_target': s['current'],
        'path_copy': list(s['path']),
        'prevent_ignored': s['prevent'] and s['passive'],
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 3, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 3, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': False, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 3, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 0, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': False, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': False}), ({'path': ['target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 3, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})], 2: [({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 6, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 6, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 6, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 6, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': False, 'prevented': False, 'siblings': 6, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 6, 'default_prevented': False, 'default_run': True, 'current_target': 'target', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': [], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': False, 'prevented': True, 'siblings': 6, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 6, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})], 3: [({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 9, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 9, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 9, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': True, 'prevented': False, 'siblings': 9, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['target'], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 0, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 9, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': True, 'prevented': False, 'siblings': 9, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 9, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})], 4: [({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 12, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 12, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 12, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': False, 'passive': True, 'prevent': False, 'prevented': True, 'siblings': 12, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 0, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': False, 'prevented': False, 'siblings': 12, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 12, 'default_prevented': False, 'default_run': True, 'current_target': 'target', 'path_copy': [], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': True, 'prevented': False, 'siblings': 12, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': [], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 12, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})], 5: [({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': True, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': False, 'siblings': 15, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 15, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True}), ({'path': ['target'], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': False, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 15, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': True}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': False, 'cancelable': False, 'passive': True, 'prevent': False, 'prevented': False, 'siblings': 15, 'current': 'root'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 15, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': True, 'stopped': False, 'immediate': True, 'cancelable': True, 'passive': False, 'prevent': True, 'prevented': True, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': True, 'passive': False, 'prevent': False, 'prevented': True, 'siblings': 15, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': [], 'target': 'target', 'next_node': True, 'siblings': 15, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': False}), ({'path': ['target'], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': True, 'passive': True, 'prevent': False, 'prevented': True, 'siblings': 0, 'current': 'target'}, {'capture': [], 'bubble': [], 'target': 'target', 'next_node': True, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['target'], 'prevent_ignored': False}), ({'path': [], 'bubbles': False, 'stopped': False, 'immediate': False, 'cancelable': False, 'passive': False, 'prevent': False, 'prevented': False, 'siblings': 0, 'current': 'root'}, {'capture': [], 'bubble': [], 'target': None, 'next_node': True, 'siblings': 0, 'default_prevented': False, 'default_run': True, 'current_target': 'root', 'path_copy': [], 'prevent_ignored': False}), ({'path': ['root', 'middle', 'target'], 'bubbles': True, 'stopped': True, 'immediate': True, 'cancelable': True, 'passive': True, 'prevent': True, 'prevented': True, 'siblings': 15, 'current': 'target'}, {'capture': ['root', 'middle'], 'bubble': ['middle', 'root'], 'target': 'target', 'next_node': False, 'siblings': 0, 'default_prevented': True, 'default_run': False, 'current_target': 'target', 'path_copy': ['root', 'middle', 'target'], 'prevent_ignored': True})]}
for i,(state,expected) in enumerate(fixtures[N]):
    check("transition "+str(i), solve(state), 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:
Ignored prevent-default calls are not diagnosed for passive listeners; the returned lifecycle plan violates the stated transition contract.

A stipulated non-UI event path is root-to-target. Capture visits ancestors in that order; bubble visits ancestors in reverse only for bubbling events. Target is visited once. stopPropagation prevents later nodes but not sibling callbacks on the current node; stopImmediate prevents both. Only cancelable, nonpassive listeners may prevent the default action. A prior prevented marker is monotonic. Inputs are finite state snapshots, including transitional and stale states; output fields are the exact independent actions/metadata defined by the corrected expression table. Numeric fixture capacities and counts vary with N.
Field definitions, each independently computed from the input snapshot: capture = s['path'][:-1]; bubble = list(reversed(s['path'][:-1])) if s['bubbles'] else []; target = s['path'][-1] if s['path'] else None; next_node = not s['stopped'] and not s['immediate']; siblings = 0 if s['immediate'] else s['siblings']; default_prevented = s['prevented'] or (s['prevent'] and s['cancelable'] and not s['passive']); default_run = not s['prevented'] and not(s['prevent'] and s['cancelable'] and not s['passive']); current_target = s['current']; path_copy = list(s['path']); prevent_ignored = s['prevent'] and (s['passive'] or not s['cancelable'])

split: open-access


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

N = 1
observations = []
def solve(s):
    return {
        'continue': s['error'] is None,
        'cleanup': s['acquired'] and not s['cleanup_done'],
        'report': s['error'] is not None and not s['reported'] and (not s['handler'] or s['error']=='fatal'),
        'collected': list(s['errors'])+([s['error']] if s['error'] is not None else []),
        'handler_call': s['handler'] and s['error']=='recoverable',
        'value': s['result'] if s['error'] is None else None,
        'remaining': s['siblings'] if s['error']=='fatal' or (s['error'] is not None and s['failfast']) else 0,
        'active': s['active'] and s['error']!='fatal',
        'handled': s['handler'] and s['error']=='recoverable' and not s['failfast'],
        'fatal': s['error']=='fatal',
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': True, 'siblings': 3, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 3, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 3, 'result': 0, 'errors': [], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 3, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 0, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': True, 'cleanup': False, 'report': True, 'collected': ['earlier', 'recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'recoverable', 'failfast': True, 'handler': False, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 0, 'result': None, 'errors': ['earlier'], 'active': False}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['earlier', 'recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': False, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': False, 'siblings': 0, 'result': 'ok', 'errors': [], 'active': False}, {'continue': True, 'cleanup': True, 'report': False, 'collected': [], 'handler_call': False, 'value': 'ok', 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 3, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 3, 'active': False, 'handled': False, 'fatal': True})], 2: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 6, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 6, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 6, 'result': None, 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 6, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': False, 'acquired': True, 'cleanup_done': False, 'siblings': 6, 'result': 0, 'errors': ['earlier'], 'active': False}, {'continue': True, 'cleanup': True, 'report': True, 'collected': ['earlier', 'recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 0, 'result': None, 'errors': ['earlier'], 'active': False}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': 0, 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': True, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': True, 'siblings': 0, 'result': 0, 'errors': [], 'active': False}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 6, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 6, 'active': False, 'handled': False, 'fatal': True})], 3: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': False, 'siblings': 9, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 9, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 9, 'result': 'ok', 'errors': [], 'active': True}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 9, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 0, 'result': 'ok', 'errors': [], 'active': False}, {'continue': True, 'cleanup': True, 'report': False, 'collected': ['recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 9, 'result': 'ok', 'errors': [], 'active': False}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 9, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': True, 'siblings': 9, 'result': None, 'errors': ['earlier'], 'active': False}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 9, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': True, 'siblings': 0, 'result': 0, 'errors': [], 'active': True}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': True}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 9, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 9, 'active': False, 'handled': False, 'fatal': True})], 4: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': False, 'siblings': 12, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 12, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 12, 'result': 0, 'errors': [], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 12, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 0, 'result': 'ok', 'errors': [], 'active': True}, {'continue': True, 'cleanup': False, 'report': False, 'collected': ['recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': False, 'siblings': 12, 'result': 'ok', 'errors': ['earlier'], 'active': False}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 12, 'active': False, 'handled': False, 'fatal': True}), ({'error': None, 'failfast': True, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 12, 'result': 'ok', 'errors': [], 'active': True}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': 'ok', 'remaining': 0, 'active': True, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': True, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': True, 'siblings': 12, 'result': 0, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': 0, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 12, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 12, 'active': False, 'handled': False, 'fatal': True})], 5: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 15, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 15, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 15, 'result': None, 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 15, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': True}, {'continue': True, 'cleanup': True, 'report': False, 'collected': ['recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': True, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': True, 'handler': False, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 0, 'result': 'ok', 'errors': ['earlier'], 'active': False}, {'continue': True, 'cleanup': True, 'report': False, 'collected': ['earlier'], 'handler_call': False, 'value': 'ok', 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'recoverable', 'failfast': False, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': True, 'siblings': 15, 'result': 0, 'errors': ['earlier'], 'active': True}, {'continue': True, 'cleanup': False, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 0, 'active': True, 'handled': True, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': True, 'siblings': 15, 'result': 0, 'errors': [], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 15, 'active': False, 'handled': False, 'fatal': True}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 15, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 15, 'active': False, 'handled': False, 'fatal': True})]}
for i,(state,expected) in enumerate(fixtures[N]):
    check("transition "+str(i), solve(state), 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(s):
    return {
        'continue': not s['failfast'],
        'cleanup': s['acquired'] and not s['cleanup_done'],
        'report': s['error'] is not None and not s['reported'] and (not s['handler'] or s['error']=='fatal'),
        'collected': list(s['errors'])+([s['error']] if s['error'] is not None else []),
        'handler_call': s['handler'] and s['error']=='recoverable',
        'value': s['result'] if s['error'] is None else None,
        'remaining': s['siblings'] if s['error']=='fatal' or (s['error'] is not None and s['failfast']) else 0,
        'active': s['active'] and s['error']!='fatal',
        'handled': s['handler'] and s['error']=='recoverable' and not s['failfast'],
        'fatal': s['error']=='fatal',
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': True, 'siblings': 3, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 3, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 3, 'result': 0, 'errors': [], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 3, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 0, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': True, 'cleanup': False, 'report': True, 'collected': ['earlier', 'recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'recoverable', 'failfast': True, 'handler': False, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 0, 'result': None, 'errors': ['earlier'], 'active': False}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['earlier', 'recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': False, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': False, 'siblings': 0, 'result': 'ok', 'errors': [], 'active': False}, {'continue': True, 'cleanup': True, 'report': False, 'collected': [], 'handler_call': False, 'value': 'ok', 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 3, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 3, 'active': False, 'handled': False, 'fatal': True})], 2: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 6, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 6, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 6, 'result': None, 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 6, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': False, 'acquired': True, 'cleanup_done': False, 'siblings': 6, 'result': 0, 'errors': ['earlier'], 'active': False}, {'continue': True, 'cleanup': True, 'report': True, 'collected': ['earlier', 'recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 0, 'result': None, 'errors': ['earlier'], 'active': False}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': 0, 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': True, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': True, 'siblings': 0, 'result': 0, 'errors': [], 'active': False}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 6, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 6, 'active': False, 'handled': False, 'fatal': True})], 3: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': False, 'siblings': 9, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 9, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 9, 'result': 'ok', 'errors': [], 'active': True}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 9, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 0, 'result': 'ok', 'errors': [], 'active': False}, {'continue': True, 'cleanup': True, 'report': False, 'collected': ['recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 9, 'result': 'ok', 'errors': [], 'active': False}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 9, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': True, 'siblings': 9, 'result': None, 'errors': ['earlier'], 'active': False}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 9, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': True, 'siblings': 0, 'result': 0, 'errors': [], 'active': True}, {'continue': False, 'cleanup': False, 'report': True, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': True}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 9, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 9, 'active': False, 'handled': False, 'fatal': True})], 4: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': False, 'siblings': 12, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 12, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 12, 'result': 0, 'errors': [], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 12, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 0, 'result': 'ok', 'errors': [], 'active': True}, {'continue': True, 'cleanup': False, 'report': False, 'collected': ['recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': False, 'siblings': 12, 'result': 'ok', 'errors': ['earlier'], 'active': False}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 12, 'active': False, 'handled': False, 'fatal': True}), ({'error': None, 'failfast': True, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 12, 'result': 'ok', 'errors': [], 'active': True}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': 'ok', 'remaining': 0, 'active': True, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': True, 'handler': True, 'reported': False, 'acquired': False, 'cleanup_done': True, 'siblings': 12, 'result': 0, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': 0, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 12, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 12, 'active': False, 'handled': False, 'fatal': True})], 5: [({'error': 'recoverable', 'failfast': True, 'handler': True, 'reported': False, 'acquired': True, 'cleanup_done': True, 'siblings': 15, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 15, 'active': True, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 15, 'result': None, 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': True, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 15, 'active': False, 'handled': False, 'fatal': True}), ({'error': 'recoverable', 'failfast': False, 'handler': False, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': True}, {'continue': True, 'cleanup': True, 'report': False, 'collected': ['recoverable'], 'handler_call': False, 'value': None, 'remaining': 0, 'active': True, 'handled': False, 'fatal': False}), ({'error': None, 'failfast': True, 'handler': False, 'reported': True, 'acquired': True, 'cleanup_done': False, 'siblings': 0, 'result': 'ok', 'errors': ['earlier'], 'active': False}, {'continue': True, 'cleanup': True, 'report': False, 'collected': ['earlier'], 'handler_call': False, 'value': 'ok', 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'recoverable', 'failfast': False, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': True, 'siblings': 15, 'result': 0, 'errors': ['earlier'], 'active': True}, {'continue': True, 'cleanup': False, 'report': False, 'collected': ['earlier', 'recoverable'], 'handler_call': True, 'value': None, 'remaining': 0, 'active': True, 'handled': True, 'fatal': False}), ({'error': 'fatal', 'failfast': False, 'handler': True, 'reported': True, 'acquired': False, 'cleanup_done': True, 'siblings': 15, 'result': 0, 'errors': [], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['fatal'], 'handler_call': False, 'value': None, 'remaining': 15, 'active': False, 'handled': False, 'fatal': True}), ({'error': None, 'failfast': False, 'handler': False, 'reported': False, 'acquired': False, 'cleanup_done': False, 'siblings': 0, 'result': None, 'errors': [], 'active': False}, {'continue': True, 'cleanup': False, 'report': False, 'collected': [], 'handler_call': False, 'value': None, 'remaining': 0, 'active': False, 'handled': False, 'fatal': False}), ({'error': 'fatal', 'failfast': True, 'handler': True, 'reported': True, 'acquired': True, 'cleanup_done': True, 'siblings': 15, 'result': 'ok', 'errors': ['earlier'], 'active': True}, {'continue': False, 'cleanup': False, 'report': False, 'collected': ['earlier', 'fatal'], 'handler_call': False, 'value': None, 'remaining': 15, 'active': False, 'handled': False, 'fatal': True})]}
for i,(state,expected) in enumerate(fixtures[N]):
    check("transition "+str(i), solve(state), 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:
Recoverable callback errors abort unrelated observer callbacks; the returned lifecycle plan violates the stated transition contract.

Plan callback failure handling. Recoverable callback errors are collected and sibling callbacks continue unless fail-fast was selected. Fatal failures stop immediately. Cleanup always runs for acquired callback resources. Report an unhandled error once; a configured error listener consumes a recoverable error. A callback return value remains distinct from an exception. Inputs are finite state snapshots, including transitional and stale states; output fields are the exact independent actions/metadata defined by the corrected expression table. Numeric fixture capacities and counts vary with N.
Field definitions, each independently computed from the input snapshot: continue = s['error']!='fatal' and not(s['error'] is not None and s['failfast']); cleanup = s['acquired'] and not s['cleanup_done']; report = s['error'] is not None and not s['reported'] and (not s['handler'] or s['error']=='fatal'); collected = list(s['errors'])+([s['error']] if s['error'] is not None else []); handler_call = s['handler'] and s['error']=='recoverable'; value = s['result'] if s['error'] is None else None; remaining = s['siblings'] if s['error']=='fatal' or (s['error'] is not None and s['failfast']) else 0; active = s['active'] and s['error']!='fatal'; handled = s['handler'] and s['error']=='recoverable' and not s['failfast']; fatal = s['error']=='fatal'

split: open-access