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['committed']),'errors':[],'open':False}), 'conflict-banner':(d['revision']!=d['base']), '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': 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', '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': [], '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': 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}), ({'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': [], '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': ['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': [], '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': 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', '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'], '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': [], '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']}), ({'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', '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', '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}), ({'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': [], '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': 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', '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':(set(d['draft']) != set(d['committed'])), 'apply-gate':(d['valid'] and d['revision']==d['base']), 'cancel-target':({'draft':list(d['committed']),'errors':[],'open':False}), 'conflict-banner':(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': 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', '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': [], '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': 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}), ({'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': [], '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': ['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': [], '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': 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', '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'], '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': [], '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']}), ({'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', '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', '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}), ({'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': [], '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': 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', '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:
Conflict notices require both a changed revision and a divergent 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: Conflict notices require both a changed revision and a divergent 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['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'] 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': ['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': [], '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': ['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'], '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': ['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': ['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'], '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': ['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': ['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': ['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', '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['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['committed']) 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': ['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': [], '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': ['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'], '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': ['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': ['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'], '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': ['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': ['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': ['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', '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:
The publish payload uses the validated draft only after revision acceptance 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: The publish payload uses the validated draft only after revision acceptance.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'zero-selected':(d['count'] is None or d['count']>0), 'unknown-badge':('?' if d['count'] is None else str(d['count'])), 'hide-empty':(not d['hide'] or d['selected'] or d['count']!=0), 'busy-marker':(d['loading'] and d['count'] is None), 'empty-message':(d['count']==0 and not d['loading']), 'stale-count':(d['loading'] and d['count'] is not None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'selected': True, 'count': 0, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': True, 'loading': True}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': False, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 1, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 1, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 7, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 7, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': None, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True})], 2: [({'selected': True, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': None, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 7, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': None, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': None, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 0, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': True, 'count': 0, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': True, 'count': 1, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 1, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 7, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False})], 3: [({'selected': True, 'count': 0, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': None, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 0, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 1, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 1, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 7, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 7, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True})], 4: [({'selected': True, 'count': 0, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': None, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 7, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 7, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': None, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': False, 'loading': False}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': True, 'loading': False}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': False, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': 1, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 1, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 7, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False})], 5: [({'selected': True, 'count': 0, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 0, 'hide': True, 'loading': True}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': False, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 1, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 1, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 7, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 7, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': None, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False})]}
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 {'zero-selected':(d['selected'] or bool(d['count'])), 'unknown-badge':('?' if d['count'] is None else str(d['count'])), 'hide-empty':(not d['hide'] or d['selected'] or d['count']!=0), 'busy-marker':(d['loading'] and d['count'] is None), 'empty-message':(d['count']==0 and not d['loading']), 'stale-count':(d['loading'] and d['count'] is not None)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'selected': True, 'count': 0, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': True, 'loading': True}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': False, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 1, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 1, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 7, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 7, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': None, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True})], 2: [({'selected': True, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': None, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 7, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': None, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': None, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 0, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': True, 'count': 0, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': True, 'count': 1, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 1, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 7, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False})], 3: [({'selected': True, 'count': 0, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': None, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 0, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 1, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 1, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 7, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': 7, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True})], 4: [({'selected': True, 'count': 0, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': None, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 7, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': 7, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': None, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': False, 'loading': False}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': True, 'loading': False}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': False, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': 1, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 1, 'hide': True, 'loading': False}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 7, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': False})], 5: [({'selected': True, 'count': 0, 'hide': False, 'loading': False}, {'zero-selected': True, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': True, 'stale-count': False}), ({'selected': False, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': False, 'count': 0, 'hide': False, 'loading': True}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 0, 'hide': True, 'loading': True}, {'zero-selected': False, 'unknown-badge': '0', 'hide-empty': False, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 1, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 1, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '1', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 7, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': False, 'count': 7, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '7', 'hide-empty': True, 'busy-marker': False, 'empty-message': False, 'stale-count': True}), ({'selected': True, 'count': None, 'hide': False, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False}), ({'selected': True, 'count': None, 'hide': True, 'loading': True}, {'zero-selected': True, 'unknown-badge': '?', 'hide-empty': True, 'busy-marker': True, 'empty-message': False, 'stale-count': False})]}
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:
Selected zero-count choices remain enabled for deselection is violated by the widget projection.

Facet choices remain removable when selected even at zero matches; counts distinguish unknown loading state from a known empty result. This example checks: Selected zero-count choices remain enabled for deselection.

split: open-access