FA-37971 / Table interactions / Open access
Table column auto-fit measurement: header measure policy · case 01
The table header measure policy result violates the stipulated table column auto-fit measurement contract.
ROOT CAUSE
The header measure policy decision uses 'if True:' instead of 'if include_header:'.
VERIFIED REPAIR
Apply the complete header measure policy rule: if include_header:.
Unsuccessful approach: The attempted repair 'if include_header and eligible:' still loses a required part of the table contract.
Case 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.
Why this case matters
An offline table UI model isolates table column auto-fit measurement, including adversarial row/column relationships.
1 / The failure
Exit 1"""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 True: 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| varied cell decorations | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 2, 'width': 21} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 2, 'width': 21} | Passed |
| hidden and unmeasured | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 6} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 6} | Passed |
| header wider | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 1, 'width': 15} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 1, 'width': 15} | Passed |
| header excluded | {'changed': True, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 32} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 4} | Failed |
| empty with header | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 0, 'width': 14} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 0, 'width': 14} | Passed |
| clipped sample | {'changed': False, 'clipped': True, 'header_used': False, 'samples': 1, 'width': 20} | {'changed': False, 'clipped': True, 'header_used': False, 'samples': 1, 'width': 20} | Passed |
| empty without header | {'changed': True, 'clipped': False, 'header_used': False, 'samples': 0, 'width': 10} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 0, 'width': 5} | Failed |
SHA-256 / d31667a0387db1d47ef2c2372491a1bb48bb8980139a1eb45f13886b74f6e385
2 / The unsuccessful fix
Exit 1"""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 and eligible: 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| varied cell decorations | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 2, 'width': 21} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 2, 'width': 21} | Passed |
| hidden and unmeasured | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 6} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 6} | Passed |
| header wider | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 1, 'width': 15} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 1, 'width': 15} | Passed |
| header excluded | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 4} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 4} | Passed |
| empty with header | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 0, 'width': 4} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 0, 'width': 14} | Failed |
| clipped sample | {'changed': False, 'clipped': True, 'header_used': False, 'samples': 1, 'width': 20} | {'changed': False, 'clipped': True, 'header_used': False, 'samples': 1, 'width': 20} | Passed |
| empty without header | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 0, 'width': 5} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 0, 'width': 5} | Passed |
SHA-256 / a1a1eea91cf4d441ad0008220e9c02a8e3ee3c34d80d0de59ac4ce0e8ec2a1a2
3 / The verified repair
Exit 0"""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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| varied cell decorations | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 2, 'width': 21} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 2, 'width': 21} | Passed |
| hidden and unmeasured | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 6} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 6} | Passed |
| header wider | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 1, 'width': 15} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 1, 'width': 15} | Passed |
| header excluded | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 4} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 1, 'width': 4} | Passed |
| empty with header | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 0, 'width': 14} | {'changed': True, 'clipped': False, 'header_used': True, 'samples': 0, 'width': 14} | Passed |
| clipped sample | {'changed': False, 'clipped': True, 'header_used': False, 'samples': 1, 'width': 20} | {'changed': False, 'clipped': True, 'header_used': False, 'samples': 1, 'width': 20} | Passed |
| empty without header | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 0, 'width': 5} | {'changed': False, 'clipped': False, 'header_used': False, 'samples': 0, 'width': 5} | Passed |
SHA-256 / db6fff2ef3683eba1c65be3774ffa033e6ff18a7152bc71b7806940d95ba4b6c
Verification & scope
Measurements, padding, and reserved decorations are nonnegative finite widths; minimum does not exceed maximum. Deterministic offline table UI model; no browser, DOM, framework, or standards conformance is claimed. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:43:06.482187+00:00.
Case digest / 8919a7bcb3e6eed5057a810f3757284ee73918bd57fb070f0ce886760e9cc64a