broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][:x['active_index']])
    r2 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)
    r3 = [row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]
    r4 = (len(pack(x['widths'],x['available']))-1)*x['row_height']
    r5 = [t for row in ([row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]) for t in row]
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = 0
    r2 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)
    r3 = [row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]
    r4 = (len(pack(x['widths'],x['available']))-1)*x['row_height']
    r5 = [t for row in ([row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]) for t in row]
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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 tab workspace reports an incorrect within row tab origin.

A multirow strip greedily packs indivisible tab widths with exact fits allowed. The active tab row is painted adjacent to content after other rows; tab identity and within-row coordinates follow this row permutation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][j] for j in next(row for row in pack(x['widths'],x['available']) if x['active_index'] in row) if j<x['active_index'])
    r2 = x['active_index']
    r3 = [row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]
    r4 = (len(pack(x['widths'],x['available']))-1)*x['row_height']
    r5 = [t for row in ([row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]) for t in row]
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][j] for j in next(row for row in pack(x['widths'],x['available']) if x['active_index'] in row) if j<x['active_index'])
    r2 = 0
    r3 = [row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]
    r4 = (len(pack(x['widths'],x['available']))-1)*x['row_height']
    r5 = [t for row in ([row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]) for t in row]
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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 tab workspace reports an incorrect active logical row.

A multirow strip greedily packs indivisible tab widths with exact fits allowed. The active tab row is painted adjacent to content after other rows; tab identity and within-row coordinates follow this row permutation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][j] for j in next(row for row in pack(x['widths'],x['available']) if x['active_index'] in row) if j<x['active_index'])
    r2 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)
    r3 = pack(x['widths'],x['available'])
    r4 = (len(pack(x['widths'],x['available']))-1)*x['row_height']
    r5 = [t for row in ([row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]) for t in row]
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][j] for j in next(row for row in pack(x['widths'],x['available']) if x['active_index'] in row) if j<x['active_index'])
    r2 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)
    r3 = list(reversed(pack(x['widths'],x['available'])))
    r4 = (len(pack(x['widths'],x['available']))-1)*x['row_height']
    r5 = [t for row in ([row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]) for t in row]
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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 tab workspace reports an incorrect active row adjacent content.

A multirow strip greedily packs indivisible tab widths with exact fits allowed. The active tab row is painted adjacent to content after other rows; tab identity and within-row coordinates follow this row permutation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][j] for j in next(row for row in pack(x['widths'],x['available']) if x['active_index'] in row) if j<x['active_index'])
    r2 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)
    r3 = [row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]
    r4 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)*x['row_height']
    r5 = [t for row in ([row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]) for t in row]
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][j] for j in next(row for row in pack(x['widths'],x['available']) if x['active_index'] in row) if j<x['active_index'])
    r2 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)
    r3 = [row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]
    r4 = len(pack(x['widths'],x['available']))*x['row_height']
    r5 = [t for row in ([row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]) for t in row]
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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 tab workspace reports an incorrect active row painted y.

A multirow strip greedily packs indivisible tab widths with exact fits allowed. The active tab row is painted adjacent to content after other rows; tab identity and within-row coordinates follow this row permutation.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][j] for j in next(row for row in pack(x['widths'],x['available']) if x['active_index'] in row) if j<x['active_index'])
    r2 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)
    r3 = [row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]
    r4 = (len(pack(x['widths'],x['available']))-1)*x['row_height']
    r5 = list(range(len(x['widths'])))
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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
def pack(widths, available):
    rows = [[]]
    occupied = 0
    for index, width in enumerate(widths):
        if rows[-1] and occupied + width > available:
            rows.append([])
            occupied = 0
        rows[-1].append(index)
        occupied += width
    return rows

