FAILURE MAP
← Case archive

FA-42231 / Listener lifecycle / Open access

A valid nested batch end is reported as unmatched · case 01

A valid nested batch end is reported as unmatched; the returned lifecycle plan violates the stated transition contract.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The unmatched_end decision in the batch-notification listener model is computed as s['end'], losing a required lifecycle condition.

VERIFIED REPAIR

Compute the unmatched_end decision from the complete contract: s['end'] and s['depth']==0.

Unsuccessful approach: The partial repair uses s['end'] and s['depth']<=1; 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': 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'],
        '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 fixtureActualExpectedOutcome
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': True}{'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': ['a'], 'tail': [], 'unmatched_end': True}{'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': True}{'depth': 2, 'empty_flush': [], 'head': ['a'], 'new_checkpoint': 0, 'partial_drop': False, 'publish': False, 'ready': False, 'rollback': ['a'], 'tail': [], 'unmatched_end': False}Failed
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': True}{'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 / 394599d48b296eb9eb2f805f143cd9d0b0c3b4b691e8477fbe4c939921972b05

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']<=1,
        '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 fixtureActualExpectedOutcome
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': True}{'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': ['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 / f4638441c498857cf6596ce4648e79fcb43f77a86285529ee47dfcab28e80c87

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 fixtureActualExpectedOutcome
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.497707+00:00.

Case digest / 0407e0757a98820e36169451c18a90b5e9b975db9d55f704cd9f23d157d3514e