broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'inflight-preserve':(d['inflight']), 'queued-replace':(d['latest'] if d['busy'] else None), 'ack-match':(d['ack']>=d['sent']), 'promote-queued':(d['queued'] if d['ack']==d['sent'] and d['queued'] is not None else None), 'failed-retain':(d['inflight'] if d['failed'] else None), 'send-now':(d['latest'] if not d['busy'] and d['valid'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']})], 2: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 3: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']})], 4: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None})], 5: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'inflight-preserve':(d['inflight']), 'queued-replace':(d['latest'] if d['busy'] else None), 'ack-match':(d['ack']<=d['sent']), 'promote-queued':(d['queued'] if d['ack']==d['sent'] and d['queued'] is not None else None), 'failed-retain':(d['inflight'] if d['failed'] else None), 'send-now':(d['latest'] if not d['busy'] and d['valid'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']})], 2: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 3: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']})], 4: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None})], 5: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

prompt:
Only the matching apply acknowledgment settles the in-flight revision is violated by the widget projection.

A filter apply queue coalesces only unsent drafts, preserves the in-flight snapshot, and acknowledges exactly the sent revision before promoting a queued draft. This example checks: Only the matching apply acknowledgment settles the in-flight revision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'inflight-preserve':(d['inflight']), 'queued-replace':(d['latest'] if d['busy'] else None), 'ack-match':(d['ack']==d['sent']), 'promote-queued':(d['queued']), 'failed-retain':(d['inflight'] if d['failed'] else None), 'send-now':(d['latest'] if not d['busy'] and d['valid'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 2: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 3: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']})], 4: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None})], 5: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'inflight-preserve':(d['inflight']), 'queued-replace':(d['latest'] if d['busy'] else None), 'ack-match':(d['ack']==d['sent']), 'promote-queued':(d['latest'] if d['ack']==d['sent'] else None), 'failed-retain':(d['inflight'] if d['failed'] else None), 'send-now':(d['latest'] if not d['busy'] and d['valid'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 2: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 3: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']})], 4: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None})], 5: [({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

prompt:
Matching completion promotes the queued snapshot rather than current editor contents is violated by the widget projection.

A filter apply queue coalesces only unsent drafts, preserves the in-flight snapshot, and acknowledges exactly the sent revision before promoting a queued draft. This example checks: Matching completion promotes the queued snapshot rather than current editor contents.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'inflight-preserve':(d['inflight']), 'queued-replace':(d['latest'] if d['busy'] else None), 'ack-match':(d['ack']==d['sent']), 'promote-queued':(d['queued'] if d['ack']==d['sent'] and d['queued'] is not None else None), 'failed-retain':(d['latest'] if d['failed'] else None), 'send-now':(d['latest'] if not d['busy'] and d['valid'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 2: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 3: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']})], 4: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None})], 5: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'inflight-preserve':(d['inflight']), 'queued-replace':(d['latest'] if d['busy'] else None), 'ack-match':(d['ack']==d['sent']), 'promote-queued':(d['queued'] if d['ack']==d['sent'] and d['queued'] is not None else None), 'failed-retain':(None), 'send-now':(d['latest'] if not d['busy'] and d['valid'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 2: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})], 3: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': ['b']})], 4: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': None, 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': False, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': None, 'send-now': None})], 5: [({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': False}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': True, 'promote-queued': ['c'], 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': ['c'], 'busy': True, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 2, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': True, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': False, 'ack': 3, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': None, 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': ['b']}), ({'inflight': ['a'], 'latest': ['b'], 'queued': None, 'busy': True, 'ack': 1, 'sent': 2, 'failed': True, 'valid': True}, {'inflight-preserve': ['a'], 'queued-replace': ['b'], 'ack-match': False, 'promote-queued': None, 'failed-retain': ['a'], 'send-now': None})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

prompt:
Failed-apply review retains the rejected snapshot is violated by the widget projection.

A filter apply queue coalesces only unsent drafts, preserves the in-flight snapshot, and acknowledges exactly the sent revision before promoting a queued draft. This example checks: Failed-apply review retains the rejected snapshot.

split: open-access