FAILURE MAP
← Case archive

FA-80136 / Typography line breaking / Open access

Runt last-line prevention: moved line fit · case 01

Rebalancing produces an overfull last line.

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

ROOT CAUSE

The fit check measures the old last line instead of the new one.

VERIFIED REPAIR

Check the width of the last line after the move.

Unsuccessful approach: Using >= rejects moves that exactly fill the line.

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(lines[-1]) > 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: moved line fit', [['serif', 'measure', 'measure', 'a', 'baseline', 'measure', 'at', 'at', 'serif', 'serif'], 10, 8], ['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at serif', 'serif']), ('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('partial-repair probe', [['type', 'the', 'kerning', 'the', 'the', 'kerning', 'the'], 11, 8], ['type the', 'kerning the', 'the', 'kerning the']), ('partial-repair probe', [['of', 'at', 'ink', 'measure', 'at', 'the', 'measure', 'ink'], 11, 6], ['of at ink', 'measure at', 'the', 'measure 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', 'on', 'baseline', 'ink', 'of', 'on', 'serif', 'on', 'type', 'ink', 'at'], 16, 4], ['kerning on', 'baseline ink of', 'on serif on type', 'ink at']), ('control layout', [['is', 'of', 'the', 'of', 'is', 'of'], 18, 8], ['is of the of is of'])], [('regression: moved line fit', [['serif', 'the', 'baseline', 'serif', 'serif', 'a', 'on', 'ink', 'x', 'ink', 'the', 'is'], 7, 8], ['serif', 'the', 'baseline', 'serif', 'serif a', 'on ink', 'x ink', 'the is']), ('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('partial-repair probe', [['of', 'at', 'ink', 'measure', 'at', 'the', 'measure', 'ink'], 11, 6], ['of at ink', 'measure at', 'the', 'measure ink']), ('partial-repair probe', [['grid', 'is', 'x', 'baseline', 'the', 'serif', 'a', 'serif', 'of', 'kerning', 'at', 'the'], 14, 9], ['grid is x', 'baseline the', 'serif a serif', 'of', 'kerning at the']), ('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', [['is', 'the', 'serif', 'grid', 'serif', 'of', 'serif'], 13, 3], ['is the serif', 'grid serif of', 'serif']), ('control layout', [['kerning', 'type', 'baseline', 'on', 'type', 'a', 'is'], 16, 7], ['kerning type', 'baseline on', 'type a is'])], [('regression: moved line fit', [['ink', 'the', 'a', 'ink', 'measure'], 8, 9], ['ink the', 'a ink', 'measure']), ('regression: moved line fit', [['grid', 'type', 'measure', 'grid', 'x', 'baseline'], 8, 9], ['grid', 'type', 'measure', 'grid x', 'baseline']), ('partial-repair probe', [['x', 'at', 'kerning', 'baseline'], 16, 9], ['x at', 'kerning baseline']), ('partial-repair probe', [['ink', 'at', 'baseline', 'measure'], 16, 9], ['ink at', 'baseline measure']), ('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', [['the', 'measure', 'grid', 'grid', 'ink', 'kerning', 'measure', 'of'], 16, 8], ['the measure grid', 'grid ink kerning', 'measure of']), ('control layout', [['on', 'ink', 'at', 'on', 'at', 'ink', 'the'], 16, 3], ['on ink at on at', 'ink the'])], [('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('regression: moved line fit', [['serif', 'the', 'baseline', 'serif', 'serif', 'a', 'on', 'ink', 'x', 'ink', 'the', 'is'], 7, 8], ['serif', 'the', 'baseline', 'serif', 'serif a', 'on ink', 'x ink', 'the is']), ('partial-repair probe', [['x', 'at', 'kerning', 'baseline'], 16, 9], ['x at', 'kerning baseline']), ('partial-repair probe', [['on', 'kerning', 'type', 'ink', 'kerning', 'of', 'serif', 'the'], 9, 8], ['on', 'kerning', 'type ink', 'kerning', 'of', 'serif the']), ('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', [['at', 'kerning', 'ink', 'kerning', 'serif', 'a'], 15, 5], ['at kerning ink', 'kerning serif a']), ('control layout', [['baseline', 'of', 'on', 'on', 'ink', 'measure', 'ink', 'x'], 16, 7], ['baseline of on', 'on ink', 'measure ink x'])], [('regression: moved line fit', [['grid', 'type', 'measure', 'grid', 'x', 'baseline'], 8, 9], ['grid', 'type', 'measure', 'grid x', 'baseline']), ('regression: moved line fit', [['at', 'on', 'serif'], 7, 7], ['at on', 'serif']), ('partial-repair probe', [['on', 'kerning', 'type', 'ink', 'kerning', 'of', 'serif', 'the'], 9, 8], ['on', 'kerning', 'type ink', 'kerning', 'of', 'serif the']), ('partial-repair probe', [['grid', 'is', 'x', 'baseline', 'the', 'serif', 'a', 'serif', 'of', 'kerning', 'at', 'the'], 14, 9], ['grid is x', 'baseline the', 'serif a serif', 'of', 'kerning at the']), ('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', [['the', 'kerning', 'on', 'baseline'], 19, 8], ['the kerning on', 'baseline']), ('control layout', [['the', 'x', 'is', 'of', 'serif'], 19, 8], ['the x is of serif'])]]
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 fixtureActualExpectedOutcome
regression: moved line fit['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at', 'serif serif']['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at serif', 'serif']Failed
regression: moved line fit['kerning', 'a a type', 'x x', 'is grid on']['kerning', 'a a type', 'x x is', 'grid on']Failed
partial-repair probe['type the', 'kerning the', 'the', 'kerning the']['type the', 'kerning the', 'the', 'kerning the']Passed
partial-repair probe['of at ink', 'measure at', 'the', 'measure ink']['of at ink', 'measure at', 'the', 'measure ink']Passed
runt limited by width['kerning', 'baseline x']['kerning', 'baseline x']Passed
one-word runt pulled down['the type', 'grid is a']['the type', 'grid is a']Passed
control layout['kerning on', 'baseline ink of', 'on serif on type', 'ink at']['kerning on', 'baseline ink of', 'on serif on type', 'ink at']Passed
control layout['is of the of is of']['is of the of is of']Passed

