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

N = 1
observations = []
def solve(s):
    return {
        'visible': s['committed'] and not s['rollback'] and s['depth']==0,
        'changed': [r for r in s['changes'] if r[1]!=r[2]],
        'first_old': {k:next(r[1] for r in s['changes'] if r[0]==k) for k in dict.fromkeys(r[0] for r in s['changes'])},
        'last_new': {k:next(r[2] for r in s['changes'] if r[0]==k) for k in dict.fromkeys(r[0] for r in s['changes'])},
        'order': list(dict.fromkeys(r[0] for r in s['changes'])),
        'revision': s['published'] if s['rollback'] else s['revision'],
        'state_rollback': s['rollback'] and not s['committed'],
        'notify_error': sorted(s['observer_failures'],key=lambda r:r[0]),
        'publish_durable': s['committed'] and s['durable'] and not s['rollback'],
        'deferred': list(s['parent_changes'])+(list(s['child_changes']) if s['child_commit'] and not s['child_rollback'] else []),
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': True, 'rollback': True, 'depth': 2, 'revision': 3, 'published': 2, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 2, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': True, 'rollback': False, 'depth': 2, 'revision': 0, 'published': 2, 'observer_error': True, 'active': False, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': True, 'deferred': ['parent', 'child']}), ({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': False, 'rollback': True, 'depth': 0, 'revision': 3, 'published': 0, 'observer_error': False, 'active': True, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': True, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 2, 'revision': 3, 'published': 0, 'observer_error': True, 'active': True, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 3, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 3, 'published': 2, 'observer_error': False, 'active': True, 'durable': True, 'deferred': [], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': True, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 3, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': True, 'deferred': []}), ({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': False, 'rollback': True, 'depth': 2, 'revision': 0, 'published': 2, 'observer_error': True, 'active': True, 'durable': True, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 2, 'state_rollback': True, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': True, 'rollback': True, 'depth': 2, 'revision': 3, 'published': 2, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 2, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})], 2: [({'changes': [['x', 1, 4], ['x', 4, 6], ['y', 8, 8]], 'committed': True, 'rollback': True, 'depth': 1, 'revision': 6, 'published': 4, 'observer_error': False, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[4, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 4], ['x', 4, 6]], 'first_old': {'x': 1, 'y': 8}, 'last_new': {'x': 6, 'y': 8}, 'order': ['x', 'y'], 'revision': 4, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [4, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 4]], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 6, 'published': 0, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[4, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 4]], 'first_old': {'x': 1}, 'last_new': {'x': 4}, 'order': ['x'], 'revision': 6, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [4, 'a']], 'publish_durable': False, 'deferred': ['child']}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 6, 'published': 0, 'observer_error': True, 'active': False, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': True, 'child_rollback': True, 'observer_failures': []}, {'visible': True, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 6, 'state_rollback': False, 'notify_error': [], 'publish_durable': True, 'deferred': ['parent']}), ({'changes': [['x', 1, 4]], 'committed': False, 'rollback': False, 'depth': 4, 'revision': 0, 'published': 0, 'observer_error': False, 'active': True, 'durable': False, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': True, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [['x', 1, 4]], 'first_old': {'x': 1}, 'last_new': {'x': 4}, 'order': ['x'], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 4]], 'committed': True, 'rollback': True, 'depth': 0, 'revision': 6, 'published': 0, 'observer_error': False, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[4, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 4]], 'first_old': {'x': 1}, 'last_new': {'x': 4}, 'order': ['x'], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [4, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 4], ['x', 4, 6], ['y', 8, 8]], 'committed': True, 'rollback': True, 'depth': 4, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': [], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[4, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 4], ['x', 4, 6]], 'first_old': {'x': 1, 'y': 8}, 'last_new': {'x': 6, 'y': 8}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [4, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 4], ['x', 4, 6], ['y', 8, 8]], 'committed': True, 'rollback': True, 'depth': 4, 'revision': 6, 'published': 4, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 4], ['x', 4, 6]], 'first_old': {'x': 1, 'y': 8}, 'last_new': {'x': 6, 'y': 8}, 'order': ['x', 'y'], 'revision': 4, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})], 3: [({'changes': [['x', 1, 6], ['x', 6, 9], ['y', 12, 12]], 'committed': True, 'rollback': True, 'depth': 1, 'revision': 9, 'published': 0, 'observer_error': False, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[6, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 6], ['x', 6, 9]], 'first_old': {'x': 1, 'y': 12}, 'last_new': {'x': 9, 'y': 12}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [6, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 6]], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 9, 'published': 6, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[6, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 6]], 'first_old': {'x': 1}, 'last_new': {'x': 6}, 'order': ['x'], 'revision': 9, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [6, 'a']], 'publish_durable': False, 'deferred': ['child']}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 6, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[6, 'a'], [0, 'z'], [1, 'm']]}, {'visible': True, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [6, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 6], ['x', 6, 9], ['y', 12, 12]], 'committed': False, 'rollback': True, 'depth': 0, 'revision': 9, 'published': 0, 'observer_error': True, 'active': False, 'durable': True, 'deferred': ['late'], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 6], ['x', 6, 9]], 'first_old': {'x': 1, 'y': 12}, 'last_new': {'x': 9, 'y': 12}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': True, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 6]], 'committed': False, 'rollback': False, 'depth': 6, 'revision': 9, 'published': 6, 'observer_error': False, 'active': True, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': [], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 6]], 'first_old': {'x': 1}, 'last_new': {'x': 6}, 'order': ['x'], 'revision': 9, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 6], ['x', 6, 9], ['y', 12, 12]], 'committed': False, 'rollback': True, 'depth': 1, 'revision': 0, 'published': 6, 'observer_error': False, 'active': False, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[6, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 6], ['x', 6, 9]], 'first_old': {'x': 1, 'y': 12}, 'last_new': {'x': 9, 'y': 12}, 'order': ['x', 'y'], 'revision': 6, 'state_rollback': True, 'notify_error': [[0, 'z'], [1, 'm'], [6, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 6], ['x', 6, 9], ['y', 12, 12]], 'committed': True, 'rollback': True, 'depth': 6, 'revision': 9, 'published': 6, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 6], ['x', 6, 9]], 'first_old': {'x': 1, 'y': 12}, 'last_new': {'x': 9, 'y': 12}, 'order': ['x', 'y'], 'revision': 6, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})], 4: [({'changes': [['x', 1, 8], ['x', 8, 12], ['y', 16, 16]], 'committed': True, 'rollback': True, 'depth': 0, 'revision': 12, 'published': 8, 'observer_error': True, 'active': False, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[8, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 8], ['x', 8, 12]], 'first_old': {'x': 1, 'y': 16}, 'last_new': {'x': 12, 'y': 16}, 'order': ['x', 'y'], 'revision': 8, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [8, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 12, 'published': 8, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[8, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 12, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [8, 'a']], 'publish_durable': False, 'deferred': ['child']}), ({'changes': [['x', 1, 8]], 'committed': False, 'rollback': True, 'depth': 8, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': True, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[8, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 8]], 'first_old': {'x': 1}, 'last_new': {'x': 8}, 'order': ['x'], 'revision': 0, 'state_rollback': True, 'notify_error': [[0, 'z'], [1, 'm'], [8, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 8]], 'committed': False, 'rollback': False, 'depth': 8, 'revision': 12, 'published': 0, 'observer_error': False, 'active': True, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 8]], 'first_old': {'x': 1}, 'last_new': {'x': 8}, 'order': ['x'], 'revision': 12, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': True, 'rollback': True, 'depth': 1, 'revision': 12, 'published': 8, 'observer_error': False, 'active': True, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[8, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 8, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [8, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 8]], 'committed': False, 'rollback': False, 'depth': 1, 'revision': 12, 'published': 8, 'observer_error': True, 'active': False, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 8]], 'first_old': {'x': 1}, 'last_new': {'x': 8}, 'order': ['x'], 'revision': 12, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 8], ['x', 8, 12], ['y', 16, 16]], 'committed': True, 'rollback': True, 'depth': 8, 'revision': 12, 'published': 8, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 8], ['x', 8, 12]], 'first_old': {'x': 1, 'y': 16}, 'last_new': {'x': 12, 'y': 16}, 'order': ['x', 'y'], 'revision': 8, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})], 5: [({'changes': [['x', 1, 10], ['x', 10, 15], ['y', 20, 20]], 'committed': True, 'rollback': True, 'depth': 0, 'revision': 15, 'published': 10, 'observer_error': True, 'active': False, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[10, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 10], ['x', 10, 15]], 'first_old': {'x': 1, 'y': 20}, 'last_new': {'x': 15, 'y': 20}, 'order': ['x', 'y'], 'revision': 10, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [10, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 10], ['x', 10, 15], ['y', 20, 20]], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 0, 'published': 10, 'observer_error': True, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[10, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 10], ['x', 10, 15]], 'first_old': {'x': 1, 'y': 20}, 'last_new': {'x': 15, 'y': 20}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [10, 'a']], 'publish_durable': False, 'deferred': ['parent', 'child']}), ({'changes': [['x', 1, 10], ['x', 10, 15], ['y', 20, 20]], 'committed': True, 'rollback': False, 'depth': 10, 'revision': 15, 'published': 0, 'observer_error': True, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 10], ['x', 10, 15]], 'first_old': {'x': 1, 'y': 20}, 'last_new': {'x': 15, 'y': 20}, 'order': ['x', 'y'], 'revision': 15, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 10]], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 15, 'published': 10, 'observer_error': True, 'active': False, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[10, 'a'], [0, 'z'], [1, 'm']]}, {'visible': True, 'changed': [['x', 1, 10]], 'first_old': {'x': 1}, 'last_new': {'x': 10}, 'order': ['x'], 'revision': 15, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [10, 'a']], 'publish_durable': True, 'deferred': ['parent']}), ({'changes': [['x', 1, 10]], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 15, 'published': 10, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': True, 'child_rollback': False, 'observer_failures': []}, {'visible': True, 'changed': [['x', 1, 10]], 'first_old': {'x': 1}, 'last_new': {'x': 10}, 'order': ['x'], 'revision': 15, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 15, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 15, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 10], ['x', 10, 15], ['y', 20, 20]], 'committed': True, 'rollback': True, 'depth': 10, 'revision': 15, 'published': 10, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 10], ['x', 10, 15]], 'first_old': {'x': 1, 'y': 20}, 'last_new': {'x': 15, 'y': 20}, 'order': ['x', 'y'], 'revision': 10, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})]}
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)

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(s):
    return {
        'visible': s['committed'] and not s['rollback'] and s['depth']==0,
        'changed': [r for r in s['changes'] if r[1]!=r[2]],
        'first_old': {k:next(r[1] for r in s['changes'] if r[0]==k) for k in dict.fromkeys(r[0] for r in s['changes'])},
        'last_new': {r[0]:r[1] for r in s['changes']},
        'order': list(dict.fromkeys(r[0] for r in s['changes'])),
        'revision': s['published'] if s['rollback'] else s['revision'],
        'state_rollback': s['rollback'] and not s['committed'],
        'notify_error': sorted(s['observer_failures'],key=lambda r:r[0]),
        'publish_durable': s['committed'] and s['durable'] and not s['rollback'],
        'deferred': list(s['parent_changes'])+(list(s['child_changes']) if s['child_commit'] and not s['child_rollback'] else []),
    }
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': True, 'rollback': True, 'depth': 2, 'revision': 3, 'published': 2, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 2, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': True, 'rollback': False, 'depth': 2, 'revision': 0, 'published': 2, 'observer_error': True, 'active': False, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': True, 'deferred': ['parent', 'child']}), ({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': False, 'rollback': True, 'depth': 0, 'revision': 3, 'published': 0, 'observer_error': False, 'active': True, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': True, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 2, 'revision': 3, 'published': 0, 'observer_error': True, 'active': True, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 3, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 3, 'published': 2, 'observer_error': False, 'active': True, 'durable': True, 'deferred': [], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': True, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 3, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': True, 'deferred': []}), ({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': False, 'rollback': True, 'depth': 2, 'revision': 0, 'published': 2, 'observer_error': True, 'active': True, 'durable': True, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[2, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 2, 'state_rollback': True, 'notify_error': [[0, 'z'], [1, 'm'], [2, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 2], ['x', 2, 3], ['y', 4, 4]], 'committed': True, 'rollback': True, 'depth': 2, 'revision': 3, 'published': 2, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 2], ['x', 2, 3]], 'first_old': {'x': 1, 'y': 4}, 'last_new': {'x': 3, 'y': 4}, 'order': ['x', 'y'], 'revision': 2, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})], 2: [({'changes': [['x', 1, 4], ['x', 4, 6], ['y', 8, 8]], 'committed': True, 'rollback': True, 'depth': 1, 'revision': 6, 'published': 4, 'observer_error': False, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[4, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 4], ['x', 4, 6]], 'first_old': {'x': 1, 'y': 8}, 'last_new': {'x': 6, 'y': 8}, 'order': ['x', 'y'], 'revision': 4, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [4, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 4]], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 6, 'published': 0, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[4, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 4]], 'first_old': {'x': 1}, 'last_new': {'x': 4}, 'order': ['x'], 'revision': 6, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [4, 'a']], 'publish_durable': False, 'deferred': ['child']}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 6, 'published': 0, 'observer_error': True, 'active': False, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': True, 'child_rollback': True, 'observer_failures': []}, {'visible': True, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 6, 'state_rollback': False, 'notify_error': [], 'publish_durable': True, 'deferred': ['parent']}), ({'changes': [['x', 1, 4]], 'committed': False, 'rollback': False, 'depth': 4, 'revision': 0, 'published': 0, 'observer_error': False, 'active': True, 'durable': False, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': True, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [['x', 1, 4]], 'first_old': {'x': 1}, 'last_new': {'x': 4}, 'order': ['x'], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 4]], 'committed': True, 'rollback': True, 'depth': 0, 'revision': 6, 'published': 0, 'observer_error': False, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[4, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 4]], 'first_old': {'x': 1}, 'last_new': {'x': 4}, 'order': ['x'], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [4, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 4], ['x', 4, 6], ['y', 8, 8]], 'committed': True, 'rollback': True, 'depth': 4, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': [], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[4, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 4], ['x', 4, 6]], 'first_old': {'x': 1, 'y': 8}, 'last_new': {'x': 6, 'y': 8}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [4, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 4], ['x', 4, 6], ['y', 8, 8]], 'committed': True, 'rollback': True, 'depth': 4, 'revision': 6, 'published': 4, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 4], ['x', 4, 6]], 'first_old': {'x': 1, 'y': 8}, 'last_new': {'x': 6, 'y': 8}, 'order': ['x', 'y'], 'revision': 4, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})], 3: [({'changes': [['x', 1, 6], ['x', 6, 9], ['y', 12, 12]], 'committed': True, 'rollback': True, 'depth': 1, 'revision': 9, 'published': 0, 'observer_error': False, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[6, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 6], ['x', 6, 9]], 'first_old': {'x': 1, 'y': 12}, 'last_new': {'x': 9, 'y': 12}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [6, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 6]], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 9, 'published': 6, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[6, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 6]], 'first_old': {'x': 1}, 'last_new': {'x': 6}, 'order': ['x'], 'revision': 9, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [6, 'a']], 'publish_durable': False, 'deferred': ['child']}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 6, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[6, 'a'], [0, 'z'], [1, 'm']]}, {'visible': True, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [6, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 6], ['x', 6, 9], ['y', 12, 12]], 'committed': False, 'rollback': True, 'depth': 0, 'revision': 9, 'published': 0, 'observer_error': True, 'active': False, 'durable': True, 'deferred': ['late'], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 6], ['x', 6, 9]], 'first_old': {'x': 1, 'y': 12}, 'last_new': {'x': 9, 'y': 12}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': True, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 6]], 'committed': False, 'rollback': False, 'depth': 6, 'revision': 9, 'published': 6, 'observer_error': False, 'active': True, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': [], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 6]], 'first_old': {'x': 1}, 'last_new': {'x': 6}, 'order': ['x'], 'revision': 9, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 6], ['x', 6, 9], ['y', 12, 12]], 'committed': False, 'rollback': True, 'depth': 1, 'revision': 0, 'published': 6, 'observer_error': False, 'active': False, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[6, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 6], ['x', 6, 9]], 'first_old': {'x': 1, 'y': 12}, 'last_new': {'x': 9, 'y': 12}, 'order': ['x', 'y'], 'revision': 6, 'state_rollback': True, 'notify_error': [[0, 'z'], [1, 'm'], [6, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 6], ['x', 6, 9], ['y', 12, 12]], 'committed': True, 'rollback': True, 'depth': 6, 'revision': 9, 'published': 6, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 6], ['x', 6, 9]], 'first_old': {'x': 1, 'y': 12}, 'last_new': {'x': 9, 'y': 12}, 'order': ['x', 'y'], 'revision': 6, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})], 4: [({'changes': [['x', 1, 8], ['x', 8, 12], ['y', 16, 16]], 'committed': True, 'rollback': True, 'depth': 0, 'revision': 12, 'published': 8, 'observer_error': True, 'active': False, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[8, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 8], ['x', 8, 12]], 'first_old': {'x': 1, 'y': 16}, 'last_new': {'x': 12, 'y': 16}, 'order': ['x', 'y'], 'revision': 8, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [8, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 12, 'published': 8, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[8, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 12, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [8, 'a']], 'publish_durable': False, 'deferred': ['child']}), ({'changes': [['x', 1, 8]], 'committed': False, 'rollback': True, 'depth': 8, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': True, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[8, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 8]], 'first_old': {'x': 1}, 'last_new': {'x': 8}, 'order': ['x'], 'revision': 0, 'state_rollback': True, 'notify_error': [[0, 'z'], [1, 'm'], [8, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 8]], 'committed': False, 'rollback': False, 'depth': 8, 'revision': 12, 'published': 0, 'observer_error': False, 'active': True, 'durable': False, 'deferred': ['late'], 'parent_changes': [], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 8]], 'first_old': {'x': 1}, 'last_new': {'x': 8}, 'order': ['x'], 'revision': 12, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': True, 'rollback': True, 'depth': 1, 'revision': 12, 'published': 8, 'observer_error': False, 'active': True, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[8, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 8, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [8, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 8]], 'committed': False, 'rollback': False, 'depth': 1, 'revision': 12, 'published': 8, 'observer_error': True, 'active': False, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 8]], 'first_old': {'x': 1}, 'last_new': {'x': 8}, 'order': ['x'], 'revision': 12, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 8], ['x', 8, 12], ['y', 16, 16]], 'committed': True, 'rollback': True, 'depth': 8, 'revision': 12, 'published': 8, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 8], ['x', 8, 12]], 'first_old': {'x': 1, 'y': 16}, 'last_new': {'x': 12, 'y': 16}, 'order': ['x', 'y'], 'revision': 8, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})], 5: [({'changes': [['x', 1, 10], ['x', 10, 15], ['y', 20, 20]], 'committed': True, 'rollback': True, 'depth': 0, 'revision': 15, 'published': 10, 'observer_error': True, 'active': False, 'durable': True, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[10, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 10], ['x', 10, 15]], 'first_old': {'x': 1, 'y': 20}, 'last_new': {'x': 15, 'y': 20}, 'order': ['x', 'y'], 'revision': 10, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [10, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 10], ['x', 10, 15], ['y', 20, 20]], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 0, 'published': 10, 'observer_error': True, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': False, 'observer_failures': [[10, 'a'], [0, 'z'], [1, 'm']]}, {'visible': False, 'changed': [['x', 1, 10], ['x', 10, 15]], 'first_old': {'x': 1, 'y': 20}, 'last_new': {'x': 15, 'y': 20}, 'order': ['x', 'y'], 'revision': 0, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [10, 'a']], 'publish_durable': False, 'deferred': ['parent', 'child']}), ({'changes': [['x', 1, 10], ['x', 10, 15], ['y', 20, 20]], 'committed': True, 'rollback': False, 'depth': 10, 'revision': 15, 'published': 0, 'observer_error': True, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': False, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 10], ['x', 10, 15]], 'first_old': {'x': 1, 'y': 20}, 'last_new': {'x': 15, 'y': 20}, 'order': ['x', 'y'], 'revision': 15, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [['x', 1, 10]], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 15, 'published': 10, 'observer_error': True, 'active': False, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': [[10, 'a'], [0, 'z'], [1, 'm']]}, {'visible': True, 'changed': [['x', 1, 10]], 'first_old': {'x': 1}, 'last_new': {'x': 10}, 'order': ['x'], 'revision': 15, 'state_rollback': False, 'notify_error': [[0, 'z'], [1, 'm'], [10, 'a']], 'publish_durable': True, 'deferred': ['parent']}), ({'changes': [['x', 1, 10]], 'committed': True, 'rollback': False, 'depth': 0, 'revision': 15, 'published': 10, 'observer_error': True, 'active': True, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': True, 'child_rollback': False, 'observer_failures': []}, {'visible': True, 'changed': [['x', 1, 10]], 'first_old': {'x': 1}, 'last_new': {'x': 10}, 'order': ['x'], 'revision': 15, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [], 'committed': True, 'rollback': False, 'depth': 1, 'revision': 15, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 15, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']}), ({'changes': [], 'committed': False, 'rollback': False, 'depth': 0, 'revision': 0, 'published': 0, 'observer_error': False, 'active': False, 'durable': False, 'deferred': [], 'parent_changes': [], 'child_changes': [], 'child_commit': False, 'child_rollback': False, 'observer_failures': []}, {'visible': False, 'changed': [], 'first_old': {}, 'last_new': {}, 'order': [], 'revision': 0, 'state_rollback': False, 'notify_error': [], 'publish_durable': False, 'deferred': []}), ({'changes': [['x', 1, 10], ['x', 10, 15], ['y', 20, 20]], 'committed': True, 'rollback': True, 'depth': 10, 'revision': 15, 'published': 10, 'observer_error': True, 'active': True, 'durable': True, 'deferred': ['late'], 'parent_changes': ['parent'], 'child_changes': ['child'], 'child_commit': True, 'child_rollback': True, 'observer_failures': [[1, 'b'], [1, 'a']]}, {'visible': False, 'changed': [['x', 1, 10], ['x', 10, 15]], 'first_old': {'x': 1, 'y': 20}, 'last_new': {'x': 15, 'y': 20}, 'order': ['x', 'y'], 'revision': 10, 'state_rollback': False, 'notify_error': [[1, 'b'], [1, 'a']], 'publish_durable': False, 'deferred': ['parent']})]}
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)