N = 1
observations = []
def solve(x):
    r0 = pack(x['widths'],x['available'])
    r1 = sum(x['widths'][j] for j in next(row for row in pack(x['widths'],x['available']) if x['active_index'] in row) if j<x['active_index'])
    r2 = next(i for i,row in enumerate(pack(x['widths'],x['available'])) if x['active_index'] in row)
    r3 = [row for row in pack(x['widths'],x['available']) if x['active_index'] not in row]+[row for row in pack(x['widths'],x['available']) if x['active_index'] in row]
    r4 = (len(pack(x['widths'],x['available']))-1)*x['row_height']
    r5 = list(reversed(range(len(x['widths']))))
    return [r0,r1,r2,r3,r4,r5]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 80, 50, 100], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 0, 'row_height': 24}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 24, [2, 3, 0, 1]]), ({'widths': [80, 70, 90, 30], 'available': 160, 'active_index': 3, 'row_height': 24}, [[[0, 1], [2, 3]], 90, 1, [[0, 1], [2, 3]], 24, [0, 1, 2, 3]]), ({'widths': [80, 70, 90, 30], 'available': 300, 'active_index': 2, 'row_height': 24}, [[[0, 1, 2, 3]], 150, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [100, 70, 70, 90], 'available': 160, 'active_index': 2, 'row_height': 24}, [[[0], [1, 2], [3]], 70, 1, [[0], [3], [1, 2]], 48, [0, 3, 1, 2]])], 2: [({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 160, 100, 200], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 0, 'row_height': 48}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 48, [2, 3, 0, 1]]), ({'widths': [160, 140, 180, 60], 'available': 320, 'active_index': 3, 'row_height': 48}, [[[0, 1], [2, 3]], 180, 1, [[0, 1], [2, 3]], 48, [0, 1, 2, 3]]), ({'widths': [160, 140, 180, 60], 'available': 600, 'active_index': 2, 'row_height': 48}, [[[0, 1, 2, 3]], 300, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [200, 140, 140, 180], 'available': 320, 'active_index': 2, 'row_height': 48}, [[[0], [1, 2], [3]], 140, 1, [[0], [3], [1, 2]], 96, [0, 3, 1, 2]])], 3: [({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 240, 150, 300], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 0, 'row_height': 72}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 72, [2, 3, 0, 1]]), ({'widths': [240, 210, 270, 90], 'available': 480, 'active_index': 3, 'row_height': 72}, [[[0, 1], [2, 3]], 270, 1, [[0, 1], [2, 3]], 72, [0, 1, 2, 3]]), ({'widths': [240, 210, 270, 90], 'available': 900, 'active_index': 2, 'row_height': 72}, [[[0, 1, 2, 3]], 450, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [300, 210, 210, 270], 'available': 480, 'active_index': 2, 'row_height': 72}, [[[0], [1, 2], [3]], 210, 1, [[0], [3], [1, 2]], 144, [0, 3, 1, 2]])], 4: [({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 320, 200, 400], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 0, 'row_height': 96}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 96, [2, 3, 0, 1]]), ({'widths': [320, 280, 360, 120], 'available': 640, 'active_index': 3, 'row_height': 96}, [[[0, 1], [2, 3]], 360, 1, [[0, 1], [2, 3]], 96, [0, 1, 2, 3]]), ({'widths': [320, 280, 360, 120], 'available': 1200, 'active_index': 2, 'row_height': 96}, [[[0, 1, 2, 3]], 600, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [400, 280, 280, 360], 'available': 640, 'active_index': 2, 'row_height': 96}, [[[0], [1, 2], [3]], 280, 1, [[0], [3], [1, 2]], 192, [0, 3, 1, 2]])], 5: [({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 400, 250, 500], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 0, 'row_height': 120}, [[[0, 1], [2, 3]], 0, 0, [[2, 3], [0, 1]], 120, [2, 3, 0, 1]]), ({'widths': [400, 350, 450, 150], 'available': 800, 'active_index': 3, 'row_height': 120}, [[[0, 1], [2, 3]], 450, 1, [[0, 1], [2, 3]], 120, [0, 1, 2, 3]]), ({'widths': [400, 350, 450, 150], 'available': 1500, 'active_index': 2, 'row_height': 120}, [[[0, 1, 2, 3]], 750, 0, [[0, 1, 2, 3]], 0, [0, 1, 2, 3]]), ({'widths': [500, 350, 350, 450], 'available': 800, 'active_index': 2, 'row_height': 120}, [[[0], [1, 2], [3]], 350, 1, [[0], [3], [1, 2]], 240, [0, 3, 1, 2]])]}