SHA-256 / 136d7f7f8ac763b51c373a9a45a4f5931de6589c8188ede465267b6cd7e6204e

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:
        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: moved line fit', [['serif', 'measure', 'measure', 'a', 'baseline', 'measure', 'at', 'at', 'serif', 'serif'], 10, 8], ['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at serif', 'serif']), ('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('partial-repair probe', [['type', 'the', 'kerning', 'the', 'the', 'kerning', 'the'], 11, 8], ['type the', 'kerning the', 'the', 'kerning the']), ('partial-repair probe', [['of', 'at', 'ink', 'measure', 'at', 'the', 'measure', 'ink'], 11, 6], ['of at ink', 'measure at', 'the', 'measure 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', 'on', 'baseline', 'ink', 'of', 'on', 'serif', 'on', 'type', 'ink', 'at'], 16, 4], ['kerning on', 'baseline ink of', 'on serif on type', 'ink at']), ('control layout', [['is', 'of', 'the', 'of', 'is', 'of'], 18, 8], ['is of the of is of'])], [('regression: moved line fit', [['serif', 'the', 'baseline', 'serif', 'serif', 'a', 'on', 'ink', 'x', 'ink', 'the', 'is'], 7, 8], ['serif', 'the', 'baseline', 'serif', 'serif a', 'on ink', 'x ink', 'the is']), ('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('partial-repair probe', [['of', 'at', 'ink', 'measure', 'at', 'the', 'measure', 'ink'], 11, 6], ['of at ink', 'measure at', 'the', 'measure ink']), ('partial-repair probe', [['grid', 'is', 'x', 'baseline', 'the', 'serif', 'a', 'serif', 'of', 'kerning', 'at', 'the'], 14, 9], ['grid is x', 'baseline the', 'serif a serif', 'of', 'kerning at the']), ('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', [['is', 'the', 'serif', 'grid', 'serif', 'of', 'serif'], 13, 3], ['is the serif', 'grid serif of', 'serif']), ('control layout', [['kerning', 'type', 'baseline', 'on', 'type', 'a', 'is'], 16, 7], ['kerning type', 'baseline on', 'type a is'])], [('regression: moved line fit', [['ink', 'the', 'a', 'ink', 'measure'], 8, 9], ['ink the', 'a ink', 'measure']), ('regression: moved line fit', [['grid', 'type', 'measure', 'grid', 'x', 'baseline'], 8, 9], ['grid', 'type', 'measure', 'grid x', 'baseline']), ('partial-repair probe', [['x', 'at', 'kerning', 'baseline'], 16, 9], ['x at', 'kerning baseline']), ('partial-repair probe', [['ink', 'at', 'baseline', 'measure'], 16, 9], ['ink at', 'baseline measure']), ('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', [['the', 'measure', 'grid', 'grid', 'ink', 'kerning', 'measure', 'of'], 16, 8], ['the measure grid', 'grid ink kerning', 'measure of']), ('control layout', [['on', 'ink', 'at', 'on', 'at', 'ink', 'the'], 16, 3], ['on ink at on at', 'ink the'])], [('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('regression: moved line fit', [['serif', 'the', 'baseline', 'serif', 'serif', 'a', 'on', 'ink', 'x', 'ink', 'the', 'is'], 7, 8], ['serif', 'the', 'baseline', 'serif', 'serif a', 'on ink', 'x ink', 'the is']), ('partial-repair probe', [['x', 'at', 'kerning', 'baseline'], 16, 9], ['x at', 'kerning baseline']), ('partial-repair probe', [['on', 'kerning', 'type', 'ink', 'kerning', 'of', 'serif', 'the'], 9, 8], ['on', 'kerning', 'type ink', 'kerning', 'of', 'serif the']), ('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', [['at', 'kerning', 'ink', 'kerning', 'serif', 'a'], 15, 5], ['at kerning ink', 'kerning serif a']), ('control layout', [['baseline', 'of', 'on', 'on', 'ink', 'measure', 'ink', 'x'], 16, 7], ['baseline of on', 'on ink', 'measure ink x'])], [('regression: moved line fit', [['grid', 'type', 'measure', 'grid', 'x', 'baseline'], 8, 9], ['grid', 'type', 'measure', 'grid x', 'baseline']), ('regression: moved line fit', [['at', 'on', 'serif'], 7, 7], ['at on', 'serif']), ('partial-repair probe', [['on', 'kerning', 'type', 'ink', 'kerning', 'of', 'serif', 'the'], 9, 8], ['on', 'kerning', 'type ink', 'kerning', 'of', 'serif the']), ('partial-repair probe', [['grid', 'is', 'x', 'baseline', 'the', 'serif', 'a', 'serif', 'of', 'kerning', 'at', 'the'], 14, 9], ['grid is x', 'baseline the', 'serif a serif', 'of', 'kerning at the']), ('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', [['the', 'kerning', 'on', 'baseline'], 19, 8], ['the kerning on', 'baseline']), ('control layout', [['the', 'x', 'is', 'of', 'serif'], 19, 8], ['the x is of serif'])]]
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 fixtureActualExpectedOutcome
regression: moved line fit['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at serif', 'serif']['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at serif', 'serif']Passed
regression: moved line fit['kerning', 'a a type', 'x x is', 'grid on']['kerning', 'a a type', 'x x is', 'grid on']Passed
partial-repair probe['type the', 'kerning the', 'the kerning', 'the']['type the', 'kerning the', 'the', 'kerning the']Failed
partial-repair probe['of at ink', 'measure at', 'the measure', 'ink']['of at ink', 'measure at', 'the', 'measure ink']Failed
runt limited by width['kerning', 'baseline x']['kerning', 'baseline x']Passed
one-word runt pulled down['the type', 'grid is a']['the type', 'grid is a']Passed
control layout['kerning on', 'baseline ink of', 'on serif on type', 'ink at']['kerning on', 'baseline ink of', 'on serif on type', 'ink at']Passed
control layout['is of the of is of']['is of the of is of']Passed

