FA-19971 / Protocols / Open access
Four-event clock measurement exchange controller: complete / consume · case 01
While complete, event consume produces complete/retain instead of idle/release_measurement.
ROOT CAUSE
In complete, the consume handler runs retain and enters complete; it must instead run release measurement and enter idle.
VERIFIED REPAIR
In phase complete, classify consume as transition to idle and emit release_measurement.
Unsuccessful approach: The partial repair chooses idle/clear_clock, which still violates this phase-specific event contract.
Case contract
For the stipulated Four-event clock measurement exchange controller, initialize the explicitly shown resource registers from seed (1..5), then consume classified events sequentially. After each event return a deep snapshot of phase, resource registers, and cumulative emitted control frames. The explicit ten phase/event rules and their resource effects define admission and response semantics. Unlisted events preserve phase and emit rejection. Payload is the consecutive integers seed through 2*seed+1. Empty event input returns no observations.
Why this case matters
Incorrect event admission now changes concrete queued data, resource ownership, or emitted protocol frames and subsequent trace behavior.
1 / The failure
Exit 1"""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 = {'receive': seed+3, 'origin': seed, 'departure': seed+5, 'response': seed+7, 'offset_twice': None, 'clock': seed*10, 'owned': True}
frames = []
observed = []
table = {('idle', 'sync_received'): ('have_sync', 'record_receive_time'), ('have_sync', 'followup_received'): ('have_origin', 'record_origin_time'), ('have_origin', 'delay_sent'): ('awaiting_delay', 'record_departure_time'), ('awaiting_delay', 'delay_response'): ('complete', 'compute_exchange'), ('have_sync', 'wrong_followup'): ('have_sync', 'reject_sequence'), ('awaiting_delay', 'wrong_response'): ('awaiting_delay', 'reject_sequence'), ('complete', 'consume'): ('complete', 'retain'), ('have_origin', 'new_sync'): ('have_sync', 'restart_exchange'), ('idle', 'delay_response'): ('idle', 'reject_orphan'), ('awaiting_delay', 'exchange_expired'): ('idle', 'discard_measurement')}
for event in events:
phase, action = table.get((phase, event), (phase, "reject"))
if action == 'record_receive_time':
r['receive']=seed+3
elif action == 'record_origin_time':
r['origin']=seed
elif action == 'record_departure_time':
r['departure']=seed+5
elif action == 'compute_exchange':
r['offset_twice']=(r['receive']-r['origin'])-(r['response']-r['departure'])
elif action == 'reject_sequence':
frames.append(['WRONG_EXCHANGE',seed+1])
elif action == 'release_measurement':
r['owned']=False
elif action == 'restart_exchange':
r['receive']=seed+3; r['origin']=None; r['offset_twice']=None
elif action == 'reject_orphan':
frames.append(['ORPHAN_RESPONSE',seed])
elif action == 'discard_measurement':
r['owned']=False; r['offset_twice']=None
elif action == 'publish_offset':
frames.append(['OFFSET',r['offset_twice']])
elif action == 'record_receive_as_origin':
r['origin']=r['receive']
elif action == 'record_origin_as_departure':
r['departure']=r['origin']
elif action == 'ignore_return_leg':
r['offset_twice']=r['receive']-r['origin'] if r['origin'] is not None else None
elif action == 'clear_exchange':
r['origin']=None; r['offset_twice']=None
elif action == 'use_previous_response':
r['response']=seed-1
elif action == 'clear_clock':
r['owned']=False; r['clock']=0
elif action == 'keep_old_origin':
r['receive']=seed+3
elif action == 'record_response':
r['response']=seed+7
elif action == 'publish_partial':
frames.append(['OFFSET',r['receive']-r['departure']])
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: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': None, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 1]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}, {'phase': 'have_origin', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': None, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received'], [{'phase': 'complete', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 1]]}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 1]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': None, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 2]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': None, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup'], [{'phase': 'complete', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2], ['WRONG_EXCHANGE', 3]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 3]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received'], [{'phase': 'complete', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3], ['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3], ['WRONG_EXCHANGE', 4]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 4]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received', 'new_sync'], [{'phase': 'complete', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 5]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'complete', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, '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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| idle/sync_received | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_sync/followup_received | [{'frames': [], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_origin/delay_sent | [{'frames': [], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/delay_response | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_sync/wrong_followup | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/wrong_response | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| complete/consume | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Failed |
| have_origin/new_sync | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| idle/delay_response | [{'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/exchange_expired | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Passed |
| ordered trace 0 | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| ordered trace 3 | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['reject', [1, 2, 3]]], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['reject', [1, 2, 3]], ['reject', [1, 2, 3]]], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Failed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
SHA-256 / 8a9c7ab23c2346172a396d28d2dddb9771a31b51282c23523057b4028efc91db
2 / The unsuccessful fix
Exit 1"""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 = {'receive': seed+3, 'origin': seed, 'departure': seed+5, 'response': seed+7, 'offset_twice': None, 'clock': seed*10, 'owned': True}
frames = []
observed = []
table = {('idle', 'sync_received'): ('have_sync', 'record_receive_time'), ('have_sync', 'followup_received'): ('have_origin', 'record_origin_time'), ('have_origin', 'delay_sent'): ('awaiting_delay', 'record_departure_time'), ('awaiting_delay', 'delay_response'): ('complete', 'compute_exchange'), ('have_sync', 'wrong_followup'): ('have_sync', 'reject_sequence'), ('awaiting_delay', 'wrong_response'): ('awaiting_delay', 'reject_sequence'), ('complete', 'consume'): ('idle', 'clear_clock'), ('have_origin', 'new_sync'): ('have_sync', 'restart_exchange'), ('idle', 'delay_response'): ('idle', 'reject_orphan'), ('awaiting_delay', 'exchange_expired'): ('idle', 'discard_measurement')}
for event in events:
phase, action = table.get((phase, event), (phase, "reject"))
if action == 'record_receive_time':
r['receive']=seed+3
elif action == 'record_origin_time':
r['origin']=seed
elif action == 'record_departure_time':
r['departure']=seed+5
elif action == 'compute_exchange':
r['offset_twice']=(r['receive']-r['origin'])-(r['response']-r['departure'])
elif action == 'reject_sequence':
frames.append(['WRONG_EXCHANGE',seed+1])
elif action == 'release_measurement':
r['owned']=False
elif action == 'restart_exchange':
r['receive']=seed+3; r['origin']=None; r['offset_twice']=None
elif action == 'reject_orphan':
frames.append(['ORPHAN_RESPONSE',seed])
elif action == 'discard_measurement':
r['owned']=False; r['offset_twice']=None
elif action == 'publish_offset':
frames.append(['OFFSET',r['offset_twice']])
elif action == 'record_receive_as_origin':
r['origin']=r['receive']
elif action == 'record_origin_as_departure':
r['departure']=r['origin']
elif action == 'ignore_return_leg':
r['offset_twice']=r['receive']-r['origin'] if r['origin'] is not None else None
elif action == 'clear_exchange':
r['origin']=None; r['offset_twice']=None
elif action == 'use_previous_response':
r['response']=seed-1
elif action == 'clear_clock':
r['owned']=False; r['clock']=0
elif action == 'keep_old_origin':
r['receive']=seed+3
elif action == 'record_response':
r['response']=seed+7
elif action == 'publish_partial':
frames.append(['OFFSET',r['receive']-r['departure']])
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: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': None, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 1]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}, {'phase': 'have_origin', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': None, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received'], [{'phase': 'complete', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 1]]}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 1]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': None, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 2]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': None, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup'], [{'phase': 'complete', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2], ['WRONG_EXCHANGE', 3]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 3]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received'], [{'phase': 'complete', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3], ['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3], ['WRONG_EXCHANGE', 4]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 4]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received', 'new_sync'], [{'phase': 'complete', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 5]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'complete', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, '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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| idle/sync_received | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_sync/followup_received | [{'frames': [], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_origin/delay_sent | [{'frames': [], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/delay_response | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_sync/wrong_followup | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/wrong_response | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| complete/consume | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 0, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Failed |
| have_origin/new_sync | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| idle/delay_response | [{'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/exchange_expired | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Passed |
| ordered trace 0 | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| ordered trace 3 | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [], 'phase': 'idle', 'registers': {'clock': 0, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 0, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'have_sync', 'registers': {'clock': 0, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Failed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
SHA-256 / b240a0d970bf17c2c5f5aed73d27f2b9528faba55c2a5d44b38aa410f53d744b
3 / The verified repair
Exit 0"""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 = {'receive': seed+3, 'origin': seed, 'departure': seed+5, 'response': seed+7, 'offset_twice': None, 'clock': seed*10, 'owned': True}
frames = []
observed = []
table = {('idle', 'sync_received'): ('have_sync', 'record_receive_time'), ('have_sync', 'followup_received'): ('have_origin', 'record_origin_time'), ('have_origin', 'delay_sent'): ('awaiting_delay', 'record_departure_time'), ('awaiting_delay', 'delay_response'): ('complete', 'compute_exchange'), ('have_sync', 'wrong_followup'): ('have_sync', 'reject_sequence'), ('awaiting_delay', 'wrong_response'): ('awaiting_delay', 'reject_sequence'), ('complete', 'consume'): ('idle', 'release_measurement'), ('have_origin', 'new_sync'): ('have_sync', 'restart_exchange'), ('idle', 'delay_response'): ('idle', 'reject_orphan'), ('awaiting_delay', 'exchange_expired'): ('idle', 'discard_measurement')}
for event in events:
phase, action = table.get((phase, event), (phase, "reject"))
if action == 'record_receive_time':
r['receive']=seed+3
elif action == 'record_origin_time':
r['origin']=seed
elif action == 'record_departure_time':
r['departure']=seed+5
elif action == 'compute_exchange':
r['offset_twice']=(r['receive']-r['origin'])-(r['response']-r['departure'])
elif action == 'reject_sequence':
frames.append(['WRONG_EXCHANGE',seed+1])
elif action == 'release_measurement':
r['owned']=False
elif action == 'restart_exchange':
r['receive']=seed+3; r['origin']=None; r['offset_twice']=None
elif action == 'reject_orphan':
frames.append(['ORPHAN_RESPONSE',seed])
elif action == 'discard_measurement':
r['owned']=False; r['offset_twice']=None
elif action == 'publish_offset':
frames.append(['OFFSET',r['offset_twice']])
elif action == 'record_receive_as_origin':
r['origin']=r['receive']
elif action == 'record_origin_as_departure':
r['departure']=r['origin']
elif action == 'ignore_return_leg':
r['offset_twice']=r['receive']-r['origin'] if r['origin'] is not None else None
elif action == 'clear_exchange':
r['origin']=None; r['offset_twice']=None
elif action == 'use_previous_response':
r['response']=seed-1
elif action == 'clear_clock':
r['owned']=False; r['clock']=0
elif action == 'keep_old_origin':
r['receive']=seed+3
elif action == 'record_response':
r['response']=seed+7
elif action == 'publish_partial':
frames.append(['OFFSET',r['receive']-r['departure']])
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: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': None, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 1]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}, {'phase': 'have_origin', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': None, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 2]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received'], [{'phase': 'complete', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 1]]}, {'phase': 'have_sync', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': 1, 'clock': 10, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 1]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 4, 'origin': 1, 'departure': 6, 'response': 8, 'offset_twice': None, 'clock': 10, 'owned': True}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': None, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 2]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': None, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}, {'phase': 'have_origin', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 3]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup'], [{'phase': 'complete', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2]]}, {'phase': 'have_sync', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': 1, 'clock': 20, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 2], ['WRONG_EXCHANGE', 3]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 5, 'origin': 2, 'departure': 7, 'response': 9, 'offset_twice': None, 'clock': 20, 'owned': True}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 3]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': None, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 4]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received'], [{'phase': 'complete', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3]]}, {'phase': 'have_sync', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3], ['WRONG_EXCHANGE', 4]]}, {'phase': 'have_origin', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': 1, 'clock': 30, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 3], ['WRONG_EXCHANGE', 4]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 6, 'origin': 3, 'departure': 8, 'response': 10, 'offset_twice': None, 'clock': 30, 'owned': True}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 4]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 5]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received', 'new_sync'], [{'phase': 'complete', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}, {'phase': 'have_origin', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': 1, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 7, 'origin': None, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 4], ['WRONG_EXCHANGE', 5]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 7, 'origin': 4, 'departure': 9, 'response': 11, 'offset_twice': None, 'clock': 40, 'owned': True}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('idle/sync_received', 'idle', ['sync_received'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_sync/followup_received', 'have_sync', ['followup_received'], [{'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_origin/delay_sent', 'have_origin', ['delay_sent'], [{'phase': 'awaiting_delay', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('awaiting_delay/delay_response', 'awaiting_delay', ['delay_response'], [{'phase': 'complete', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': True}, 'frames': []}]), ('have_sync/wrong_followup', 'have_sync', ['wrong_followup'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('awaiting_delay/wrong_response', 'awaiting_delay', ['wrong_response'], [{'phase': 'awaiting_delay', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('complete/consume', 'complete', ['consume'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': []}]), ('have_origin/new_sync', 'have_origin', ['new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}]), ('idle/delay_response', 'idle', ['delay_response'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['ORPHAN_RESPONSE', 5]]}]), ('awaiting_delay/exchange_expired', 'awaiting_delay', ['exchange_expired'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': []}]), ('ordered trace 0', 'idle', ['sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received', 'new_sync', 'followup_received', 'new_sync'], [{'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': []}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, 'frames': [['WRONG_EXCHANGE', 6]]}]), ('ordered trace 3', 'awaiting_delay', ['delay_response', 'consume', 'delay_response', 'sync_received', 'wrong_followup', 'followup_received', 'new_sync', 'followup_received'], [{'phase': 'complete', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': True}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': []}, {'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': 1, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_sync', 'registers': {'receive': 8, 'origin': None, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}, {'phase': 'have_origin', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': False}, 'frames': [['ORPHAN_RESPONSE', 5], ['WRONG_EXCHANGE', 6]]}]), ('empty input', 'idle', [], []), ('unknown event', 'idle', ['unsupported'], [{'phase': 'idle', 'registers': {'receive': 8, 'origin': 5, 'departure': 10, 'response': 12, 'offset_twice': None, 'clock': 50, 'owned': True}, '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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| idle/sync_received | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_sync/followup_received | [{'frames': [], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_origin/delay_sent | [{'frames': [], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/delay_response | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| have_sync/wrong_followup | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/wrong_response | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'awaiting_delay', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| complete/consume | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Passed |
| have_origin/new_sync | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| idle/delay_response | [{'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| awaiting_delay/exchange_expired | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Passed |
| ordered trace 0 | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_origin', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [['WRONG_EXCHANGE', 2]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': None, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
| ordered trace 3 | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | [{'frames': [], 'phase': 'complete', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}, {'frames': [], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}, {'frames': [['ORPHAN_RESPONSE', 1]], 'phase': 'have_sync', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': 1, 'origin': 1, 'owned': False, 'receive': 4, 'response': 8}}] | Passed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'idle', 'registers': {'clock': 10, 'departure': 6, 'offset_twice': None, 'origin': 1, 'owned': True, 'receive': 4, 'response': 8}}] | Passed |
SHA-256 / 43ade4522d1d84828ab9c45a41c340bbb34760c01e4cf7b16d102f70e82c3145
Verification & scope
Bounded offline control-plane abstraction with prescribed initial registers and classified events. Not a named protocol implementation or conformance test; excludes wire parsing, transport retries, physical execution, authentication, crash persistence, and timing. Related event faults share the full corrected controller and evaluation group. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:40:13.934421+00:00.
Case digest / c32638a624ff34646397e6eeb7ad7d7e0b9182947a0663ed7e76ba7b4f6c00b2