for i, (inputs, expected) in enumerate(fixtures[N]):
    check("workspace regression "+str(i), solve(inputs), expected)
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 tab workspace reports an incorrect rowwise hit identity.

A multirow strip greedily packs indivisible tab widths with exact fits allowed. The active tab row is painted adjacent to content after other rows; tab identity and within-row coordinates follow this row permutation.

split: open-access


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

N = 1
observations = []
def solve(cols, order, hidden, widths, minimum, maximum, default):
    by_id = {c['id']: cols[0] for c in cols}
    ids = [c for c in order if c in by_id and c not in hidden]
    ids += [c['id'] for c in cols if c['id'] not in order and c['id'] not in hidden]
    resolved = {c: max(minimum.get(c, 0), min(maximum.get(c, 10000), widths.get(c, by_id[c].get('width', default)))) for c in ids}
    starts = {c: sum(resolved[x] for x in ids[:i]) for i,c in enumerate(ids)}
    return {'ids': ids, 'widths': resolved, 'starts': starts, 'total': sum(resolved.values()), 'resizable': [c for c in ids if by_id[c].get('resize', True)], 'handles': [c for c in ids[:-1] if by_id[c].get('resize', True)], 'last': ids[-1] if ids else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*1}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 12, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 12, 'c': 22}, 'total': 42, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 2:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*2}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 24, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 24, 'c': 34}, 'total': 54, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 3:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*3}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 36, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 36, 'c': 46}, 'total': 66, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 4:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*4}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 48, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 48, 'c': 58}, 'total': 78, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 5:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*5}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 60, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 60, 'c': 70}, 'total': 90, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

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(cols, order, hidden, widths, minimum, maximum, default):
    by_id = {c['id']: {'id':c['id']} for c in cols}
    ids = [c for c in order if c in by_id and c not in hidden]
    ids += [c['id'] for c in cols if c['id'] not in order and c['id'] not in hidden]
    resolved = {c: max(minimum.get(c, 0), min(maximum.get(c, 10000), widths.get(c, by_id[c].get('width', default)))) for c in ids}
    starts = {c: sum(resolved[x] for x in ids[:i]) for i,c in enumerate(ids)}
    return {'ids': ids, 'widths': resolved, 'starts': starts, 'total': sum(resolved.values()), 'resizable': [c for c in ids if by_id[c].get('resize', True)], 'handles': [c for c in ids[:-1] if by_id[c].get('resize', True)], 'last': ids[-1] if ids else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*1}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 12, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 12, 'c': 22}, 'total': 42, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 2:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*2}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 24, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 24, 'c': 34}, 'total': 54, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 3:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*3}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 36, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 36, 'c': 46}, 'total': 66, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 4:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*4}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 48, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 48, 'c': 58}, 'total': 78, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 5:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*5}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 60, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 60, 'c': 70}, 'total': 90, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

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 schema order result violates the stipulated column track resolution contract.

Resolve unique schema IDs in saved order then append unlisted visible columns; clamp widths to per-column bounds, keep explicit zero, compute prefix starts, omit a terminal resize handle, and use None for no terminal column.

split: open-access


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

