FA-42211 / Listener lifecycle / Open access
Batch callback failure removes events before its checkpoint · case 01
Batch callback failure removes events before its checkpoint; the returned lifecycle plan violates the stated transition contract.
ROOT CAUSE
The rollback decision in the batch-notification listener model is computed as [] if s['error'] else list(s['values']), losing a required lifecycle condition.
VERIFIED REPAIR
Compute the rollback decision from the complete contract: s['values'][:s['checkpoint']] if s['error'] else list(s['values']).
Unsuccessful approach: The partial repair uses s['values'][s['checkpoint']:] if s['error'] else list(s['values']); a retained regression distinguishes it from the full transition.
Case contract
Plan batched observer publication. A batch holds until threshold or explicit flush, publishes at most threshold values, and preserves the unconsumed suffix. Nested batch scopes publish only at depth zero. An exception rolls back only the current batch checkpoint. Empty batches do not notify; a final partial batch publishes only when partial delivery is allowed. Acknowledgement notifications deduplicate pending batch IDs in first-occurrence order and exclude IDs already acknowledged. Inputs are finite state snapshots, including transitional and stale states; output fields are the exact independent actions/metadata defined by the corrected expression table. Numeric fixture capacities and counts vary with N. Field definitions, each independently computed from the input snapshot: ready = len(s['values'])>=s['threshold']; publish = s['depth']==0 and bool(s['values']) and (len(s['values'])>=s['threshold'] or s['flush'] or (s['final'] and s['partial'])); head = s['values'][:s['threshold']]; tail = s['values'][s['threshold']:]; rollback = s['values'][:s['checkpoint']] if s['error'] else list(s['values']); depth = max(0,s['depth']+int(s['begin'])-int(s['end'])); partial_drop = s['final'] and not s['partial'] and 0<len(s['values'])<s['threshold']; new_checkpoint = len(s['values']) if s['begin'] else s['checkpoint']; unmatched_end = s['end'] and s['depth']==0; empty_flush = list(dict.fromkeys(x for x in s['batch_ids'] if x not in s['acknowledged']))
Why this case matters
Observer implementations need to preserve this state while subscriptions enter, execute, and leave their lifecycle.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'ready': len(s['values'])>=s['threshold'],
'publish': s['depth']==0 and bool(s['values']) and (len(s['values'])>=s['threshold'] or s['flush'] or (s['final'] and s['partial'])),
'head': s['values'][:s['threshold']],
'tail': s['values'][s['threshold']:],
'rollback': [] if s['error'] else list(s['values']),
'depth': max(0,s['depth']+int(s['begin'])-int(s['end'])),
'partial_drop': s['final'] and not s['partial'] and 0<len(s['values'])<s['threshold'],
'new_checkpoint': len(s['values']) if s['begin'] else s['checkpoint'],
'unmatched_end': s['end'] and s['depth']==0,
'empty_flush': list(dict.fromkeys(x for x in s['batch_ids'] if x not in s['acknowledged'])),
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': True, 'depth': 3, 'partial': True, 'final': True, 'error': True, 'checkpoint': 3, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 3, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': [], 'threshold': 4, 'flush': True, 'depth': 0, 'partial': False, 'final': True, 'error': True, 'checkpoint': 3, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': True, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 1, 'partial': True, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a'], 'threshold': 2, 'flush': True, 'depth': 3, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': True, 'depth': 3, 'partial': False, 'final': True, 'error': True, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': [], 'depth': 4, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 4, 'flush': True, 'depth': 3, 'partial': True, 'final': True, 'error': True, 'checkpoint': 3, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 3, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 2: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a', 'b', 'c'], 'threshold': 4, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 1, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': False, 'publish': True, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': True, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': False, 'checkpoint': 1, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 8, 'flush': True, 'depth': 6, 'partial': False, 'final': True, 'error': False, 'checkpoint': 6, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['a']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 5, 'partial_drop': False, 'new_checkpoint': 6, 'unmatched_end': False, 'empty_flush': ['b']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 6, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 6, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': [], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 8, 'flush': True, 'depth': 6, 'partial': True, 'final': True, 'error': True, 'checkpoint': 6, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 6, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 3: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 9, 'begin': False, 'end': False, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 9, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 6, 'flush': True, 'depth': 1, 'partial': True, 'final': True, 'error': True, 'checkpoint': 9, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': True, 'depth': 0, 'partial': False, 'final': True, 'error': False, 'checkpoint': 0, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 0, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 6, 'flush': False, 'depth': 9, 'partial': True, 'final': False, 'error': True, 'checkpoint': 9, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 9, 'partial_drop': False, 'new_checkpoint': 9, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 6, 'flush': False, 'depth': 1, 'partial': False, 'final': False, 'error': True, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 12, 'flush': True, 'depth': 9, 'partial': True, 'final': True, 'error': True, 'checkpoint': 9, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 9, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 4: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 12, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 12, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b']}), ({'values': ['a'], 'threshold': 8, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 12, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': False, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 12, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': False, 'error': False, 'checkpoint': 1, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': [], 'threshold': 16, 'flush': True, 'depth': 1, 'partial': False, 'final': True, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 8, 'flush': True, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 12, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 12, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 16, 'flush': True, 'depth': 12, 'partial': True, 'final': True, 'error': True, 'checkpoint': 12, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 12, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 5: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 15, 'partial': False, 'final': True, 'error': True, 'checkpoint': 0, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': [], 'depth': 15, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 10, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': False, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 15, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 0, 'begin': True, 'end': True, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 20, 'flush': True, 'depth': 1, 'partial': False, 'final': False, 'error': False, 'checkpoint': 15, 'begin': True, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 20, 'flush': False, 'depth': 15, 'partial': False, 'final': True, 'error': False, 'checkpoint': 1, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 15, 'partial_drop': True, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 20, 'flush': True, 'depth': 15, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 16, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 20, 'flush': True, 'depth': 15, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 15, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), 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 |
|---|---|---|---|
| transition 0 | {'depth': 3, 'empty_flush': ['b', 'a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 3, 'empty_flush': ['b', 'a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a', 'b', 'c'], 'tail': ['b', 'c'], 'unmatched_end': False} | Failed |
| transition 1 | {'depth': 0, 'empty_flush': ['a'], 'head': [], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': True} | {'depth': 0, 'empty_flush': ['a'], 'head': [], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': True} | Passed |
| transition 2 | {'depth': 1, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 1, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': [], 'unmatched_end': False} | {'depth': 1, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 1, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | Failed |
| transition 3 | {'depth': 2, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | {'depth': 2, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | Passed |
| transition 4 | {'depth': 2, 'empty_flush': ['a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 2, 'empty_flush': ['a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a'], 'tail': ['b', 'c'], 'unmatched_end': False} | Failed |
| transition 5 | {'depth': 4, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 4, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': ['b', 'c'], 'unmatched_end': False} | Passed |
| transition 6 | {'depth': 0, 'empty_flush': [], 'head': [], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': False} | {'depth': 0, 'empty_flush': [], 'head': [], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': False} | Passed |
| transition 7 | {'depth': 3, 'empty_flush': ['a'], 'head': ['a', 'b', 'c'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': False} | {'depth': 3, 'empty_flush': ['a'], 'head': ['a', 'b', 'c'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a', 'b', 'c'], 'tail': [], 'unmatched_end': False} | Failed |
SHA-256 / 1d7754b6e2dd3b04c1ec5811856cb0232309584bcfd0fdb27eb772e26349d021
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'ready': len(s['values'])>=s['threshold'],
'publish': s['depth']==0 and bool(s['values']) and (len(s['values'])>=s['threshold'] or s['flush'] or (s['final'] and s['partial'])),
'head': s['values'][:s['threshold']],
'tail': s['values'][s['threshold']:],
'rollback': s['values'][s['checkpoint']:] if s['error'] else list(s['values']),
'depth': max(0,s['depth']+int(s['begin'])-int(s['end'])),
'partial_drop': s['final'] and not s['partial'] and 0<len(s['values'])<s['threshold'],
'new_checkpoint': len(s['values']) if s['begin'] else s['checkpoint'],
'unmatched_end': s['end'] and s['depth']==0,
'empty_flush': list(dict.fromkeys(x for x in s['batch_ids'] if x not in s['acknowledged'])),
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': True, 'depth': 3, 'partial': True, 'final': True, 'error': True, 'checkpoint': 3, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 3, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': [], 'threshold': 4, 'flush': True, 'depth': 0, 'partial': False, 'final': True, 'error': True, 'checkpoint': 3, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': True, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 1, 'partial': True, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a'], 'threshold': 2, 'flush': True, 'depth': 3, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': True, 'depth': 3, 'partial': False, 'final': True, 'error': True, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': [], 'depth': 4, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 4, 'flush': True, 'depth': 3, 'partial': True, 'final': True, 'error': True, 'checkpoint': 3, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 3, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 2: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a', 'b', 'c'], 'threshold': 4, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 1, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': False, 'publish': True, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': True, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': False, 'checkpoint': 1, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 8, 'flush': True, 'depth': 6, 'partial': False, 'final': True, 'error': False, 'checkpoint': 6, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['a']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 5, 'partial_drop': False, 'new_checkpoint': 6, 'unmatched_end': False, 'empty_flush': ['b']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 6, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 6, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': [], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 8, 'flush': True, 'depth': 6, 'partial': True, 'final': True, 'error': True, 'checkpoint': 6, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 6, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 3: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 9, 'begin': False, 'end': False, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 9, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 6, 'flush': True, 'depth': 1, 'partial': True, 'final': True, 'error': True, 'checkpoint': 9, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': True, 'depth': 0, 'partial': False, 'final': True, 'error': False, 'checkpoint': 0, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 0, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 6, 'flush': False, 'depth': 9, 'partial': True, 'final': False, 'error': True, 'checkpoint': 9, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 9, 'partial_drop': False, 'new_checkpoint': 9, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 6, 'flush': False, 'depth': 1, 'partial': False, 'final': False, 'error': True, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 12, 'flush': True, 'depth': 9, 'partial': True, 'final': True, 'error': True, 'checkpoint': 9, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 9, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 4: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 12, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 12, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b']}), ({'values': ['a'], 'threshold': 8, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 12, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': False, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 12, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': False, 'error': False, 'checkpoint': 1, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': [], 'threshold': 16, 'flush': True, 'depth': 1, 'partial': False, 'final': True, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 8, 'flush': True, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 12, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 12, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 16, 'flush': True, 'depth': 12, 'partial': True, 'final': True, 'error': True, 'checkpoint': 12, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 12, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 5: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 15, 'partial': False, 'final': True, 'error': True, 'checkpoint': 0, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': [], 'depth': 15, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 10, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': False, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 15, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 0, 'begin': True, 'end': True, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 20, 'flush': True, 'depth': 1, 'partial': False, 'final': False, 'error': False, 'checkpoint': 15, 'begin': True, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 20, 'flush': False, 'depth': 15, 'partial': False, 'final': True, 'error': False, 'checkpoint': 1, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 15, 'partial_drop': True, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 20, 'flush': True, 'depth': 15, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 16, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 20, 'flush': True, 'depth': 15, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 15, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), 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 |
|---|---|---|---|
| transition 0 | {'depth': 3, 'empty_flush': ['b', 'a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 3, 'empty_flush': ['b', 'a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a', 'b', 'c'], 'tail': ['b', 'c'], 'unmatched_end': False} | Failed |
| transition 1 | {'depth': 0, 'empty_flush': ['a'], 'head': [], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': True} | {'depth': 0, 'empty_flush': ['a'], 'head': [], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': True} | Passed |
| transition 2 | {'depth': 1, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 1, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': [], 'unmatched_end': False} | {'depth': 1, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 1, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | Failed |
| transition 3 | {'depth': 2, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | {'depth': 2, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | Passed |
| transition 4 | {'depth': 2, 'empty_flush': ['a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['b', 'c'], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 2, 'empty_flush': ['a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a'], 'tail': ['b', 'c'], 'unmatched_end': False} | Failed |
| transition 5 | {'depth': 4, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a', 'b', 'c'], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 4, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': ['b', 'c'], 'unmatched_end': False} | Failed |
| transition 6 | {'depth': 0, 'empty_flush': [], 'head': [], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': False} | {'depth': 0, 'empty_flush': [], 'head': [], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': False} | Passed |
| transition 7 | {'depth': 3, 'empty_flush': ['a'], 'head': ['a', 'b', 'c'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': False} | {'depth': 3, 'empty_flush': ['a'], 'head': ['a', 'b', 'c'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a', 'b', 'c'], 'tail': [], 'unmatched_end': False} | Failed |
SHA-256 / 796772ef43dd1cd3a02b3d50bcd1ef53807feb2b802306a453ffb9391bcd5b99
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(s):
return {
'ready': len(s['values'])>=s['threshold'],
'publish': s['depth']==0 and bool(s['values']) and (len(s['values'])>=s['threshold'] or s['flush'] or (s['final'] and s['partial'])),
'head': s['values'][:s['threshold']],
'tail': s['values'][s['threshold']:],
'rollback': s['values'][:s['checkpoint']] if s['error'] else list(s['values']),
'depth': max(0,s['depth']+int(s['begin'])-int(s['end'])),
'partial_drop': s['final'] and not s['partial'] and 0<len(s['values'])<s['threshold'],
'new_checkpoint': len(s['values']) if s['begin'] else s['checkpoint'],
'unmatched_end': s['end'] and s['depth']==0,
'empty_flush': list(dict.fromkeys(x for x in s['batch_ids'] if x not in s['acknowledged'])),
}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': True, 'depth': 3, 'partial': True, 'final': True, 'error': True, 'checkpoint': 3, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 3, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': [], 'threshold': 4, 'flush': True, 'depth': 0, 'partial': False, 'final': True, 'error': True, 'checkpoint': 3, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': True, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 1, 'partial': True, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a'], 'threshold': 2, 'flush': True, 'depth': 3, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': True, 'depth': 3, 'partial': False, 'final': True, 'error': True, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': [], 'depth': 4, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 4, 'flush': True, 'depth': 3, 'partial': True, 'final': True, 'error': True, 'checkpoint': 3, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 3, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 2: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a', 'b', 'c'], 'threshold': 4, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 1, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': False, 'publish': True, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': True, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': False, 'checkpoint': 1, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 8, 'flush': True, 'depth': 6, 'partial': False, 'final': True, 'error': False, 'checkpoint': 6, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['a']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 5, 'partial_drop': False, 'new_checkpoint': 6, 'unmatched_end': False, 'empty_flush': ['b']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 6, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 6, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': [], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 8, 'flush': True, 'depth': 6, 'partial': True, 'final': True, 'error': True, 'checkpoint': 6, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 6, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 3: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': True, 'error': True, 'checkpoint': 9, 'begin': False, 'end': False, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 9, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 6, 'flush': True, 'depth': 1, 'partial': True, 'final': True, 'error': True, 'checkpoint': 9, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': True, 'depth': 0, 'partial': False, 'final': True, 'error': False, 'checkpoint': 0, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': True, 'depth': 0, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 6, 'flush': False, 'depth': 9, 'partial': True, 'final': False, 'error': True, 'checkpoint': 9, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 9, 'partial_drop': False, 'new_checkpoint': 9, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 6, 'flush': False, 'depth': 1, 'partial': False, 'final': False, 'error': True, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 12, 'flush': True, 'depth': 9, 'partial': True, 'final': True, 'error': True, 'checkpoint': 9, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 9, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 4: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 12, 'partial': False, 'final': True, 'error': True, 'checkpoint': 1, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a'], 'depth': 12, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b']}), ({'values': ['a'], 'threshold': 8, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 12, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': False, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 12, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': False, 'final': False, 'error': False, 'checkpoint': 1, 'begin': False, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': [], 'threshold': 16, 'flush': True, 'depth': 1, 'partial': False, 'final': True, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': True, 'final': False, 'error': False, 'checkpoint': 0, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': ['a', 'b', 'c'], 'depth': 2, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a', 'b', 'c'], 'threshold': 8, 'flush': True, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 12, 'begin': False, 'end': True, 'batch_ids': [], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 12, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 16, 'flush': True, 'depth': 12, 'partial': True, 'final': True, 'error': True, 'checkpoint': 12, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 12, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})], 5: [({'values': ['a', 'b', 'c'], 'threshold': 1, 'flush': False, 'depth': 15, 'partial': False, 'final': True, 'error': True, 'checkpoint': 0, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': []}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': ['b', 'c'], 'rollback': [], 'depth': 15, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['b', 'a']}), ({'values': ['a'], 'threshold': 10, 'flush': False, 'depth': 0, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': False, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['a']}, {'ready': False, 'publish': True, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 15, 'unmatched_end': True, 'empty_flush': []}), ({'values': ['a'], 'threshold': 1, 'flush': False, 'depth': 1, 'partial': True, 'final': False, 'error': True, 'checkpoint': 0, 'begin': True, 'end': True, 'batch_ids': [], 'acknowledged': ['a']}, {'ready': True, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': []}), ({'values': [], 'threshold': 20, 'flush': True, 'depth': 1, 'partial': False, 'final': False, 'error': False, 'checkpoint': 15, 'begin': True, 'end': True, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 1, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 20, 'flush': False, 'depth': 15, 'partial': False, 'final': True, 'error': False, 'checkpoint': 1, 'begin': False, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 15, 'partial_drop': True, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': ['a'], 'threshold': 20, 'flush': True, 'depth': 15, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': True, 'end': False, 'batch_ids': ['a'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a'], 'tail': [], 'rollback': ['a'], 'depth': 16, 'partial_drop': False, 'new_checkpoint': 1, 'unmatched_end': False, 'empty_flush': ['a']}), ({'values': [], 'threshold': 1, 'flush': False, 'depth': 0, 'partial': False, 'final': False, 'error': False, 'checkpoint': 0, 'begin': False, 'end': False, 'batch_ids': [], 'acknowledged': []}, {'ready': False, 'publish': False, 'head': [], 'tail': [], 'rollback': [], 'depth': 0, 'partial_drop': False, 'new_checkpoint': 0, 'unmatched_end': False, 'empty_flush': []}), ({'values': ['a', 'b', 'c'], 'threshold': 20, 'flush': True, 'depth': 15, 'partial': True, 'final': True, 'error': True, 'checkpoint': 15, 'begin': True, 'end': True, 'batch_ids': ['b', 'a', 'b'], 'acknowledged': ['b']}, {'ready': False, 'publish': False, 'head': ['a', 'b', 'c'], 'tail': [], 'rollback': ['a', 'b', 'c'], 'depth': 15, 'partial_drop': False, 'new_checkpoint': 3, 'unmatched_end': False, 'empty_flush': ['a']})]}
for i,(state,expected) in enumerate(fixtures[N]):
check("transition "+str(i), solve(state), 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 |
|---|---|---|---|
| transition 0 | {'depth': 3, 'empty_flush': ['b', 'a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a', 'b', 'c'], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 3, 'empty_flush': ['b', 'a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a', 'b', 'c'], 'tail': ['b', 'c'], 'unmatched_end': False} | Passed |
| transition 1 | {'depth': 0, 'empty_flush': ['a'], 'head': [], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': True} | {'depth': 0, 'empty_flush': ['a'], 'head': [], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': True} | Passed |
| transition 2 | {'depth': 1, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 1, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | {'depth': 1, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 1, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | Passed |
| transition 3 | {'depth': 2, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | {'depth': 2, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a'], 'tail': [], 'unmatched_end': False} | Passed |
| transition 4 | {'depth': 2, 'empty_flush': ['a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a'], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 2, 'empty_flush': ['a'], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': ['a'], 'tail': ['b', 'c'], 'unmatched_end': False} | Passed |
| transition 5 | {'depth': 4, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': ['b', 'c'], 'unmatched_end': False} | {'depth': 4, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': True, 'rollback': [], 'tail': ['b', 'c'], 'unmatched_end': False} | Passed |
| transition 6 | {'depth': 0, 'empty_flush': [], 'head': [], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': False} | {'depth': 0, 'empty_flush': [], 'head': [], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': [], 'tail': [], 'unmatched_end': False} | Passed |
| transition 7 | {'depth': 3, 'empty_flush': ['a'], 'head': ['a', 'b', 'c'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a', 'b', 'c'], 'tail': [], 'unmatched_end': False} | {'depth': 3, 'empty_flush': ['a'], 'head': ['a', 'b', 'c'], 'new_checkpoint': 3, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a', 'b', 'c'], 'tail': [], 'unmatched_end': False} | Passed |
SHA-256 / c7caf2cbc8970cbc0076c8f9912c8ec3a9d93e2af755d420535ad869bc23c9f6
Verification & scope
A deterministic, bounded, single-threaded transition planner. Returned plans model state changes; they do not implement a production event framework. 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:43:49.348283+00:00.
Case digest / b356f3e004ee5a58ba96fcdf36ffe1c65af336c4505bbb713720e05a39545869