prompt:
Transaction coalescing retains the first intermediate new value; the returned lifecycle plan violates the stated transition contract.

Plan observer notifications around a local state transaction. Pending changes become visible only after successful outermost commit. Rollback restores the prior published revision. Change records [field,old,new] with equal endpoints are suppressed; repeated fields keep the earliest old and latest new in input order. Observer errors do not roll back an already committed state. An inner savepoint contributes child changes only on commit without rollback; parent changes survive every child outcome. Committed observer failures are [registration_position,error] records and report in stable registration order, retaining arrival order for a tied position. 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: visible = s['committed'] and not s['rollback'] and s['depth']==0; changed = [r for r in s['changes'] if r[1]!=r[2]]; first_old = {k:next(r[1] for r in s['changes'] if r[0]==k) for k in dict.fromkeys(r[0] for r in s['changes'])}; last_new = {r[0]:r[2] for r in s['changes']}; order = list(dict.fromkeys(r[0] for r in s['changes'])); revision = s['published'] if s['rollback'] else s['revision']; state_rollback = s['rollback'] and not s['committed']; notify_error = sorted(s['observer_failures'],key=lambda r:r[0]); publish_durable = s['committed'] and s['durable'] and not s['rollback']; deferred = list(s['parent_changes'])+(list(s['child_changes']) if s['child_commit'] and not s['child_rollback'] else [])

split: open-access