FAILURE MAP
← Case archive

FA-42166 / Listener lifecycle / Open access

A no-op flush advances invalidation version · case 01

A no-op flush advances invalidation version; the returned lifecycle plan violates the stated transition contract.

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

ROOT CAUSE

The version decision in the coalesced-invalidation listener model is computed as s['version']+int(s['flush']), losing a required lifecycle condition.

VERIFIED REPAIR

Compute the version decision from the complete contract: s['version']+int(s['flush'] and bool(s['dirty'] or s['full']) and not s['disposed']).

Unsuccessful approach: The partial repair uses s['version']+int(s['flush'] and bool(s['dirty'])); a retained regression distinguishes it from the full transition.

Case contract

Plan a listener invalidation accumulator. Dirty field names form an insertion-ordered set; repeated invalidation keeps first order. Exactly one microtask is requested while dirty and unscheduled. A flush atomically detaches the current fields, so dirt arriving during callbacks becomes a later batch. Full invalidation supersedes field names. Disposed observers drop both batches. 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: fields = list(dict.fromkeys(s['dirty']+([s['incoming']] if s['incoming'] is not None else []))); schedule = bool(s['dirty'] or s['incoming'] is not None or s['full']) and not s['scheduled'] and not s['disposed']; flush_fields = list(dict.fromkeys(s['dirty'])) if s['flush'] and not s['disposed'] and not s['full'] else []; next_batch = list(dict.fromkeys(s['during'])) if s['flush'] and not s['disposed'] else []; full = s['full'] and s['flush'] and not s['disposed']; version = s['version']+int(s['flush'] and bool(s['dirty'] or s['full']) and not s['disposed']); scheduled_after = bool(s['during']) if s['flush'] else s['scheduled']; stale = s['delivered']<s['version']; reentrant = s['flush'] and s['running']; retained = [] if s['disposed'] else list(dict.fromkeys(s['dirty']))

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 {
        'fields': list(dict.fromkeys(s['dirty']+([s['incoming']] if s['incoming'] is not None else []))),
        'schedule': bool(s['dirty'] or s['incoming'] is not None or s['full']) and not s['scheduled'] and not s['disposed'],
        'flush_fields': list(dict.fromkeys(s['dirty'])) if s['flush'] and not s['disposed'] and not s['full'] else [],
        'next_batch': list(dict.fromkeys(s['during'])) if s['flush'] and not s['disposed'] else [],
        'full': s['full'] and s['flush'] and not s['disposed'],
        'version': s['version']+int(s['flush']),
        'scheduled_after': bool(s['during']) if s['flush'] else s['scheduled'],
        'stale': s['delivered']<s['version'],
        'reentrant': s['flush'] and s['running'],
        'retained': [] if s['disposed'] else list(dict.fromkeys(s['dirty'])),
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 1, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': False, 'disposed': False, 'version': 2, 'delivered': 0, 'running': False}, {'fields': ['a', 'b', 'c'], 'schedule': True, 'flush_fields': ['a', 'b'], 'next_batch': ['late'], 'full': False, 'version': 3, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['a', 'b']}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': [], 'full': True, 'disposed': True, 'version': 2, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': False, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 2: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'a', 'scheduled': True, 'flush': False, 'during': [], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': ['a', 'b'], 'next_batch': ['late'], 'full': False, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a', 'b']}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': False, 'flush': False, 'during': ['late'], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': False}, {'fields': ['a', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 3: [({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['a'], 'incoming': 'a', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a']}), ({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['a']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': True, 'during': [], 'full': False, 'disposed': False, 'version': 6, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 6, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 6, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 4: [({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': False, 'during': ['late'], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['a', 'b', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': [], 'full': False, 'disposed': True, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': False, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': False, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 5: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 10, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 11, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': False, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': [], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': [], 'full': False, 'disposed': False, 'version': 10, 'delivered': 1, 'running': False}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': ['a', 'b'], 'next_batch': [], 'full': False, 'version': 11, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': ['a', 'b']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 10, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 10, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})]}
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{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 3}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 2}Failed
transition 1{'fields': ['a'], 'flush_fields': [], 'full': True, 'next_batch': ['late'], 'reentrant': True, 'retained': ['a'], 'schedule': False, 'scheduled_after': True, 'stale': False, 'version': 1}{'fields': ['a'], 'flush_fields': [], 'full': True, 'next_batch': ['late'], 'reentrant': True, 'retained': ['a'], 'schedule': False, 'scheduled_after': True, 'stale': False, 'version': 1}Passed
transition 2{'fields': ['a', 'b'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}{'fields': ['a', 'b'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}Passed
transition 3{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}Passed
transition 4{'fields': ['a', 'b', 'c'], 'flush_fields': ['a', 'b'], 'full': False, 'next_batch': ['late'], 'reentrant': False, 'retained': ['a', 'b'], 'schedule': True, 'scheduled_after': True, 'stale': True, 'version': 3}{'fields': ['a', 'b', 'c'], 'flush_fields': ['a', 'b'], 'full': False, 'next_batch': ['late'], 'reentrant': False, 'retained': ['a', 'b'], 'schedule': True, 'scheduled_after': True, 'stale': True, 'version': 3}Passed
transition 5{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 3}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}Failed
transition 6{'fields': [], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}{'fields': [], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}Passed
transition 7{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 3}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 2}Failed

