FAILURE MAP
← Case archive

FA-37536 / Table interactions / Open access

Table row height measurement cache: stale measurement prune · case 01

The table stale measurement prune result violates the stipulated table row height measurement cache contract.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The stale measurement prune decision uses 'if True' instead of 'if k in ids'.

VERIFIED REPAIR

Apply the complete stale measurement prune rule: if k in ids.

Unsuccessful approach: The attempted repair 'if k in ids[:1]' still loses a required part of the table contract.

Case contract

Measured row heights are keyed by stable row ID plus row-data generation and column-width fingerprint. Invalid measurements use an estimate, minimum applies before detail height, positions are ordered prefixes, and stale row measurements are pruned.

Why this case matters

An offline table UI model isolates table row height measurement cache, 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(rows, measurements, generation, width_key, minimum, estimate, details):
    heights={}
    for r in rows:
        k=r['id']; m=measurements.get(k)
        valid=m is not None and m['generation']==generation and m['width_key']==width_key
        h=m['height'] if valid else estimate
        heights[k]=max(minimum,h)+details.get(k,0)
    ids=[r['id'] for r in rows]
    offsets={k:sum(heights[x] for x in ids[:i]) for i,k in enumerate(ids)}
    return {'heights':heights,'offsets':offsets,'total':sum(heights.values()),'remeasure':[r['id'] for r in rows if r['id'] not in measurements or measurements[r['id']]['generation']!=generation or measurements[r['id']]['width_key']!=width_key],'retained':{k:v for k,v in measurements.items() if True}}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'total': 15, 'remeasure': [], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 2:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':2+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 8, 'b': 8}, 'offsets': {'a': 0, 'b': 8}, 'total': 16, 'remeasure': [], 'retained': {'a': {'height': 5, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 3:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':3+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 9, 'b': 8}, 'offsets': {'a': 0, 'b': 9}, 'total': 17, 'remeasure': [], 'retained': {'a': {'height': 6, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 4:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':4+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 10, 'b': 8}, 'offsets': {'a': 0, 'b': 10}, 'total': 18, 'remeasure': [], 'retained': {'a': {'height': 7, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 5:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':5+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 11, 'b': 8}, 'offsets': {'a': 0, 'b': 11}, 'total': 19, 'remeasure': [], 'retained': {'a': {'height': 8, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

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 fixtureActualExpectedOutcome
fresh variable rows{'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'w'}, 'b': {'generation': 2, 'height': 8, 'width_key': 'w'}}, 'total': 15}{'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'w'}, 'b': {'generation': 2, 'height': 8, 'width_key': 'w'}}, 'total': 15}Passed
stale generation{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 1, 'height': 4, 'width_key': 'w'}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 1, 'height': 4, 'width_key': 'w'}}, 'total': 10}Passed
changed widths{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'old'}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'old'}}, 'total': 10}Passed
typed width key{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 1}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 1}}, 'total': 10}Passed
zero and stale id{'heights': {'a': 0}, 'offsets': {'a': 0}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 0, 'width_key': 'w'}, 'gone': {'generation': 2, 'height': 7, 'width_key': 'w'}}, 'total': 0}{'heights': {'a': 0}, 'offsets': {'a': 0}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 0, 'width_key': 'w'}}, 'total': 0}Failed
minimum clamp{'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'remeasure': ['b'], 'retained': {'a': {'generation': 2, 'height': 1, 'width_key': 'w'}}, 'total': 15}{'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'remeasure': ['b'], 'retained': {'a': {'generation': 2, 'height': 1, 'width_key': 'w'}}, 'total': 15}Passed
empty{'heights': {}, 'offsets': {}, 'remeasure': [], 'retained': {}, 'total': 0}{'heights': {}, 'offsets': {}, 'remeasure': [], 'retained': {}, 'total': 0}Passed

