FA-80061 / Typography line breaking / Open access
Box-glue-penalty breakpoints: overflow trigger · case 01
Lines that exactly fill the measure are broken early.
ROOT CAUSE
The overflow test uses >= width.
THE FAILURE
The overflow test uses >= width.
Unsuccessful approach: Allowing one extra unit produces overfull lines.
Case contract
Input [items, width]; items are ["b",w], ["g",w] or ["p",w,cost,flag]. Legal breaks: glue immediately after a box; penalty with cost < 10000 (width counted only if broken there); cost <= -10000 forces a break. Discardable glue/penalties at a line start are dropped. First-fit: when the running width exceeds the measure, break at the last legal breakpoint. Return [[line width, break kind]] with kinds glue/penalty/forced/end.
Why this case matters
Line breaking decides where paragraphs wrap on screen and in print; a wrong decision point shifts every following line.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
items, width = x
lines = []
start = 0
n = len(items)
while start < n:
while start < n and items[start][0] != 'b':
start += 1
if start >= n:
break
total = 0
last = None
result = None
i = start
while i < n:
it = items[i]
if it[0] == 'p':
if it[2] <= -10000:
result = (i, total + it[1], 'forced')
break
if it[2] < 10000:
last = (i, total + it[1], 'penalty')
elif it[0] == 'g':
if items[i - 1][0] == 'b':
last = (i, total, 'glue')
total += it[1]
else:
total += it[1]
if total >= width and last is not None:
result = last
break
i += 1
if result is None:
lines.append([total, 'end'])
break
lines.append([result[1], result[2]])
start = result[0] + 1
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: overflow trigger', [[['b', 2], ['g', 1], ['b', 6], ['g', 2], ['b', 4], ['p', 0, 9999, False], ['g', 1], ['b', 1], ['g', 1], ['b', 5], ['g', 2], ['b', 4], ['p', 0, 10000, False], ['g', 2], ['b', 1], ['p', 1, 50, True], ['g', 1]], 9], [[9, 'glue'], [6, 'glue'], [5, 'glue'], [8, 'end']]), ('regression: overflow trigger', [[['b', 5], ['p', 0, -10000, False], ['g', 1], ['b', 5], ['g', 2], ['b', 2], ['p', 1, 50, True], ['g', 2], ['b', 2], ['p', 0, 10000, False], ['g', 2], ['b', 7], ['g', 1], ['g', 1], ['b', 7], ['g', 1], ['b', 5], ['g', 1], ['b', 1], ['g', 1], ['b', 2], ['g', 1]], 7], [[5, 'forced'], [5, 'glue'], [3, 'penalty'], [11, 'glue'], [7, 'glue'], [7, 'glue'], [3, 'end']]), ('regression: overflow trigger', [[['b', 6], ['g', 1], ['b', 3], ['g', 1], ['b', 1], ['p', 1, 50, True], ['g', 2], ['b', 7], ['g', 1], ['b', 1], ['g', 1], ['b', 7], ['p', 0, -10000, False], ['g', 1], ['g', 1], ['b', 1], ['p', 1, 50, True], ['p', 1, 50, True], ['g', 1]], 9], [[6, 'glue'], [6, 'penalty'], [9, 'glue'], [7, 'forced'], [2, 'end']]), ('partial-repair probe', [[['b', 4], ['p', 0, -10000, False], ['g', 1], ['b', 4], ['g', 1], ['b', 4], ['g', 1], ['b', 5], ['p', 1, 50, True], ['g', 2], ['b', 2], ['p', 1, 50, True], ['g', 1], ['b', 2], ['p', 0, 10000, False], ['g', 1], ['b', 7], ['p', 1, 50, True], ['g', 1], ['b', 7], ['p', 0, 9999, False], ['g', 1], ['b', 2], ['g', 2]], 8], [[4, 'forced'], [4, 'glue'], [4, 'glue'], [6, 'penalty'], [3, 'penalty'], [11, 'penalty'], [7, 'penalty'], [4, 'end']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('inhibited penalty', [[['b', 5], ['p', 0, 10000, False], ['b', 4], ['g', 1], ['b', 3]], 7], [[9, 'glue'], [3, 'end']]), ('control layout', [[['b', 2], ['g', 2], ['b', 2], ['g', 1], ['b', 3], ['g', 2], ['b', 7], ['p', 0, 9999, False], ['g', 1], ['b', 6], ['p', 1, 50, True], ['g', 2], ['b', 3], ['p', 0, 10000, False], ['g', 2], ['b', 4], ['p', 1, 50, True], ['g', 1], ['b', 7], ['g', 1], ['g', 1], ['b', 2], ['p', 0, 900, False], ['p', 1, 50, True], ['g', 1]], 15], [[10, 'glue'], [15, 'penalty'], [10, 'penalty'], [12, 'end']]), ('control layout', [[['b', 7], ['g', 2], ['b', 7], ['p', 0, 9999, False], ['g', 1], ['b', 5], ['g', 1], ['b', 7], ['g', 2], ['b', 5], ['g', 2], ['b', 1], ['p', 0, 900, False], ['g', 2], ['b', 3], ['p', 1, 50, True], ['g', 2]], 10], [[7, 'glue'], [7, 'penalty'], [5, 'glue'], [7, 'glue'], [8, 'penalty'], [5, 'end']])], [('regression: overflow trigger', [[['b', 1], ['g', 1], ['b', 5], ['g', 2], ['b', 4], ['g', 1], ['b', 6], ['g', 1], ['b', 1], ['p', 0, -10000, False], ['g', 1], ['b', 4], ['g', 2], ['b', 1], ['g', 1], ['b', 4], ['p', 0, 9999, False], ['g', 2], ['b', 6], ['p', 0, -5000, False], ['g', 1], ['g', 1], ['b', 3], ['p', 1, 50, True], ['g', 2]], 7], [[7, 'glue'], [4, 'glue'], [6, 'glue'], [1, 'forced'], [7, 'glue'], [4, 'penalty'], [6, 'penalty'], [5, 'end']]), ('regression: overflow trigger', [[['b', 5], ['p', 1, 50, True], ['g', 1], ['b', 5], ['g', 2], ['b', 2], ['g', 1], ['b', 2], ['g', 2], ['b', 5], ['p', 1, 50, True], ['g', 1], ['b', 6], ['p', 0, -10000, False], ['g', 1], ['b', 4], ['g', 1], ['g', 1], ['b', 4], ['g', 1], ['b', 6], ['g', 1], ['g', 1]], 8], [[6, 'penalty'], [5, 'glue'], [5, 'glue'], [6, 'penalty'], [6, 'forced'], [4, 'glue'], [4, 'glue'], [8, 'end']]), ('partial-repair probe', [[['b', 1], ['g', 2], ['b', 5], ['p', 1, 50, True], ['g', 2], ['b', 6], ['p', 1, 50, True], ['g', 1], ['b', 7], ['p', 1, 50, True], ['g', 1], ['b', 2], ['g', 1], ['b', 2], ['g', 2], ['b', 4], ['g', 2]], 12], [[9, 'penalty'], [7, 'penalty'], [10, 'glue'], [10, 'end']]), ('regression: overflow trigger', [[['b', 6], ['p', 1, 50, True], ['g', 1], ['g', 1], ['b', 6], ['p', 0, 10000, False], ['g', 1], ['b', 2], ['p', 0, -10000, False], ['g', 2], ['b', 1], ['p', 0, 10000, False], ['g', 2], ['b', 7], ['g', 2], ['b', 1], ['p', 0, -10000, False], ['g', 1], ['b', 3], ['g', 2], ['b', 2], ['p', 0, 900, False], ['g', 2], ['b', 1], ['p', 1, 50, True], ['g', 1], ['b', 6], ['g', 2]], 7], [[7, 'penalty'], [9, 'forced'], [10, 'glue'], [1, 'forced'], [7, 'penalty'], [2, 'penalty'], [6, 'glue']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('inhibited penalty', [[['b', 5], ['p', 0, 10000, False], ['b', 4], ['g', 1], ['b', 3]], 7], [[9, 'glue'], [3, 'end']]), ('control layout', [[['b', 4], ['g', 2], ['b', 4], ['g', 2], ['b', 3], ['p', 0, -10000, False], ['g', 1], ['g', 1], ['b', 6], ['p', 1, 50, True], ['g', 2], ['b', 1], ['g', 2], ['b', 2], ['p', 0, -10000, False], ['g', 2], ['b', 5], ['g', 2], ['b', 2], ['p', 0, 10000, False], ['g', 1], ['b', 3], ['p', 1, 50, True], ['g', 2], ['b', 3], ['p', 0, 10000, False], ['g', 2]], 18], [[15, 'forced'], [13, 'forced'], [14, 'penalty'], [5, 'end']]), ('control layout', [[['b', 3], ['g', 2], ['b', 5], ['g', 2], ['b', 2], ['g', 1], ['b', 7], ['g', 1], ['b', 7], ['g', 2], ['b', 2], ['g', 1], ['g', 1], ['b', 7], ['p', 1, 50, True], ['g', 1]], 16], [[14, 'glue'], [15, 'glue'], [12, 'end']])], [('regression: overflow trigger', [[['b', 2], ['g', 1], ['b', 4], ['g', 2], ['b', 1], ['p', 1, 50, True], ['g', 1], ['b', 6], ['g', 2], ['b', 6], ['g', 1], ['b', 7], ['g', 2], ['b', 6], ['g', 1]], 16], [[11, 'penalty'], [14, 'glue'], [16, 'end']]), ('regression: overflow trigger', [[['b', 5], ['p', 1, 50, True], ['g', 2], ['b', 3], ['g', 1], ['b', 2], ['g', 2], ['b', 5], ['g', 1], ['b', 2], ['g', 2], ['b', 7], ['g', 1], ['g', 1]], 17], [[13, 'glue'], [17, 'glue']]), ('partial-repair probe', [[['b', 5], ['p', 0, -5000, False], ['g', 2], ['b', 7], ['g', 2], ['b', 4], ['p', 1, 50, True], ['g', 1], ['g', 1], ['b', 5], ['g', 1], ['b', 7], ['g', 2], ['b', 6], ['p', 1, 50, True], ['g', 1]], 12], [[5, 'penalty'], [7, 'glue'], [11, 'glue'], [7, 'glue'], [7, 'end']]), ('partial-repair probe', [[['b', 2], ['g', 1], ['b', 3], ['p', 1, 50, True], ['g', 1], ['b', 6], ['p', 0, 900, False], ['g', 1], ['b', 7], ['g', 1], ['b', 7], ['g', 1]], 7], [[7, 'penalty'], [6, 'penalty'], [7, 'glue'], [7, 'glue']]), ('inhibited penalty', [[['b', 5], ['p', 0, 10000, False], ['b', 4], ['g', 1], ['b', 3]], 7], [[9, 'glue'], [3, 'end']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('control layout', [[['b', 4], ['g', 1], ['b', 5], ['g', 1], ['b', 4], ['g', 1], ['b', 2], ['g', 2], ['b', 2], ['g', 1], ['b', 5], ['g', 1]], 12], [[10, 'glue'], [11, 'glue'], [6, 'end']]), ('control layout', [[['b', 6], ['g', 1], ['g', 1], ['b', 4], ['g', 1], ['b', 5], ['p', 0, -10000, False], ['g', 1], ['b', 4], ['p', 1, 50, True], ['g', 1], ['b', 1], ['p', 1, 50, True], ['g', 2]], 14], [[12, 'glue'], [5, 'forced'], [8, 'end']])], [('regression: overflow trigger', [[['b', 5], ['g', 1], ['g', 1], ['b', 4], ['g', 1], ['b', 3], ['p', 0, -5000, False], ['g', 2], ['b', 4], ['p', 1, 50, True], ['g', 1], ['b', 4], ['g', 2], ['b', 5], ['g', 2]], 11], [[11, 'glue'], [10, 'penalty'], [11, 'glue']]), ('regression: overflow trigger', [[['b', 2], ['g', 1], ['b', 6], ['g', 1], ['b', 1], ['g', 1], ['b', 5], ['g', 2], ['b', 4], ['p', 1, 50, True], ['g', 2], ['b', 7], ['p', 1, 50, True], ['g', 1], ['b', 4], ['g', 1]], 8], [[2, 'glue'], [8, 'glue'], [5, 'glue'], [5, 'penalty'], [8, 'penalty'], [5, 'end']]), ('regression: overflow trigger', [[['b', 2], ['g', 1], ['b', 4], ['g', 2], ['b', 1], ['p', 1, 50, True], ['g', 1], ['b', 6], ['g', 2], ['b', 6], ['g', 1], ['b', 7], ['g', 2], ['b', 6], ['g', 1]], 16], [[11, 'penalty'], [14, 'glue'], [16, 'end']]), ('partial-repair probe', [[['b', 3], ['g', 1], ['b', 6], ['g', 1], ['b', 7], ['g', 1], ['b', 6], ['p', 1, 50, True], ['g', 1], ['b', 5], ['p', 1, 50, True], ['g', 1], ['b', 2], ['g', 2], ['b', 3], ['g', 1], ['g', 1]], 17], [[10, 'glue'], [15, 'penalty'], [15, 'end']]), ('forced break', [[['b', 2], ['g', 1], ['b', 2], ['p', 0, -10000, False], ['b', 3]], 20], [[5, 'forced'], [3, 'end']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('control layout', [[['b', 4], ['p', 1, 50, True], ['g', 2], ['b', 1], ['g', 1], ['g', 1], ['b', 6], ['g', 1], ['b', 1], ['p', 0, -10000, False], ['g', 1], ['b', 7], ['g', 2], ['b', 5], ['g', 1]], 10], [[7, 'glue'], [8, 'forced'], [7, 'glue'], [6, 'end']]), ('control layout', [[['b', 2], ['p', 1, 50, True], ['g', 1], ['b', 5], ['g', 2], ['b', 6], ['g', 2], ['b', 6], ['g', 1], ['b', 1], ['g', 1], ['b', 1], ['p', 1, 50, True], ['g', 1]], 17], [[16, 'glue'], [11, 'end']])], [('regression: overflow trigger', [[['b', 6], ['g', 2], ['b', 3], ['p', 1, 50, True], ['g', 2], ['b', 4], ['g', 2], ['b', 6], ['g', 1], ['b', 7], ['g', 1]], 12], [[12, 'penalty'], [12, 'glue'], [8, 'end']]), ('regression: overflow trigger', [[['b', 3], ['g', 1], ['b', 6], ['g', 1], ['b', 1], ['g', 2], ['b', 3], ['p', 1, 50, True], ['g', 1], ['b', 3], ['g', 1]], 8], [[3, 'glue'], [8, 'glue'], [8, 'end']]), ('regression: overflow trigger', [[['b', 3], ['p', 0, 10000, False], ['g', 2], ['b', 6], ['g', 1], ['b', 7], ['g', 1], ['b', 1], ['p', 1, 50, True], ['g', 1]], 9], [[11, 'glue'], [10, 'penalty']]), ('regression: overflow trigger', [[['b', 6], ['g', 1], ['b', 6], ['g', 2], ['b', 3], ['p', 0, 10000, False], ['g', 1], ['g', 1], ['b', 1], ['p', 0, 10000, False], ['g', 2], ['b', 4], ['g', 1], ['b', 2], ['g', 2], ['b', 5], ['g', 1], ['b', 2], ['g', 1], ['g', 1]], 13], [[13, 'glue'], [12, 'glue'], [12, 'glue']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('forced break', [[['b', 2], ['g', 1], ['b', 2], ['p', 0, -10000, False], ['b', 3]], 20], [[5, 'forced'], [3, 'end']]), ('control layout', [[['b', 3], ['g', 2], ['b', 3], ['g', 1], ['g', 1], ['b', 3], ['p', 0, 10000, False], ['g', 2], ['b', 1], ['g', 1], ['b', 3], ['g', 1]], 14], [[8, 'glue'], [11, 'end']]), ('control layout', [[['b', 7], ['g', 2], ['b', 7], ['g', 1], ['b', 7], ['g', 1], ['b', 1], ['p', 0, 10000, False], ['g', 1], ['b', 6], ['g', 2], ['b', 7], ['p', 1, 50, True], ['g', 2]], 10], [[7, 'glue'], [7, 'glue'], [7, 'glue'], [8, 'glue'], [9, 'end']])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(args), 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: overflow trigger | [[2, 'glue'], [6, 'glue'], [6, 'glue'], [5, 'glue'], [8, 'end']] | [[9, 'glue'], [6, 'glue'], [5, 'glue'], [8, 'end']] | Failed |
| regression: overflow trigger | [[5, 'forced'], [5, 'glue'], [3, 'penalty'], [11, 'glue'], [7, 'glue'], [5, 'glue'], [5, 'end']] | [[5, 'forced'], [5, 'glue'], [3, 'penalty'], [11, 'glue'], [7, 'glue'], [7, 'glue'], [3, 'end']] | Failed |
| regression: overflow trigger | [[6, 'glue'], [6, 'penalty'], [7, 'glue'], [1, 'glue'], [7, 'forced'], [2, 'end']] | [[6, 'glue'], [6, 'penalty'], [9, 'glue'], [7, 'forced'], [2, 'end']] | Failed |
| partial-repair probe | [[4, 'forced'], [4, 'glue'], [4, 'glue'], [6, 'penalty'], [3, 'penalty'], [11, 'penalty'], [7, 'penalty'], [4, 'end']] | [[4, 'forced'], [4, 'glue'], [4, 'glue'], [6, 'penalty'], [3, 'penalty'], [11, 'penalty'], [7, 'penalty'], [4, 'end']] | Passed |
| hyphen penalty taken | [[6, 'penalty'], [4, 'glue'], [3, 'end']] | [[6, 'penalty'], [4, 'glue'], [3, 'end']] | Passed |
| inhibited penalty | [[9, 'glue'], [3, 'end']] | [[9, 'glue'], [3, 'end']] | Passed |
| control layout | [[10, 'glue'], [15, 'penalty'], [10, 'penalty'], [12, 'end']] | [[10, 'glue'], [15, 'penalty'], [10, 'penalty'], [12, 'end']] | Passed |
| control layout | [[7, 'glue'], [7, 'penalty'], [5, 'glue'], [7, 'glue'], [8, 'penalty'], [5, 'end']] | [[7, 'glue'], [7, 'penalty'], [5, 'glue'], [7, 'glue'], [8, 'penalty'], [5, 'end']] | Passed |
SHA-256 / 2a2a9c058d4ef12af05c8b33abf6f00d6d515c44eb229150447ce2d66bae04ca
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
items, width = x
lines = []
start = 0
n = len(items)
while start < n:
while start < n and items[start][0] != 'b':
start += 1
if start >= n:
break
total = 0
last = None
result = None
i = start
while i < n:
it = items[i]
if it[0] == 'p':
if it[2] <= -10000:
result = (i, total + it[1], 'forced')
break
if it[2] < 10000:
last = (i, total + it[1], 'penalty')
elif it[0] == 'g':
if items[i - 1][0] == 'b':
last = (i, total, 'glue')
total += it[1]
else:
total += it[1]
if total > width + 1 and last is not None:
result = last
break
i += 1
if result is None:
lines.append([total, 'end'])
break
lines.append([result[1], result[2]])
start = result[0] + 1
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: overflow trigger', [[['b', 2], ['g', 1], ['b', 6], ['g', 2], ['b', 4], ['p', 0, 9999, False], ['g', 1], ['b', 1], ['g', 1], ['b', 5], ['g', 2], ['b', 4], ['p', 0, 10000, False], ['g', 2], ['b', 1], ['p', 1, 50, True], ['g', 1]], 9], [[9, 'glue'], [6, 'glue'], [5, 'glue'], [8, 'end']]), ('regression: overflow trigger', [[['b', 5], ['p', 0, -10000, False], ['g', 1], ['b', 5], ['g', 2], ['b', 2], ['p', 1, 50, True], ['g', 2], ['b', 2], ['p', 0, 10000, False], ['g', 2], ['b', 7], ['g', 1], ['g', 1], ['b', 7], ['g', 1], ['b', 5], ['g', 1], ['b', 1], ['g', 1], ['b', 2], ['g', 1]], 7], [[5, 'forced'], [5, 'glue'], [3, 'penalty'], [11, 'glue'], [7, 'glue'], [7, 'glue'], [3, 'end']]), ('regression: overflow trigger', [[['b', 6], ['g', 1], ['b', 3], ['g', 1], ['b', 1], ['p', 1, 50, True], ['g', 2], ['b', 7], ['g', 1], ['b', 1], ['g', 1], ['b', 7], ['p', 0, -10000, False], ['g', 1], ['g', 1], ['b', 1], ['p', 1, 50, True], ['p', 1, 50, True], ['g', 1]], 9], [[6, 'glue'], [6, 'penalty'], [9, 'glue'], [7, 'forced'], [2, 'end']]), ('partial-repair probe', [[['b', 4], ['p', 0, -10000, False], ['g', 1], ['b', 4], ['g', 1], ['b', 4], ['g', 1], ['b', 5], ['p', 1, 50, True], ['g', 2], ['b', 2], ['p', 1, 50, True], ['g', 1], ['b', 2], ['p', 0, 10000, False], ['g', 1], ['b', 7], ['p', 1, 50, True], ['g', 1], ['b', 7], ['p', 0, 9999, False], ['g', 1], ['b', 2], ['g', 2]], 8], [[4, 'forced'], [4, 'glue'], [4, 'glue'], [6, 'penalty'], [3, 'penalty'], [11, 'penalty'], [7, 'penalty'], [4, 'end']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('inhibited penalty', [[['b', 5], ['p', 0, 10000, False], ['b', 4], ['g', 1], ['b', 3]], 7], [[9, 'glue'], [3, 'end']]), ('control layout', [[['b', 2], ['g', 2], ['b', 2], ['g', 1], ['b', 3], ['g', 2], ['b', 7], ['p', 0, 9999, False], ['g', 1], ['b', 6], ['p', 1, 50, True], ['g', 2], ['b', 3], ['p', 0, 10000, False], ['g', 2], ['b', 4], ['p', 1, 50, True], ['g', 1], ['b', 7], ['g', 1], ['g', 1], ['b', 2], ['p', 0, 900, False], ['p', 1, 50, True], ['g', 1]], 15], [[10, 'glue'], [15, 'penalty'], [10, 'penalty'], [12, 'end']]), ('control layout', [[['b', 7], ['g', 2], ['b', 7], ['p', 0, 9999, False], ['g', 1], ['b', 5], ['g', 1], ['b', 7], ['g', 2], ['b', 5], ['g', 2], ['b', 1], ['p', 0, 900, False], ['g', 2], ['b', 3], ['p', 1, 50, True], ['g', 2]], 10], [[7, 'glue'], [7, 'penalty'], [5, 'glue'], [7, 'glue'], [8, 'penalty'], [5, 'end']])], [('regression: overflow trigger', [[['b', 1], ['g', 1], ['b', 5], ['g', 2], ['b', 4], ['g', 1], ['b', 6], ['g', 1], ['b', 1], ['p', 0, -10000, False], ['g', 1], ['b', 4], ['g', 2], ['b', 1], ['g', 1], ['b', 4], ['p', 0, 9999, False], ['g', 2], ['b', 6], ['p', 0, -5000, False], ['g', 1], ['g', 1], ['b', 3], ['p', 1, 50, True], ['g', 2]], 7], [[7, 'glue'], [4, 'glue'], [6, 'glue'], [1, 'forced'], [7, 'glue'], [4, 'penalty'], [6, 'penalty'], [5, 'end']]), ('regression: overflow trigger', [[['b', 5], ['p', 1, 50, True], ['g', 1], ['b', 5], ['g', 2], ['b', 2], ['g', 1], ['b', 2], ['g', 2], ['b', 5], ['p', 1, 50, True], ['g', 1], ['b', 6], ['p', 0, -10000, False], ['g', 1], ['b', 4], ['g', 1], ['g', 1], ['b', 4], ['g', 1], ['b', 6], ['g', 1], ['g', 1]], 8], [[6, 'penalty'], [5, 'glue'], [5, 'glue'], [6, 'penalty'], [6, 'forced'], [4, 'glue'], [4, 'glue'], [8, 'end']]), ('partial-repair probe', [[['b', 1], ['g', 2], ['b', 5], ['p', 1, 50, True], ['g', 2], ['b', 6], ['p', 1, 50, True], ['g', 1], ['b', 7], ['p', 1, 50, True], ['g', 1], ['b', 2], ['g', 1], ['b', 2], ['g', 2], ['b', 4], ['g', 2]], 12], [[9, 'penalty'], [7, 'penalty'], [10, 'glue'], [10, 'end']]), ('regression: overflow trigger', [[['b', 6], ['p', 1, 50, True], ['g', 1], ['g', 1], ['b', 6], ['p', 0, 10000, False], ['g', 1], ['b', 2], ['p', 0, -10000, False], ['g', 2], ['b', 1], ['p', 0, 10000, False], ['g', 2], ['b', 7], ['g', 2], ['b', 1], ['p', 0, -10000, False], ['g', 1], ['b', 3], ['g', 2], ['b', 2], ['p', 0, 900, False], ['g', 2], ['b', 1], ['p', 1, 50, True], ['g', 1], ['b', 6], ['g', 2]], 7], [[7, 'penalty'], [9, 'forced'], [10, 'glue'], [1, 'forced'], [7, 'penalty'], [2, 'penalty'], [6, 'glue']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('inhibited penalty', [[['b', 5], ['p', 0, 10000, False], ['b', 4], ['g', 1], ['b', 3]], 7], [[9, 'glue'], [3, 'end']]), ('control layout', [[['b', 4], ['g', 2], ['b', 4], ['g', 2], ['b', 3], ['p', 0, -10000, False], ['g', 1], ['g', 1], ['b', 6], ['p', 1, 50, True], ['g', 2], ['b', 1], ['g', 2], ['b', 2], ['p', 0, -10000, False], ['g', 2], ['b', 5], ['g', 2], ['b', 2], ['p', 0, 10000, False], ['g', 1], ['b', 3], ['p', 1, 50, True], ['g', 2], ['b', 3], ['p', 0, 10000, False], ['g', 2]], 18], [[15, 'forced'], [13, 'forced'], [14, 'penalty'], [5, 'end']]), ('control layout', [[['b', 3], ['g', 2], ['b', 5], ['g', 2], ['b', 2], ['g', 1], ['b', 7], ['g', 1], ['b', 7], ['g', 2], ['b', 2], ['g', 1], ['g', 1], ['b', 7], ['p', 1, 50, True], ['g', 1]], 16], [[14, 'glue'], [15, 'glue'], [12, 'end']])], [('regression: overflow trigger', [[['b', 2], ['g', 1], ['b', 4], ['g', 2], ['b', 1], ['p', 1, 50, True], ['g', 1], ['b', 6], ['g', 2], ['b', 6], ['g', 1], ['b', 7], ['g', 2], ['b', 6], ['g', 1]], 16], [[11, 'penalty'], [14, 'glue'], [16, 'end']]), ('regression: overflow trigger', [[['b', 5], ['p', 1, 50, True], ['g', 2], ['b', 3], ['g', 1], ['b', 2], ['g', 2], ['b', 5], ['g', 1], ['b', 2], ['g', 2], ['b', 7], ['g', 1], ['g', 1]], 17], [[13, 'glue'], [17, 'glue']]), ('partial-repair probe', [[['b', 5], ['p', 0, -5000, False], ['g', 2], ['b', 7], ['g', 2], ['b', 4], ['p', 1, 50, True], ['g', 1], ['g', 1], ['b', 5], ['g', 1], ['b', 7], ['g', 2], ['b', 6], ['p', 1, 50, True], ['g', 1]], 12], [[5, 'penalty'], [7, 'glue'], [11, 'glue'], [7, 'glue'], [7, 'end']]), ('partial-repair probe', [[['b', 2], ['g', 1], ['b', 3], ['p', 1, 50, True], ['g', 1], ['b', 6], ['p', 0, 900, False], ['g', 1], ['b', 7], ['g', 1], ['b', 7], ['g', 1]], 7], [[7, 'penalty'], [6, 'penalty'], [7, 'glue'], [7, 'glue']]), ('inhibited penalty', [[['b', 5], ['p', 0, 10000, False], ['b', 4], ['g', 1], ['b', 3]], 7], [[9, 'glue'], [3, 'end']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('control layout', [[['b', 4], ['g', 1], ['b', 5], ['g', 1], ['b', 4], ['g', 1], ['b', 2], ['g', 2], ['b', 2], ['g', 1], ['b', 5], ['g', 1]], 12], [[10, 'glue'], [11, 'glue'], [6, 'end']]), ('control layout', [[['b', 6], ['g', 1], ['g', 1], ['b', 4], ['g', 1], ['b', 5], ['p', 0, -10000, False], ['g', 1], ['b', 4], ['p', 1, 50, True], ['g', 1], ['b', 1], ['p', 1, 50, True], ['g', 2]], 14], [[12, 'glue'], [5, 'forced'], [8, 'end']])], [('regression: overflow trigger', [[['b', 5], ['g', 1], ['g', 1], ['b', 4], ['g', 1], ['b', 3], ['p', 0, -5000, False], ['g', 2], ['b', 4], ['p', 1, 50, True], ['g', 1], ['b', 4], ['g', 2], ['b', 5], ['g', 2]], 11], [[11, 'glue'], [10, 'penalty'], [11, 'glue']]), ('regression: overflow trigger', [[['b', 2], ['g', 1], ['b', 6], ['g', 1], ['b', 1], ['g', 1], ['b', 5], ['g', 2], ['b', 4], ['p', 1, 50, True], ['g', 2], ['b', 7], ['p', 1, 50, True], ['g', 1], ['b', 4], ['g', 1]], 8], [[2, 'glue'], [8, 'glue'], [5, 'glue'], [5, 'penalty'], [8, 'penalty'], [5, 'end']]), ('regression: overflow trigger', [[['b', 2], ['g', 1], ['b', 4], ['g', 2], ['b', 1], ['p', 1, 50, True], ['g', 1], ['b', 6], ['g', 2], ['b', 6], ['g', 1], ['b', 7], ['g', 2], ['b', 6], ['g', 1]], 16], [[11, 'penalty'], [14, 'glue'], [16, 'end']]), ('partial-repair probe', [[['b', 3], ['g', 1], ['b', 6], ['g', 1], ['b', 7], ['g', 1], ['b', 6], ['p', 1, 50, True], ['g', 1], ['b', 5], ['p', 1, 50, True], ['g', 1], ['b', 2], ['g', 2], ['b', 3], ['g', 1], ['g', 1]], 17], [[10, 'glue'], [15, 'penalty'], [15, 'end']]), ('forced break', [[['b', 2], ['g', 1], ['b', 2], ['p', 0, -10000, False], ['b', 3]], 20], [[5, 'forced'], [3, 'end']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('control layout', [[['b', 4], ['p', 1, 50, True], ['g', 2], ['b', 1], ['g', 1], ['g', 1], ['b', 6], ['g', 1], ['b', 1], ['p', 0, -10000, False], ['g', 1], ['b', 7], ['g', 2], ['b', 5], ['g', 1]], 10], [[7, 'glue'], [8, 'forced'], [7, 'glue'], [6, 'end']]), ('control layout', [[['b', 2], ['p', 1, 50, True], ['g', 1], ['b', 5], ['g', 2], ['b', 6], ['g', 2], ['b', 6], ['g', 1], ['b', 1], ['g', 1], ['b', 1], ['p', 1, 50, True], ['g', 1]], 17], [[16, 'glue'], [11, 'end']])], [('regression: overflow trigger', [[['b', 6], ['g', 2], ['b', 3], ['p', 1, 50, True], ['g', 2], ['b', 4], ['g', 2], ['b', 6], ['g', 1], ['b', 7], ['g', 1]], 12], [[12, 'penalty'], [12, 'glue'], [8, 'end']]), ('regression: overflow trigger', [[['b', 3], ['g', 1], ['b', 6], ['g', 1], ['b', 1], ['g', 2], ['b', 3], ['p', 1, 50, True], ['g', 1], ['b', 3], ['g', 1]], 8], [[3, 'glue'], [8, 'glue'], [8, 'end']]), ('regression: overflow trigger', [[['b', 3], ['p', 0, 10000, False], ['g', 2], ['b', 6], ['g', 1], ['b', 7], ['g', 1], ['b', 1], ['p', 1, 50, True], ['g', 1]], 9], [[11, 'glue'], [10, 'penalty']]), ('regression: overflow trigger', [[['b', 6], ['g', 1], ['b', 6], ['g', 2], ['b', 3], ['p', 0, 10000, False], ['g', 1], ['g', 1], ['b', 1], ['p', 0, 10000, False], ['g', 2], ['b', 4], ['g', 1], ['b', 2], ['g', 2], ['b', 5], ['g', 1], ['b', 2], ['g', 1], ['g', 1]], 13], [[13, 'glue'], [12, 'glue'], [12, 'glue']]), ('hyphen penalty taken', [[['b', 5], ['p', 1, 50, True], ['b', 4], ['g', 1], ['b', 3]], 7], [[6, 'penalty'], [4, 'glue'], [3, 'end']]), ('forced break', [[['b', 2], ['g', 1], ['b', 2], ['p', 0, -10000, False], ['b', 3]], 20], [[5, 'forced'], [3, 'end']]), ('control layout', [[['b', 3], ['g', 2], ['b', 3], ['g', 1], ['g', 1], ['b', 3], ['p', 0, 10000, False], ['g', 2], ['b', 1], ['g', 1], ['b', 3], ['g', 1]], 14], [[8, 'glue'], [11, 'end']]), ('control layout', [[['b', 7], ['g', 2], ['b', 7], ['g', 1], ['b', 7], ['g', 1], ['b', 1], ['p', 0, 10000, False], ['g', 1], ['b', 6], ['g', 2], ['b', 7], ['p', 1, 50, True], ['g', 2]], 10], [[7, 'glue'], [7, 'glue'], [7, 'glue'], [8, 'glue'], [9, 'end']])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(args), 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: overflow trigger | [[9, 'glue'], [6, 'glue'], [5, 'glue'], [8, 'end']] | [[9, 'glue'], [6, 'glue'], [5, 'glue'], [8, 'end']] | Passed |
| regression: overflow trigger | [[5, 'forced'], [5, 'glue'], [3, 'penalty'], [11, 'glue'], [7, 'glue'], [7, 'glue'], [3, 'end']] | [[5, 'forced'], [5, 'glue'], [3, 'penalty'], [11, 'glue'], [7, 'glue'], [7, 'glue'], [3, 'end']] | Passed |
| regression: overflow trigger | [[10, 'glue'], [10, 'glue'], [9, 'forced'], [2, 'end']] | [[6, 'glue'], [6, 'penalty'], [9, 'glue'], [7, 'forced'], [2, 'end']] | Failed |
| partial-repair probe | [[4, 'forced'], [9, 'glue'], [10, 'penalty'], [11, 'penalty'], [7, 'penalty'], [4, 'end']] | [[4, 'forced'], [4, 'glue'], [4, 'glue'], [6, 'penalty'], [3, 'penalty'], [11, 'penalty'], [7, 'penalty'], [4, 'end']] | Failed |
| hyphen penalty taken | [[6, 'penalty'], [8, 'end']] | [[6, 'penalty'], [4, 'glue'], [3, 'end']] | Failed |
| inhibited penalty | [[9, 'glue'], [3, 'end']] | [[9, 'glue'], [3, 'end']] | Passed |
| control layout | [[10, 'glue'], [15, 'penalty'], [10, 'penalty'], [12, 'end']] | [[10, 'glue'], [15, 'penalty'], [10, 'penalty'], [12, 'end']] | Passed |
| control layout | [[7, 'glue'], [7, 'penalty'], [5, 'glue'], [7, 'glue'], [8, 'penalty'], [5, 'end']] | [[7, 'glue'], [7, 'penalty'], [5, 'glue'], [7, 'glue'], [8, 'penalty'], [5, 'end']] | Passed |
SHA-256 / 3cf6e4cacb85ed9585f620820380795c68dbd544d366b7709406671da02e107c
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic toy typesetting model with integer widths and a stipulated rule set; it does not claim conformance to any engine. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:49:50.298466+00:00.
Case digest / 19c0c250dbe35c3a133a2313f70b3816fe4115ad4a30cc57eb5e327aa28f71fd