SHA-256 / 3ea13e65f06e423313ec11f77dd200c24f5ff1eafea03f45c3ac59e78234f351

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    return {
        'fields': list(dict.fromkeys(s['dirty']+([s['incoming']] if s['incoming'] is not None else []))),
        'schedule': bool(s['dirty'] or s['incoming'] is not None or s['full']) and not s['scheduled'] and not s['disposed'],
        'flush_fields': list(dict.fromkeys(s['dirty'])) if s['flush'] and not s['disposed'] and not s['full'] else [],
        'next_batch': list(dict.fromkeys(s['during'])) if s['flush'] and not s['disposed'] else [],
        'full': s['full'] and s['flush'] and not s['disposed'],
        'version': s['version']+int(s['flush'] and bool(s['dirty'])),
        'scheduled_after': bool(s['during']) if s['flush'] else s['scheduled'],
        'stale': s['delivered']<s['version'],
        'reentrant': s['flush'] and s['running'],
        'retained': [] if s['disposed'] else list(dict.fromkeys(s['dirty'])),
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 1, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': False, 'disposed': False, 'version': 2, 'delivered': 0, 'running': False}, {'fields': ['a', 'b', 'c'], 'schedule': True, 'flush_fields': ['a', 'b'], 'next_batch': ['late'], 'full': False, 'version': 3, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['a', 'b']}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': [], 'full': True, 'disposed': True, 'version': 2, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': False, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 2: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'a', 'scheduled': True, 'flush': False, 'during': [], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': ['a', 'b'], 'next_batch': ['late'], 'full': False, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a', 'b']}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': False, 'flush': False, 'during': ['late'], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': False}, {'fields': ['a', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 3: [({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['a'], 'incoming': 'a', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a']}), ({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['a']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': True, 'during': [], 'full': False, 'disposed': False, 'version': 6, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 6, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 6, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 4: [({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': False, 'during': ['late'], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['a', 'b', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': [], 'full': False, 'disposed': True, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': False, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': False, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 5: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 10, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 11, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': False, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': [], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': [], 'full': False, 'disposed': False, 'version': 10, 'delivered': 1, 'running': False}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': ['a', 'b'], 'next_batch': [], 'full': False, 'version': 11, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': ['a', 'b']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 10, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 10, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})]}
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{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 3}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 2}Failed
transition 1{'fields': ['a'], 'flush_fields': [], 'full': True, 'next_batch': ['late'], 'reentrant': True, 'retained': ['a'], 'schedule': False, 'scheduled_after': True, 'stale': False, 'version': 1}{'fields': ['a'], 'flush_fields': [], 'full': True, 'next_batch': ['late'], 'reentrant': True, 'retained': ['a'], 'schedule': False, 'scheduled_after': True, 'stale': False, 'version': 1}Passed
transition 2{'fields': ['a', 'b'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}{'fields': ['a', 'b'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}Passed
transition 3{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}Passed
transition 4{'fields': ['a', 'b', 'c'], 'flush_fields': ['a', 'b'], 'full': False, 'next_batch': ['late'], 'reentrant': False, 'retained': ['a', 'b'], 'schedule': True, 'scheduled_after': True, 'stale': True, 'version': 3}{'fields': ['a', 'b', 'c'], 'flush_fields': ['a', 'b'], 'full': False, 'next_batch': ['late'], 'reentrant': False, 'retained': ['a', 'b'], 'schedule': True, 'scheduled_after': True, 'stale': True, 'version': 3}Passed
transition 5{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 3}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}Failed
transition 6{'fields': [], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}{'fields': [], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}Passed
transition 7{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 3}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 2}Failed

