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 = {'agreed': seed, 'latest': seed+1, 'enabled': phase=='ready', 'definitions': [], 'decoded': [], 'queued': []}
    frames = []
    observed = []
    table = {('unset', 'describe'): ('ready', 'send_records'), ('described', 'known_schema'): ('ready', 'ack_schema'), ('described', 'unknown_schema'): ('defining', 'send_definition'), ('defining', 'definition_accepted'): ('ready', 'enable_records'), ('defining', 'definition_rejected'): ('failed', 'stop_records'), ('ready', 'schema_change'): ('described', 'pause_describe'), ('ready', 'record'): ('ready', 'decode_agreed'), ('unset', 'record'): ('unset', 'reject_untyped'), ('failed', 'fresh_description'): ('described', 'send_schema_id'), ('ready', 'duplicate_definition'): ('ready', 'ack_existing')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_schema_id':
            frames.append(['SCHEMA_ID',seed])
        elif action == 'ack_schema':
            r['enabled']=True; frames.append(['SCHEMA_OK',seed])
        elif action == 'send_definition':
            r['definitions'].append(seed); frames.append(['DEFINITION',seed,payload])
        elif action == 'enable_records':
            r['enabled']=True
        elif action == 'stop_records':
            r['enabled']=False
        elif action == 'pause_describe':
            r['enabled']=False; frames.append(['SCHEMA_ID',seed+1])
        elif action == 'decode_agreed':
            r['decoded'].append([r['agreed'],payload])
        elif action == 'reject_untyped':
            frames.append(['UNTYPED',payload])
        elif action == 'ack_existing':
            frames.append(['SCHEMA_OK',r['agreed']])
        elif action == 'send_records':
            frames.append(['RECORD',seed,payload])
        elif action == 'send_id_only':
            frames.append(['SCHEMA_ID',seed])
        elif action == 'resend_definition':
            r['definitions'].append(seed); frames.append(['DEFINITION',seed,payload])
        elif action == 'describe_without_pause':
            frames.append(['SCHEMA_ID',seed+1]); r['enabled']=True
        elif action == 'decode_latest':
            r['decoded'].append([r['latest'],payload])
        elif action == 'decode_default':
            r['decoded'].append([0,payload])
        elif action == 'buffer_unbounded':
            r['queued'].extend(payload)
        elif action == 'replace_schema':
            r['agreed']=r['latest']
        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: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 1]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 1, [1, 2, 3]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [], 'decoded': [[1, [1, 2, 3]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [1, 2, 3]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 1]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change'], [{'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1]]}, {'phase': 'defining', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]]]}, {'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]]]}, {'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]], ['SCHEMA_ID', 2]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted'], [{'phase': 'failed', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1]]}, {'phase': 'defining', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]]]}, {'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 2]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 2, [2, 3, 4, 5]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [], 'decoded': [[2, [2, 3, 4, 5]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [2, 3, 4, 5]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 2]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change', 'known_schema'], [{'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}, {'phase': 'defining', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}, {'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}, {'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]], ['SCHEMA_ID', 3]]}, {'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]], ['SCHEMA_ID', 3], ['SCHEMA_OK', 2]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted', 'record'], [{'phase': 'failed', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}, {'phase': 'defining', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}, {'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}, {'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [2], 'decoded': [[2, [2, 3, 4, 5]]], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 3]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 3, [3, 4, 5, 6, 7]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [], 'decoded': [[3, [3, 4, 5, 6, 7]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [3, 4, 5, 6, 7]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 3]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change', 'known_schema', 'duplicate_definition'], [{'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}, {'phase': 'defining', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]], ['SCHEMA_ID', 4]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]], ['SCHEMA_ID', 4], ['SCHEMA_OK', 3]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]], ['SCHEMA_ID', 4], ['SCHEMA_OK', 3], ['SCHEMA_OK', 3]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted', 'record', 'duplicate_definition'], [{'phase': 'failed', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}, {'phase': 'defining', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [[3, [3, 4, 5, 6, 7]]], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [[3, [3, 4, 5, 6, 7]]], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]], ['SCHEMA_OK', 3]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 4]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [], 'decoded': [[4, [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [4, 5, 6, 7, 8, 9]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 4]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change', 'known_schema', 'duplicate_definition', 'schema_change'], [{'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}, {'phase': 'defining', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_ID', 5]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_ID', 5], ['SCHEMA_OK', 4]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_ID', 5], ['SCHEMA_OK', 4], ['SCHEMA_OK', 4]]}, {'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_ID', 5], ['SCHEMA_OK', 4], ['SCHEMA_OK', 4], ['SCHEMA_ID', 5]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted', 'record', 'duplicate_definition', 'schema_change'], [{'phase': 'failed', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}, {'phase': 'defining', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [[4, [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [[4, [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_OK', 4]]}, {'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [[4, [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_OK', 4], ['SCHEMA_ID', 5]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 5]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 6]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [5, 6, 7, 8, 9, 10, 11]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 5]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change', 'known_schema', 'duplicate_definition', 'schema_change', 'unknown_schema'], [{'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}, {'phase': 'defining', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5], ['SCHEMA_OK', 5]]}, {'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5], ['SCHEMA_OK', 5], ['SCHEMA_ID', 6]]}, {'phase': 'defining', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5, 5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5], ['SCHEMA_OK', 5], ['SCHEMA_ID', 6], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted', 'record', 'duplicate_definition', 'schema_change', 'known_schema'], [{'phase': 'failed', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}, {'phase': 'defining', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_OK', 5]]}, {'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_OK', 5], ['SCHEMA_ID', 6]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_OK', 5], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, '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 = {'agreed': seed, 'latest': seed+1, 'enabled': phase=='ready', 'definitions': [], 'decoded': [], 'queued': []}
    frames = []
    observed = []
    table = {('unset', 'describe'): ('unset', 'send_records'), ('described', 'known_schema'): ('ready', 'ack_schema'), ('described', 'unknown_schema'): ('defining', 'send_definition'), ('defining', 'definition_accepted'): ('ready', 'enable_records'), ('defining', 'definition_rejected'): ('failed', 'stop_records'), ('ready', 'schema_change'): ('described', 'pause_describe'), ('ready', 'record'): ('ready', 'decode_agreed'), ('unset', 'record'): ('unset', 'reject_untyped'), ('failed', 'fresh_description'): ('described', 'send_schema_id'), ('ready', 'duplicate_definition'): ('ready', 'ack_existing')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_schema_id':
            frames.append(['SCHEMA_ID',seed])
        elif action == 'ack_schema':
            r['enabled']=True; frames.append(['SCHEMA_OK',seed])
        elif action == 'send_definition':
            r['definitions'].append(seed); frames.append(['DEFINITION',seed,payload])
        elif action == 'enable_records':
            r['enabled']=True
        elif action == 'stop_records':
            r['enabled']=False
        elif action == 'pause_describe':
            r['enabled']=False; frames.append(['SCHEMA_ID',seed+1])
        elif action == 'decode_agreed':
            r['decoded'].append([r['agreed'],payload])
        elif action == 'reject_untyped':
            frames.append(['UNTYPED',payload])
        elif action == 'ack_existing':
            frames.append(['SCHEMA_OK',r['agreed']])
        elif action == 'send_records':
            frames.append(['RECORD',seed,payload])
        elif action == 'send_id_only':
            frames.append(['SCHEMA_ID',seed])
        elif action == 'resend_definition':
            r['definitions'].append(seed); frames.append(['DEFINITION',seed,payload])
        elif action == 'describe_without_pause':
            frames.append(['SCHEMA_ID',seed+1]); r['enabled']=True
        elif action == 'decode_latest':
            r['decoded'].append([r['latest'],payload])
        elif action == 'decode_default':
            r['decoded'].append([0,payload])
        elif action == 'buffer_unbounded':
            r['queued'].extend(payload)
        elif action == 'replace_schema':
            r['agreed']=r['latest']
        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: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 1]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 1, [1, 2, 3]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [], 'decoded': [[1, [1, 2, 3]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [1, 2, 3]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 1]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change'], [{'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1]]}, {'phase': 'defining', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]]]}, {'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]]]}, {'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]], ['SCHEMA_ID', 2]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted'], [{'phase': 'failed', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1]]}, {'phase': 'defining', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]]]}, {'phase': 'ready', 'registers': {'agreed': 1, 'latest': 2, 'enabled': True, 'definitions': [1], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 1], ['DEFINITION', 1, [1, 2, 3]]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 1, 'latest': 2, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 2]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 2, [2, 3, 4, 5]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [], 'decoded': [[2, [2, 3, 4, 5]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [2, 3, 4, 5]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 2]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change', 'known_schema'], [{'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}, {'phase': 'defining', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}, {'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}, {'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]], ['SCHEMA_ID', 3]]}, {'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]], ['SCHEMA_ID', 3], ['SCHEMA_OK', 2]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted', 'record'], [{'phase': 'failed', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2]]}, {'phase': 'defining', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}, {'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [2], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}, {'phase': 'ready', 'registers': {'agreed': 2, 'latest': 3, 'enabled': True, 'definitions': [2], 'decoded': [[2, [2, 3, 4, 5]]], 'queued': []}, 'frames': [['SCHEMA_ID', 2], ['DEFINITION', 2, [2, 3, 4, 5]]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 2, 'latest': 3, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 3]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 3, [3, 4, 5, 6, 7]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [], 'decoded': [[3, [3, 4, 5, 6, 7]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [3, 4, 5, 6, 7]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 3]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change', 'known_schema', 'duplicate_definition'], [{'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}, {'phase': 'defining', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]], ['SCHEMA_ID', 4]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]], ['SCHEMA_ID', 4], ['SCHEMA_OK', 3]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]], ['SCHEMA_ID', 4], ['SCHEMA_OK', 3], ['SCHEMA_OK', 3]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted', 'record', 'duplicate_definition'], [{'phase': 'failed', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3]]}, {'phase': 'defining', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [[3, [3, 4, 5, 6, 7]]], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]]]}, {'phase': 'ready', 'registers': {'agreed': 3, 'latest': 4, 'enabled': True, 'definitions': [3], 'decoded': [[3, [3, 4, 5, 6, 7]]], 'queued': []}, 'frames': [['SCHEMA_ID', 3], ['DEFINITION', 3, [3, 4, 5, 6, 7]], ['SCHEMA_OK', 3]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 3, 'latest': 4, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 4]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [], 'decoded': [[4, [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [4, 5, 6, 7, 8, 9]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 4]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change', 'known_schema', 'duplicate_definition', 'schema_change'], [{'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}, {'phase': 'defining', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_ID', 5]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_ID', 5], ['SCHEMA_OK', 4]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_ID', 5], ['SCHEMA_OK', 4], ['SCHEMA_OK', 4]]}, {'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_ID', 5], ['SCHEMA_OK', 4], ['SCHEMA_OK', 4], ['SCHEMA_ID', 5]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted', 'record', 'duplicate_definition', 'schema_change'], [{'phase': 'failed', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4]]}, {'phase': 'defining', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [[4, [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]]]}, {'phase': 'ready', 'registers': {'agreed': 4, 'latest': 5, 'enabled': True, 'definitions': [4], 'decoded': [[4, [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_OK', 4]]}, {'phase': 'described', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [4], 'decoded': [[4, [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': [['SCHEMA_ID', 4], ['DEFINITION', 4, [4, 5, 6, 7, 8, 9]], ['SCHEMA_OK', 4], ['SCHEMA_ID', 5]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 4, 'latest': 5, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('unset/describe', 'unset', ['describe'], [{'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}]), ('described/known_schema', 'described', ['known_schema'], [{'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 5]]}]), ('described/unknown_schema', 'described', ['unknown_schema'], [{'phase': 'defining', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}]), ('defining/definition_accepted', 'defining', ['definition_accepted'], [{'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('defining/definition_rejected', 'defining', ['definition_rejected'], [{'phase': 'failed', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}]), ('ready/schema_change', 'ready', ['schema_change'], [{'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 6]]}]), ('ready/record', 'ready', ['record'], [{'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': []}]), ('unset/record', 'unset', ['record'], [{'phase': 'unset', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['UNTYPED', [5, 6, 7, 8, 9, 10, 11]]]}]), ('failed/fresh_description', 'failed', ['fresh_description'], [{'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}]), ('ready/duplicate_definition', 'ready', ['duplicate_definition'], [{'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_OK', 5]]}]), ('ordered trace 0', 'unset', ['describe', 'unknown_schema', 'definition_accepted', 'schema_change', 'known_schema', 'duplicate_definition', 'schema_change', 'unknown_schema'], [{'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}, {'phase': 'defining', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5], ['SCHEMA_OK', 5]]}, {'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5], ['SCHEMA_OK', 5], ['SCHEMA_ID', 6]]}, {'phase': 'defining', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5, 5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5], ['SCHEMA_OK', 5], ['SCHEMA_ID', 6], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}]), ('ordered trace 3', 'defining', ['definition_rejected', 'fresh_description', 'unknown_schema', 'definition_accepted', 'record', 'duplicate_definition', 'schema_change', 'known_schema'], [{'phase': 'failed', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': []}, {'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5]]}, {'phase': 'defining', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_OK', 5]]}, {'phase': 'described', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [5], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_OK', 5], ['SCHEMA_ID', 6]]}, {'phase': 'ready', 'registers': {'agreed': 5, 'latest': 6, 'enabled': True, 'definitions': [5], 'decoded': [[5, [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': [['SCHEMA_ID', 5], ['DEFINITION', 5, [5, 6, 7, 8, 9, 10, 11]], ['SCHEMA_OK', 5], ['SCHEMA_ID', 6], ['SCHEMA_OK', 5]]}]), ('empty input', 'unset', [], []), ('unknown event', 'unset', ['unsupported'], [{'phase': 'unset', 'registers': {'agreed': 5, 'latest': 6, 'enabled': False, 'definitions': [], 'decoded': [], 'queued': []}, '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 unset, event describe produces ready/send_records instead of described/send_schema_id.

For the stipulated Application schema-version exchange 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