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 = {'dictionary': 'old' if phase in ('active','switching') else None, 'epoch': seed, 'enabled': phase=='active', 'cache': ['old'], 'decoded': []}
    frames = []
    observed = []
    table = {('empty', 'offer'): ('offered', 'send_fingerprint'), ('offered', 'cache_hit'): ('active', 'select_cached'), ('offered', 'cache_miss'): ('installing', 'send_dictionary'), ('installing', 'verified'): ('active', 'confirm_install'), ('installing', 'bad_fingerprint'): ('empty', 'reject_dictionary'), ('active', 'replacement_offer'): ('switching', 'pause_old_epoch'), ('switching', 'replacement_ready'): ('active', 'switch_epoch'), ('switching', 'replacement_failed'): ('active', 'resume_old_epoch'), ('empty', 'compressed_payload'): ('active', 'decode_default'), ('active', 'evicted'): ('empty', 'notify_unavailable')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_fingerprint':
            frames.append(['DICT_ID','new',seed+1])
        elif action == 'select_cached':
            r['dictionary']='new'; r['epoch']=seed+1
        elif action == 'send_dictionary':
            frames.append(['DICT_BODY','new',payload])
        elif action == 'confirm_install':
            r['cache'].append('new'); r['dictionary']='new'; frames.append(['DICT_READY',seed+1])
        elif action == 'reject_dictionary':
            frames.append(['BAD_DICT','new']); r['enabled']=False
        elif action == 'pause_old_epoch':
            r['enabled']=False
        elif action == 'switch_epoch':
            r['dictionary']='new'; r['epoch']=seed+1; r['enabled']=True
        elif action == 'resume_old_epoch':
            r['dictionary']='old'; r['epoch']=seed; r['enabled']=True
        elif action == 'reject_missing':
            frames.append(['MISSING_DICT',seed])
        elif action == 'notify_unavailable':
            r['enabled']=False; r['cache']=[]; frames.append(['DICT_EVICTED',seed])
        elif action == 'compress':
            frames.append(['COMPRESSED',r['dictionary'],payload])
        elif action == 'send_payload':
            frames.append(['COMPRESSED',None,payload])
        elif action == 'select_default':
            r['dictionary']='default'
        elif action == 'compress_without_confirm':
            r['dictionary']='new'; frames.append(['COMPRESSED','new',payload])
        elif action == 'cache_bad':
            r['cache'].append('corrupt')
        elif action == 'switch_immediately':
            r['dictionary']='new'; r['epoch']=seed+1
        elif action == 'continue_old':
            frames.append(['COMPRESSED','old',payload])
        elif action == 'keep_old_epoch':
            r['enabled']=True
        elif action == 'use_rejected_epoch':
            r['dictionary']='rejected'
        elif action == 'discard_old':
            r['cache']=[]
        elif action == 'decode_default':
            r['decoded'].append(['default',payload])
        elif action == 'deliver_raw':
            r['decoded'].append(['raw',payload])
        elif action == 'decode_stale':
            r['decoded'].append(['old',payload])
        elif action == 'silent_drop':
            r['cache']=[]
        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: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [1, 2, 3]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 1, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 2]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 1, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 1]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 1, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 1]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 1, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 1, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2], ['DICT_EVICTED', 1]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 1, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [2, 3, 4, 5]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 3]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 2, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 2]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 2, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 2]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted', 'offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3], ['DICT_EVICTED', 2]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3], ['DICT_EVICTED', 2], ['DICT_ID', 'new', 3]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified', 'evicted'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 3]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3], ['DICT_EVICTED', 2]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [3, 4, 5, 6, 7]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 4]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 3, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 3]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 3]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3], ['DICT_ID', 'new', 4]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified', 'evicted', 'offer'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3], ['DICT_ID', 'new', 4]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 5]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 4, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 4]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 4]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss', 'verified'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 6, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 6]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 6, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 5, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 5]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 5]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss', 'verified', 'evicted'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss', 'verified'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(phase, events, seed):
    payload = list(range(seed, seed * 2 + 2))
    r = {'dictionary': 'old' if phase in ('active','switching') else None, 'epoch': seed, 'enabled': phase=='active', 'cache': ['old'], 'decoded': []}
    frames = []
    observed = []
    table = {('empty', 'offer'): ('offered', 'send_fingerprint'), ('offered', 'cache_hit'): ('active', 'select_cached'), ('offered', 'cache_miss'): ('installing', 'send_dictionary'), ('installing', 'verified'): ('active', 'confirm_install'), ('installing', 'bad_fingerprint'): ('empty', 'reject_dictionary'), ('active', 'replacement_offer'): ('switching', 'pause_old_epoch'), ('switching', 'replacement_ready'): ('active', 'switch_epoch'), ('switching', 'replacement_failed'): ('active', 'resume_old_epoch'), ('empty', 'compressed_payload'): ('empty', 'deliver_raw'), ('active', 'evicted'): ('empty', 'notify_unavailable')}
    for event in events:
        phase, action = table.get((phase, event), (phase, "reject"))
        if action == 'send_fingerprint':
            frames.append(['DICT_ID','new',seed+1])
        elif action == 'select_cached':
            r['dictionary']='new'; r['epoch']=seed+1
        elif action == 'send_dictionary':
            frames.append(['DICT_BODY','new',payload])
        elif action == 'confirm_install':
            r['cache'].append('new'); r['dictionary']='new'; frames.append(['DICT_READY',seed+1])
        elif action == 'reject_dictionary':
            frames.append(['BAD_DICT','new']); r['enabled']=False
        elif action == 'pause_old_epoch':
            r['enabled']=False
        elif action == 'switch_epoch':
            r['dictionary']='new'; r['epoch']=seed+1; r['enabled']=True
        elif action == 'resume_old_epoch':
            r['dictionary']='old'; r['epoch']=seed; r['enabled']=True
        elif action == 'reject_missing':
            frames.append(['MISSING_DICT',seed])
        elif action == 'notify_unavailable':
            r['enabled']=False; r['cache']=[]; frames.append(['DICT_EVICTED',seed])
        elif action == 'compress':
            frames.append(['COMPRESSED',r['dictionary'],payload])
        elif action == 'send_payload':
            frames.append(['COMPRESSED',None,payload])
        elif action == 'select_default':
            r['dictionary']='default'
        elif action == 'compress_without_confirm':
            r['dictionary']='new'; frames.append(['COMPRESSED','new',payload])
        elif action == 'cache_bad':
            r['cache'].append('corrupt')
        elif action == 'switch_immediately':
            r['dictionary']='new'; r['epoch']=seed+1
        elif action == 'continue_old':
            frames.append(['COMPRESSED','old',payload])
        elif action == 'keep_old_epoch':
            r['enabled']=True
        elif action == 'use_rejected_epoch':
            r['dictionary']='rejected'
        elif action == 'discard_old':
            r['cache']=[]
        elif action == 'decode_default':
            r['decoded'].append(['default',payload])
        elif action == 'deliver_raw':
            r['decoded'].append(['raw',payload])
        elif action == 'decode_stale':
            r['decoded'].append(['old',payload])
        elif action == 'silent_drop':
            r['cache']=[]
        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: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [1, 2, 3]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 1, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 2]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 1, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 1]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 1, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 1]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 1, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 1, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2], ['DICT_EVICTED', 1]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 1, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 1, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [1, 2, 3]]]}])], 2: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [2, 3, 4, 5]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 3]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 2, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 2]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 2, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 2]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted', 'offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3], ['DICT_EVICTED', 2]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3], ['DICT_EVICTED', 2], ['DICT_ID', 'new', 3]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified', 'evicted'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 3]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 2, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 3], ['DICT_BODY', 'new', [2, 3, 4, 5]], ['DICT_READY', 3], ['DICT_EVICTED', 2]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 2, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [2, 3, 4, 5]]]}])], 3: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [3, 4, 5, 6, 7]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 4]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 3, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 3]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 3]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3], ['DICT_ID', 'new', 4]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified', 'evicted', 'offer'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 3, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 4], ['DICT_BODY', 'new', [3, 4, 5, 6, 7]], ['DICT_READY', 4], ['DICT_EVICTED', 3], ['DICT_ID', 'new', 4]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 3, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [3, 4, 5, 6, 7]]]}])], 4: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 5]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 4, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 4]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 4]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss', 'verified'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 4, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]], ['DICT_READY', 5], ['DICT_EVICTED', 4], ['DICT_ID', 'new', 5], ['DICT_BODY', 'new', [4, 5, 6, 7, 8, 9]]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 4, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [4, 5, 6, 7, 8, 9]]]}])], 5: [('empty/offer', 'empty', ['offer'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6]]}]), ('offered/cache_hit', 'offered', ['cache_hit'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 6, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('offered/cache_miss', 'offered', ['cache_miss'], [{'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}]), ('installing/verified', 'installing', ['verified'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_READY', 6]]}]), ('installing/bad_fingerprint', 'installing', ['bad_fingerprint'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}]), ('active/replacement_offer', 'active', ['replacement_offer'], [{'phase': 'switching', 'registers': {'dictionary': 'old', 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_ready', 'switching', ['replacement_ready'], [{'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 6, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('switching/replacement_failed', 'switching', ['replacement_failed'], [{'phase': 'active', 'registers': {'dictionary': 'old', 'epoch': 5, 'enabled': True, 'cache': ['old'], 'decoded': []}, 'frames': []}]), ('empty/compressed_payload', 'empty', ['compressed_payload'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['MISSING_DICT', 5]]}]), ('active/evicted', 'active', ['evicted'], [{'phase': 'empty', 'registers': {'dictionary': 'old', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_EVICTED', 5]]}]), ('ordered trace 0', 'empty', ['offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss', 'verified', 'evicted'], [{'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['new'], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5]]}]), ('ordered trace 3', 'installing', ['bad_fingerprint', 'offer', 'cache_miss', 'verified', 'evicted', 'offer', 'cache_miss', 'verified'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new']]}, {'phase': 'offered', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6]]}, {'phase': 'installing', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['old', 'new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6]]}, {'phase': 'empty', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5]]}, {'phase': 'offered', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6]]}, {'phase': 'installing', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': [], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]]]}, {'phase': 'active', 'registers': {'dictionary': 'new', 'epoch': 5, 'enabled': False, 'cache': ['new'], 'decoded': []}, 'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6], ['DICT_EVICTED', 5], ['DICT_ID', 'new', 6], ['DICT_BODY', 'new', [5, 6, 7, 8, 9, 10, 11]], ['DICT_READY', 6]]}]), ('empty input', 'empty', [], []), ('unknown event', 'empty', ['unsupported'], [{'phase': 'empty', 'registers': {'dictionary': None, 'epoch': 5, 'enabled': False, 'cache': ['old'], 'decoded': []}, 'frames': [['reject', [5, 6, 7, 8, 9, 10, 11]]]}])]}
for label, phase, events, expected in cases[N]:
    check(label, solve(phase, events, N), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
While empty, event compressed_payload produces active/decode_default instead of empty/reject_missing.

For the stipulated Compression dictionary installation 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