SHA-256 / 88d1bb03f840151172a1f1052a53ac540e6b039527353edbf89ff1e56c77e801

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(s):
    return {
        'fields': list(dict.fromkeys(s['dirty']+([s['incoming']] if s['incoming'] is not None else []))),
        'schedule': bool(s['dirty'] or s['incoming'] is not None or s['full']) and not s['scheduled'] and not s['disposed'],
        'flush_fields': list(dict.fromkeys(s['dirty'])) if s['flush'] and not s['disposed'] and not s['full'] else [],
        'next_batch': list(dict.fromkeys(s['during'])) if s['flush'] and not s['disposed'] else [],
        'full': s['full'] and s['flush'] and not s['disposed'],
        'version': s['version']+int(s['flush'] and bool(s['dirty'] or s['full']) and not s['disposed']),
        'scheduled_after': bool(s['during']) if s['flush'] else s['scheduled'],
        'stale': s['delivered']<s['version'],
        'reentrant': s['flush'] and s['running'],
        'retained': [] if s['disposed'] else list(dict.fromkeys(s['dirty'])),
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 1, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': False, 'disposed': False, 'version': 2, 'delivered': 0, 'running': False}, {'fields': ['a', 'b', 'c'], 'schedule': True, 'flush_fields': ['a', 'b'], 'next_batch': ['late'], 'full': False, 'version': 3, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['a', 'b']}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': [], 'full': True, 'disposed': True, 'version': 2, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': False, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 2, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 2, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 2: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'a', 'scheduled': True, 'flush': False, 'during': [], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': ['a', 'b'], 'next_batch': ['late'], 'full': False, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a', 'b']}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': False, 'flush': False, 'during': ['late'], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': False}, {'fields': ['a', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 4, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 4, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 3: [({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['a'], 'incoming': 'a', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': ['a']}), ({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['a']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': True, 'during': [], 'full': False, 'disposed': False, 'version': 6, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 6, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 6, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 6, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 4: [({'dirty': ['c', 'a'], 'incoming': 'a', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 1, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': False, 'during': ['late'], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['a', 'b', 'c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': [], 'full': False, 'disposed': True, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': False, 'stale': True, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': True, 'disposed': False, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 8, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 8, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})], 5: [({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': False, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': True, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': False, 'version': 10, 'delivered': 0, 'running': False}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': ['late'], 'full': True, 'version': 11, 'scheduled_after': True, 'stale': True, 'reentrant': False, 'retained': ['c', 'a']}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': True, 'disposed': True, 'version': 0, 'delivered': 1, 'running': True}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': False, 'during': [], 'full': False, 'disposed': True, 'version': 0, 'delivered': 0, 'running': False}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': [], 'incoming': 'c', 'scheduled': True, 'flush': False, 'during': ['late'], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': True}, {'fields': ['c'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': True, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['a', 'b', 'a'], 'incoming': None, 'scheduled': True, 'flush': True, 'during': [], 'full': False, 'disposed': False, 'version': 10, 'delivered': 1, 'running': False}, {'fields': ['a', 'b'], 'schedule': False, 'flush_fields': ['a', 'b'], 'next_batch': [], 'full': False, 'version': 11, 'scheduled_after': False, 'stale': True, 'reentrant': False, 'retained': ['a', 'b']}), ({'dirty': [], 'incoming': None, 'scheduled': False, 'flush': False, 'during': [], 'full': False, 'disposed': False, 'version': 0, 'delivered': 0, 'running': False}, {'fields': [], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 0, 'scheduled_after': False, 'stale': False, 'reentrant': False, 'retained': []}), ({'dirty': ['c', 'a'], 'incoming': 'c', 'scheduled': True, 'flush': True, 'during': ['late'], 'full': True, 'disposed': True, 'version': 10, 'delivered': 1, 'running': True}, {'fields': ['c', 'a'], 'schedule': False, 'flush_fields': [], 'next_batch': [], 'full': False, 'version': 10, 'scheduled_after': True, 'stale': True, 'reentrant': True, 'retained': []})]}
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{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 2}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 2}Passed
transition 1{'fields': ['a'], 'flush_fields': [], 'full': True, 'next_batch': ['late'], 'reentrant': True, 'retained': ['a'], 'schedule': False, 'scheduled_after': True, 'stale': False, 'version': 1}{'fields': ['a'], 'flush_fields': [], 'full': True, 'next_batch': ['late'], 'reentrant': True, 'retained': ['a'], 'schedule': False, 'scheduled_after': True, 'stale': False, 'version': 1}Passed
transition 2{'fields': ['a', 'b'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}{'fields': ['a', 'b'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}Passed
transition 3{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}Passed
transition 4{'fields': ['a', 'b', 'c'], 'flush_fields': ['a', 'b'], 'full': False, 'next_batch': ['late'], 'reentrant': False, 'retained': ['a', 'b'], 'schedule': True, 'scheduled_after': True, 'stale': True, 'version': 3}{'fields': ['a', 'b', 'c'], 'flush_fields': ['a', 'b'], 'full': False, 'next_batch': ['late'], 'reentrant': False, 'retained': ['a', 'b'], 'schedule': True, 'scheduled_after': True, 'stale': True, 'version': 3}Passed
transition 5{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': True, 'version': 2}Passed
transition 6{'fields': [], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}{'fields': [], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': False, 'retained': [], 'schedule': False, 'scheduled_after': False, 'stale': False, 'version': 0}Passed
transition 7{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 2}{'fields': ['c', 'a'], 'flush_fields': [], 'full': False, 'next_batch': [], 'reentrant': True, 'retained': [], 'schedule': False, 'scheduled_after': True, 'stale': True, 'version': 2}Passed

SHA-256 / d6f1b5edfc592ce6b1ac494ec937b3c82550054a170563ef5bf084c24e67e060

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

Case digest / 118eb30e4122db6d561bed7d492463a7b655e57e4a569e7ba786f4ab9600d42b