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

N = 1
observations = []
def solve(d):
    return {'open-copy':(list(d['committed'])), 'dirty-order':(d['draft'] != d['committed']), 'apply-gate':(d['valid'] and d['revision']==d['base']), 'cancel-target':({'draft':list(d['committed']),'errors':[],'open':False}), 'conflict-banner':(d['revision']!=d['base'] and set(d['draft'])!=set(d['committed'])), 'apply-payload':(list(d['draft']) if d['valid'] and d['revision']==d['base'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None})], 2: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 3: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']})], 4: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None})], 5: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': 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 {'open-copy':(list(d['committed'])), 'dirty-order':(len(d['draft']) != len(d['committed'])), 'apply-gate':(d['valid'] and d['revision']==d['base']), 'cancel-target':({'draft':list(d['committed']),'errors':[],'open':False}), 'conflict-banner':(d['revision']!=d['base'] and set(d['draft'])!=set(d['committed'])), 'apply-payload':(list(d['draft']) if d['valid'] and d['revision']==d['base'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None})], 2: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 3: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']})], 4: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None})], 5: [({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': 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:
Draft dirtiness ignores ordering but retains constraint identity is violated by the widget projection.

An Apply/Cancel filter panel keeps draft and committed constraints separate; validation and revision determine whether a draft may be published. This example checks: Draft dirtiness ignores ordering but retains constraint identity.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'open-copy':(list(d['committed'])), 'dirty-order':(set(d['draft']) != set(d['committed'])), 'apply-gate':(d['valid']), 'cancel-target':({'draft':list(d['committed']),'errors':[],'open':False}), 'conflict-banner':(d['revision']!=d['base'] and set(d['draft'])!=set(d['committed'])), 'apply-payload':(list(d['draft']) if d['valid'] and d['revision']==d['base'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 2: [({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 3: [({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None})], 4: [({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None})], 5: [({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': 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 {'open-copy':(list(d['committed'])), 'dirty-order':(set(d['draft']) != set(d['committed'])), 'apply-gate':(d['revision']==d['base']), 'cancel-target':({'draft':list(d['committed']),'errors':[],'open':False}), 'conflict-banner':(d['revision']!=d['base'] and set(d['draft'])!=set(d['committed'])), 'apply-payload':(list(d['draft']) if d['valid'] and d['revision']==d['base'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 2: [({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 3: [({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None})], 4: [({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None})], 5: [({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': 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:
Applying rejects a valid but stale draft is violated by the widget projection.

An Apply/Cancel filter panel keeps draft and committed constraints separate; validation and revision determine whether a draft may be published. This example checks: Applying rejects a valid but stale draft.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'open-copy':(list(d['committed'])), 'dirty-order':(set(d['draft']) != set(d['committed'])), 'apply-gate':(d['valid'] and d['revision']==d['base']), 'cancel-target':({'draft':list(d['draft']),'errors':[],'open':False}), 'conflict-banner':(d['revision']!=d['base'] and set(d['draft'])!=set(d['committed'])), 'apply-payload':(list(d['draft']) if d['valid'] and d['revision']==d['base'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 2: [({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 3: [({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 4: [({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 5: [({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': 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 {'open-copy':(list(d['committed'])), 'dirty-order':(set(d['draft']) != set(d['committed'])), 'apply-gate':(d['valid'] and d['revision']==d['base']), 'cancel-target':({'draft':list(d['committed']),'errors':[],'open':True}), 'conflict-banner':(d['revision']!=d['base'] and set(d['draft'])!=set(d['committed'])), 'apply-payload':(list(d['draft']) if d['valid'] and d['revision']==d['base'] else None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 2: [({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 3: [({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b']}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 4: [({'committed': [], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': [], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': ['b', 'a']}), ({'committed': ['a'], 'draft': [], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None})], 5: [({'committed': [], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a', 'b'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a', 'b'], 'dirty-order': False, 'apply-gate': False, 'cancel-target': {'draft': ['a', 'b'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': [], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': [], 'dirty-order': False, 'apply-gate': True, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': [], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': [], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': [], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': [], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': [], 'valid': True, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': True, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': []}), ({'committed': ['a'], 'draft': ['b'], 'valid': False, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': False, 'revision': 1, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': False, 'apply-payload': None}), ({'committed': ['a'], 'draft': ['b', 'a'], 'valid': True, 'revision': 2, 'base': 1}, {'open-copy': ['a'], 'dirty-order': True, 'apply-gate': False, 'cancel-target': {'draft': ['a'], 'errors': [], 'open': False}, 'conflict-banner': True, 'apply-payload': 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:
Cancel restores the committed snapshot without merging pending constraints is violated by the widget projection.

An Apply/Cancel filter panel keeps draft and committed constraints separate; validation and revision determine whether a draft may be published. This example checks: Cancel restores the committed snapshot without merging pending constraints.

split: open-access