#!/usr/bin/env python3
state={"restart":{"status":"complete","operation_id":"OP-77"},"verify":{"status":"failed"},"restart_count":1,"compensation_count":0}
print('Initial checkpoint:',state)
if state['restart']['status']!='complete':
    state['restart_count']+=1
else:
    print('✓ Resume skipped already-completed side effect')
# Reconcile real state after failed verification.
current_health='unhealthy'
if current_health!='healthy':
    state['compensation_count']+=1
    state['recovery']='compensated_and_escalated'
assert state['restart_count']==1
assert state['compensation_count']==1
print('Final state:',state)
print('PASS: resumed from checkpoint without duplicate side effect')
