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

N = 1
observations = []
def solve(rows, selected, page, disabled, mode, excluded):
    known={r['id'] for r in rows}
    eligible=[r['id'] for r in rows if r['id'] in page and r['id'] not in disabled]
    active=set(selected) & known
    checked=[r for r in eligible if (r not in excluded if mode=='all' else r in active)]
    return {'eligible':eligible,'checked':checked,'all':bool(eligible) and len(checked)==len(eligible),'mixed':0<len(checked)<len(eligible),'disabled':not eligible,'select_page':sorted(active|set(eligible)),'clear_page':sorted(set()),'off_page':sorted(active-set(page)),'excluded':sorted(set(excluded)&known),'count':len(known-set(excluded)) if mode=='all' else len(active)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(1)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 2:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(2)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 3:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(3)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 4:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(4)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 5:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(5)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

check('variant selected identity', solve([{'id':'a'},{'id':'b'+str(N)}], ['b'+str(N)], ['a','b'+str(N)], [], 'explicit', []), {'eligible':['a','b'+str(N)], 'checked':['b'+str(N)], 'all':False, 'mixed':True, 'disabled':False, 'select_page':['a','b'+str(N)], 'clear_page':[], 'off_page':[], 'excluded':[], 'count':1})
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, selected, page, disabled, mode, excluded):
    known={r['id'] for r in rows}
    eligible=[r['id'] for r in rows if r['id'] in page and r['id'] not in disabled]
    active=set(selected) & known
    checked=[r for r in eligible if (r not in excluded if mode=='all' else r in active)]
    return {'eligible':eligible,'checked':checked,'all':bool(eligible) and len(checked)==len(eligible),'mixed':0<len(checked)<len(eligible),'disabled':not eligible,'select_page':sorted(active|set(eligible)),'clear_page':sorted(active-set(page)),'off_page':sorted(active-set(page)),'excluded':sorted(set(excluded)&known),'count':len(known-set(excluded)) if mode=='all' else len(active)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(1)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 2:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(2)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 3:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(3)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 4:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(4)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 5:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(5)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

check('variant selected identity', solve([{'id':'a'},{'id':'b'+str(N)}], ['b'+str(N)], ['a','b'+str(N)], [], 'explicit', []), {'eligible':['a','b'+str(N)], 'checked':['b'+str(N)], 'all':False, 'mixed':True, 'disabled':False, 'select_page':['a','b'+str(N)], 'clear_page':[], 'off_page':[], 'excluded':[], 'count':1})
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 page clear difference result violates the stipulated table row checkbox reconciliation contract.

Checkbox header state concerns enabled loaded page rows; explicit selections use stable row IDs and survive pagination, global select-all uses exclusions, stale IDs are removed, and empty eligible pages are disabled and unchecked.

split: open-access


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

N = 1
observations = []
def solve(rows, selected, page, disabled, mode, excluded):
    known={r['id'] for r in rows}
    eligible=[r['id'] for r in rows if r['id'] in page and r['id'] not in disabled]
    active=set(selected) & known
    checked=[r for r in eligible if (r not in excluded if mode=='all' else r in active)]
    return {'eligible':eligible,'checked':checked,'all':bool(eligible) and len(checked)==len(eligible),'mixed':0<len(checked)<len(eligible),'disabled':not eligible,'select_page':sorted(active|set(eligible)),'clear_page':sorted(active-set(eligible)),'off_page':sorted(active),'excluded':sorted(set(excluded)&known),'count':len(known-set(excluded)) if mode=='all' else len(active)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(1)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 2:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(2)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 3:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(3)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 4:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(4)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 5:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(5)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

check('variant selected identity', solve([{'id':'a'},{'id':'b'+str(N)}], ['b'+str(N)], ['a','b'+str(N)], [], 'explicit', []), {'eligible':['a','b'+str(N)], 'checked':['b'+str(N)], 'all':False, 'mixed':True, 'disabled':False, 'select_page':['a','b'+str(N)], 'clear_page':[], 'off_page':[], 'excluded':[], 'count':1})
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, selected, page, disabled, mode, excluded):
    known={r['id'] for r in rows}
    eligible=[r['id'] for r in rows if r['id'] in page and r['id'] not in disabled]
    active=set(selected) & known
    checked=[r for r in eligible if (r not in excluded if mode=='all' else r in active)]
    return {'eligible':eligible,'checked':checked,'all':bool(eligible) and len(checked)==len(eligible),'mixed':0<len(checked)<len(eligible),'disabled':not eligible,'select_page':sorted(active|set(eligible)),'clear_page':sorted(active-set(eligible)),'off_page':sorted(active-set(eligible)),'excluded':sorted(set(excluded)&known),'count':len(known-set(excluded)) if mode=='all' else len(active)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(1)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 2:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(2)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 3:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(3)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 4:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(4)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 5:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(5)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

check('variant selected identity', solve([{'id':'a'},{'id':'b'+str(N)}], ['b'+str(N)], ['a','b'+str(N)], [], 'explicit', []), {'eligible':['a','b'+str(N)], 'checked':['b'+str(N)], 'all':False, 'mixed':True, 'disabled':False, 'select_page':['a','b'+str(N)], 'clear_page':[], 'off_page':[], 'excluded':[], 'count':1})
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 offpage badge result violates the stipulated table row checkbox reconciliation contract.

Checkbox header state concerns enabled loaded page rows; explicit selections use stable row IDs and survive pagination, global select-all uses exclusions, stale IDs are removed, and empty eligible pages are disabled and unchecked.

split: open-access


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

N = 1
observations = []
def solve(rows, selected, page, disabled, mode, excluded):
    known={r['id'] for r in rows}
    eligible=[r['id'] for r in rows if r['id'] in page and r['id'] not in disabled]
    active=set(selected) & known
    checked=[r for r in eligible if (r not in excluded if mode=='all' else r in active)]
    return {'eligible':eligible,'checked':checked,'all':bool(eligible) and len(checked)==len(eligible),'mixed':0<len(checked)<len(eligible),'disabled':not eligible,'select_page':sorted(active|set(eligible)),'clear_page':sorted(active-set(eligible)),'off_page':sorted(active-set(page)),'excluded':sorted(set(excluded)&known),'count':len(checked)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(1)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 2:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(2)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 3:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(3)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 4:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(4)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 5:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(5)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

check('variant selected identity', solve([{'id':'a'},{'id':'b'+str(N)}], ['b'+str(N)], ['a','b'+str(N)], [], 'explicit', []), {'eligible':['a','b'+str(N)], 'checked':['b'+str(N)], 'all':False, 'mixed':True, 'disabled':False, 'select_page':['a','b'+str(N)], 'clear_page':[], 'off_page':[], 'excluded':[], 'count':1})
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, selected, page, disabled, mode, excluded):
    known={r['id'] for r in rows}
    eligible=[r['id'] for r in rows if r['id'] in page and r['id'] not in disabled]
    active=set(selected) & known
    checked=[r for r in eligible if (r not in excluded if mode=='all' else r in active)]
    return {'eligible':eligible,'checked':checked,'all':bool(eligible) and len(checked)==len(eligible),'mixed':0<len(checked)<len(eligible),'disabled':not eligible,'select_page':sorted(active|set(eligible)),'clear_page':sorted(active-set(eligible)),'off_page':sorted(active-set(page)),'excluded':sorted(set(excluded)&known),'count':len(known) if mode=='all' else len(active)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(1)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 2:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(2)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 3:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(3)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 4:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(4)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

if N == 5:
    check('partial page', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'+str(5)}], ['a','c','stale'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b', 'c'], 'clear_page': ['c'], 'off_page': ['c'], 'excluded': [], 'count': 2})
    check('disabled row', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': ['a'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': ['b'], 'off_page': [], 'excluded': [], 'count': 2})
    check('global mode', solve([{'id':'a'},{'id':'b'},{'id':'c'}], [], ['a','b'], [], 'all', ['b','stale']), {'eligible': ['a', 'b'], 'checked': ['a'], 'all': False, 'mixed': True, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': ['b'], 'count': 2})
    check('empty page', solve([{'id':'a'}], ['a'], [], [], 'explicit', []), {'eligible': [], 'checked': [], 'all': False, 'mixed': False, 'disabled': True, 'select_page': ['a'], 'clear_page': ['a'], 'off_page': ['a'], 'excluded': [], 'count': 1})
    check('none checked', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})
    check('full checked', solve([{'id':'a'},{'id':'b'}], ['a','b'], ['a','b'], [], 'explicit', []), {'eligible': ['a', 'b'], 'checked': ['a', 'b'], 'all': True, 'mixed': False, 'disabled': False, 'select_page': ['a', 'b'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 2})
    check('disabled unselected', solve([{'id':'a'},{'id':'b'}], [], ['a','b'], ['b'], 'explicit', []), {'eligible': ['a'], 'checked': [], 'all': False, 'mixed': False, 'disabled': False, 'select_page': ['a'], 'clear_page': [], 'off_page': [], 'excluded': [], 'count': 0})

check('variant selected identity', solve([{'id':'a'},{'id':'b'+str(N)}], ['b'+str(N)], ['a','b'+str(N)], [], 'explicit', []), {'eligible':['a','b'+str(N)], 'checked':['b'+str(N)], 'all':False, 'mixed':True, 'disabled':False, 'select_page':['a','b'+str(N)], 'clear_page':[], 'off_page':[], 'excluded':[], 'count':1})
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 global exclusion count result violates the stipulated table row checkbox reconciliation contract.

Checkbox header state concerns enabled loaded page rows; explicit selections use stable row IDs and survive pagination, global select-all uses exclusions, stale IDs are removed, and empty eligible pages are disabled and unchecked.

split: open-access


prompt:
The table reverse row drag result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table reverse column drag result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table inclusive row end result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table inclusive column end result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table hidden selection row result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table hidden selection column result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table locked selected cell result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table top outline result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table bottom outline result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access


prompt:
The table left outline result violates the stipulated table rectangular selection projection contract.

A rectangular cell selection is inclusive on both axes and independent of drag direction; hidden rows and columns are omitted, locked cells remain selected but are not editable, and outline edges follow visible surviving cells.

split: open-access