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 = {'endpoint': 'target' if phase=='away' else 'home', 'home_open': phase not in ('away','suspended'), 'sequence': seed+3, 'boundary': None, 'target_checked': False, 'queue': payload[:], 'delivered': []}
    frames = []
    observed = []
    table = {('home', 'move_offer'): ('probing', 'probe_target'), ('probing', 'target_ready'): ('away', 'switch_target'), ('probing', 'target_rejected'): ('home', 'discard_target'), ('draining', 'home_flushed'): ('switching', 'send_boundary'), ('switching', 'boundary_ack'): ('away', 'switch_target'), ('switching', 'old_endpoint_data'): ('switching', 'accept_before_boundary'), ('away', 'old_endpoint_data'): ('away', 'reject_old_endpoint'), ('away', 'target_lost'): ('suspended', 'report_unavailable'), ('home', 'unsolicited_boundary_ack'): ('home', 'reject_unoffered'), ('draining', 'new_application_data'): ('draining', 'queue_after_boundary')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'probe_target':
            r['target_checked']=True; frames.append(['PROBE_TARGET',seed])
        elif action == 'freeze_home_sequence':
            r['boundary']=r['sequence']
        elif action == 'discard_target':
            r['target_checked']=False
        elif action == 'send_boundary':
            frames.append(['BOUNDARY',r['sequence']])
        elif action == 'switch_target':
            r['endpoint']='target'; r['home_open']=False
        elif action == 'accept_before_boundary':
            r['delivered'].extend([x for x in payload if x<r['sequence']])
        elif action == 'reject_old_endpoint':
            frames.append(['OLD_ENDPOINT',seed])
        elif action == 'report_unavailable':
            frames.append(['UNAVAILABLE',seed])
        elif action == 'reject_unoffered':
            frames.append(['NO_MIGRATION',seed])
        elif action == 'queue_after_boundary':
            r['queue'].extend(payload)
        elif action == 'stop_home':
            r['home_open']=False
        elif action == 'reset_sequence':
            r['sequence']=0
        elif action == 'send_zero_boundary':
            frames.append(['BOUNDARY',0])
        elif action == 'resume_home':
            r['endpoint']='home'; r['home_open']=True
        elif action == 'send_on_both':
            frames.extend([['HOME',payload],['TARGET',payload]])
        elif action == 'drop_all':
            r['delivered']=[]
        elif action == 'accept_all':
            r['delivered'].extend(payload)
        elif action == 'deliver':
            r['delivered'].extend(payload)
        elif action == 'silent_drop':
            r['queue']=[]
        elif action == 'send_home':
            frames.append(['HOME',payload])
        elif action == 'send_target':
            frames.append(['TARGET',payload])
        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: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': True, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': 4, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['BOUNDARY', 4]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': [1, 2, 3]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 1]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['UNAVAILABLE', 1]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['NO_MIGRATION', 1]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': True, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': True, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1], ['PROBE_TARGET', 1]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1], ['PROBE_TARGET', 1]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': []}, 'frames': [['BOUNDARY', 4]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': [1, 2, 3]}, 'frames': [['BOUNDARY', 4]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': [1, 2, 3]}, 'frames': [['BOUNDARY', 4]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': True, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': 5, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['BOUNDARY', 5]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': [2, 3, 4]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 2]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['UNAVAILABLE', 2]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['NO_MIGRATION', 2]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': True, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': True, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2], ['PROBE_TARGET', 2]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2], ['PROBE_TARGET', 2]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': True, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2], ['PROBE_TARGET', 2], ['PROBE_TARGET', 2]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack', 'target_lost'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': []}, 'frames': [['BOUNDARY', 5]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': [2, 3, 4]}, 'frames': [['BOUNDARY', 5]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': [2, 3, 4]}, 'frames': [['BOUNDARY', 5]]}, {'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': [2, 3, 4]}, 'frames': [['BOUNDARY', 5], ['UNAVAILABLE', 2]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': True, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': 6, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['BOUNDARY', 6]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': [3, 4, 5]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 3]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['UNAVAILABLE', 3]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['NO_MIGRATION', 3]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer', 'target_rejected'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': True, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': True, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3], ['PROBE_TARGET', 3]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3], ['PROBE_TARGET', 3]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': True, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3], ['PROBE_TARGET', 3], ['PROBE_TARGET', 3]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3], ['PROBE_TARGET', 3], ['PROBE_TARGET', 3]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack', 'target_lost'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['BOUNDARY', 6]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': [3, 4, 5]}, 'frames': [['BOUNDARY', 6]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': [3, 4, 5]}, 'frames': [['BOUNDARY', 6]]}, {'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': [3, 4, 5]}, 'frames': [['BOUNDARY', 6], ['UNAVAILABLE', 3]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': 7, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['BOUNDARY', 7]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': [4, 5, 6]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 4]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['UNAVAILABLE', 4]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['NO_MIGRATION', 4]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4], ['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack', 'target_lost'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['BOUNDARY', 7]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': [4, 5, 6]}, 'frames': [['BOUNDARY', 7]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': [4, 5, 6]}, 'frames': [['BOUNDARY', 7]]}, {'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': [4, 5, 6]}, 'frames': [['BOUNDARY', 7], ['UNAVAILABLE', 4]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': 8, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['BOUNDARY', 8]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6, 7]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 5]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['UNAVAILABLE', 5]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['NO_MIGRATION', 5]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer', 'target_rejected'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack', 'target_lost'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['BOUNDARY', 8]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6, 7]}, 'frames': [['BOUNDARY', 8]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6, 7]}, 'frames': [['BOUNDARY', 8]]}, {'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6, 7]}, 'frames': [['BOUNDARY', 8], ['UNAVAILABLE', 5]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, '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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'endpoint': 'target' if phase=='away' else 'home', 'home_open': phase not in ('away','suspended'), 'sequence': seed+3, 'boundary': None, 'target_checked': False, 'queue': payload[:], 'delivered': []}
    frames = []
    observed = []
    table = {('home', 'move_offer'): ('probing', 'probe_target'), ('probing', 'target_ready'): ('draining', 'reset_sequence'), ('probing', 'target_rejected'): ('home', 'discard_target'), ('draining', 'home_flushed'): ('switching', 'send_boundary'), ('switching', 'boundary_ack'): ('away', 'switch_target'), ('switching', 'old_endpoint_data'): ('switching', 'accept_before_boundary'), ('away', 'old_endpoint_data'): ('away', 'reject_old_endpoint'), ('away', 'target_lost'): ('suspended', 'report_unavailable'), ('home', 'unsolicited_boundary_ack'): ('home', 'reject_unoffered'), ('draining', 'new_application_data'): ('draining', 'queue_after_boundary')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'probe_target':
            r['target_checked']=True; frames.append(['PROBE_TARGET',seed])
        elif action == 'freeze_home_sequence':
            r['boundary']=r['sequence']
        elif action == 'discard_target':
            r['target_checked']=False
        elif action == 'send_boundary':
            frames.append(['BOUNDARY',r['sequence']])
        elif action == 'switch_target':
            r['endpoint']='target'; r['home_open']=False
        elif action == 'accept_before_boundary':
            r['delivered'].extend([x for x in payload if x<r['sequence']])
        elif action == 'reject_old_endpoint':
            frames.append(['OLD_ENDPOINT',seed])
        elif action == 'report_unavailable':
            frames.append(['UNAVAILABLE',seed])
        elif action == 'reject_unoffered':
            frames.append(['NO_MIGRATION',seed])
        elif action == 'queue_after_boundary':
            r['queue'].extend(payload)
        elif action == 'stop_home':
            r['home_open']=False
        elif action == 'reset_sequence':
            r['sequence']=0
        elif action == 'send_zero_boundary':
            frames.append(['BOUNDARY',0])
        elif action == 'resume_home':
            r['endpoint']='home'; r['home_open']=True
        elif action == 'send_on_both':
            frames.extend([['HOME',payload],['TARGET',payload]])
        elif action == 'drop_all':
            r['delivered']=[]
        elif action == 'accept_all':
            r['delivered'].extend(payload)
        elif action == 'deliver':
            r['delivered'].extend(payload)
        elif action == 'silent_drop':
            r['queue']=[]
        elif action == 'send_home':
            frames.append(['HOME',payload])
        elif action == 'send_target':
            frames.append(['TARGET',payload])
        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: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': True, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': 4, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['BOUNDARY', 4]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': [1, 2, 3]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 1]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['UNAVAILABLE', 1]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['NO_MIGRATION', 1]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': True, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': True, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1], ['PROBE_TARGET', 1]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['PROBE_TARGET', 1], ['PROBE_TARGET', 1]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': []}, 'frames': [['BOUNDARY', 4]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': [1, 2, 3]}, 'frames': [['BOUNDARY', 4]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3, 1, 2, 3], 'delivered': [1, 2, 3]}, 'frames': [['BOUNDARY', 4]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 4, 'boundary': None, 'target_checked': False, 'queue': [1, 2, 3], 'delivered': []}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': True, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': 5, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['BOUNDARY', 5]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': [2, 3, 4]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 2]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['UNAVAILABLE', 2]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['NO_MIGRATION', 2]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': True, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': True, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2], ['PROBE_TARGET', 2]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2], ['PROBE_TARGET', 2]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': True, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['PROBE_TARGET', 2], ['PROBE_TARGET', 2], ['PROBE_TARGET', 2]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack', 'target_lost'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': []}, 'frames': [['BOUNDARY', 5]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': [2, 3, 4]}, 'frames': [['BOUNDARY', 5]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': [2, 3, 4]}, 'frames': [['BOUNDARY', 5]]}, {'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5, 2, 3, 4, 5], 'delivered': [2, 3, 4]}, 'frames': [['BOUNDARY', 5], ['UNAVAILABLE', 2]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 5, 'boundary': None, 'target_checked': False, 'queue': [2, 3, 4, 5], 'delivered': []}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': True, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': 6, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['BOUNDARY', 6]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': [3, 4, 5]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 3]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['UNAVAILABLE', 3]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['NO_MIGRATION', 3]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer', 'target_rejected'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': True, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': True, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3], ['PROBE_TARGET', 3]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3], ['PROBE_TARGET', 3]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': True, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3], ['PROBE_TARGET', 3], ['PROBE_TARGET', 3]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['PROBE_TARGET', 3], ['PROBE_TARGET', 3], ['PROBE_TARGET', 3]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack', 'target_lost'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['BOUNDARY', 6]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': [3, 4, 5]}, 'frames': [['BOUNDARY', 6]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': [3, 4, 5]}, 'frames': [['BOUNDARY', 6]]}, {'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7, 3, 4, 5, 6, 7], 'delivered': [3, 4, 5]}, 'frames': [['BOUNDARY', 6], ['UNAVAILABLE', 3]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 6, 'boundary': None, 'target_checked': False, 'queue': [3, 4, 5, 6, 7], 'delivered': []}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': 7, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['BOUNDARY', 7]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': [4, 5, 6]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 4]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['UNAVAILABLE', 4]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['NO_MIGRATION', 4]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': True, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['PROBE_TARGET', 4], ['PROBE_TARGET', 4], ['PROBE_TARGET', 4], ['PROBE_TARGET', 4]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack', 'target_lost'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['BOUNDARY', 7]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': [4, 5, 6]}, 'frames': [['BOUNDARY', 7]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': [4, 5, 6]}, 'frames': [['BOUNDARY', 7]]}, {'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9], 'delivered': [4, 5, 6]}, 'frames': [['BOUNDARY', 7], ['UNAVAILABLE', 4]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 7, 'boundary': None, 'target_checked': False, 'queue': [4, 5, 6, 7, 8, 9], 'delivered': []}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('home/move_offer', 'home', ['move_offer'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5]]}]), ('probing/target_ready', 'probing', ['target_ready'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': 8, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}]), ('probing/target_rejected', 'probing', ['target_rejected'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}]), ('draining/home_flushed', 'draining', ['home_flushed'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['BOUNDARY', 8]]}]), ('switching/boundary_ack', 'switching', ['boundary_ack'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}]), ('switching/old_endpoint_data', 'switching', ['old_endpoint_data'], [{'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6, 7]}, 'frames': []}]), ('away/old_endpoint_data', 'away', ['old_endpoint_data'], [{'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['OLD_ENDPOINT', 5]]}]), ('away/target_lost', 'away', ['target_lost'], [{'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['UNAVAILABLE', 5]]}]), ('home/unsolicited_boundary_ack', 'home', ['unsolicited_boundary_ack'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['NO_MIGRATION', 5]]}]), ('draining/new_application_data', 'draining', ['new_application_data'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}]), ('ordered trace 0', 'home', ['move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer', 'target_rejected', 'move_offer', 'target_rejected'], [{'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'probing', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': True, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}, {'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5], ['PROBE_TARGET', 5]]}]), ('ordered trace 3', 'draining', ['new_application_data', 'home_flushed', 'old_endpoint_data', 'boundary_ack', 'target_lost'], [{'phase': 'draining', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': []}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': []}, 'frames': [['BOUNDARY', 8]]}, {'phase': 'switching', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6, 7]}, 'frames': [['BOUNDARY', 8]]}, {'phase': 'away', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6, 7]}, 'frames': [['BOUNDARY', 8]]}, {'phase': 'suspended', 'registers': {'endpoint': 'target', 'home_open': False, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11], 'delivered': [5, 6, 7]}, 'frames': [['BOUNDARY', 8], ['UNAVAILABLE', 5]]}]), ('empty input', 'home', [], []), ('unknown event', 'home', ['unsupported'], [{'phase': 'home', 'registers': {'endpoint': 'home', 'home_open': True, 'sequence': 8, 'boundary': None, 'target_checked': False, 'queue': [5, 6, 7, 8, 9, 10, 11], 'delivered': []}, '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 probing, event target_ready produces away/switch_target instead of draining/freeze_home_sequence.

For the stipulated Application stream endpoint migration 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