SHA-256 / 7342d979a9092dc00a0d664c410648d022047e3a18b328ea3371e29a1bc4328f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, measurements, generation, width_key, minimum, estimate, details):
    heights={}
    for r in rows:
        k=r['id']; m=measurements.get(k)
        valid=m is not None and m['generation']==generation and m['width_key']==width_key
        h=m['height'] if valid else estimate
        heights[k]=max(minimum,h)+details.get(k,0)
    ids=[r['id'] for r in rows]
    offsets={k:sum(heights[x] for x in ids[:i]) for i,k in enumerate(ids)}
    return {'heights':heights,'offsets':offsets,'total':sum(heights.values()),'remeasure':[r['id'] for r in rows if r['id'] not in measurements or measurements[r['id']]['generation']!=generation or measurements[r['id']]['width_key']!=width_key],'retained':{k:v for k,v in measurements.items() if k in ids[:1]}}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'total': 15, 'remeasure': [], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 2:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':2+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 8, 'b': 8}, 'offsets': {'a': 0, 'b': 8}, 'total': 16, 'remeasure': [], 'retained': {'a': {'height': 5, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 3:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':3+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 9, 'b': 8}, 'offsets': {'a': 0, 'b': 9}, 'total': 17, 'remeasure': [], 'retained': {'a': {'height': 6, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 4:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':4+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 10, 'b': 8}, 'offsets': {'a': 0, 'b': 10}, 'total': 18, 'remeasure': [], 'retained': {'a': {'height': 7, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 5:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':5+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 11, 'b': 8}, 'offsets': {'a': 0, 'b': 11}, 'total': 19, 'remeasure': [], 'retained': {'a': {'height': 8, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

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 fixtureActualExpectedOutcome
fresh variable rows{'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'w'}}, 'total': 15}{'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'w'}, 'b': {'generation': 2, 'height': 8, 'width_key': 'w'}}, 'total': 15}Failed
stale generation{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 1, 'height': 4, 'width_key': 'w'}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 1, 'height': 4, 'width_key': 'w'}}, 'total': 10}Passed
changed widths{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'old'}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'old'}}, 'total': 10}Passed
typed width key{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 1}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 1}}, 'total': 10}Passed
zero and stale id{'heights': {'a': 0}, 'offsets': {'a': 0}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 0, 'width_key': 'w'}}, 'total': 0}{'heights': {'a': 0}, 'offsets': {'a': 0}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 0, 'width_key': 'w'}}, 'total': 0}Passed
minimum clamp{'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'remeasure': ['b'], 'retained': {'a': {'generation': 2, 'height': 1, 'width_key': 'w'}}, 'total': 15}{'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'remeasure': ['b'], 'retained': {'a': {'generation': 2, 'height': 1, 'width_key': 'w'}}, 'total': 15}Passed
empty{'heights': {}, 'offsets': {}, 'remeasure': [], 'retained': {}, 'total': 0}{'heights': {}, 'offsets': {}, 'remeasure': [], 'retained': {}, 'total': 0}Passed