N = 1
observations = []
def solve(cols, order, hidden, widths, minimum, maximum, default):
    by_id = {c['id']: c for c in cols}
    ids = [c for c in order if c in by_id]
    ids += [c['id'] for c in cols if c['id'] not in order and c['id'] not in hidden]
    resolved = {c: max(minimum.get(c, 0), min(maximum.get(c, 10000), widths.get(c, by_id[c].get('width', default)))) for c in ids}
    starts = {c: sum(resolved[x] for x in ids[:i]) for i,c in enumerate(ids)}
    return {'ids': ids, 'widths': resolved, 'starts': starts, 'total': sum(resolved.values()), 'resizable': [c for c in ids if by_id[c].get('resize', True)], 'handles': [c for c in ids[:-1] if by_id[c].get('resize', True)], 'last': ids[-1] if ids else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*1}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 12, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 12, 'c': 22}, 'total': 42, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 2:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*2}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 24, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 24, 'c': 34}, 'total': 54, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 3:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*3}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 36, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 36, 'c': 46}, 'total': 66, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 4:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*4}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 48, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 48, 'c': 58}, 'total': 78, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 5:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*5}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 60, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 60, 'c': 70}, 'total': 90, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

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(cols, order, hidden, widths, minimum, maximum, default):
    by_id = {c['id']: c for c in cols}
    ids = [c for c in order if c in by_id and c not in hidden[:1]]
    ids += [c['id'] for c in cols if c['id'] not in order and c['id'] not in hidden]
    resolved = {c: max(minimum.get(c, 0), min(maximum.get(c, 10000), widths.get(c, by_id[c].get('width', default)))) for c in ids}
    starts = {c: sum(resolved[x] for x in ids[:i]) for i,c in enumerate(ids)}
    return {'ids': ids, 'widths': resolved, 'starts': starts, 'total': sum(resolved.values()), 'resizable': [c for c in ids if by_id[c].get('resize', True)], 'handles': [c for c in ids[:-1] if by_id[c].get('resize', True)], 'last': ids[-1] if ids else None}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*1}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 12, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 12, 'c': 22}, 'total': 42, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 2:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*2}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 24, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 24, 'c': 34}, 'total': 54, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 3:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*3}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 36, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 36, 'c': 46}, 'total': 66, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 4:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*4}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 48, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 48, 'c': 58}, 'total': 78, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

if N == 5:
    check('mixed schema', solve([{'id':'a','width':8,'resize':False},{'id':'b'},{'id':'c','width':30}], ['b','gone','a'], [], {'b':12*5}, {'a':10}, {'c':20}, 7), {'ids': ['b', 'a', 'c'], 'widths': {'b': 60, 'a': 10, 'c': 20}, 'starts': {'b': 0, 'a': 60, 'c': 70}, 'total': 90, 'resizable': ['b', 'c'], 'handles': ['b'], 'last': 'c'})
    check('zero override', solve([{'id':'a','width':8},{'id':'b','width':9}], ['a','b'], [], {'a':0}, {}, {}, 5), {'ids': ['a', 'b'], 'widths': {'a': 0, 'b': 9}, 'starts': {'a': 0, 'b': 0}, 'total': 9, 'resizable': ['a', 'b'], 'handles': ['a'], 'last': 'b'})
    check('multiple hidden', solve([{'id':'a'},{'id':'b'},{'id':'c'},{'id':'d'}], ['a','b','c'], ['a','b','d'], {}, {}, {}, 6), {'ids': ['c'], 'widths': {'c': 6}, 'starts': {'c': 0}, 'total': 6, 'resizable': ['c'], 'handles': [], 'last': 'c'})
    check('empty table', solve([], [], [], {}, {}, {}, 5), {'ids': [], 'widths': {}, 'starts': {}, 'total': 0, 'resizable': [], 'handles': [], 'last': None})
    check('fixed singleton', solve([{'id':'x','resize':False}], ['x'], [], {}, {'x':11}, {'x':11}, 3), {'ids': ['x'], 'widths': {'x': 11}, 'starts': {'x': 0}, 'total': 11, 'resizable': [], 'handles': [], 'last': 'x'})
    check('default tracks', solve([{'id':'q'},{'id':'r'}], [], [], {}, {}, {}, 4), {'ids': ['q', 'r'], 'widths': {'q': 4, 'r': 4}, 'starts': {'q': 0, 'r': 4}, 'total': 8, 'resizable': ['q', 'r'], 'handles': ['q'], 'last': 'r'})

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 hidden track result violates the stipulated column track resolution contract.

Resolve unique schema IDs in saved order then append unlisted visible columns; clamp widths to per-column bounds, keep explicit zero, compute prefix starts, omit a terminal resize handle, and use None for no terminal column.

split: open-access