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

N = 1
observations = []
def solve(d):
    return {'row-error':([e['message'] for e in d['errors'] if e['id']==d['id']]), 'slot-error':([e['message'] for e in d['errors'] if e['id']==d['id'] and e['slot']==d['slot']]), 'removed-row-errors':([e for e in d['errors'] if e['id'] in d['rows']]), 'server-error-revision':(d['errors'] if d['error_revision']==d['revision'] else []), 'first-invalid-row':(next((row for row in d['rows'] if any(e['id']==row for e in d['errors'])),None)), 'invalid-row-count':(len(d['errors']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 0, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 1, 'slot': 'upper', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 0, 'slot': 'upper', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1})], 2: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [], 'id': 'a', 'index': 0, 'slot': 'upper', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 0, 'slot': 'lower', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 1, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': ['U'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': ['U'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['B'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1})], 3: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 1, 'slot': 'upper', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 1, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0})], 4: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 0, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 1, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'upper', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': ['U'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': ['U'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['B'], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 1, 'slot': 'upper', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['B'], 'removed-row-errors': [], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': None, 'invalid-row-count': 0})], 5: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 0, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 1, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'gone', 'index': 0, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'a', 'invalid-row-count': 2})]}
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 {'row-error':([e['message'] for e in d['errors'] if e['id']==d['id']]), 'slot-error':([e['message'] for e in d['errors'] if e['id']==d['id'] and e['slot']==d['slot']]), 'removed-row-errors':([e for e in d['errors'] if e['id'] in d['rows']]), 'server-error-revision':(d['errors'] if d['error_revision']==d['revision'] else []), 'first-invalid-row':(next((row for row in d['rows'] if any(e['id']==row for e in d['errors'])),None)), 'invalid-row-count':(len(d['rows']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 0, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 1, 'slot': 'upper', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 0, 'slot': 'upper', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1})], 2: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [], 'id': 'a', 'index': 0, 'slot': 'upper', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 0, 'slot': 'lower', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 1, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': ['U'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': ['U'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['B'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1})], 3: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 1, 'slot': 'upper', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 1, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'a', 'invalid-row-count': 2}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0})], 4: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 0, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 1, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'upper', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': ['U'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': ['U'], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['B'], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 1, 'slot': 'upper', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['B'], 'removed-row-errors': [], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': None, 'invalid-row-count': 0})], 5: [({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'a', 'index': 1, 'slot': 'upper', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'b', 'index': 0, 'slot': 'upper', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 0, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [], 'id': 'gone', 'index': 1, 'slot': 'lower', 'rows': ['a', 'b'], 'error_revision': 2, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 0, 'slot': 'lower', 'rows': ['b'], 'error_revision': 1, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'a', 'index': 1, 'slot': 'lower', 'rows': ['b'], 'error_revision': 2, 'revision': 2}, {'row-error': ['U'], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': 'b', 'invalid-row-count': 1}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 0, 'slot': 'lower', 'rows': [], 'error_revision': 1, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [], 'server-error-revision': [], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'b', 'index': 1, 'slot': 'lower', 'rows': [], 'error_revision': 2, 'revision': 2}, {'row-error': ['L', 'B'], 'slot-error': ['L'], 'removed-row-errors': [], 'server-error-revision': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'first-invalid-row': None, 'invalid-row-count': 0}), ({'errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'id': 'gone', 'index': 0, 'slot': 'upper', 'rows': ['a', 'b'], 'error_revision': 1, 'revision': 2}, {'row-error': [], 'slot-error': [], 'removed-row-errors': [{'id': 'b', 'slot': 'lower', 'message': 'L'}, {'id': 'a', 'slot': 'upper', 'message': 'U'}, {'id': 'b', 'slot': 'upper', 'message': 'B'}], 'server-error-revision': [], 'first-invalid-row': 'a', 'invalid-row-count': 2})]}
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:
Invalid criterion totals deduplicate slot errors and ignore removed rows is violated by the widget projection.

Filter validation is attached to stable criterion IDs and operand slots. Server errors belong to the submitted revision and cannot move to neighboring rows after reordering. This example checks: Invalid criterion totals deduplicate slot errors and ignore removed rows.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'user-budget':(d['rows'][:d['limit']]), 'required-visible':([x for x in d['rows'] if x['required']]), 'overflow-count':(max(0,sum(not x['required'] for x in d['rows'])-d['limit'])), 'expanded-labels':(d['rows'] if d['expanded'] else d['rows'][:d['limit']]), 'expander-enabled':(sum(not x['required'] for x in d['rows'])>d['limit']), 'operand-caption':(' + '.join(x['label'] for x in d['rows'] if x['enabled']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'})], 2: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 1, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 1, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''})], 3: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [], 'limit': 1, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 2, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 2, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'c'})], 4: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''})], 5: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 1, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 1, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 2, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 2, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'scope + a'})]}
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 {'user-budget':([x for x in d['rows'] if not x['required']]), 'required-visible':([x for x in d['rows'] if x['required']]), 'overflow-count':(max(0,sum(not x['required'] for x in d['rows'])-d['limit'])), 'expanded-labels':(d['rows'] if d['expanded'] else d['rows'][:d['limit']]), 'expander-enabled':(sum(not x['required'] for x in d['rows'])>d['limit']), 'operand-caption':(' + '.join(x['label'] for x in d['rows'] if x['enabled']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'})], 2: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 1, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 1, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''})], 3: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [], 'limit': 1, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 2, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 2, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'c'})], 4: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 0, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 1, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': False}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''})], 5: [({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': False}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 1, 'expanded': True}, {'user-budget': [{'label': 'a', 'required': False, 'enabled': True}], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 1, 'expanded-labels': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'expander-enabled': True, 'operand-caption': 'scope + a'}), ({'rows': [{'label': 'c', 'required': False, 'enabled': True}], 'limit': 2, 'expanded': True}, {'user-budget': [{'label': 'c', 'required': False, 'enabled': True}], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [{'label': 'c', 'required': False, 'enabled': True}], 'expander-enabled': False, 'operand-caption': 'c'}), ({'rows': [], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 0, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 1, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 1, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 2, 'expanded': False}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [], 'limit': 2, 'expanded': True}, {'user-budget': [], 'required-visible': [], 'overflow-count': 0, 'expanded-labels': [], 'expander-enabled': False, 'operand-caption': ''}), ({'rows': [{'label': 'scope', 'required': True, 'enabled': True}, {'label': 'a', 'required': False, 'enabled': True}, {'label': 'b', 'required': False, 'enabled': False}], 'limit': 0, 'expanded': False}, {'user-budget': [], 'required-visible': [{'label': 'scope', 'required': True, 'enabled': True}], 'overflow-count': 2, 'expanded-labels': [], 'expander-enabled': True, 'operand-caption': 'scope + a'})]}
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:
Required labels do not consume the user-summary display budget is violated by the widget projection.

A collapsed filter summary budgets visible criterion labels separately from hidden criteria, keeps mandatory labels outside the user budget, and computes omitted counts from visible identities. This example checks: Required labels do not consume the user-summary display budget.

split: open-access