FA-18861 / Protocols / Open access
Bidirectional orderly-close controller: send closed / remote fin · case 01
While send_closed, event remote_fin produces closed/release instead of closing/ack_fin.
ROOT CAUSE
In send closed, the remote fin handler runs release and enters closed; it must instead run ack fin and enter closing.
VERIFIED REPAIR
In phase send_closed, classify remote_fin as transition to closing and emit ack_fin.
Unsuccessful approach: The partial repair chooses send_closed/ack_fin, which still violates this phase-specific event contract.
Case contract
For the stipulated Bidirectional orderly-close 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 = {'tx_open': phase not in ('send_closed','closing','closed'), 'rx_open': phase not in ('receive_closed','closing','closed'), 'received': [], 'sent': [], 'owned': phase!='closed', 'fin_pending': phase in ('send_closed','closing'), 'payload_pending': payload[:]}
frames = []
observed = []
table = {('open', 'local_eof'): ('send_closed', 'send_fin'), ('open', 'remote_fin'): ('receive_closed', 'ack_fin'), ('send_closed', 'fin_receipt'): ('send_closed', 'retire_fin'), ('receive_closed', 'local_data'): ('receive_closed', 'send'), ('send_closed', 'remote_fin'): ('closed', 'release'), ('receive_closed', 'local_eof'): ('closing', 'send_fin'), ('closing', 'fin_confirmed'): ('closed', 'release'), ('closed', 'late_data'): ('closed', 'reject'), ('send_closed', 'local_data'): ('send_closed', 'reject'), ('receive_closed', 'remote_data'): ('receive_closed', 'reject')}
for event in events:
phase, action = table.get((phase, event), (phase, "reject"))
if action == 'send_fin':
r['tx_open']=False; frames.append(['FIN',seed])
elif action == 'send_two_fins':
r['tx_open']=False; frames.extend([['FIN',seed],['FIN',seed]])
elif action == 'send_fin_as_data':
r['tx_open']=False; frames.append(['DATA',['FIN',seed]])
elif action == 'retire_fin':
r['fin_pending']=False
elif action == 'retire_payload_too':
r['fin_pending']=False; r['payload_pending']=[]
elif action == 'ack_fin':
r['rx_open']=False; frames.append(['ACK_FIN',seed])
elif action == 'deliver':
r['received'].extend(payload)
elif action == 'send':
r['sent'].extend(payload)
elif action == 'release':
r['owned']=False
elif action == 'reject':
frames.append(['REJECT',event])
elif action == 'drop_both':
r['tx_open']=False; r['rx_open']=False; r['owned']=False
elif action == 'discard':
r['received']=[]; r['sent']=[]
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: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['ACK_FIN', 1]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': [['ACK_FIN', 1]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'unsupported']]}])], 2: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['ACK_FIN', 2]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['ACK_FIN', 2]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'unsupported']]}])], 3: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['ACK_FIN', 3]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['ACK_FIN', 3]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'unsupported']]}])], 4: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['ACK_FIN', 4]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['ACK_FIN', 4]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'unsupported']]}])], 5: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['ACK_FIN', 5]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['ACK_FIN', 5]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'unsupported']]}])]}
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 |
|---|---|---|---|
| open/local_eof | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| open/remote_fin | [{'frames': [['ACK_FIN', 1]], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | [{'frames': [['ACK_FIN', 1]], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | Passed |
| send_closed/fin_receipt | [{'frames': [], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| receive_closed/local_data | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}] | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}] | Passed |
| send_closed/remote_fin | [{'frames': [], 'phase': 'closed', 'registers': {'fin_pending': True, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [['ACK_FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Failed |
| receive_closed/local_eof | [{'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| closing/fin_confirmed | [{'frames': [], 'phase': 'closed', 'registers': {'fin_pending': True, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [], 'phase': 'closed', 'registers': {'fin_pending': True, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| closed/late_data | [{'frames': [['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| send_closed/local_data | [{'frames': [['REJECT', 'local_data']], 'phase': 'send_closed', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [['REJECT', 'local_data']], 'phase': 'send_closed', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| receive_closed/remote_data | [{'frames': [['REJECT', 'remote_data']], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | [{'frames': [['REJECT', 'remote_data']], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | Passed |
| ordered trace 0 | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['REJECT', 'fin_confirmed']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['REJECT', 'fin_confirmed'], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Failed |
| ordered trace 3 | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}, {'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}] | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}, {'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}] | Passed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['REJECT', 'unsupported']], 'phase': 'open', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': True}}] | [{'frames': [['REJECT', 'unsupported']], 'phase': 'open', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': True}}] | Passed |
SHA-256 / 1729a8fc471f75f0f2c95de330d70306ae6b0be31e59fa362d41e2693becccd4
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 = {'tx_open': phase not in ('send_closed','closing','closed'), 'rx_open': phase not in ('receive_closed','closing','closed'), 'received': [], 'sent': [], 'owned': phase!='closed', 'fin_pending': phase in ('send_closed','closing'), 'payload_pending': payload[:]}
frames = []
observed = []
table = {('open', 'local_eof'): ('send_closed', 'send_fin'), ('open', 'remote_fin'): ('receive_closed', 'ack_fin'), ('send_closed', 'fin_receipt'): ('send_closed', 'retire_fin'), ('receive_closed', 'local_data'): ('receive_closed', 'send'), ('send_closed', 'remote_fin'): ('send_closed', 'ack_fin'), ('receive_closed', 'local_eof'): ('closing', 'send_fin'), ('closing', 'fin_confirmed'): ('closed', 'release'), ('closed', 'late_data'): ('closed', 'reject'), ('send_closed', 'local_data'): ('send_closed', 'reject'), ('receive_closed', 'remote_data'): ('receive_closed', 'reject')}
for event in events:
phase, action = table.get((phase, event), (phase, "reject"))
if action == 'send_fin':
r['tx_open']=False; frames.append(['FIN',seed])
elif action == 'send_two_fins':
r['tx_open']=False; frames.extend([['FIN',seed],['FIN',seed]])
elif action == 'send_fin_as_data':
r['tx_open']=False; frames.append(['DATA',['FIN',seed]])
elif action == 'retire_fin':
r['fin_pending']=False
elif action == 'retire_payload_too':
r['fin_pending']=False; r['payload_pending']=[]
elif action == 'ack_fin':
r['rx_open']=False; frames.append(['ACK_FIN',seed])
elif action == 'deliver':
r['received'].extend(payload)
elif action == 'send':
r['sent'].extend(payload)
elif action == 'release':
r['owned']=False
elif action == 'reject':
frames.append(['REJECT',event])
elif action == 'drop_both':
r['tx_open']=False; r['rx_open']=False; r['owned']=False
elif action == 'discard':
r['received']=[]; r['sent']=[]
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: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['ACK_FIN', 1]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': [['ACK_FIN', 1]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'unsupported']]}])], 2: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['ACK_FIN', 2]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['ACK_FIN', 2]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'unsupported']]}])], 3: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['ACK_FIN', 3]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['ACK_FIN', 3]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'unsupported']]}])], 4: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['ACK_FIN', 4]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['ACK_FIN', 4]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'unsupported']]}])], 5: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['ACK_FIN', 5]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['ACK_FIN', 5]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'unsupported']]}])]}
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 |
|---|---|---|---|
| open/local_eof | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| open/remote_fin | [{'frames': [['ACK_FIN', 1]], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | [{'frames': [['ACK_FIN', 1]], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | Passed |
| send_closed/fin_receipt | [{'frames': [], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| receive_closed/local_data | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}] | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}] | Passed |
| send_closed/remote_fin | [{'frames': [['ACK_FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['ACK_FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Failed |
| receive_closed/local_eof | [{'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| closing/fin_confirmed | [{'frames': [], 'phase': 'closed', 'registers': {'fin_pending': True, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [], 'phase': 'closed', 'registers': {'fin_pending': True, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| closed/late_data | [{'frames': [['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| send_closed/local_data | [{'frames': [['REJECT', 'local_data']], 'phase': 'send_closed', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [['REJECT', 'local_data']], 'phase': 'send_closed', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| receive_closed/remote_data | [{'frames': [['REJECT', 'remote_data']], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | [{'frames': [['REJECT', 'remote_data']], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | Passed |
| ordered trace 0 | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'fin_confirmed']], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'fin_confirmed'], ['REJECT', 'late_data']], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Failed |
| ordered trace 3 | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}, {'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}] | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}, {'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}] | Passed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['REJECT', 'unsupported']], 'phase': 'open', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': True}}] | [{'frames': [['REJECT', 'unsupported']], 'phase': 'open', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': True}}] | Passed |
SHA-256 / 97c5b3627d1cdb7a95022af092f4df1841cce00340931c31757cd39ff9a2c80d
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 = {'tx_open': phase not in ('send_closed','closing','closed'), 'rx_open': phase not in ('receive_closed','closing','closed'), 'received': [], 'sent': [], 'owned': phase!='closed', 'fin_pending': phase in ('send_closed','closing'), 'payload_pending': payload[:]}
frames = []
observed = []
table = {('open', 'local_eof'): ('send_closed', 'send_fin'), ('open', 'remote_fin'): ('receive_closed', 'ack_fin'), ('send_closed', 'fin_receipt'): ('send_closed', 'retire_fin'), ('receive_closed', 'local_data'): ('receive_closed', 'send'), ('send_closed', 'remote_fin'): ('closing', 'ack_fin'), ('receive_closed', 'local_eof'): ('closing', 'send_fin'), ('closing', 'fin_confirmed'): ('closed', 'release'), ('closed', 'late_data'): ('closed', 'reject'), ('send_closed', 'local_data'): ('send_closed', 'reject'), ('receive_closed', 'remote_data'): ('receive_closed', 'reject')}
for event in events:
phase, action = table.get((phase, event), (phase, "reject"))
if action == 'send_fin':
r['tx_open']=False; frames.append(['FIN',seed])
elif action == 'send_two_fins':
r['tx_open']=False; frames.extend([['FIN',seed],['FIN',seed]])
elif action == 'send_fin_as_data':
r['tx_open']=False; frames.append(['DATA',['FIN',seed]])
elif action == 'retire_fin':
r['fin_pending']=False
elif action == 'retire_payload_too':
r['fin_pending']=False; r['payload_pending']=[]
elif action == 'ack_fin':
r['rx_open']=False; frames.append(['ACK_FIN',seed])
elif action == 'deliver':
r['received'].extend(payload)
elif action == 'send':
r['sent'].extend(payload)
elif action == 'release':
r['owned']=False
elif action == 'reject':
frames.append(['REJECT',event])
elif action == 'drop_both':
r['tx_open']=False; r['rx_open']=False; r['owned']=False
elif action == 'discard':
r['received']=[]; r['sent']=[]
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: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['ACK_FIN', 1]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': [['ACK_FIN', 1]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [1, 2, 3], 'owned': False, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['FIN', 1], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [1, 2, 3]}, 'frames': [['REJECT', 'unsupported']]}])], 2: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['ACK_FIN', 2]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['ACK_FIN', 2]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['ACK_FIN', 2], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [2, 3, 4, 5], 'owned': False, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['FIN', 2], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [2, 3, 4, 5]}, 'frames': [['REJECT', 'unsupported']]}])], 3: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['ACK_FIN', 3]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['ACK_FIN', 3]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['ACK_FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [3, 4, 5, 6, 7], 'owned': False, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['FIN', 3], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [3, 4, 5, 6, 7]}, 'frames': [['REJECT', 'unsupported']]}])], 4: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['ACK_FIN', 4]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['ACK_FIN', 4]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['ACK_FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [4, 5, 6, 7, 8, 9], 'owned': False, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['FIN', 4], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [4, 5, 6, 7, 8, 9]}, 'frames': [['REJECT', 'unsupported']]}])], 5: [('open/local_eof', 'open', ['local_eof'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}]), ('open/remote_fin', 'open', ['remote_fin'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['ACK_FIN', 5]]}]), ('send_closed/fin_receipt', 'send_closed', ['fin_receipt'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('receive_closed/local_data', 'receive_closed', ['local_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('send_closed/remote_fin', 'send_closed', ['remote_fin'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['ACK_FIN', 5]]}]), ('receive_closed/local_eof', 'receive_closed', ['local_eof'], [{'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}]), ('closing/fin_confirmed', 'closing', ['fin_confirmed'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}]), ('closed/late_data', 'closed', ['late_data'], [{'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'late_data']]}]), ('send_closed/local_data', 'send_closed', ['local_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': True, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'local_data']]}]), ('receive_closed/remote_data', 'receive_closed', ['remote_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'remote_data']]}]), ('ordered trace 0', 'open', ['local_eof', 'remote_fin', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'send_closed', 'registers': {'tx_open': False, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['ACK_FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('ordered trace 3', 'receive_closed', ['local_data', 'local_eof', 'fin_confirmed', 'late_data', 'late_data', 'late_data', 'late_data', 'late_data'], [{'phase': 'receive_closed', 'registers': {'tx_open': True, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': []}, {'phase': 'closing', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5]]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}, {'phase': 'closed', 'registers': {'tx_open': False, 'rx_open': False, 'received': [], 'sent': [5, 6, 7, 8, 9, 10, 11], 'owned': False, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['FIN', 5], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data'], ['REJECT', 'late_data']]}]), ('empty input', 'open', [], []), ('unknown event', 'open', ['unsupported'], [{'phase': 'open', 'registers': {'tx_open': True, 'rx_open': True, 'received': [], 'sent': [], 'owned': True, 'fin_pending': False, 'payload_pending': [5, 6, 7, 8, 9, 10, 11]}, 'frames': [['REJECT', 'unsupported']]}])]}
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 |
|---|---|---|---|
| open/local_eof | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| open/remote_fin | [{'frames': [['ACK_FIN', 1]], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | [{'frames': [['ACK_FIN', 1]], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | Passed |
| send_closed/fin_receipt | [{'frames': [], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| receive_closed/local_data | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}] | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}] | Passed |
| send_closed/remote_fin | [{'frames': [['ACK_FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['ACK_FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| receive_closed/local_eof | [{'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| closing/fin_confirmed | [{'frames': [], 'phase': 'closed', 'registers': {'fin_pending': True, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [], 'phase': 'closed', 'registers': {'fin_pending': True, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| closed/late_data | [{'frames': [['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| send_closed/local_data | [{'frames': [['REJECT', 'local_data']], 'phase': 'send_closed', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | [{'frames': [['REJECT', 'local_data']], 'phase': 'send_closed', 'registers': {'fin_pending': True, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}] | Passed |
| receive_closed/remote_data | [{'frames': [['REJECT', 'remote_data']], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | [{'frames': [['REJECT', 'remote_data']], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': True}}] | Passed |
| ordered trace 0 | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | [{'frames': [['FIN', 1]], 'phase': 'send_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}, {'frames': [['FIN', 1], ['ACK_FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [], 'tx_open': False}}] | Passed |
| ordered trace 3 | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}, {'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}] | [{'frames': [], 'phase': 'receive_closed', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': True}}, {'frames': [['FIN', 1]], 'phase': 'closing', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1]], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}, {'frames': [['FIN', 1], ['REJECT', 'late_data']], 'phase': 'closed', 'registers': {'fin_pending': False, 'owned': False, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': False, 'sent': [1, 2, 3], 'tx_open': False}}] | Passed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['REJECT', 'unsupported']], 'phase': 'open', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': True}}] | [{'frames': [['REJECT', 'unsupported']], 'phase': 'open', 'registers': {'fin_pending': False, 'owned': True, 'payload_pending': [1, 2, 3], 'received': [], 'rx_open': True, 'sent': [], 'tx_open': True}}] | Passed |
SHA-256 / 651ff0b3ac7970a25269653735d533049cc749648d2e14bd45dbd8fc2a90cd03
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:01.953544+00:00.
Case digest / a192fefbe4239de60af512e3b41b8ab7952faa93fd39419c792a564b75a4528a