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

N = 1
observations = []
def solve(rows, clicked, selected, action, permissions, pending, include_hidden, visible, revision):
    by={r['id']:r for r in rows}
    if clicked not in by: return {'status':'missing','targets':[]}
    ids=[r['id'] for r in rows if r['id'] in selected] if clicked in selected and action['bulk'] else [clicked]
    if not include_hidden: ids=[k for k in ids if k in visible]
    blocked=[k for k in ids if not permissions.get(k,{}).get(action['id'],False)]
    busy=[k for k in ids if k in pending]
    if blocked: return {'status':'forbidden','targets':[],'blocked':blocked}
    if busy: return {'status':'busy','targets':[],'blocked':busy}
    if not ids: return {'status':'empty','targets':[]}
    return {'status':'ready','targets':[{'id':k,'revision':revision.get(k),'payload':{f:by[k].get(f) for f in action.get('fields',[])}} for k in ids],'action':action['id']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('ordered bulk selection', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 1}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 2:
    check('ordered bulk selection', solve([{'id':'a','v':2},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 2}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 3:
    check('ordered bulk selection', solve([{'id':'a','v':3},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 3}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 4:
    check('ordered bulk selection', solve([{'id':'a','v':4},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 4}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 5:
    check('ordered bulk selection', solve([{'id':'a','v':5},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 5}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

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(rows, clicked, selected, action, permissions, pending, include_hidden, visible, revision):
    by={r['id']:r for r in rows}
    if clicked not in by: return {'status':'missing','targets':[]}
    ids=[r['id'] for r in rows if r['id'] in selected] if clicked in selected and action['bulk'] else [clicked]
    if not include_hidden: ids=[k for k in ids if k in visible]
    blocked=[k for k in ids if not permissions.get(k,{}).get(action['id'],False)]
    busy=[k for k in ids if k in pending]
    if blocked: return {'status':'forbidden','targets':[],'blocked':blocked}
    if busy: return {'status':'busy','targets':[],'blocked':busy}
    if not ids: return {'status':'empty','targets':[]}
    return {'status':'confirm','targets':[{'id':k,'revision':revision.get(k),'payload':{f:by[k].get(f) for f in action.get('fields',[])}} for k in ids],'action':action['id']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('ordered bulk selection', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 1}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 2:
    check('ordered bulk selection', solve([{'id':'a','v':2},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 2}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 3:
    check('ordered bulk selection', solve([{'id':'a','v':3},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 3}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 4:
    check('ordered bulk selection', solve([{'id':'a','v':4},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 4}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 5:
    check('ordered bulk selection', solve([{'id':'a','v':5},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 5}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

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 table action confirmation result violates the stipulated table row action targeting contract.

A row action uses current row order, bulk selection only when the clicked row belongs to it and the action permits bulk, optional visible scope, default-deny per-action permissions, atomic busy/permission rejection, explicit empty scope, confirmation policy, and per-row revision snapshots.

split: open-access


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

N = 1
observations = []
def solve(rows, clicked, selected, action, permissions, pending, include_hidden, visible, revision):
    by={r['id']:r for r in rows}
    if clicked not in by: return {'status':'missing','targets':[]}
    ids=[r['id'] for r in rows if r['id'] in selected] if clicked in selected and action['bulk'] else [clicked]
    if not include_hidden: ids=[k for k in ids if k in visible]
    blocked=[k for k in ids if not permissions.get(k,{}).get(action['id'],False)]
    busy=[k for k in ids if k in pending]
    if blocked: return {'status':'forbidden','targets':[],'blocked':blocked}
    if busy: return {'status':'busy','targets':[],'blocked':busy}
    if not ids: return {'status':'empty','targets':[]}
    return {'status':'confirm' if action.get('confirm') else 'ready','targets':[{'id':k,'revision':revision.get(clicked),'payload':{f:by[k].get(f) for f in action.get('fields',[])}} for k in ids],'action':action['id']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('ordered bulk selection', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 1}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 2:
    check('ordered bulk selection', solve([{'id':'a','v':2},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 2}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 3:
    check('ordered bulk selection', solve([{'id':'a','v':3},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 3}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 4:
    check('ordered bulk selection', solve([{'id':'a','v':4},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 4}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 5:
    check('ordered bulk selection', solve([{'id':'a','v':5},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 5}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

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(rows, clicked, selected, action, permissions, pending, include_hidden, visible, revision):
    by={r['id']:r for r in rows}
    if clicked not in by: return {'status':'missing','targets':[]}
    ids=[r['id'] for r in rows if r['id'] in selected] if clicked in selected and action['bulk'] else [clicked]
    if not include_hidden: ids=[k for k in ids if k in visible]
    blocked=[k for k in ids if not permissions.get(k,{}).get(action['id'],False)]
    busy=[k for k in ids if k in pending]
    if blocked: return {'status':'forbidden','targets':[],'blocked':blocked}
    if busy: return {'status':'busy','targets':[],'blocked':busy}
    if not ids: return {'status':'empty','targets':[]}
    return {'status':'confirm' if action.get('confirm') else 'ready','targets':[{'id':k,'revision':None,'payload':{f:by[k].get(f) for f in action.get('fields',[])}} for k in ids],'action':action['id']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('ordered bulk selection', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 1}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 2:
    check('ordered bulk selection', solve([{'id':'a','v':2},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 2}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 3:
    check('ordered bulk selection', solve([{'id':'a','v':3},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 3}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 4:
    check('ordered bulk selection', solve([{'id':'a','v':4},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 4}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

if N == 5:
    check('ordered bulk selection', solve([{'id':'a','v':5},{'id':'b','v':2},{'id':'c','v':3}], 'a', ['c','a'], {'id':'delete','bulk':True,'confirm':True,'fields':['v']}, {'a':{'delete':True},'c':{'delete':True}}, [], True, ['a','b'], {'a':1,'b':2,'c':3}), {'status': 'confirm', 'targets': [{'id': 'a', 'revision': 1, 'payload': {'v': 5}}, {'id': 'c', 'revision': 3, 'payload': {'v': 3}}], 'action': 'delete'})
    check('clicked outside selection', solve([{'id':'a'},{'id':'b'}], 'b', ['a'], {'id':'open','bulk':True,'confirm':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {'a':1,'b':2}), {'status': 'ready', 'targets': [{'id': 'b', 'revision': 2, 'payload': {}}], 'action': 'open'})
    check('single action selected', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':False}, {'a':{'open':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('one forbidden member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'open':True}}, [], True, ['a','b'], {}), {'status': 'forbidden', 'targets': [], 'blocked': ['b']})
    check('one busy member', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'delete','bulk':True}, {'a':{'delete':True},'b':{'delete':True}}, ['unrelated','b'], True, ['a','b'], {}), {'status': 'busy', 'targets': [], 'blocked': ['b']})
    check('hidden targets excluded', solve([{'id':'a'},{'id':'b'}], 'a', ['a','b'], {'id':'open','bulk':True}, {'a':{'open':True},'b':{'open':True}}, [], False, ['a'], {}), {'status': 'ready', 'targets': [{'id': 'a', 'revision': None, 'payload': {}}], 'action': 'open'})
    check('empty visible scope', solve([{'id':'a'}], 'a', [], {'id':'open','bulk':False}, {'a':{'open':True}}, [], False, [], {}), {'status': 'empty', 'targets': []})
    check('missing row', solve([], 'a', [], {'id':'open','bulk':False}, {}, [], True, [], {}), {'status': 'missing', 'targets': []})

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 table target specific revision result violates the stipulated table row action targeting contract.

A row action uses current row order, bulk selection only when the clicked row belongs to it and the action permits bulk, optional visible scope, default-deny per-action permissions, atomic busy/permission rejection, explicit empty scope, confirmation policy, and per-row revision snapshots.

split: open-access


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

N = 1
observations = []
def solve(old_rows, new_rows, columns, selected_before, selected_after, old_widths, new_widths, old_theme, new_theme, old_errors, new_errors):
    old={r['id']:r for r in old_rows}; new={r['id']:r for r in new_rows}
    old_order=[r['id'] for r in old_rows]; new_order=[r['id'] for r in new_rows]
    paint=[]; measure=[]
    for r in new_rows:
        key=r['id']
        for c in columns:
            cell=(key,c['id'])
            changed=key not in old or old[key].get(c['id'])!=r.get(c['id'])
            decor=(cell in selected_before)!=(cell in selected_after) or old_errors.get(cell)!=new_errors.get(cell)
            layout=old_widths.get(c['id'])!=new_widths.get(c['id'])
            stripe=c.get('stripe',False) and (key not in old_order or old_order.index(key)%2!=new_order.index(key)%2)
            if changed or decor or layout or stripe or old_theme!=new_theme: paint.append(cell)
            if c.get('wrap',False) and (changed or layout): measure.append(cell)
    return {'paint':paint,'measure':measure,'removed':[k for k in old_order if k not in new],'added':[k for k in new_order if k not in old]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':1+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 2:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':2+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 3:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':3+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 4:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':4+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 5:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':5+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

check('variant wrapping width invalidation', solve([{'id':'r','a':1}], [{'id':'r','a':1}], [{'id':'a','field':'a','wrap':True}], [], [], {'a':N}, {'a':3}, 'light', 'light', {}, {}), {'paint':[('r','a')] if N!=3 else [],'measure':[('r','a')] if N!=3 else [],'removed':[],'added':[]})
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(old_rows, new_rows, columns, selected_before, selected_after, old_widths, new_widths, old_theme, new_theme, old_errors, new_errors):
    old={r['id']:r for r in old_rows}; new={r['id']:r for r in new_rows}
    old_order=[r['id'] for r in old_rows]; new_order=[r['id'] for r in new_rows]
    paint=[]; measure=[]
    for r in new_rows:
        key=r['id']
        for c in columns:
            cell=(key,c['id'])
            changed=key not in old or old[key]!=r
            decor=(cell in selected_before)!=(cell in selected_after) or old_errors.get(cell)!=new_errors.get(cell)
            layout=old_widths.get(c['id'])!=new_widths.get(c['id'])
            stripe=c.get('stripe',False) and (key not in old_order or old_order.index(key)%2!=new_order.index(key)%2)
            if changed or decor or layout or stripe or old_theme!=new_theme: paint.append(cell)
            if c.get('wrap',False) and (changed or layout): measure.append(cell)
    return {'paint':paint,'measure':measure,'removed':[k for k in old_order if k not in new],'added':[k for k in new_order if k not in old]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':1+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 2:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':2+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 3:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':3+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 4:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':4+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 5:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':5+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

check('variant wrapping width invalidation', solve([{'id':'r','a':1}], [{'id':'r','a':1}], [{'id':'a','field':'a','wrap':True}], [], [], {'a':N}, {'a':3}, 'light', 'light', {}, {}), {'paint':[('r','a')] if N!=3 else [],'measure':[('r','a')] if N!=3 else [],'removed':[],'added':[]})
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 table field accessor change result violates the stipulated table cell render invalidation contract.

Table invalidation uses column field accessors and stable row IDs; repaint follows value, symmetric selection, error-text, width, stripe parity, or theme changes. Only wrapped cells remeasure on value/width changes, and added/removed row IDs drive mount/disposal.

split: open-access


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

N = 1
observations = []
def solve(old_rows, new_rows, columns, selected_before, selected_after, old_widths, new_widths, old_theme, new_theme, old_errors, new_errors):
    old={r['id']:r for r in old_rows}; new={r['id']:r for r in new_rows}
    old_order=[r['id'] for r in old_rows]; new_order=[r['id'] for r in new_rows]
    paint=[]; measure=[]
    for r in new_rows:
        key=r['id']
        for c in columns:
            cell=(key,c['id'])
            changed=key not in old or old[key].get(c['field'])!=r.get(c['field'])
            decor=cell in selected_after or old_errors.get(cell)!=new_errors.get(cell)
            layout=old_widths.get(c['id'])!=new_widths.get(c['id'])
            stripe=c.get('stripe',False) and (key not in old_order or old_order.index(key)%2!=new_order.index(key)%2)
            if changed or decor or layout or stripe or old_theme!=new_theme: paint.append(cell)
            if c.get('wrap',False) and (changed or layout): measure.append(cell)
    return {'paint':paint,'measure':measure,'removed':[k for k in old_order if k not in new],'added':[k for k in new_order if k not in old]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':1+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 2:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':2+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 3:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':3+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 4:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':4+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 5:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':5+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

check('variant wrapping width invalidation', solve([{'id':'r','a':1}], [{'id':'r','a':1}], [{'id':'a','field':'a','wrap':True}], [], [], {'a':N}, {'a':3}, 'light', 'light', {}, {}), {'paint':[('r','a')] if N!=3 else [],'measure':[('r','a')] if N!=3 else [],'removed':[],'added':[]})
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(old_rows, new_rows, columns, selected_before, selected_after, old_widths, new_widths, old_theme, new_theme, old_errors, new_errors):
    old={r['id']:r for r in old_rows}; new={r['id']:r for r in new_rows}
    old_order=[r['id'] for r in old_rows]; new_order=[r['id'] for r in new_rows]
    paint=[]; measure=[]
    for r in new_rows:
        key=r['id']
        for c in columns:
            cell=(key,c['id'])
            changed=key not in old or old[key].get(c['field'])!=r.get(c['field'])
            decor=cell in selected_before and cell not in selected_after or old_errors.get(cell)!=new_errors.get(cell)
            layout=old_widths.get(c['id'])!=new_widths.get(c['id'])
            stripe=c.get('stripe',False) and (key not in old_order or old_order.index(key)%2!=new_order.index(key)%2)
            if changed or decor or layout or stripe or old_theme!=new_theme: paint.append(cell)
            if c.get('wrap',False) and (changed or layout): measure.append(cell)
    return {'paint':paint,'measure':measure,'removed':[k for k in old_order if k not in new],'added':[k for k in new_order if k not in old]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':1+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 2:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':2+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 3:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':3+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 4:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':4+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

if N == 5:
    check('accessor value changes', solve([{'id':'a','amount':1,'note':'same'}], [{'id':'a','amount':5+2,'note':'same'}], [{'id':'display','field':'amount','wrap':True},{'id':'note','field':'note'}], [], [], {'display':8,'note':4}, {'display':8,'note':4}, 'light', 'light', {}, {}), {'paint': [('a', 'display')], 'measure': [('a', 'display')], 'removed': [], 'added': []})
    check('selection removed and added', solve([{'id':'a','v':1},{'id':'b','v':2}], [{'id':'a','v':1},{'id':'b','v':2}], [{'id':'v','field':'v','wrap':True}], [('a','v')], [('b','v')], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('a', 'v'), ('b', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('error message changes', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {('a','v'):'old'}, {('a','v'):'new'}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('width shrinks wrapping', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':8}, {'v':4}, 'light', 'light', {}, {}), {'paint': [('a', 'v')], 'measure': [('a', 'v')], 'removed': [], 'added': []})
    check('theme-only repaint', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v','wrap':True}], [], [], {'v':5}, {'v':5}, 'light', 'dark', {}, {}), {'paint': [('a', 'v')], 'measure': [], 'removed': [], 'added': []})
    check('parity and removals', solve([{'id':'a','v':1},{'id':'b','v':2},{'id':'c','v':3},{'id':'gone','v':4}], [{'id':'b','v':2},{'id':'c','v':3},{'id':'a','v':1},{'id':'new','v':5}], [{'id':'v','field':'v','stripe':True}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [('b', 'v'), ('c', 'v'), ('new', 'v')], 'measure': [], 'removed': ['gone'], 'added': ['new']})
    check('unchanged', solve([{'id':'a','v':1}], [{'id':'a','v':1}], [{'id':'v','field':'v'}], [], [], {'v':5}, {'v':5}, 'light', 'light', {}, {}), {'paint': [], 'measure': [], 'removed': [], 'added': []})

check('variant wrapping width invalidation', solve([{'id':'r','a':1}], [{'id':'r','a':1}], [{'id':'a','field':'a','wrap':True}], [], [], {'a':N}, {'a':3}, 'light', 'light', {}, {}), {'paint':[('r','a')] if N!=3 else [],'measure':[('r','a')] if N!=3 else [],'removed':[],'added':[]})
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 table selection symmetric difference result violates the stipulated table cell render invalidation contract.

Table invalidation uses column field accessors and stable row IDs; repaint follows value, symmetric selection, error-text, width, stripe parity, or theme changes. Only wrapped cells remeasure on value/width changes, and added/removed row IDs drive mount/disposal.

split: open-access