SHA-256 / e0762b4a167a80ad07f48abc3abbd9372e9e76386615641ad3498a6a605db4a0

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows, measurements, generation, width_key, minimum, estimate, details):
    heights={}
    for r in rows:
        k=r['id']; m=measurements.get(k)
        valid=m is not None and m['generation']==generation and m['width_key']==width_key
        h=m['height'] if valid else estimate
        heights[k]=max(minimum,h)+details.get(k,0)
    ids=[r['id'] for r in rows]
    offsets={k:sum(heights[x] for x in ids[:i]) for i,k in enumerate(ids)}
    return {'heights':heights,'offsets':offsets,'total':sum(heights.values()),'remeasure':[r['id'] for r in rows if r['id'] not in measurements or measurements[r['id']]['generation']!=generation or measurements[r['id']]['width_key']!=width_key],'retained':{k:v for k,v in measurements.items() if k in ids}}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'total': 15, 'remeasure': [], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 2:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':2+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 8, 'b': 8}, 'offsets': {'a': 0, 'b': 8}, 'total': 16, 'remeasure': [], 'retained': {'a': {'height': 5, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 3:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':3+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 9, 'b': 8}, 'offsets': {'a': 0, 'b': 9}, 'total': 17, 'remeasure': [], 'retained': {'a': {'height': 6, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 4:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':4+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 10, 'b': 8}, 'offsets': {'a': 0, 'b': 10}, 'total': 18, 'remeasure': [], 'retained': {'a': {'height': 7, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

if N == 5:
    check('fresh variable rows', solve([{'id':'a'},{'id':'b'}], {'a':{'height':5+3,'generation':2,'width_key':'w'},'b':{'height':8,'generation':2,'width_key':'w'}}, 2, 'w', 2, 10, {'a':3}), {'heights': {'a': 11, 'b': 8}, 'offsets': {'a': 0, 'b': 11}, 'total': 19, 'remeasure': [], 'retained': {'a': {'height': 8, 'generation': 2, 'width_key': 'w'}, 'b': {'height': 8, 'generation': 2, 'width_key': 'w'}}})
    check('stale generation', solve([{'id':'a'}], {'a':{'height':4,'generation':1,'width_key':'w'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 1, 'width_key': 'w'}}})
    check('changed widths', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':'old'}}, 2, 'w', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 'old'}}})
    check('typed width key', solve([{'id':'a'}], {'a':{'height':4,'generation':2,'width_key':1}}, 2, '1', 2, 10, {}), {'heights': {'a': 10}, 'offsets': {'a': 0}, 'total': 10, 'remeasure': ['a'], 'retained': {'a': {'height': 4, 'generation': 2, 'width_key': 1}}})
    check('zero and stale id', solve([{'id':'a'}], {'a':{'height':0,'generation':2,'width_key':'w'},'gone':{'height':7,'generation':2,'width_key':'w'}}, 2, 'w', 0, 10, {}), {'heights': {'a': 0}, 'offsets': {'a': 0}, 'total': 0, 'remeasure': [], 'retained': {'a': {'height': 0, 'generation': 2, 'width_key': 'w'}}})
    check('minimum clamp', solve([{'id':'a'},{'id':'b'}], {'a':{'height':1,'generation':2,'width_key':'w'}}, 2, 'w', 3, 10, {'b':2}), {'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'total': 15, 'remeasure': ['b'], 'retained': {'a': {'height': 1, 'generation': 2, 'width_key': 'w'}}})
    check('empty', solve([], {}, 2, 'w', 3, 10, {}), {'heights': {}, 'offsets': {}, 'total': 0, 'remeasure': [], 'retained': {}})

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 fixtureActualExpectedOutcome
fresh variable rows{'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'w'}, 'b': {'generation': 2, 'height': 8, 'width_key': 'w'}}, 'total': 15}{'heights': {'a': 7, 'b': 8}, 'offsets': {'a': 0, 'b': 7}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'w'}, 'b': {'generation': 2, 'height': 8, 'width_key': 'w'}}, 'total': 15}Passed
stale generation{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 1, 'height': 4, 'width_key': 'w'}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 1, 'height': 4, 'width_key': 'w'}}, 'total': 10}Passed
changed widths{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'old'}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 'old'}}, 'total': 10}Passed
typed width key{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 1}}, 'total': 10}{'heights': {'a': 10}, 'offsets': {'a': 0}, 'remeasure': ['a'], 'retained': {'a': {'generation': 2, 'height': 4, 'width_key': 1}}, 'total': 10}Passed
zero and stale id{'heights': {'a': 0}, 'offsets': {'a': 0}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 0, 'width_key': 'w'}}, 'total': 0}{'heights': {'a': 0}, 'offsets': {'a': 0}, 'remeasure': [], 'retained': {'a': {'generation': 2, 'height': 0, 'width_key': 'w'}}, 'total': 0}Passed
minimum clamp{'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'remeasure': ['b'], 'retained': {'a': {'generation': 2, 'height': 1, 'width_key': 'w'}}, 'total': 15}{'heights': {'a': 3, 'b': 12}, 'offsets': {'a': 0, 'b': 3}, 'remeasure': ['b'], 'retained': {'a': {'generation': 2, 'height': 1, 'width_key': 'w'}}, 'total': 15}Passed
empty{'heights': {}, 'offsets': {}, 'remeasure': [], 'retained': {}, 'total': 0}{'heights': {}, 'offsets': {}, 'remeasure': [], 'retained': {}, 'total': 0}Passed

SHA-256 / e623acf945a82ebb3d87f3f64730a332051aee3b5ac066715f3a12bbb5de8524

Verification & scope

Row IDs are unique; estimates and minimum/detail heights are nonnegative; width fingerprints are scalar. 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:02.155506+00:00.

Case digest / 73d776131a28298ac76f5139f8a33907ef971c08a3956075b9911e67376e7145