FA-80126 / Typography line breaking / Open access
Runt last-line prevention: runt length threshold · case 01
Last lines of exactly the minimum length are still rebalanced.
ROOT CAUSE
The runt test uses <=.
VERIFIED REPAIR
Rebalance only when the last line is shorter than the minimum.
Unsuccessful approach: Using min - 1 leaves genuine runts.
Case contract
Input [words, width, minimum last-line length]. Greedy fill (unit spaces; overwide word alone). Then while there are at least two lines and the last line string is shorter than the minimum, move the last word of the previous line down if that line keeps at least one word and the new last line fits. Return lines.
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):
words, width, min_last = x
lines = []
cur = ''
for w in words:
cand = w if not cur else cur + ' ' + w
if len(cand) <= width or not cur:
cur = cand
else:
lines.append(cur)
cur = w
lines.append(cur)
while len(lines) >= 2 and len(lines[-1]) <= min_last:
prev = lines[-2].split(' ')
if len(prev) < 2:
break
moved = prev[-1] + ' ' + lines[-1]
if len(moved) > width:
break
lines[-2] = ' '.join(prev[:-1])
lines[-1] = moved
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: runt length threshold', [['the', 'is', 'grid', 'at', 'at', 'a', 'is'], 18, 7], ['the is grid at', 'at a is']), ('regression: runt length threshold', [['kerning', 'a', 'a', 'ink', 'x', 'is', 'on', 'type', 'grid', 'of', 'x'], 11, 4], ['kerning a a', 'ink x is on', 'type grid', 'of x']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['a', 'of', 'is', 'a', 'at', 'on', 'at', 'baseline', 'at', 'on'], 13, 3], ['a of is a at', 'on at', 'baseline', 'at on']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['measure', 'kerning', 'is', 'a', 'is', 'of', 'at', 'of', 'a', 'of'], 7, 4], ['measure', 'kerning', 'is a is', 'of at', 'of a of']), ('control layout', [['type', 'the', 'baseline', 'a', 'grid', 'x', 'ink', 'of'], 20, 9], ['type the baseline a', 'grid x ink of'])], [('regression: runt length threshold', [['a', 'at', 'is', 'on', 'baseline'], 17, 8], ['a at is on', 'baseline']), ('regression: runt length threshold', [['serif', 'baseline', 'x', 'ink', 'at', 'on', 'on', 'a', 'at'], 16, 4], ['serif baseline x', 'ink at on on', 'a at']), ('partial-repair probe', [['grid', 'the', 'baseline', 'at', 'the', 'is'], 16, 7], ['grid the', 'baseline', 'at the is']), ('partial-repair probe', [['type', 'type', 'grid'], 12, 5], ['type', 'type grid']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['is', 'ink', 'of', 'x', 'x', 'serif', 'at', 'kerning', 'type'], 15, 5], ['is ink of x x', 'serif at', 'kerning type']), ('control layout', [['the', 'measure', 'grid', 'on', 'a', 'measure', 'at'], 11, 7], ['the measure', 'grid on a', 'measure at'])], [('regression: runt length threshold', [['ink', 'the', 'kerning', 'x', 'kerning'], 18, 7], ['ink the kerning x', 'kerning']), ('regression: runt length threshold', [['grid', 'a', 'the', 'a', 'the', 'kerning', 'a', 'of', 'a', 'at', 'on'], 9, 5], ['grid a', 'the a the', 'kerning a', 'of a', 'at on']), ('partial-repair probe', [['a', 'of', 'is', 'a', 'at', 'on', 'at', 'baseline', 'at', 'on'], 13, 3], ['a of is a at', 'on at', 'baseline', 'at on']), ('partial-repair probe', [['baseline', 'kerning', 'grid', 'baseline', 'on', 'x', 'of', 'grid', 'kerning', 'a', 'of'], 19, 3], ['baseline kerning', 'grid baseline on x', 'of grid kerning', 'a of']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['is', 'on', 'serif', 'grid', 'serif', 'grid', 'of', 'measure', 'of', 'of'], 15, 7], ['is on serif', 'grid serif grid', 'of', 'measure of of']), ('control layout', [['ink', 'kerning', 'ink'], 8, 9], ['ink', 'kerning', 'ink'])], [('regression: runt length threshold', [['grid', 'kerning', 'a', 'measure', 'serif', 'type'], 14, 4], ['grid kerning a', 'measure serif', 'type']), ('regression: runt length threshold', [['kerning', 'a', 'a', 'ink', 'x', 'is', 'on', 'type', 'grid', 'of', 'x'], 11, 4], ['kerning a a', 'ink x is on', 'type grid', 'of x']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['a', 'baseline', 'grid', 'on', 'at', 'on', 'kerning', 'a', 'type', 'serif', 'on', 'ink'], 8, 4], ['a', 'baseline', 'grid on', 'at on', 'kerning', 'a type', 'serif', 'on ink']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('control layout', [['grid', 'serif', 'a', 'serif', 'is'], 11, 5], ['grid serif', 'a serif is']), ('control layout', [['grid', 'a', 'type'], 10, 6], ['grid', 'a type'])], [('regression: runt length threshold', [['a', 'kerning', 'serif', 'is', 'a'], 16, 4], ['a kerning serif', 'is a']), ('regression: runt length threshold', [['is', 'grid', 'measure', 'of', 'type'], 12, 4], ['is grid', 'measure of', 'type']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['x', 'on', 'is', 'the', 'is', 'is', 'ink'], 18, 7], ['x on is the', 'is is ink']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('control layout', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('control layout', [['of', 'measure', 'on', 'ink'], 9, 8], ['of', 'measure', 'on ink'])]]
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: runt length threshold | ['the is grid', 'at at a is'] | ['the is grid at', 'at a is'] | Failed |
| regression: runt length threshold | ['kerning a a', 'ink x is on', 'type', 'grid of x'] | ['kerning a a', 'ink x is on', 'type grid', 'of x'] | Failed |
| partial-repair probe | ['of measure at', 'x baseline', 'serif', 'the of the'] | ['of measure at', 'x baseline', 'serif', 'the of the'] | Passed |
| partial-repair probe | ['a of is a at', 'on at', 'baseline', 'at on'] | ['a of is a at', 'on at', 'baseline', 'at on'] | Passed |
| one-word runt pulled down | ['the type', 'grid is a'] | ['the type', 'grid is a'] | Passed |
| runt limited by width | ['kerning', 'baseline x'] | ['kerning', 'baseline x'] | Passed |
| control layout | ['measure', 'kerning', 'is a is', 'of at', 'of a of'] | ['measure', 'kerning', 'is a is', 'of at', 'of a of'] | Passed |
| control layout | ['type the baseline a', 'grid x ink of'] | ['type the baseline a', 'grid x ink of'] | Passed |
SHA-256 / 117a0d8eafc7934289049fcfa1a40da120b8e191e0d2e3fd8f7e111e25f4ea0a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width, min_last = x
lines = []
cur = ''
for w in words:
cand = w if not cur else cur + ' ' + w
if len(cand) <= width or not cur:
cur = cand
else:
lines.append(cur)
cur = w
lines.append(cur)
while len(lines) >= 2 and len(lines[-1]) < min_last - 1:
prev = lines[-2].split(' ')
if len(prev) < 2:
break
moved = prev[-1] + ' ' + lines[-1]
if len(moved) > width:
break
lines[-2] = ' '.join(prev[:-1])
lines[-1] = moved
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: runt length threshold', [['the', 'is', 'grid', 'at', 'at', 'a', 'is'], 18, 7], ['the is grid at', 'at a is']), ('regression: runt length threshold', [['kerning', 'a', 'a', 'ink', 'x', 'is', 'on', 'type', 'grid', 'of', 'x'], 11, 4], ['kerning a a', 'ink x is on', 'type grid', 'of x']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['a', 'of', 'is', 'a', 'at', 'on', 'at', 'baseline', 'at', 'on'], 13, 3], ['a of is a at', 'on at', 'baseline', 'at on']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['measure', 'kerning', 'is', 'a', 'is', 'of', 'at', 'of', 'a', 'of'], 7, 4], ['measure', 'kerning', 'is a is', 'of at', 'of a of']), ('control layout', [['type', 'the', 'baseline', 'a', 'grid', 'x', 'ink', 'of'], 20, 9], ['type the baseline a', 'grid x ink of'])], [('regression: runt length threshold', [['a', 'at', 'is', 'on', 'baseline'], 17, 8], ['a at is on', 'baseline']), ('regression: runt length threshold', [['serif', 'baseline', 'x', 'ink', 'at', 'on', 'on', 'a', 'at'], 16, 4], ['serif baseline x', 'ink at on on', 'a at']), ('partial-repair probe', [['grid', 'the', 'baseline', 'at', 'the', 'is'], 16, 7], ['grid the', 'baseline', 'at the is']), ('partial-repair probe', [['type', 'type', 'grid'], 12, 5], ['type', 'type grid']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['is', 'ink', 'of', 'x', 'x', 'serif', 'at', 'kerning', 'type'], 15, 5], ['is ink of x x', 'serif at', 'kerning type']), ('control layout', [['the', 'measure', 'grid', 'on', 'a', 'measure', 'at'], 11, 7], ['the measure', 'grid on a', 'measure at'])], [('regression: runt length threshold', [['ink', 'the', 'kerning', 'x', 'kerning'], 18, 7], ['ink the kerning x', 'kerning']), ('regression: runt length threshold', [['grid', 'a', 'the', 'a', 'the', 'kerning', 'a', 'of', 'a', 'at', 'on'], 9, 5], ['grid a', 'the a the', 'kerning a', 'of a', 'at on']), ('partial-repair probe', [['a', 'of', 'is', 'a', 'at', 'on', 'at', 'baseline', 'at', 'on'], 13, 3], ['a of is a at', 'on at', 'baseline', 'at on']), ('partial-repair probe', [['baseline', 'kerning', 'grid', 'baseline', 'on', 'x', 'of', 'grid', 'kerning', 'a', 'of'], 19, 3], ['baseline kerning', 'grid baseline on x', 'of grid kerning', 'a of']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['is', 'on', 'serif', 'grid', 'serif', 'grid', 'of', 'measure', 'of', 'of'], 15, 7], ['is on serif', 'grid serif grid', 'of', 'measure of of']), ('control layout', [['ink', 'kerning', 'ink'], 8, 9], ['ink', 'kerning', 'ink'])], [('regression: runt length threshold', [['grid', 'kerning', 'a', 'measure', 'serif', 'type'], 14, 4], ['grid kerning a', 'measure serif', 'type']), ('regression: runt length threshold', [['kerning', 'a', 'a', 'ink', 'x', 'is', 'on', 'type', 'grid', 'of', 'x'], 11, 4], ['kerning a a', 'ink x is on', 'type grid', 'of x']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['a', 'baseline', 'grid', 'on', 'at', 'on', 'kerning', 'a', 'type', 'serif', 'on', 'ink'], 8, 4], ['a', 'baseline', 'grid on', 'at on', 'kerning', 'a type', 'serif', 'on ink']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('control layout', [['grid', 'serif', 'a', 'serif', 'is'], 11, 5], ['grid serif', 'a serif is']), ('control layout', [['grid', 'a', 'type'], 10, 6], ['grid', 'a type'])], [('regression: runt length threshold', [['a', 'kerning', 'serif', 'is', 'a'], 16, 4], ['a kerning serif', 'is a']), ('regression: runt length threshold', [['is', 'grid', 'measure', 'of', 'type'], 12, 4], ['is grid', 'measure of', 'type']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['x', 'on', 'is', 'the', 'is', 'is', 'ink'], 18, 7], ['x on is the', 'is is ink']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('control layout', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('control layout', [['of', 'measure', 'on', 'ink'], 9, 8], ['of', 'measure', 'on ink'])]]
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: runt length threshold | ['the is grid at', 'at a is'] | ['the is grid at', 'at a is'] | Passed |
| regression: runt length threshold | ['kerning a a', 'ink x is on', 'type grid', 'of x'] | ['kerning a a', 'ink x is on', 'type grid', 'of x'] | Passed |
| partial-repair probe | ['of measure at', 'x baseline', 'serif the', 'of the'] | ['of measure at', 'x baseline', 'serif', 'the of the'] | Failed |
| partial-repair probe | ['a of is a at', 'on at', 'baseline at', 'on'] | ['a of is a at', 'on at', 'baseline', 'at on'] | Failed |
| one-word runt pulled down | ['the type', 'grid is a'] | ['the type', 'grid is a'] | Passed |
| runt limited by width | ['kerning', 'baseline x'] | ['kerning', 'baseline x'] | Passed |
| control layout | ['measure', 'kerning', 'is a is', 'of at', 'of a of'] | ['measure', 'kerning', 'is a is', 'of at', 'of a of'] | Passed |
| control layout | ['type the baseline a', 'grid x ink of'] | ['type the baseline a', 'grid x ink of'] | Passed |
SHA-256 / cab48823b7fbb04a26e4db3eb73ae215887b1ae902bee9a26b7bd8236f234a7b
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width, min_last = x
lines = []
cur = ''
for w in words:
cand = w if not cur else cur + ' ' + w
if len(cand) <= width or not cur:
cur = cand
else:
lines.append(cur)
cur = w
lines.append(cur)
while len(lines) >= 2 and len(lines[-1]) < min_last:
prev = lines[-2].split(' ')
if len(prev) < 2:
break
moved = prev[-1] + ' ' + lines[-1]
if len(moved) > width:
break
lines[-2] = ' '.join(prev[:-1])
lines[-1] = moved
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: runt length threshold', [['the', 'is', 'grid', 'at', 'at', 'a', 'is'], 18, 7], ['the is grid at', 'at a is']), ('regression: runt length threshold', [['kerning', 'a', 'a', 'ink', 'x', 'is', 'on', 'type', 'grid', 'of', 'x'], 11, 4], ['kerning a a', 'ink x is on', 'type grid', 'of x']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['a', 'of', 'is', 'a', 'at', 'on', 'at', 'baseline', 'at', 'on'], 13, 3], ['a of is a at', 'on at', 'baseline', 'at on']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['measure', 'kerning', 'is', 'a', 'is', 'of', 'at', 'of', 'a', 'of'], 7, 4], ['measure', 'kerning', 'is a is', 'of at', 'of a of']), ('control layout', [['type', 'the', 'baseline', 'a', 'grid', 'x', 'ink', 'of'], 20, 9], ['type the baseline a', 'grid x ink of'])], [('regression: runt length threshold', [['a', 'at', 'is', 'on', 'baseline'], 17, 8], ['a at is on', 'baseline']), ('regression: runt length threshold', [['serif', 'baseline', 'x', 'ink', 'at', 'on', 'on', 'a', 'at'], 16, 4], ['serif baseline x', 'ink at on on', 'a at']), ('partial-repair probe', [['grid', 'the', 'baseline', 'at', 'the', 'is'], 16, 7], ['grid the', 'baseline', 'at the is']), ('partial-repair probe', [['type', 'type', 'grid'], 12, 5], ['type', 'type grid']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['is', 'ink', 'of', 'x', 'x', 'serif', 'at', 'kerning', 'type'], 15, 5], ['is ink of x x', 'serif at', 'kerning type']), ('control layout', [['the', 'measure', 'grid', 'on', 'a', 'measure', 'at'], 11, 7], ['the measure', 'grid on a', 'measure at'])], [('regression: runt length threshold', [['ink', 'the', 'kerning', 'x', 'kerning'], 18, 7], ['ink the kerning x', 'kerning']), ('regression: runt length threshold', [['grid', 'a', 'the', 'a', 'the', 'kerning', 'a', 'of', 'a', 'at', 'on'], 9, 5], ['grid a', 'the a the', 'kerning a', 'of a', 'at on']), ('partial-repair probe', [['a', 'of', 'is', 'a', 'at', 'on', 'at', 'baseline', 'at', 'on'], 13, 3], ['a of is a at', 'on at', 'baseline', 'at on']), ('partial-repair probe', [['baseline', 'kerning', 'grid', 'baseline', 'on', 'x', 'of', 'grid', 'kerning', 'a', 'of'], 19, 3], ['baseline kerning', 'grid baseline on x', 'of grid kerning', 'a of']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('control layout', [['is', 'on', 'serif', 'grid', 'serif', 'grid', 'of', 'measure', 'of', 'of'], 15, 7], ['is on serif', 'grid serif grid', 'of', 'measure of of']), ('control layout', [['ink', 'kerning', 'ink'], 8, 9], ['ink', 'kerning', 'ink'])], [('regression: runt length threshold', [['grid', 'kerning', 'a', 'measure', 'serif', 'type'], 14, 4], ['grid kerning a', 'measure serif', 'type']), ('regression: runt length threshold', [['kerning', 'a', 'a', 'ink', 'x', 'is', 'on', 'type', 'grid', 'of', 'x'], 11, 4], ['kerning a a', 'ink x is on', 'type grid', 'of x']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['a', 'baseline', 'grid', 'on', 'at', 'on', 'kerning', 'a', 'type', 'serif', 'on', 'ink'], 8, 4], ['a', 'baseline', 'grid on', 'at on', 'kerning', 'a type', 'serif', 'on ink']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('control layout', [['grid', 'serif', 'a', 'serif', 'is'], 11, 5], ['grid serif', 'a serif is']), ('control layout', [['grid', 'a', 'type'], 10, 6], ['grid', 'a type'])], [('regression: runt length threshold', [['a', 'kerning', 'serif', 'is', 'a'], 16, 4], ['a kerning serif', 'is a']), ('regression: runt length threshold', [['is', 'grid', 'measure', 'of', 'type'], 12, 4], ['is grid', 'measure of', 'type']), ('partial-repair probe', [['of', 'measure', 'at', 'x', 'baseline', 'serif', 'the', 'of', 'the'], 13, 7], ['of measure at', 'x baseline', 'serif', 'the of the']), ('partial-repair probe', [['x', 'on', 'is', 'the', 'is', 'is', 'ink'], 18, 7], ['x on is the', 'is is ink']), ('runt limited by width', [['kerning', 'baseline', 'x'], 10, 4], ['kerning', 'baseline x']), ('one-word runt pulled down', [['the', 'type', 'grid', 'is', 'a'], 12, 5], ['the type', 'grid is a']), ('control layout', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('control layout', [['of', 'measure', 'on', 'ink'], 9, 8], ['of', 'measure', 'on ink'])]]
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: runt length threshold | ['the is grid at', 'at a is'] | ['the is grid at', 'at a is'] | Passed |
| regression: runt length threshold | ['kerning a a', 'ink x is on', 'type grid', 'of x'] | ['kerning a a', 'ink x is on', 'type grid', 'of x'] | Passed |
| partial-repair probe | ['of measure at', 'x baseline', 'serif', 'the of the'] | ['of measure at', 'x baseline', 'serif', 'the of the'] | Passed |
| partial-repair probe | ['a of is a at', 'on at', 'baseline', 'at on'] | ['a of is a at', 'on at', 'baseline', 'at on'] | Passed |
| one-word runt pulled down | ['the type', 'grid is a'] | ['the type', 'grid is a'] | Passed |
| runt limited by width | ['kerning', 'baseline x'] | ['kerning', 'baseline x'] | Passed |
| control layout | ['measure', 'kerning', 'is a is', 'of at', 'of a of'] | ['measure', 'kerning', 'is a is', 'of at', 'of a of'] | Passed |
| control layout | ['type the baseline a', 'grid x ink of'] | ['type the baseline a', 'grid x ink of'] | Passed |
SHA-256 / 8fb44c1795f129d7db6ab44138717878915fd26a803b5d3bd8a963e4833925c5
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.958122+00:00.
Case digest / d39c059f2638813dc00c9eb4851189bb6beffe1da8bc367ea569eeeab6d45576