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

N = 1
observations = []
def solve(column, cells, header, padding, minimum, maximum, include_header, icons, current):
    eligible=[c for c in cells if c['column']==column and not c.get('hidden') and c.get('measured',True)]
    widths=[c['text_width']+c.get('indent',0)+c.get('icon_width',0) for c in eligible]
    if include_header: widths.append(header['text_width']+header.get('sort_width',0)+header.get('menu_width',0))
    content=max(widths,default=0)
    result=max(minimum,min(maximum,content+padding+icons))
    return {'width':result,'changed':result!=current,'samples':len(eligible),'header_used':include_header,'clipped':content+2*padding+icons>maximum}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':1+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 21, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 2:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':2+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 22, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 3:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':3+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 23, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 4:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':4+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 24, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 5:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':5+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 25, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

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(column, cells, header, padding, minimum, maximum, include_header, icons, current):
    eligible=[c for c in cells if c['column']==column and not c.get('hidden') and c.get('measured',True)]
    widths=[c['text_width']+c.get('indent',0)+c.get('icon_width',0) for c in eligible]
    if include_header: widths.append(header['text_width']+header.get('sort_width',0)+header.get('menu_width',0))
    content=max(widths,default=0)
    result=max(minimum,min(maximum,content+2*padding))
    return {'width':result,'changed':result!=current,'samples':len(eligible),'header_used':include_header,'clipped':content+2*padding+icons>maximum}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':1+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 21, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 2:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':2+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 22, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 3:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':3+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 23, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 4:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':4+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 24, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 5:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':5+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 25, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

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 two sided padding result violates the stipulated table column auto-fit measurement contract.

Auto-fit measures only this column’s visible measured cells, includes indentation and cell icons, optionally measures header text plus both controls, takes the widest content, adds two-sided padding and reserved icons, clamps bounds, and reports changes in either direction.

split: open-access


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

N = 1
observations = []
def solve(column, cells, header, padding, minimum, maximum, include_header, icons, current):
    eligible=[c for c in cells if c['column']==column and not c.get('hidden') and c.get('measured',True)]
    widths=[c['text_width']+c.get('indent',0)+c.get('icon_width',0) for c in eligible]
    if include_header: widths.append(header['text_width']+header.get('sort_width',0)+header.get('menu_width',0))
    content=max(widths,default=0)
    result=max(minimum,min(maximum,content+2*padding+icons))
    return {'width':result,'changed':True,'samples':len(eligible),'header_used':include_header,'clipped':content+2*padding+icons>maximum}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':1+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 21, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 2:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':2+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 22, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 3:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':3+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 23, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 4:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':4+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 24, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 5:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':5+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 25, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

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(column, cells, header, padding, minimum, maximum, include_header, icons, current):
    eligible=[c for c in cells if c['column']==column and not c.get('hidden') and c.get('measured',True)]
    widths=[c['text_width']+c.get('indent',0)+c.get('icon_width',0) for c in eligible]
    if include_header: widths.append(header['text_width']+header.get('sort_width',0)+header.get('menu_width',0))
    content=max(widths,default=0)
    result=max(minimum,min(maximum,content+2*padding+icons))
    return {'width':result,'changed':result>current,'samples':len(eligible),'header_used':include_header,'clipped':content+2*padding+icons>maximum}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':1+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 21, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 2:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':2+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 22, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 3:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':3+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 23, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 4:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':4+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 24, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

