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

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'forwarding': ['old'] if phase=='usable' else [], 'advertised': ['old'] if phase=='usable' else [], 'checks': 0, 'liveness': seed, 'withdrawals': 0}
    frames = []
    observed = []
    table = {('unknown', 'announce'): ('usable', 'install'), ('candidate', 'loop_free'): ('usable', 'install'), ('candidate', 'loop_detected'): ('rejected', 'suppress'), ('usable', 'withdraw'): ('withdrawn', 'remove_and_propagate'), ('withdrawn', 'stale_announce'): ('withdrawn', 'suppress'), ('usable', 'newer_announce'): ('candidate', 'hold_validate'), ('usable', 'neighbor_down'): ('unreachable', 'invalidate'), ('unreachable', 'neighbor_up'): ('unknown', 'request_refresh'), ('rejected', 'corrected_announce'): ('candidate', 'check_path'), ('usable', 'duplicate_announce'): ('usable', 'refresh_liveness')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'check_path':
            r['checks']+=1
        elif action == 'install':
            r['forwarding']=['candidate']
        elif action == 'suppress':
            frames.append(['REJECT_PATH',payload])
        elif action == 'remove_and_propagate':
            r['forwarding']=[]; r['advertised']=[]; r['withdrawals']+=1
        elif action == 'hold_validate':
            r['checks']+=1
        elif action == 'invalidate':
            r['forwarding']=[]; r['advertised']=[]
        elif action == 'request_refresh':
            frames.append(['REQUEST_ROUTES',seed])
        elif action == 'refresh_liveness':
            r['liveness']=seed+len(payload)
        elif action == 'advertise_only':
            r['advertised']=['candidate']
        elif action == 'advertise':
            r['advertised']=['candidate']
        elif action == 'remove_only':
            r['forwarding']=[]
        elif action == 'remove_immediately':
            r['forwarding']=[]; r['checks']+=1
        elif action == 'install_cached':
            r['forwarding']=['old']
        elif action == 'reinstall':
            r['forwarding']=['candidate']; r['withdrawals']+=1
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 1]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]], ['REJECT_PATH', [1, 2, 3]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [1, 2, 3]], ['REJECT_PATH', [1, 2, 3]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 2]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 6, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 6, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 6, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 6, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 6, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 6, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 3]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 8, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce', 'loop_detected'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 8, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 4]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 10, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 4, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 10, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 5]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 12, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce', 'loop_detected'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 4, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 4, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 12, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), 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(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'forwarding': ['old'] if phase=='usable' else [], 'advertised': ['old'] if phase=='usable' else [], 'checks': 0, 'liveness': seed, 'withdrawals': 0}
    frames = []
    observed = []
    table = {('unknown', 'announce'): ('unknown', 'ignore'), ('candidate', 'loop_free'): ('usable', 'install'), ('candidate', 'loop_detected'): ('rejected', 'suppress'), ('usable', 'withdraw'): ('withdrawn', 'remove_and_propagate'), ('withdrawn', 'stale_announce'): ('withdrawn', 'suppress'), ('usable', 'newer_announce'): ('candidate', 'hold_validate'), ('usable', 'neighbor_down'): ('unreachable', 'invalidate'), ('unreachable', 'neighbor_up'): ('unknown', 'request_refresh'), ('rejected', 'corrected_announce'): ('candidate', 'check_path'), ('usable', 'duplicate_announce'): ('usable', 'refresh_liveness')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'check_path':
            r['checks']+=1
        elif action == 'install':
            r['forwarding']=['candidate']
        elif action == 'suppress':
            frames.append(['REJECT_PATH',payload])
        elif action == 'remove_and_propagate':
            r['forwarding']=[]; r['advertised']=[]; r['withdrawals']+=1
        elif action == 'hold_validate':
            r['checks']+=1
        elif action == 'invalidate':
            r['forwarding']=[]; r['advertised']=[]
        elif action == 'request_refresh':
            frames.append(['REQUEST_ROUTES',seed])
        elif action == 'refresh_liveness':
            r['liveness']=seed+len(payload)
        elif action == 'advertise_only':
            r['advertised']=['candidate']
        elif action == 'advertise':
            r['advertised']=['candidate']
        elif action == 'remove_only':
            r['forwarding']=[]
        elif action == 'remove_immediately':
            r['forwarding']=[]; r['checks']+=1
        elif action == 'install_cached':
            r['forwarding']=['old']
        elif action == 'reinstall':
            r['forwarding']=['candidate']; r['withdrawals']+=1
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 1]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 1, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [1, 2, 3]], ['REJECT_PATH', [1, 2, 3]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [1, 2, 3]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [1, 2, 3]], ['REJECT_PATH', [1, 2, 3]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 1, 'withdrawals': 0}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 2]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 6, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 2, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 6, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 6, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 6, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 6, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 6, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]], ['REJECT_PATH', [2, 3, 4, 5]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 2, 'withdrawals': 0}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 3]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 8, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce', 'loop_detected'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 3, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 8, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 8, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]], ['REJECT_PATH', [3, 4, 5, 6, 7]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 3, 'withdrawals': 0}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 4]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 10, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 4, 'liveness': 4, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 10, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 10, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]], ['REJECT_PATH', [4, 5, 6, 7, 8, 9]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 4, 'withdrawals': 0}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('unknown/announce', 'unknown', ['announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_free', 'candidate', ['loop_free'], [{'phase': 'usable', 'registers': {'forwarding': ['candidate'], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('candidate/loop_detected', 'candidate', ['loop_detected'], [{'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}]), ('usable/withdraw', 'usable', ['withdraw'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 1}, 'frames': []}]), ('withdrawn/stale_announce', 'withdrawn', ['stale_announce'], [{'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}]), ('usable/newer_announce', 'usable', ['newer_announce'], [{'phase': 'candidate', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('usable/neighbor_down', 'usable', ['neighbor_down'], [{'phase': 'unreachable', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('unreachable/neighbor_up', 'unreachable', ['neighbor_up'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REQUEST_ROUTES', 5]]}]), ('rejected/corrected_announce', 'rejected', ['corrected_announce'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': []}]), ('usable/duplicate_announce', 'usable', ['duplicate_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 12, 'withdrawals': 0}, 'frames': []}]), ('ordered trace 0', 'unknown', ['announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce', 'loop_detected', 'corrected_announce', 'loop_detected'], [{'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': []}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 1, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 2, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 3, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'candidate', 'registers': {'forwarding': [], 'advertised': [], 'checks': 4, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'rejected', 'registers': {'forwarding': [], 'advertised': [], 'checks': 4, 'liveness': 5, 'withdrawals': 0}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}]), ('ordered trace 3', 'usable', ['duplicate_announce', 'withdraw', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce', 'stale_announce'], [{'phase': 'usable', 'registers': {'forwarding': ['old'], 'advertised': ['old'], 'checks': 0, 'liveness': 12, 'withdrawals': 0}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': []}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'withdrawn', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 12, 'withdrawals': 1}, 'frames': [['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]], ['REJECT_PATH', [5, 6, 7, 8, 9, 10, 11]]]}]), ('empty input', 'unknown', [], []), ('unknown event', 'unknown', ['unsupported'], [{'phase': 'unknown', 'registers': {'forwarding': [], 'advertised': [], 'checks': 0, 'liveness': 5, 'withdrawals': 0}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), 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:
While unknown, event announce produces usable/install instead of candidate/check_path.

For the stipulated Route advertisement lifecycle controller, initialize the explicitly shown resource registers from seed (1..5), then consume classified events sequentially. After each event return a deep snapshot of phase, resource registers, and cumulative emitted control frames. The explicit ten phase/event rules and their resource effects define admission and response semantics. Unlisted events preserve phase and emit rejection. Payload is the consecutive integers seed through 2*seed+1. Empty event input returns no observations.

split: open-access