FA-19321 / Protocols / Open access
Compression dictionary installation controller: switching / replacement ready · case 01
While switching, event replacement_ready produces switching/wait instead of active/switch_epoch.
ROOT CAUSE
In switching, the replacement ready handler runs wait and enters switching; it must instead run switch epoch and enter active.
VERIFIED REPAIR
In phase switching, classify replacement_ready as transition to active and emit switch_epoch.
Unsuccessful approach: The partial repair chooses active/keep_old_epoch, which still violates this phase-specific event contract.
Case contract
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.
Why this case matters
Incorrect event admission now changes concrete queued data, resource ownership, or emitted protocol frames and subsequent trace behavior.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(phase, events, seed):
payload = list(range(seed, seed * 2 + 2))
r = {'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'): ('switching', 'wait'), ('switching', 'replacement_failed'): ('active', 'resume_old_epoch'), ('empty', 'compressed_payload'): ('empty', 'reject_missing'), ('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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| empty/offer | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| offered/cache_hit | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 2}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 2}}] | Passed |
| offered/cache_miss | [{'frames': [['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| installing/verified | [{'frames': [['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| installing/bad_fingerprint | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| active/replacement_offer | [{'frames': [], 'phase': 'switching', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | [{'frames': [], 'phase': 'switching', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | Passed |
| switching/replacement_ready | [{'frames': [], 'phase': 'switching', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': True, 'epoch': 2}}] | Failed |
| switching/replacement_failed | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': True, 'epoch': 1}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': True, 'epoch': 1}}] | Passed |
| empty/compressed_payload | [{'frames': [['MISSING_DICT', 1]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['MISSING_DICT', 1]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| active/evicted | [{'frames': [['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | Passed |
| ordered trace 0 | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2], ['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2], ['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| ordered trace 3 | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
SHA-256 / 5a94bdfb16d6196ae0ec5353994bc3862f53a078f5fa27839ede0218c611dcfa
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(phase, events, seed):
payload = list(range(seed, seed * 2 + 2))
r = {'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', 'keep_old_epoch'), ('switching', 'replacement_failed'): ('active', 'resume_old_epoch'), ('empty', 'compressed_payload'): ('empty', 'reject_missing'), ('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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| empty/offer | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| offered/cache_hit | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 2}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 2}}] | Passed |
| offered/cache_miss | [{'frames': [['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| installing/verified | [{'frames': [['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| installing/bad_fingerprint | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| active/replacement_offer | [{'frames': [], 'phase': 'switching', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | [{'frames': [], 'phase': 'switching', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | Passed |
| switching/replacement_ready | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': True, 'epoch': 1}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': True, 'epoch': 2}}] | Failed |
| switching/replacement_failed | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': True, 'epoch': 1}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': True, 'epoch': 1}}] | Passed |
| empty/compressed_payload | [{'frames': [['MISSING_DICT', 1]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['MISSING_DICT', 1]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| active/evicted | [{'frames': [['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | Passed |
| ordered trace 0 | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2], ['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2], ['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| ordered trace 3 | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
SHA-256 / d34a5d0522984e83a2c5423c044ee8e45055e0850b2a92345641e9fc1e6e7904
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(phase, events, seed):
payload = list(range(seed, seed * 2 + 2))
r = {'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', 'reject_missing'), ('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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| empty/offer | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| offered/cache_hit | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 2}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 2}}] | Passed |
| offered/cache_miss | [{'frames': [['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| installing/verified | [{'frames': [['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| installing/bad_fingerprint | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| active/replacement_offer | [{'frames': [], 'phase': 'switching', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | [{'frames': [], 'phase': 'switching', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | Passed |
| switching/replacement_ready | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': True, 'epoch': 2}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'new', 'enabled': True, 'epoch': 2}}] | Passed |
| switching/replacement_failed | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': True, 'epoch': 1}}] | [{'frames': [], 'phase': 'active', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': 'old', 'enabled': True, 'epoch': 1}}] | Passed |
| empty/compressed_payload | [{'frames': [['MISSING_DICT', 1]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['MISSING_DICT', 1]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
| active/evicted | [{'frames': [['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'old', 'enabled': False, 'epoch': 1}}] | Passed |
| ordered trace 0 | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2], ['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}, {'frames': [['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2], ['DICT_EVICTED', 1]], 'phase': 'empty', 'registers': {'cache': [], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| ordered trace 3 | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | [{'frames': [['BAD_DICT', 'new']], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2]], 'phase': 'offered', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]]], 'phase': 'installing', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}, {'frames': [['BAD_DICT', 'new'], ['DICT_ID', 'new', 2], ['DICT_BODY', 'new', [1, 2, 3]], ['DICT_READY', 2]], 'phase': 'active', 'registers': {'cache': ['old', 'new'], 'decoded': [], 'dictionary': 'new', 'enabled': False, 'epoch': 1}}] | Passed |
| empty input | [] | [] | Passed |
| unknown event | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | [{'frames': [['reject', [1, 2, 3]]], 'phase': 'empty', 'registers': {'cache': ['old'], 'decoded': [], 'dictionary': None, 'enabled': False, 'epoch': 1}}] | Passed |
SHA-256 / a4b1f969d1dbb203bf21ac59cbf60ce5d64043efb3d13d30ecc2464857451cbb
Verification & scope
Bounded offline control-plane abstraction with prescribed initial registers and classified events. Not a named protocol implementation or conformance test; excludes wire parsing, transport retries, physical execution, authentication, crash persistence, and timing. Related event faults share the full corrected controller and evaluation group. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:40:06.797121+00:00.
Case digest / 0186f087001819eb2333cd0dab817ff9c1db90ad57b7a9cd6c4da1588d762d47