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 = {'cut': seed+1, 'buffer': payload[:], 'delivered': [], 'snapshot': [x for x in payload if x<=seed+1] if phase=='saved' else [], 'durable': phase=='saved'}
    frames = []
    observed = []
    table = {('streaming', 'fence_request'): ('draining', 'freeze_cut'), ('draining', 'record_before_cut'): ('draining', 'deliver_pre_cut'), ('draining', 'record_after_cut'): ('draining', 'buffer_post_cut'), ('draining', 'pre_cut_drained'): ('fenced', 'ack_fence'), ('fenced', 'checkpoint_request'): ('streaming', 'deliver_all'), ('checkpointing', 'checkpoint_saved'): ('saved', 'report_checkpoint'), ('saved', 'resume'): ('streaming', 'release_buffer_in_order'), ('checkpointing', 'checkpoint_failed'): ('fenced', 'report_failure_keep_buffer'), ('fenced', 'record_after_cut'): ('fenced', 'buffer_post_cut'), ('streaming', 'unsolicited_resume'): ('streaming', 'reject_unfenced')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'freeze_cut':
            r['cut']=seed+1
        elif action == 'deliver_pre_cut':
            r['delivered'].extend([x for x in payload if x<=r['cut']])
        elif action == 'buffer_post_cut':
            r['buffer'].extend([x for x in payload if x>r['cut']])
        elif action == 'ack_fence':
            frames.append(['FENCED',r['cut']])
        elif action == 'snapshot_cut':
            r['snapshot']=[x for x in payload if x<=r['cut']]
        elif action == 'report_checkpoint':
            r['durable']=True; frames.append(['CHECKPOINT',r['cut']])
        elif action == 'release_buffer_in_order':
            r['delivered'].extend(r['buffer']); r['buffer']=[]
        elif action == 'report_failure_keep_buffer':
            frames.append(['CHECKPOINT_FAILED',r['cut']])
        elif action == 'reject_unfenced':
            frames.append(['NOT_FENCED',seed])
        elif action == 'advance_cut':
            r['cut']=max(payload)+1
        elif action == 'deliver_post_cut':
            r['delivered'].extend([x for x in payload if x>r['cut']])
        elif action == 'drop_record':
            r['buffer']=[]
        elif action == 'deliver_all':
            r['delivered'].extend(payload)
        elif action == 'clear_post_cut':
            r['buffer']=[]
        elif action == 'snapshot_latest':
            r['snapshot']=payload[:]
        elif action == 'resume':
            r['delivered'].extend(r['buffer']); r['buffer']=[]
        elif action == 'report_latest_cut':
            r['durable']=True; frames.append(['CHECKPOINT',max(payload)])
        elif action == 'release_reverse':
            r['delivered'].extend(reversed(r['buffer'])); r['buffer']=[]
        elif action == 'drop_buffer':
            r['buffer']=[]
        elif action == 'report_success':
            r['durable']=True; frames.append(['CHECKPOINT',r['cut']])
        elif action == 'deliver':
            r['delivered'].extend(payload)
        elif action == 'replay_previous':
            r['delivered'].extend([seed-1])
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [1, 2], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 2]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [1, 2], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 2]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 2, 'buffer': [], 'delivered': [1, 2, 3], 'snapshot': [1, 2], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 2]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 1]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 2]]}, {'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 2]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [1, 2], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [1, 2], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [1, 2], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 2]]}, {'phase': 'checkpointing', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [1, 2], 'snapshot': [1, 2], 'durable': False}, 'frames': [['FENCED', 2]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [2, 3], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 3]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [2, 3], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 3]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 3, 'buffer': [], 'delivered': [2, 3, 4, 5], 'snapshot': [2, 3], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 3]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 2]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 3]]}, {'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 3]]}, {'phase': 'checkpointing', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5, 4, 5], 'delivered': [], 'snapshot': [2, 3], 'durable': False}, 'frames': [['FENCED', 3]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request', 'checkpoint_failed'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [2, 3], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [2, 3], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [2, 3], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 3]]}, {'phase': 'checkpointing', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [2, 3], 'snapshot': [2, 3], 'durable': False}, 'frames': [['FENCED', 3]]}, {'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [2, 3], 'snapshot': [2, 3], 'durable': False}, 'frames': [['FENCED', 3], ['CHECKPOINT_FAILED', 3]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 4]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [3, 4], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 4]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 4, 'buffer': [], 'delivered': [3, 4, 5, 6, 7], 'snapshot': [3, 4], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 4]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 3]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut', 'checkpoint_request', 'checkpoint_failed'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'checkpointing', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4], ['CHECKPOINT_FAILED', 4]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'checkpointing', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4], ['CHECKPOINT_FAILED', 4]]}, {'phase': 'checkpointing', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4], ['CHECKPOINT_FAILED', 4]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 5]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [4, 5], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 5]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 5, 'buffer': [], 'delivered': [4, 5, 6, 7, 8, 9], 'snapshot': [4, 5], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 5]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 4]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5]]}, {'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request', 'checkpoint_failed'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5]]}, {'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5]]}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5], ['CHECKPOINT_FAILED', 5]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 6]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 6]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 6, 'buffer': [], 'delivered': [5, 6, 7, 8, 9, 10, 11], 'snapshot': [5, 6], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 6]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 5]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request', 'checkpoint_failed'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6], ['CHECKPOINT_FAILED', 6]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6], ['CHECKPOINT_FAILED', 6]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': 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 = {'cut': seed+1, 'buffer': payload[:], 'delivered': [], 'snapshot': [x for x in payload if x<=seed+1] if phase=='saved' else [], 'durable': phase=='saved'}
    frames = []
    observed = []
    table = {('streaming', 'fence_request'): ('draining', 'freeze_cut'), ('draining', 'record_before_cut'): ('draining', 'deliver_pre_cut'), ('draining', 'record_after_cut'): ('draining', 'buffer_post_cut'), ('draining', 'pre_cut_drained'): ('fenced', 'ack_fence'), ('fenced', 'checkpoint_request'): ('checkpointing', 'snapshot_latest'), ('checkpointing', 'checkpoint_saved'): ('saved', 'report_checkpoint'), ('saved', 'resume'): ('streaming', 'release_buffer_in_order'), ('checkpointing', 'checkpoint_failed'): ('fenced', 'report_failure_keep_buffer'), ('fenced', 'record_after_cut'): ('fenced', 'buffer_post_cut'), ('streaming', 'unsolicited_resume'): ('streaming', 'reject_unfenced')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'freeze_cut':
            r['cut']=seed+1
        elif action == 'deliver_pre_cut':
            r['delivered'].extend([x for x in payload if x<=r['cut']])
        elif action == 'buffer_post_cut':
            r['buffer'].extend([x for x in payload if x>r['cut']])
        elif action == 'ack_fence':
            frames.append(['FENCED',r['cut']])
        elif action == 'snapshot_cut':
            r['snapshot']=[x for x in payload if x<=r['cut']]
        elif action == 'report_checkpoint':
            r['durable']=True; frames.append(['CHECKPOINT',r['cut']])
        elif action == 'release_buffer_in_order':
            r['delivered'].extend(r['buffer']); r['buffer']=[]
        elif action == 'report_failure_keep_buffer':
            frames.append(['CHECKPOINT_FAILED',r['cut']])
        elif action == 'reject_unfenced':
            frames.append(['NOT_FENCED',seed])
        elif action == 'advance_cut':
            r['cut']=max(payload)+1
        elif action == 'deliver_post_cut':
            r['delivered'].extend([x for x in payload if x>r['cut']])
        elif action == 'drop_record':
            r['buffer']=[]
        elif action == 'deliver_all':
            r['delivered'].extend(payload)
        elif action == 'clear_post_cut':
            r['buffer']=[]
        elif action == 'snapshot_latest':
            r['snapshot']=payload[:]
        elif action == 'resume':
            r['delivered'].extend(r['buffer']); r['buffer']=[]
        elif action == 'report_latest_cut':
            r['durable']=True; frames.append(['CHECKPOINT',max(payload)])
        elif action == 'release_reverse':
            r['delivered'].extend(reversed(r['buffer'])); r['buffer']=[]
        elif action == 'drop_buffer':
            r['buffer']=[]
        elif action == 'report_success':
            r['durable']=True; frames.append(['CHECKPOINT',r['cut']])
        elif action == 'deliver':
            r['delivered'].extend(payload)
        elif action == 'replay_previous':
            r['delivered'].extend([seed-1])
        else:
            if action not in ("wait", "ignore", "keep", "retain", "keep_peer", "keep_offer", "keep_hold", "keep_batch", "retain_staging", "keep_staging", "keep_local_owner", "keep_old_session", "keep_address", "keep_old_expiry", "ignore_conflict", "keep_service", "keep_subscription", "retain_shadow", "keep_live", "keep_suspicion", "keep_roles", "keep_staged"):
                frames.append([action, payload[:]])
        observed.append(json.loads(json.dumps({"phase": phase, "registers": r, "frames": frames})))
    return observed
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [1, 2], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 2]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [1, 2], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 2]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 2, 'buffer': [], 'delivered': [1, 2, 3], 'snapshot': [1, 2], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 2]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 1]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 2]]}, {'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 2]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [1, 2], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [1, 2], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [1, 2], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 2]]}, {'phase': 'checkpointing', 'registers': {'cut': 2, 'buffer': [1, 2, 3, 3], 'delivered': [1, 2], 'snapshot': [1, 2], 'durable': False}, 'frames': [['FENCED', 2]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 2, 'buffer': [1, 2, 3], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [2, 3], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 3]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [2, 3], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 3]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 3, 'buffer': [], 'delivered': [2, 3, 4, 5], 'snapshot': [2, 3], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 3]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 2]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 3]]}, {'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 3]]}, {'phase': 'checkpointing', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5, 4, 5], 'delivered': [], 'snapshot': [2, 3], 'durable': False}, 'frames': [['FENCED', 3]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request', 'checkpoint_failed'], [{'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [2, 3], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [2, 3], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [2, 3], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 3]]}, {'phase': 'checkpointing', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [2, 3], 'snapshot': [2, 3], 'durable': False}, 'frames': [['FENCED', 3]]}, {'phase': 'fenced', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5, 4, 5], 'delivered': [2, 3], 'snapshot': [2, 3], 'durable': False}, 'frames': [['FENCED', 3], ['CHECKPOINT_FAILED', 3]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 3, 'buffer': [2, 3, 4, 5], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 4]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [3, 4], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 4]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 4, 'buffer': [], 'delivered': [3, 4, 5, 6, 7], 'snapshot': [3, 4], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 4]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 3]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut', 'checkpoint_request', 'checkpoint_failed'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'checkpointing', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7, 5, 6, 7], 'delivered': [], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4], ['CHECKPOINT_FAILED', 4]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'checkpointing', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4]]}, {'phase': 'fenced', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4], ['CHECKPOINT_FAILED', 4]]}, {'phase': 'checkpointing', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7, 5, 6, 7], 'delivered': [3, 4], 'snapshot': [3, 4], 'durable': False}, 'frames': [['FENCED', 4], ['CHECKPOINT_FAILED', 4]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 4, 'buffer': [3, 4, 5, 6, 7], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 5]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [4, 5], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 5]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 5, 'buffer': [], 'delivered': [4, 5, 6, 7, 8, 9], 'snapshot': [4, 5], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 5]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 4]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5]]}, {'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request', 'checkpoint_failed'], [{'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5]]}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5]]}, {'phase': 'checkpointing', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5]]}, {'phase': 'fenced', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9, 6, 7, 8, 9], 'delivered': [4, 5], 'snapshot': [4, 5], 'durable': False}, 'frames': [['FENCED', 5], ['CHECKPOINT_FAILED', 5], ['CHECKPOINT_FAILED', 5]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 5, 'buffer': [4, 5, 6, 7, 8, 9], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('streaming/fence_request', 'streaming', ['fence_request'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_before_cut', 'draining', ['record_before_cut'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/record_after_cut', 'draining', ['record_after_cut'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('draining/pre_cut_drained', 'draining', ['pre_cut_drained'], [{'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 6]]}]), ('fenced/checkpoint_request', 'fenced', ['checkpoint_request'], [{'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': []}]), ('checkpointing/checkpoint_saved', 'checkpointing', ['checkpoint_saved'], [{'phase': 'saved', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': True}, 'frames': [['CHECKPOINT', 6]]}]), ('saved/resume', 'saved', ['resume'], [{'phase': 'streaming', 'registers': {'cut': 6, 'buffer': [], 'delivered': [5, 6, 7, 8, 9, 10, 11], 'snapshot': [5, 6], 'durable': True}, 'frames': []}]), ('checkpointing/checkpoint_failed', 'checkpointing', ['checkpoint_failed'], [{'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['CHECKPOINT_FAILED', 6]]}]), ('fenced/record_after_cut', 'fenced', ['record_after_cut'], [{'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}]), ('streaming/unsolicited_resume', 'streaming', ['unsolicited_resume'], [{'phase': 'streaming', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['NOT_FENCED', 5]]}]), ('ordered trace 0', 'streaming', ['fence_request', 'record_after_cut', 'pre_cut_drained', 'record_after_cut', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request', 'checkpoint_failed'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6], ['CHECKPOINT_FAILED', 6]]}]), ('ordered trace 3', 'draining', ['record_before_cut', 'record_after_cut', 'pre_cut_drained', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request', 'checkpoint_failed', 'checkpoint_request'], [{'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'draining', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [], 'durable': False}, 'frames': []}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'fenced', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6], ['CHECKPOINT_FAILED', 6]]}, {'phase': 'checkpointing', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11, 7, 8, 9, 10, 11], 'delivered': [5, 6], 'snapshot': [5, 6], 'durable': False}, 'frames': [['FENCED', 6], ['CHECKPOINT_FAILED', 6], ['CHECKPOINT_FAILED', 6]]}]), ('empty input', 'streaming', [], []), ('unknown event', 'streaming', ['unsupported'], [{'phase': 'streaming', 'registers': {'cut': 6, 'buffer': [5, 6, 7, 8, 9, 10, 11], 'delivered': [], 'snapshot': [], 'durable': 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 fenced, event checkpoint_request produces streaming/deliver_all instead of checkpointing/snapshot_cut.

For the stipulated Record-stream checkpoint fence 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