SHA-256 / e0905af980d60e5176c57b3bb77d175ebcad8628d18187e469ae26a5820d8156

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: moved line fit', [['serif', 'measure', 'measure', 'a', 'baseline', 'measure', 'at', 'at', 'serif', 'serif'], 10, 8], ['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at serif', 'serif']), ('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('partial-repair probe', [['type', 'the', 'kerning', 'the', 'the', 'kerning', 'the'], 11, 8], ['type the', 'kerning the', 'the', 'kerning the']), ('partial-repair probe', [['of', 'at', 'ink', 'measure', 'at', 'the', 'measure', 'ink'], 11, 6], ['of at ink', 'measure at', 'the', 'measure 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', 'on', 'baseline', 'ink', 'of', 'on', 'serif', 'on', 'type', 'ink', 'at'], 16, 4], ['kerning on', 'baseline ink of', 'on serif on type', 'ink at']), ('control layout', [['is', 'of', 'the', 'of', 'is', 'of'], 18, 8], ['is of the of is of'])], [('regression: moved line fit', [['serif', 'the', 'baseline', 'serif', 'serif', 'a', 'on', 'ink', 'x', 'ink', 'the', 'is'], 7, 8], ['serif', 'the', 'baseline', 'serif', 'serif a', 'on ink', 'x ink', 'the is']), ('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('partial-repair probe', [['of', 'at', 'ink', 'measure', 'at', 'the', 'measure', 'ink'], 11, 6], ['of at ink', 'measure at', 'the', 'measure ink']), ('partial-repair probe', [['grid', 'is', 'x', 'baseline', 'the', 'serif', 'a', 'serif', 'of', 'kerning', 'at', 'the'], 14, 9], ['grid is x', 'baseline the', 'serif a serif', 'of', 'kerning at the']), ('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', [['is', 'the', 'serif', 'grid', 'serif', 'of', 'serif'], 13, 3], ['is the serif', 'grid serif of', 'serif']), ('control layout', [['kerning', 'type', 'baseline', 'on', 'type', 'a', 'is'], 16, 7], ['kerning type', 'baseline on', 'type a is'])], [('regression: moved line fit', [['ink', 'the', 'a', 'ink', 'measure'], 8, 9], ['ink the', 'a ink', 'measure']), ('regression: moved line fit', [['grid', 'type', 'measure', 'grid', 'x', 'baseline'], 8, 9], ['grid', 'type', 'measure', 'grid x', 'baseline']), ('partial-repair probe', [['x', 'at', 'kerning', 'baseline'], 16, 9], ['x at', 'kerning baseline']), ('partial-repair probe', [['ink', 'at', 'baseline', 'measure'], 16, 9], ['ink at', 'baseline measure']), ('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', [['the', 'measure', 'grid', 'grid', 'ink', 'kerning', 'measure', 'of'], 16, 8], ['the measure grid', 'grid ink kerning', 'measure of']), ('control layout', [['on', 'ink', 'at', 'on', 'at', 'ink', 'the'], 16, 3], ['on ink at on at', 'ink the'])], [('regression: moved line fit', [['kerning', 'a', 'a', 'type', 'x', 'x', 'is', 'grid', 'on'], 8, 8], ['kerning', 'a a type', 'x x is', 'grid on']), ('regression: moved line fit', [['serif', 'the', 'baseline', 'serif', 'serif', 'a', 'on', 'ink', 'x', 'ink', 'the', 'is'], 7, 8], ['serif', 'the', 'baseline', 'serif', 'serif a', 'on ink', 'x ink', 'the is']), ('partial-repair probe', [['x', 'at', 'kerning', 'baseline'], 16, 9], ['x at', 'kerning baseline']), ('partial-repair probe', [['on', 'kerning', 'type', 'ink', 'kerning', 'of', 'serif', 'the'], 9, 8], ['on', 'kerning', 'type ink', 'kerning', 'of', 'serif the']), ('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', [['at', 'kerning', 'ink', 'kerning', 'serif', 'a'], 15, 5], ['at kerning ink', 'kerning serif a']), ('control layout', [['baseline', 'of', 'on', 'on', 'ink', 'measure', 'ink', 'x'], 16, 7], ['baseline of on', 'on ink', 'measure ink x'])], [('regression: moved line fit', [['grid', 'type', 'measure', 'grid', 'x', 'baseline'], 8, 9], ['grid', 'type', 'measure', 'grid x', 'baseline']), ('regression: moved line fit', [['at', 'on', 'serif'], 7, 7], ['at on', 'serif']), ('partial-repair probe', [['on', 'kerning', 'type', 'ink', 'kerning', 'of', 'serif', 'the'], 9, 8], ['on', 'kerning', 'type ink', 'kerning', 'of', 'serif the']), ('partial-repair probe', [['grid', 'is', 'x', 'baseline', 'the', 'serif', 'a', 'serif', 'of', 'kerning', 'at', 'the'], 14, 9], ['grid is x', 'baseline the', 'serif a serif', 'of', 'kerning at the']), ('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', [['the', 'kerning', 'on', 'baseline'], 19, 8], ['the kerning on', 'baseline']), ('control layout', [['the', 'x', 'is', 'of', 'serif'], 19, 8], ['the x is of serif'])]]
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 fixtureActualExpectedOutcome
regression: moved line fit['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at serif', 'serif']['serif', 'measure', 'measure a', 'baseline', 'measure at', 'at serif', 'serif']Passed
regression: moved line fit['kerning', 'a a type', 'x x is', 'grid on']['kerning', 'a a type', 'x x is', 'grid on']Passed
partial-repair probe['type the', 'kerning the', 'the', 'kerning the']['type the', 'kerning the', 'the', 'kerning the']Passed
partial-repair probe['of at ink', 'measure at', 'the', 'measure ink']['of at ink', 'measure at', 'the', 'measure ink']Passed
runt limited by width['kerning', 'baseline x']['kerning', 'baseline x']Passed
one-word runt pulled down['the type', 'grid is a']['the type', 'grid is a']Passed
control layout['kerning on', 'baseline ink of', 'on serif on type', 'ink at']['kerning on', 'baseline ink of', 'on serif on type', 'ink at']Passed
control layout['is of the of is of']['is of the of is of']Passed

SHA-256 / 4dfcf01b1fb1dfa8a3a4c041a911dba2faefe9c000aa1c4763ceaf97c63f2f79

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.976878+00:00.

Case digest / 0639b1f14c8b841e78882b99356fd167d224ec9bfa89c10ba39609b99657d33e