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 = {'baseline': [seed-1], 'buffer': payload[:], 'cursor': seed, 'subscription': True, 'published': [], 'ready': False}
    frames = []
    observed = []
    table = {('new', 'subscribe'): ('pending', 'request_snapshot'), ('pending', 'snapshot_begin'): ('snapshot', 'reset_baseline'), ('snapshot', 'snapshot_end'): ('catchup', 'seal_baseline'), ('catchup', 'caught_up'): ('live', 'publish_ready'), ('live', 'gap'): ('resync', 'request_baseline'), ('resync', 'snapshot_begin'): ('snapshot', 'replace_baseline'), ('live', 'disconnect'): ('paused', 'save_cursor'), ('paused', 'resume_accepted'): ('catchup', 'request_after_cursor'), ('paused', 'cursor_expired'): ('live', 'deliver_delta'), ('live', 'unsubscribe'): ('closed', 'release_subscription')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'request_snapshot':
            frames.append(['SNAPSHOT',seed])
        elif action == 'reset_baseline':
            r['baseline']=[]
        elif action == 'seal_baseline':
            r['baseline']=payload[:]
        elif action == 'publish_ready':
            r['published'].extend(r['baseline']+r['buffer']); r['buffer']=[]; r['ready']=True
        elif action == 'request_baseline':
            r['ready']=False; frames.append(['SNAPSHOT',seed])
        elif action == 'replace_baseline':
            r['baseline']=[]; r['published']=[]
        elif action == 'save_cursor':
            r['cursor']=seed
        elif action == 'request_after_cursor':
            frames.append(['RESUME_AFTER',r['cursor']])
        elif action == 'release_subscription':
            r['subscription']=False
        elif action == 'merge_old':
            r['baseline'].extend(payload)
        elif action == 'deliver_delta':
            r['published'].extend(payload)
        elif action == 'publish':
            r['published'].extend(r['baseline'])
        elif action == 'drop_buffer':
            r['buffer']=[]; r['ready']=True
        elif action == 'keep_delivering':
            r['published'].extend(payload)
        elif action == 'forget_cursor':
            r['cursor']=None
        elif action == 'advance_cursor':
            r['cursor']=seed+len(payload)
        elif action == 'request_from_start':
            frames.append(['RESUME_AFTER',0])
        elif action == 'retry_cursor':
            frames.append(['RESUME_AFTER',r['cursor']])
        elif action == 'retain_subscription':
            r['ready']=False
        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: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [1, 2, 3], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [0], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 1]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up'], [{'phase': 'pending', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}, {'phase': 'catchup', 'registers': {'baseline': [1, 2, 3], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}, {'phase': 'live', 'registers': {'baseline': [1, 2, 3], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [1, 2, 3, 1, 2, 3], 'ready': True}, 'frames': [['SNAPSHOT', 1]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin'], [{'phase': 'live', 'registers': {'baseline': [0], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [0], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [0], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': [['SNAPSHOT', 1]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': [['SNAPSHOT', 1]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [1], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 2]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up', 'disconnect'], [{'phase': 'pending', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'catchup', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'live', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [2, 3, 4, 5, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'paused', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [2, 3, 4, 5, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end'], [{'phase': 'live', 'registers': {'baseline': [1], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [1], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [1], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'catchup', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [2], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 3]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up', 'disconnect', 'cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'catchup', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'live', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'paused', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'pending', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3], ['SNAPSHOT', 3]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end', 'caught_up'], [{'phase': 'live', 'registers': {'baseline': [2], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [2], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [2], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'catchup', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'live', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [3], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 4]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin'], [{'phase': 'pending', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'catchup', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'live', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'paused', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'pending', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4], ['SNAPSHOT', 4]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4], ['SNAPSHOT', 4]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end', 'caught_up', 'gap'], [{'phase': 'live', 'registers': {'baseline': [3], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [3], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [3], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'catchup', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'live', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'resync', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': False}, 'frames': [['SNAPSHOT', 4], ['SNAPSHOT', 4]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [4], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 5]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end'], [{'phase': 'pending', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'catchup', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'live', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'paused', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'pending', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}, {'phase': 'catchup', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end', 'caught_up', 'gap', 'snapshot_begin'], [{'phase': 'live', 'registers': {'baseline': [4], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [4], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [4], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'catchup', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'live', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'resync', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': False}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, '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 = {'baseline': [seed-1], 'buffer': payload[:], 'cursor': seed, 'subscription': True, 'published': [], 'ready': False}
    frames = []
    observed = []
    table = {('new', 'subscribe'): ('pending', 'request_snapshot'), ('pending', 'snapshot_begin'): ('snapshot', 'reset_baseline'), ('snapshot', 'snapshot_end'): ('catchup', 'seal_baseline'), ('catchup', 'caught_up'): ('live', 'publish_ready'), ('live', 'gap'): ('resync', 'request_baseline'), ('resync', 'snapshot_begin'): ('snapshot', 'replace_baseline'), ('live', 'disconnect'): ('paused', 'save_cursor'), ('paused', 'resume_accepted'): ('catchup', 'request_after_cursor'), ('paused', 'cursor_expired'): ('paused', 'retry_cursor'), ('live', 'unsubscribe'): ('closed', 'release_subscription')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'request_snapshot':
            frames.append(['SNAPSHOT',seed])
        elif action == 'reset_baseline':
            r['baseline']=[]
        elif action == 'seal_baseline':
            r['baseline']=payload[:]
        elif action == 'publish_ready':
            r['published'].extend(r['baseline']+r['buffer']); r['buffer']=[]; r['ready']=True
        elif action == 'request_baseline':
            r['ready']=False; frames.append(['SNAPSHOT',seed])
        elif action == 'replace_baseline':
            r['baseline']=[]; r['published']=[]
        elif action == 'save_cursor':
            r['cursor']=seed
        elif action == 'request_after_cursor':
            frames.append(['RESUME_AFTER',r['cursor']])
        elif action == 'release_subscription':
            r['subscription']=False
        elif action == 'merge_old':
            r['baseline'].extend(payload)
        elif action == 'deliver_delta':
            r['published'].extend(payload)
        elif action == 'publish':
            r['published'].extend(r['baseline'])
        elif action == 'drop_buffer':
            r['buffer']=[]; r['ready']=True
        elif action == 'keep_delivering':
            r['published'].extend(payload)
        elif action == 'forget_cursor':
            r['cursor']=None
        elif action == 'advance_cursor':
            r['cursor']=seed+len(payload)
        elif action == 'request_from_start':
            frames.append(['RESUME_AFTER',0])
        elif action == 'retry_cursor':
            frames.append(['RESUME_AFTER',r['cursor']])
        elif action == 'retain_subscription':
            r['ready']=False
        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: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [1, 2, 3], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [0], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 1]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up'], [{'phase': 'pending', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}, {'phase': 'catchup', 'registers': {'baseline': [1, 2, 3], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 1]]}, {'phase': 'live', 'registers': {'baseline': [1, 2, 3], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [1, 2, 3, 1, 2, 3], 'ready': True}, 'frames': [['SNAPSHOT', 1]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin'], [{'phase': 'live', 'registers': {'baseline': [0], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [0], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [0], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': [['SNAPSHOT', 1]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 1, 'subscription': True, 'published': [0, 1, 2, 3], 'ready': True}, 'frames': [['SNAPSHOT', 1]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [0], 'buffer': [1, 2, 3], 'cursor': 1, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [1], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 2]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up', 'disconnect'], [{'phase': 'pending', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'catchup', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'live', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [2, 3, 4, 5, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'paused', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [2, 3, 4, 5, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end'], [{'phase': 'live', 'registers': {'baseline': [1], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [1], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [1], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}, {'phase': 'catchup', 'registers': {'baseline': [2, 3, 4, 5], 'buffer': [], 'cursor': 2, 'subscription': True, 'published': [1, 2, 3, 4, 5], 'ready': True}, 'frames': [['SNAPSHOT', 2]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [1], 'buffer': [2, 3, 4, 5], 'cursor': 2, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [2], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 3]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up', 'disconnect', 'cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'catchup', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'live', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'paused', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'pending', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3], ['SNAPSHOT', 3]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end', 'caught_up'], [{'phase': 'live', 'registers': {'baseline': [2], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [2], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [2], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'catchup', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}, {'phase': 'live', 'registers': {'baseline': [3, 4, 5, 6, 7], 'buffer': [], 'cursor': 3, 'subscription': True, 'published': [2, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'ready': True}, 'frames': [['SNAPSHOT', 3]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [2], 'buffer': [3, 4, 5, 6, 7], 'cursor': 3, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [3], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 4]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin'], [{'phase': 'pending', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'catchup', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'live', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'paused', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'pending', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4], ['SNAPSHOT', 4]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4], ['SNAPSHOT', 4]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end', 'caught_up', 'gap'], [{'phase': 'live', 'registers': {'baseline': [3], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [3], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [3], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'catchup', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'live', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': True}, 'frames': [['SNAPSHOT', 4]]}, {'phase': 'resync', 'registers': {'baseline': [4, 5, 6, 7, 8, 9], 'buffer': [], 'cursor': 4, 'subscription': True, 'published': [3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'ready': False}, 'frames': [['SNAPSHOT', 4], ['SNAPSHOT', 4]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [3], 'buffer': [4, 5, 6, 7, 8, 9], 'cursor': 4, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('new/subscribe', 'new', ['subscribe'], [{'phase': 'pending', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}]), ('pending/snapshot_begin', 'pending', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('snapshot/snapshot_end', 'snapshot', ['snapshot_end'], [{'phase': 'catchup', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('catchup/caught_up', 'catchup', ['caught_up'], [{'phase': 'live', 'registers': {'baseline': [4], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': []}]), ('live/gap', 'live', ['gap'], [{'phase': 'resync', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}]), ('resync/snapshot_begin', 'resync', ['snapshot_begin'], [{'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('live/disconnect', 'live', ['disconnect'], [{'phase': 'paused', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': []}]), ('paused/resume_accepted', 'paused', ['resume_accepted'], [{'phase': 'catchup', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['RESUME_AFTER', 5]]}]), ('paused/cursor_expired', 'paused', ['cursor_expired'], [{'phase': 'pending', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}]), ('live/unsubscribe', 'live', ['unsubscribe'], [{'phase': 'closed', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': False, 'published': [], 'ready': False}, 'frames': []}]), ('ordered trace 0', 'new', ['subscribe', 'snapshot_begin', 'snapshot_end', 'caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end'], [{'phase': 'pending', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'catchup', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'live', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'paused', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'pending', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}, {'phase': 'catchup', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}]), ('ordered trace 3', 'catchup', ['caught_up', 'disconnect', 'cursor_expired', 'snapshot_begin', 'snapshot_end', 'caught_up', 'gap', 'snapshot_begin'], [{'phase': 'live', 'registers': {'baseline': [4], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': []}, {'phase': 'paused', 'registers': {'baseline': [4], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': []}, {'phase': 'pending', 'registers': {'baseline': [4], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'catchup', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'live', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': True}, 'frames': [['SNAPSHOT', 5]]}, {'phase': 'resync', 'registers': {'baseline': [5, 6, 7, 8, 9, 10, 11], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [4, 5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'ready': False}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}, {'phase': 'snapshot', 'registers': {'baseline': [], 'buffer': [], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, 'frames': [['SNAPSHOT', 5], ['SNAPSHOT', 5]]}]), ('empty input', 'new', [], []), ('unknown event', 'new', ['unsupported'], [{'phase': 'new', 'registers': {'baseline': [4], 'buffer': [5, 6, 7, 8, 9, 10, 11], 'cursor': 5, 'subscription': True, 'published': [], 'ready': False}, '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 paused, event cursor_expired produces live/deliver_delta instead of pending/request_snapshot.

For the stipulated Resumable event subscription 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