if N == 5:
    check('varied cell decorations', solve('amount', [{'column':'amount','text_width':5+8,'indent':3,'icon_width':4},{'column':'amount','text_width':7},{'column':'other','text_width':90}], {'text_width':5,'sort_width':3,'menu_width':2}, 2, 1, 100, True, 1, 30), {'width': 25, 'changed': True, 'samples': 2, 'header_used': True, 'clipped': False})
    check('hidden and unmeasured', solve('a', [{'column':'a','text_width':90,'hidden':True},{'column':'a','text_width':80,'measured':False},{'column':'a','text_width':4,'offscreen':True}], {'text_width':2}, 1, 1, 100, False, 0, 6), {'width': 6, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('header wider', solve('a', [{'column':'a','text_width':2}], {'text_width':8,'sort_width':3,'menu_width':2}, 1, 1, 100, True, 0, 1), {'width': 15, 'changed': True, 'samples': 1, 'header_used': True, 'clipped': False})
    check('header excluded', solve('a', [{'column':'a','text_width':2}], {'text_width':30}, 1, 1, 100, False, 0, 4), {'width': 4, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': False})
    check('empty with header', solve('a', [], {'text_width':10}, 2, 1, 100, True, 0, 1), {'width': 14, 'changed': True, 'samples': 0, 'header_used': True, 'clipped': False})
    check('clipped sample', solve('a', [{'column':'a','text_width':50}], {'text_width':2}, 2, 5, 20, False, 1, 20), {'width': 20, 'changed': False, 'samples': 1, 'header_used': False, 'clipped': True})
    check('empty without header', solve('a', [], {'text_width':10}, 0, 5, 20, False, 0, 5), {'width': 5, 'changed': False, 'samples': 0, 'header_used': False, 'clipped': False})

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 auto fit change event result violates the stipulated table column auto-fit measurement contract.

Auto-fit measures only this column’s visible measured cells, includes indentation and cell icons, optionally measures header text plus both controls, takes the widest content, adds two-sided padding and reserved icons, clamps bounds, and reports changes in either direction.

split: open-access


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

N = 1
observations = []
def solve(state, event, pointer, delta, widths, constraints, rtl, live):
    out=dict(state); current=dict(widths)
    if event=='start':
        out={'pointer':pointer,'column':state['column'],'base':state.get('base',0),'draft':widths[state['column']]}
        return {'state':out,'widths':current,'persist':None}
    if state.get('pointer')!=pointer: return {'state':out,'widths':current,'persist':None}
    c=state['column']; low,high=constraints[c]
    proposed=max(low,min(high,state['base']+(-delta if rtl else delta)))
    if event=='move':
        out['draft']=proposed
        if live: current[c]=proposed
        return {'state':out,'widths':current,'persist':None}
    if event=='cancel':
        current[c]=state['base']; return {'state':{},'widths':current,'persist':None}
    if event=='end':
        current[c]=proposed
        return {'state':{},'widths':current,'persist':(c,proposed) if proposed!=state['base'] else None}
    return {'state':out,'widths':current,'persist':None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*1,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 2:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*2,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 20, 'draft': 20}, 'widths': {'a': 20, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 3:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*3,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 30, 'draft': 30}, 'widths': {'a': 30, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 4:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*4,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 40, 'draft': 40}, 'widths': {'a': 40, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 5:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*5,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 50, 'draft': 50}, 'widths': {'a': 50, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

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(state, event, pointer, delta, widths, constraints, rtl, live):
    out=dict(state); current=dict(widths)
    if event=='start':
        out={'pointer':pointer,'column':state['column'],'base':state.get('draft',widths[state['column']]),'draft':widths[state['column']]}
        return {'state':out,'widths':current,'persist':None}
    if state.get('pointer')!=pointer: return {'state':out,'widths':current,'persist':None}
    c=state['column']; low,high=constraints[c]
    proposed=max(low,min(high,state['base']+(-delta if rtl else delta)))
    if event=='move':
        out['draft']=proposed
        if live: current[c]=proposed
        return {'state':out,'widths':current,'persist':None}
    if event=='cancel':
        current[c]=state['base']; return {'state':{},'widths':current,'persist':None}
    if event=='end':
        current[c]=proposed
        return {'state':{},'widths':current,'persist':(c,proposed) if proposed!=state['base'] else None}
    return {'state':out,'widths':current,'persist':None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*1,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 2:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*2,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 20, 'draft': 20}, 'widths': {'a': 20, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 3:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*3,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 30, 'draft': 30}, 'widths': {'a': 30, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 4:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*4,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 40, 'draft': 40}, 'widths': {'a': 40, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 5:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*5,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 50, 'draft': 50}, 'widths': {'a': 50, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

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 resize base snapshot result violates the stipulated table column resize transaction contract.

A table resize snapshots its starting width and pointer, applies cumulative drag displacement from that snapshot with RTL inversion and bounds, supports live/deferred drawing, rolls back cancel, commits the final pointer displacement, and persists only changed widths.

split: open-access


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

N = 1
observations = []
def solve(state, event, pointer, delta, widths, constraints, rtl, live):
    out=dict(state); current=dict(widths)
    if event=='start':
        out={'pointer':pointer,'column':state['column'],'base':widths[state['column']],'draft':widths[state['column']]}
        return {'state':out,'widths':current,'persist':None}
    if False: return {'state':out,'widths':current,'persist':None}
    c=state['column']; low,high=constraints[c]
    proposed=max(low,min(high,state['base']+(-delta if rtl else delta)))
    if event=='move':
        out['draft']=proposed
        if live: current[c]=proposed
        return {'state':out,'widths':current,'persist':None}
    if event=='cancel':
        current[c]=state['base']; return {'state':{},'widths':current,'persist':None}
    if event=='end':
        current[c]=proposed
        return {'state':{},'widths':current,'persist':(c,proposed) if proposed!=state['base'] else None}
    return {'state':out,'widths':current,'persist':None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*1,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 2:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*2,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 20, 'draft': 20}, 'widths': {'a': 20, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 3:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*3,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 30, 'draft': 30}, 'widths': {'a': 30, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 4:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*4,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 40, 'draft': 40}, 'widths': {'a': 40, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 5:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*5,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 50, 'draft': 50}, 'widths': {'a': 50, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

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(state, event, pointer, delta, widths, constraints, rtl, live):
    out=dict(state); current=dict(widths)
    if event=='start':
        out={'pointer':pointer,'column':state['column'],'base':widths[state['column']],'draft':widths[state['column']]}
        return {'state':out,'widths':current,'persist':None}
    if state.get('pointer') is None: return {'state':out,'widths':current,'persist':None}
    c=state['column']; low,high=constraints[c]
    proposed=max(low,min(high,state['base']+(-delta if rtl else delta)))
    if event=='move':
        out['draft']=proposed
        if live: current[c]=proposed
        return {'state':out,'widths':current,'persist':None}
    if event=='cancel':
        current[c]=state['base']; return {'state':{},'widths':current,'persist':None}
    if event=='end':
        current[c]=proposed
        return {'state':{},'widths':current,'persist':(c,proposed) if proposed!=state['base'] else None}
    return {'state':out,'widths':current,'persist':None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*1,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 2:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*2,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 20, 'draft': 20}, 'widths': {'a': 20, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 3:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*3,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 30, 'draft': 30}, 'widths': {'a': 30, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 4:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*4,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 40, 'draft': 40}, 'widths': {'a': 40, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

if N == 5:
    check('fresh drag snapshot', solve({'column':'a','base':1,'draft':2}, 'start', 7, 0, {'a':10*5,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 50, 'draft': 50}, 'widths': {'a': 50, 'b': 9}, 'persist': None})
    check('live move absolute delta', solve({'pointer':7,'column':'a','base':10,'draft':13}, 'move', 7, 5, {'a':13,'b':9}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 15}, 'widths': {'a': 15, 'b': 9}, 'persist': None})
    check('deferred rtl move', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'move', 7, 20, {'a':10}, {'a':(5,50)}, True, False), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 5}, 'widths': {'a': 10}, 'persist': None})
    check('other pointer', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 8, 20, {'a':10}, {'a':(5,50)}, False, True), {'state': {'pointer': 7, 'column': 'a', 'base': 10, 'draft': 10}, 'widths': {'a': 10}, 'persist': None})
    check('cancel live', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'cancel', 7, 5, {'a':15}, {'a':(5,50)}, False, True), {'state': {}, 'widths': {'a': 10}, 'persist': None})
    check('end latest delta', solve({'pointer':7,'column':'a','base':10,'draft':15}, 'end', 7, 70, {'a':15}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 50}, 'persist': ('a', 50)})
    check('end shrink', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, -2, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 8}, 'persist': ('a', 8)})
    check('noop end', solve({'pointer':7,'column':'a','base':10,'draft':10}, 'end', 7, 0, {'a':10}, {'a':(5,50)}, False, False), {'state': {}, 'widths': {'a': 10}, 'persist': None})

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 resize pointer owner result violates the stipulated table column resize transaction contract.

A table resize snapshots its starting width and pointer, applies cumulative drag displacement from that snapshot with RTL inversion and bounds, supports live/deferred drawing, rolls back cancel, commits the final pointer displacement, and persists only changed widths.

split: open-access