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

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'local_owner': phase!='released', 'remote_owners': int(phase=='released'), 'fenced': phase in ('fenced','transferring','released'), 'offers': int(phase in ('offering','fenced','transferring')), 'writes': [], 'queued': []}
    frames = []
    observed = []
    table = {('owned', 'handoff_request'): ('offering', 'send_offer'), ('offering', 'peer_ready'): ('fenced', 'fence_local'), ('fenced', 'fence_confirmed'): ('transferring', 'send_grant'), ('transferring', 'grant_ack'): ('released', 'forget_local_owner'), ('offering', 'peer_refuses'): ('owned', 'withdraw_offer'), ('offering', 'local_write'): ('offering', 'write_local'), ('fenced', 'local_write'): ('fenced', 'reject_fenced'), ('released', 'local_write'): ('released', 'reject_not_owner'), ('transferring', 'duplicate_ready'): ('transferring', 'repeat_grant'), ('owned', 'unsolicited_ack'): ('released', 'forget_local_owner')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_offer':
            r['offers']+=1; frames.append(['OFFER_OWNER',seed])
        elif action == 'fence_local':
            r['fenced']=True
        elif action == 'send_grant':
            r['remote_owners']+=1; frames.append(['GRANT_OWNER',seed])
        elif action == 'forget_local_owner':
            r['local_owner']=False
        elif action == 'withdraw_offer':
            r['offers']=0
        elif action == 'write_local':
            r['writes'].append(['local',payload])
        elif action == 'reject_fenced':
            frames.append(['FENCED',payload])
        elif action == 'reject_not_owner':
            frames.append(['NOT_OWNER',payload])
        elif action == 'repeat_grant':
            frames.append(['GRANT_OWNER',seed])
        elif action == 'reject_unoffered':
            frames.append(['NO_OFFER',seed])
        elif action == 'drop_owner':
            r['local_owner']=False
        elif action == 'grant_both':
            r['remote_owners']+=1; r['local_owner']=True
        elif action == 'continue_local':
            r['writes'].append(['local',payload])
        elif action == 'grant_remote':
            r['remote_owners']+=1
        elif action == 'drop_record':
            r['local_owner']=False
        elif action == 'unfence_local':
            r['fenced']=False
        elif action == 'resume_local':
            r['local_owner']=True; r['fenced']=False
        elif action == 'write_remote':
            r['writes'].append(['remote',payload])
        elif action == 'reject':
            frames.append(['REJECT',seed])
        elif action == 'queue_write':
            r['queued'].extend(payload)
        elif action == 'grant_second_owner':
            r['remote_owners']+=2
        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: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [1, 2, 3]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [1, 2, 3]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [1, 2, 3]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 1]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1], ['OFFER_OWNER', 1]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1], ['OFFER_OWNER', 1]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1], ['NOT_OWNER', [1, 2, 3]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1], ['NOT_OWNER', [1, 2, 3]], ['NOT_OWNER', [1, 2, 3]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 1]]}])], 2: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [2, 3, 4, 5]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [2, 3, 4, 5]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [2, 3, 4, 5]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 2]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready', 'fence_confirmed'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2], ['OFFER_OWNER', 2]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2], ['OFFER_OWNER', 2]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2], ['OFFER_OWNER', 2], ['GRANT_OWNER', 2]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2], ['NOT_OWNER', [2, 3, 4, 5]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2], ['NOT_OWNER', [2, 3, 4, 5]], ['NOT_OWNER', [2, 3, 4, 5]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2], ['NOT_OWNER', [2, 3, 4, 5]], ['NOT_OWNER', [2, 3, 4, 5]], ['NOT_OWNER', [2, 3, 4, 5]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 2]]}])], 3: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [3, 4, 5, 6, 7]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [3, 4, 5, 6, 7]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [3, 4, 5, 6, 7]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 3]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready', 'fence_confirmed', 'duplicate_ready'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3], ['OFFER_OWNER', 3]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3], ['OFFER_OWNER', 3]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3], ['OFFER_OWNER', 3], ['GRANT_OWNER', 3]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3], ['OFFER_OWNER', 3], ['GRANT_OWNER', 3], ['GRANT_OWNER', 3]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3], ['NOT_OWNER', [3, 4, 5, 6, 7]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 3]]}])], 4: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [4, 5, 6, 7, 8, 9]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 4]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready', 'fence_confirmed', 'duplicate_ready', 'grant_ack'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4], ['GRANT_OWNER', 4]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4], ['GRANT_OWNER', 4], ['GRANT_OWNER', 4]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4], ['GRANT_OWNER', 4], ['GRANT_OWNER', 4]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write', 'local_write', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 4]]}])], 5: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [5, 6, 7, 8, 9, 10, 11]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 5]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready', 'fence_confirmed', 'duplicate_ready', 'grant_ack', 'local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5], ['GRANT_OWNER', 5]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5], ['GRANT_OWNER', 5], ['GRANT_OWNER', 5]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5], ['GRANT_OWNER', 5], ['GRANT_OWNER', 5]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5], ['GRANT_OWNER', 5], ['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write', 'local_write', 'local_write', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 5]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'local_owner': phase!='released', 'remote_owners': int(phase=='released'), 'fenced': phase in ('fenced','transferring','released'), 'offers': int(phase in ('offering','fenced','transferring')), 'writes': [], 'queued': []}
    frames = []
    observed = []
    table = {('owned', 'handoff_request'): ('offering', 'send_offer'), ('offering', 'peer_ready'): ('fenced', 'fence_local'), ('fenced', 'fence_confirmed'): ('transferring', 'send_grant'), ('transferring', 'grant_ack'): ('released', 'forget_local_owner'), ('offering', 'peer_refuses'): ('owned', 'withdraw_offer'), ('offering', 'local_write'): ('offering', 'write_local'), ('fenced', 'local_write'): ('fenced', 'reject_fenced'), ('released', 'local_write'): ('released', 'reject_not_owner'), ('transferring', 'duplicate_ready'): ('transferring', 'repeat_grant'), ('owned', 'unsolicited_ack'): ('owned', 'fence_local')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_offer':
            r['offers']+=1; frames.append(['OFFER_OWNER',seed])
        elif action == 'fence_local':
            r['fenced']=True
        elif action == 'send_grant':
            r['remote_owners']+=1; frames.append(['GRANT_OWNER',seed])
        elif action == 'forget_local_owner':
            r['local_owner']=False
        elif action == 'withdraw_offer':
            r['offers']=0
        elif action == 'write_local':
            r['writes'].append(['local',payload])
        elif action == 'reject_fenced':
            frames.append(['FENCED',payload])
        elif action == 'reject_not_owner':
            frames.append(['NOT_OWNER',payload])
        elif action == 'repeat_grant':
            frames.append(['GRANT_OWNER',seed])
        elif action == 'reject_unoffered':
            frames.append(['NO_OFFER',seed])
        elif action == 'drop_owner':
            r['local_owner']=False
        elif action == 'grant_both':
            r['remote_owners']+=1; r['local_owner']=True
        elif action == 'continue_local':
            r['writes'].append(['local',payload])
        elif action == 'grant_remote':
            r['remote_owners']+=1
        elif action == 'drop_record':
            r['local_owner']=False
        elif action == 'unfence_local':
            r['fenced']=False
        elif action == 'resume_local':
            r['local_owner']=True; r['fenced']=False
        elif action == 'write_remote':
            r['writes'].append(['remote',payload])
        elif action == 'reject':
            frames.append(['REJECT',seed])
        elif action == 'queue_write':
            r['queued'].extend(payload)
        elif action == 'grant_second_owner':
            r['remote_owners']+=2
        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: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [1, 2, 3]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [1, 2, 3]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [1, 2, 3]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 1]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1], ['OFFER_OWNER', 1]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 1], ['OFFER_OWNER', 1]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1], ['NOT_OWNER', [1, 2, 3]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 1], ['NOT_OWNER', [1, 2, 3]], ['NOT_OWNER', [1, 2, 3]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 1]]}])], 2: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [2, 3, 4, 5]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [2, 3, 4, 5]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [2, 3, 4, 5]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 2]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready', 'fence_confirmed'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2], ['OFFER_OWNER', 2]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2], ['OFFER_OWNER', 2]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 2], ['OFFER_OWNER', 2], ['GRANT_OWNER', 2]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2], ['NOT_OWNER', [2, 3, 4, 5]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2], ['NOT_OWNER', [2, 3, 4, 5]], ['NOT_OWNER', [2, 3, 4, 5]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 2], ['NOT_OWNER', [2, 3, 4, 5]], ['NOT_OWNER', [2, 3, 4, 5]], ['NOT_OWNER', [2, 3, 4, 5]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 2]]}])], 3: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [3, 4, 5, 6, 7]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [3, 4, 5, 6, 7]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [3, 4, 5, 6, 7]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 3]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready', 'fence_confirmed', 'duplicate_ready'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3], ['OFFER_OWNER', 3]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3], ['OFFER_OWNER', 3]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3], ['OFFER_OWNER', 3], ['GRANT_OWNER', 3]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 3], ['OFFER_OWNER', 3], ['GRANT_OWNER', 3], ['GRANT_OWNER', 3]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3], ['NOT_OWNER', [3, 4, 5, 6, 7]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 3], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]], ['NOT_OWNER', [3, 4, 5, 6, 7]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 3]]}])], 4: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [4, 5, 6, 7, 8, 9]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [4, 5, 6, 7, 8, 9]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 4]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready', 'fence_confirmed', 'duplicate_ready', 'grant_ack'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4], ['GRANT_OWNER', 4]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4], ['GRANT_OWNER', 4], ['GRANT_OWNER', 4]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 4], ['OFFER_OWNER', 4], ['GRANT_OWNER', 4], ['GRANT_OWNER', 4]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write', 'local_write', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 4], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]], ['NOT_OWNER', [4, 5, 6, 7, 8, 9]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 4]]}])], 5: [('owned/handoff_request', 'owned', ['handoff_request'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5]]}]), ('offering/peer_ready', 'offering', ['peer_ready'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('fenced/fence_confirmed', 'fenced', ['fence_confirmed'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5]]}]), ('transferring/grant_ack', 'transferring', ['grant_ack'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/peer_refuses', 'offering', ['peer_refuses'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': []}]), ('offering/local_write', 'offering', ['local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [['local', [5, 6, 7, 8, 9, 10, 11]]], 'queued': []}, 'frames': []}]), ('fenced/local_write', 'fenced', ['local_write'], [{'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['FENCED', [5, 6, 7, 8, 9, 10, 11]]]}]), ('released/local_write', 'released', ['local_write'], [{'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}]), ('transferring/duplicate_ready', 'transferring', ['duplicate_ready'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5]]}]), ('owned/unsolicited_ack', 'owned', ['unsolicited_ack'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['NO_OFFER', 5]]}]), ('ordered trace 0', 'owned', ['handoff_request', 'peer_refuses', 'handoff_request', 'peer_ready', 'fence_confirmed', 'duplicate_ready', 'grant_ack', 'local_write'], [{'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5]]}, {'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5]]}, {'phase': 'offering', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5]]}, {'phase': 'fenced', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5], ['GRANT_OWNER', 5]]}, {'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5], ['GRANT_OWNER', 5], ['GRANT_OWNER', 5]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5], ['GRANT_OWNER', 5], ['GRANT_OWNER', 5]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 1, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['OFFER_OWNER', 5], ['OFFER_OWNER', 5], ['GRANT_OWNER', 5], ['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}]), ('ordered trace 3', 'transferring', ['duplicate_ready', 'grant_ack', 'local_write', 'local_write', 'local_write', 'local_write', 'local_write', 'local_write'], [{'phase': 'transferring', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'released', 'registers': {'local_owner': False, 'remote_owners': 0, 'fenced': True, 'offers': 1, 'writes': [], 'queued': []}, 'frames': [['GRANT_OWNER', 5], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]], ['NOT_OWNER', [5, 6, 7, 8, 9, 10, 11]]]}]), ('empty input', 'owned', [], []), ('unknown event', 'owned', ['unsupported'], [{'phase': 'owned', 'registers': {'local_owner': True, 'remote_owners': 0, 'fenced': False, 'offers': 0, 'writes': [], 'queued': []}, 'frames': [['REJECT', 5]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
While owned, event unsolicited_ack produces released/forget_local_owner instead of owned/reject_unoffered.

For the stipulated Exclusive owner handoff controller, initialize the explicitly shown resource registers from seed (1..5), then consume classified events sequentially. After each event return a deep snapshot of phase, resource registers, and cumulative emitted control frames. The explicit ten phase/event rules and their resource effects define admission and response semantics. Unlisted events preserve phase and emit rejection. Payload is the consecutive integers seed through 2*seed+1. Empty event input returns no observations.

split: open-access