FAILURE MAP
← Case archive

FA-80116 / Typography line breaking / Open access

Drop cap shaped paragraph: line fit boundary · case 01

Lines that exactly fill their shaped width are broken early.

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

ROOT CAUSE

The fit uses need < avail(li).

VERIFIED REPAIR

Accept need equal to the available width.

Unsuccessful approach: Allowing one unit extra overfills shaped lines.

Case contract

Input [word widths, width, cap lines, cap width, gap, indent]. With a drop cap its first letter moves into the cap (first word loses one unit) and the first cap-lines lines are narrowed by cap width + gap; the first-line indent applies only without a cap. Greedy fill with unit spaces; a word too wide for an empty line is set alone. Return [[words on line, used width]].

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, cap_lines, cap_width, gap, indent = x
    lens = list(words)
    if cap_lines > 0:
        lens[0] = lens[0] - 1
    def avail(li):
        base = width
        if li < cap_lines:
            base -= cap_width + gap
        elif cap_lines == 0 and li == 0:
            base -= indent
        return base
    lines = []
    cur = []
    used = 0
    for w in lens:
        li = len(lines)
        need = w if not cur else used + 1 + w
        if need < avail(li) or not cur:
            cur.append(w)
            used = need
        else:
            lines.append([len(cur), used])
            cur = [w]
            used = w
    if cur:
        lines.append([len(cur), used])
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('regression: line fit boundary', [[2, 6, 2, 3, 2, 6, 5, 5], 16, 2, 2, 1, 1], [[3, 11], [3, 13], [2, 11]]), ('partial-repair probe', [[5, 6, 5, 1, 6, 4], 13, 2, 3, 2, 2], [[1, 4], [1, 6], [2, 7], [2, 11]]), ('regression: line fit boundary', [[7, 4, 5, 7, 6, 6, 2, 6, 6, 1, 8], 19, 3, 2, 1, 4], [[2, 11], [2, 13], [3, 16], [3, 15], [1, 8]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[8, 1, 7, 8], 24, 2, 5, 1, 4], [[3, 17], [1, 8]]), ('control layout', [[1, 6, 8, 7], 14, 2, 2, 2, 1], [[2, 7], [1, 8], [1, 7]]), ('control layout', [[3, 1, 1, 8, 2], 20, 2, 3, 1, 4], [[4, 15], [1, 2]])], [('regression: line fit boundary', [[5, 5, 1, 5, 1, 5, 3, 1, 5, 2, 4], 17, 0, 4, 1, 1], [[3, 13], [4, 17], [4, 15]]), ('regression: line fit boundary', [[2, 2, 1, 4, 6, 3, 1, 1, 7, 3], 20, 2, 5, 1, 3], [[4, 11], [4, 14], [2, 11]]), ('partial-repair probe', [[2, 3, 3, 8, 8, 2, 7, 8, 7, 6, 1], 15, 0, 2, 1, 1], [[3, 10], [1, 8], [2, 11], [1, 7], [1, 8], [2, 14], [1, 1]]), ('regression: line fit boundary', [[7, 7, 1, 8, 3, 2, 4, 1, 7, 1, 3], 19, 2, 2, 1, 4], [[3, 16], [3, 15], [4, 16], [1, 3]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[4, 3, 8, 3, 6, 1, 7, 2], 24, 2, 4, 2, 2], [[3, 16], [3, 12], [2, 10]]), ('control layout', [[5, 1, 4, 2, 6], 18, 2, 5, 1, 4], [[3, 11], [2, 9]])], [('regression: line fit boundary', [[8, 7, 8, 4, 7, 4, 6, 5, 8, 6], 12, 0, 5, 2, 2], [[1, 8], [1, 7], [1, 8], [2, 12], [2, 11], [1, 5], [1, 8], [1, 6]]), ('regression: line fit boundary', [[8, 3, 5, 5, 1, 7, 1, 5, 8, 8, 6, 3], 17, 0, 4, 2, 1], [[2, 12], [3, 13], [3, 15], [2, 17], [2, 10]]), ('partial-repair probe', [[7, 5, 1, 6, 5], 13, 0, 4, 2, 4], [[1, 7], [2, 7], [2, 12]]), ('partial-repair probe', [[8, 8, 5, 1, 8, 7, 5, 7, 3], 20, 0, 4, 2, 2], [[2, 17], [3, 16], [2, 13], [2, 11]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[3, 4, 7, 8, 7, 5], 20, 0, 4, 1, 3], [[3, 16], [2, 16], [1, 5]]), ('control layout', [[2, 2, 2, 3, 2, 2, 8, 7, 2, 5], 22, 0, 4, 2, 2], [[6, 18], [3, 19], [1, 5]])], [('regression: line fit boundary', [[6, 2, 4, 1, 3, 1, 3], 20, 0, 4, 1, 4], [[4, 16], [3, 9]]), ('regression: line fit boundary', [[1, 5, 3, 8, 7], 12, 0, 2, 1, 2], [[2, 7], [2, 12], [1, 7]]), ('regression: line fit boundary', [[6, 6, 2, 1, 5, 5, 8, 3, 1, 3, 6, 5], 23, 3, 4, 2, 1], [[4, 17], [2, 11], [3, 14], [3, 16]]), ('partial-repair probe', [[4, 8, 2, 1, 8, 8, 6, 3, 7], 14, 0, 3, 2, 3], [[1, 4], [3, 13], [1, 8], [1, 8], [2, 10], [1, 7]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[4, 4, 4, 2, 8, 5, 8, 2, 4, 7], 24, 0, 3, 2, 3], [[4, 17], [3, 23], [3, 15]]), ('control layout', [[8, 6, 8, 5], 15, 2, 4, 2, 4], [[1, 7], [1, 6], [2, 14]])], [('regression: line fit boundary', [[5, 8, 5, 4, 1, 5, 5, 1, 1, 5, 5, 2], 24, 2, 2, 2, 3], [[3, 19], [5, 20], [4, 16]]), ('regression: line fit boundary', [[1, 2, 3, 4, 7, 4, 2, 4, 8, 7, 3], 15, 2, 5, 1, 2], [[3, 7], [1, 4], [3, 15], [2, 13], [2, 11]]), ('partial-repair probe', [[3, 8, 7, 8], 19, 3, 3, 1, 3], [[2, 11], [1, 7], [1, 8]]), ('partial-repair probe', [[3, 7, 5, 3, 1, 7, 5], 24, 0, 2, 2, 2], [[4, 21], [3, 15]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[1, 7, 4, 7], 13, 3, 2, 2, 3], [[2, 8], [1, 4], [1, 7]]), ('control layout', [[4, 4, 5, 4, 8], 19, 0, 3, 2, 2], [[3, 15], [2, 13]])]]
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
three-line drop cap[[2, 8], [1, 4], [2, 9], [2, 10], [1, 3]][[2, 8], [1, 4], [2, 9], [3, 14]]Failed
regression: line fit boundary[[3, 11], [2, 6], [2, 12], [1, 5]][[3, 11], [3, 13], [2, 11]]Failed
partial-repair probe[[1, 4], [1, 6], [2, 7], [2, 11]][[1, 4], [1, 6], [2, 7], [2, 11]]Passed
regression: line fit boundary[[2, 11], [2, 13], [2, 13], [4, 18], [1, 8]][[2, 11], [2, 13], [3, 16], [3, 15], [1, 8]]Failed
no cap uses indent[[1, 5], [2, 8], [2, 9]][[2, 9], [2, 11], [1, 2]]Failed
control layout[[3, 17], [1, 8]][[3, 17], [1, 8]]Passed
control layout[[2, 7], [1, 8], [1, 7]][[2, 7], [1, 8], [1, 7]]Passed
control layout[[4, 15], [1, 2]][[4, 15], [1, 2]]Passed

SHA-256 / 9310946ea65eb60463d3dc9be086af0090ac6242e9e4af89b54e8d20eb99547e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    words, width, cap_lines, cap_width, gap, indent = x
    lens = list(words)
    if cap_lines > 0:
        lens[0] = lens[0] - 1
    def avail(li):
        base = width
        if li < cap_lines:
            base -= cap_width + gap
        elif cap_lines == 0 and li == 0:
            base -= indent
        return base
    lines = []
    cur = []
    used = 0
    for w in lens:
        li = len(lines)
        need = w if not cur else used + 1 + w
        if need <= avail(li) + 1 or not cur:
            cur.append(w)
            used = need
        else:
            lines.append([len(cur), used])
            cur = [w]
            used = w
    if cur:
        lines.append([len(cur), used])
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('regression: line fit boundary', [[2, 6, 2, 3, 2, 6, 5, 5], 16, 2, 2, 1, 1], [[3, 11], [3, 13], [2, 11]]), ('partial-repair probe', [[5, 6, 5, 1, 6, 4], 13, 2, 3, 2, 2], [[1, 4], [1, 6], [2, 7], [2, 11]]), ('regression: line fit boundary', [[7, 4, 5, 7, 6, 6, 2, 6, 6, 1, 8], 19, 3, 2, 1, 4], [[2, 11], [2, 13], [3, 16], [3, 15], [1, 8]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[8, 1, 7, 8], 24, 2, 5, 1, 4], [[3, 17], [1, 8]]), ('control layout', [[1, 6, 8, 7], 14, 2, 2, 2, 1], [[2, 7], [1, 8], [1, 7]]), ('control layout', [[3, 1, 1, 8, 2], 20, 2, 3, 1, 4], [[4, 15], [1, 2]])], [('regression: line fit boundary', [[5, 5, 1, 5, 1, 5, 3, 1, 5, 2, 4], 17, 0, 4, 1, 1], [[3, 13], [4, 17], [4, 15]]), ('regression: line fit boundary', [[2, 2, 1, 4, 6, 3, 1, 1, 7, 3], 20, 2, 5, 1, 3], [[4, 11], [4, 14], [2, 11]]), ('partial-repair probe', [[2, 3, 3, 8, 8, 2, 7, 8, 7, 6, 1], 15, 0, 2, 1, 1], [[3, 10], [1, 8], [2, 11], [1, 7], [1, 8], [2, 14], [1, 1]]), ('regression: line fit boundary', [[7, 7, 1, 8, 3, 2, 4, 1, 7, 1, 3], 19, 2, 2, 1, 4], [[3, 16], [3, 15], [4, 16], [1, 3]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[4, 3, 8, 3, 6, 1, 7, 2], 24, 2, 4, 2, 2], [[3, 16], [3, 12], [2, 10]]), ('control layout', [[5, 1, 4, 2, 6], 18, 2, 5, 1, 4], [[3, 11], [2, 9]])], [('regression: line fit boundary', [[8, 7, 8, 4, 7, 4, 6, 5, 8, 6], 12, 0, 5, 2, 2], [[1, 8], [1, 7], [1, 8], [2, 12], [2, 11], [1, 5], [1, 8], [1, 6]]), ('regression: line fit boundary', [[8, 3, 5, 5, 1, 7, 1, 5, 8, 8, 6, 3], 17, 0, 4, 2, 1], [[2, 12], [3, 13], [3, 15], [2, 17], [2, 10]]), ('partial-repair probe', [[7, 5, 1, 6, 5], 13, 0, 4, 2, 4], [[1, 7], [2, 7], [2, 12]]), ('partial-repair probe', [[8, 8, 5, 1, 8, 7, 5, 7, 3], 20, 0, 4, 2, 2], [[2, 17], [3, 16], [2, 13], [2, 11]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[3, 4, 7, 8, 7, 5], 20, 0, 4, 1, 3], [[3, 16], [2, 16], [1, 5]]), ('control layout', [[2, 2, 2, 3, 2, 2, 8, 7, 2, 5], 22, 0, 4, 2, 2], [[6, 18], [3, 19], [1, 5]])], [('regression: line fit boundary', [[6, 2, 4, 1, 3, 1, 3], 20, 0, 4, 1, 4], [[4, 16], [3, 9]]), ('regression: line fit boundary', [[1, 5, 3, 8, 7], 12, 0, 2, 1, 2], [[2, 7], [2, 12], [1, 7]]), ('regression: line fit boundary', [[6, 6, 2, 1, 5, 5, 8, 3, 1, 3, 6, 5], 23, 3, 4, 2, 1], [[4, 17], [2, 11], [3, 14], [3, 16]]), ('partial-repair probe', [[4, 8, 2, 1, 8, 8, 6, 3, 7], 14, 0, 3, 2, 3], [[1, 4], [3, 13], [1, 8], [1, 8], [2, 10], [1, 7]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[4, 4, 4, 2, 8, 5, 8, 2, 4, 7], 24, 0, 3, 2, 3], [[4, 17], [3, 23], [3, 15]]), ('control layout', [[8, 6, 8, 5], 15, 2, 4, 2, 4], [[1, 7], [1, 6], [2, 14]])], [('regression: line fit boundary', [[5, 8, 5, 4, 1, 5, 5, 1, 1, 5, 5, 2], 24, 2, 2, 2, 3], [[3, 19], [5, 20], [4, 16]]), ('regression: line fit boundary', [[1, 2, 3, 4, 7, 4, 2, 4, 8, 7, 3], 15, 2, 5, 1, 2], [[3, 7], [1, 4], [3, 15], [2, 13], [2, 11]]), ('partial-repair probe', [[3, 8, 7, 8], 19, 3, 3, 1, 3], [[2, 11], [1, 7], [1, 8]]), ('partial-repair probe', [[3, 7, 5, 3, 1, 7, 5], 24, 0, 2, 2, 2], [[4, 21], [3, 15]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[1, 7, 4, 7], 13, 3, 2, 2, 3], [[2, 8], [1, 4], [1, 7]]), ('control layout', [[4, 4, 5, 4, 8], 19, 0, 3, 2, 2], [[3, 15], [2, 13]])]]
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
three-line drop cap[[2, 8], [2, 11], [2, 8], [2, 8]][[2, 8], [1, 4], [2, 9], [3, 14]]Failed
regression: line fit boundary[[3, 11], [3, 13], [2, 11]][[3, 11], [3, 13], [2, 11]]Passed
partial-repair probe[[1, 4], [1, 6], [3, 14], [1, 4]][[1, 4], [1, 6], [2, 7], [2, 11]]Failed
regression: line fit boundary[[3, 17], [2, 14], [3, 16], [3, 17]][[2, 11], [2, 13], [3, 16], [3, 15], [1, 8]]Failed
no cap uses indent[[2, 9], [2, 11], [1, 2]][[2, 9], [2, 11], [1, 2]]Passed
control layout[[3, 17], [1, 8]][[3, 17], [1, 8]]Passed
control layout[[2, 7], [1, 8], [1, 7]][[2, 7], [1, 8], [1, 7]]Passed
control layout[[4, 15], [1, 2]][[4, 15], [1, 2]]Passed

SHA-256 / a9fae570dbef1a5f4aeb78f91827c8a09af95b4048316cccc16fcb7cbb218cb2

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    words, width, cap_lines, cap_width, gap, indent = x
    lens = list(words)
    if cap_lines > 0:
        lens[0] = lens[0] - 1
    def avail(li):
        base = width
        if li < cap_lines:
            base -= cap_width + gap
        elif cap_lines == 0 and li == 0:
            base -= indent
        return base
    lines = []
    cur = []
    used = 0
    for w in lens:
        li = len(lines)
        need = w if not cur else used + 1 + w
        if need <= avail(li) or not cur:
            cur.append(w)
            used = need
        else:
            lines.append([len(cur), used])
            cur = [w]
            used = w
    if cur:
        lines.append([len(cur), used])
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('regression: line fit boundary', [[2, 6, 2, 3, 2, 6, 5, 5], 16, 2, 2, 1, 1], [[3, 11], [3, 13], [2, 11]]), ('partial-repair probe', [[5, 6, 5, 1, 6, 4], 13, 2, 3, 2, 2], [[1, 4], [1, 6], [2, 7], [2, 11]]), ('regression: line fit boundary', [[7, 4, 5, 7, 6, 6, 2, 6, 6, 1, 8], 19, 3, 2, 1, 4], [[2, 11], [2, 13], [3, 16], [3, 15], [1, 8]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[8, 1, 7, 8], 24, 2, 5, 1, 4], [[3, 17], [1, 8]]), ('control layout', [[1, 6, 8, 7], 14, 2, 2, 2, 1], [[2, 7], [1, 8], [1, 7]]), ('control layout', [[3, 1, 1, 8, 2], 20, 2, 3, 1, 4], [[4, 15], [1, 2]])], [('regression: line fit boundary', [[5, 5, 1, 5, 1, 5, 3, 1, 5, 2, 4], 17, 0, 4, 1, 1], [[3, 13], [4, 17], [4, 15]]), ('regression: line fit boundary', [[2, 2, 1, 4, 6, 3, 1, 1, 7, 3], 20, 2, 5, 1, 3], [[4, 11], [4, 14], [2, 11]]), ('partial-repair probe', [[2, 3, 3, 8, 8, 2, 7, 8, 7, 6, 1], 15, 0, 2, 1, 1], [[3, 10], [1, 8], [2, 11], [1, 7], [1, 8], [2, 14], [1, 1]]), ('regression: line fit boundary', [[7, 7, 1, 8, 3, 2, 4, 1, 7, 1, 3], 19, 2, 2, 1, 4], [[3, 16], [3, 15], [4, 16], [1, 3]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[4, 3, 8, 3, 6, 1, 7, 2], 24, 2, 4, 2, 2], [[3, 16], [3, 12], [2, 10]]), ('control layout', [[5, 1, 4, 2, 6], 18, 2, 5, 1, 4], [[3, 11], [2, 9]])], [('regression: line fit boundary', [[8, 7, 8, 4, 7, 4, 6, 5, 8, 6], 12, 0, 5, 2, 2], [[1, 8], [1, 7], [1, 8], [2, 12], [2, 11], [1, 5], [1, 8], [1, 6]]), ('regression: line fit boundary', [[8, 3, 5, 5, 1, 7, 1, 5, 8, 8, 6, 3], 17, 0, 4, 2, 1], [[2, 12], [3, 13], [3, 15], [2, 17], [2, 10]]), ('partial-repair probe', [[7, 5, 1, 6, 5], 13, 0, 4, 2, 4], [[1, 7], [2, 7], [2, 12]]), ('partial-repair probe', [[8, 8, 5, 1, 8, 7, 5, 7, 3], 20, 0, 4, 2, 2], [[2, 17], [3, 16], [2, 13], [2, 11]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('control layout', [[3, 4, 7, 8, 7, 5], 20, 0, 4, 1, 3], [[3, 16], [2, 16], [1, 5]]), ('control layout', [[2, 2, 2, 3, 2, 2, 8, 7, 2, 5], 22, 0, 4, 2, 2], [[6, 18], [3, 19], [1, 5]])], [('regression: line fit boundary', [[6, 2, 4, 1, 3, 1, 3], 20, 0, 4, 1, 4], [[4, 16], [3, 9]]), ('regression: line fit boundary', [[1, 5, 3, 8, 7], 12, 0, 2, 1, 2], [[2, 7], [2, 12], [1, 7]]), ('regression: line fit boundary', [[6, 6, 2, 1, 5, 5, 8, 3, 1, 3, 6, 5], 23, 3, 4, 2, 1], [[4, 17], [2, 11], [3, 14], [3, 16]]), ('partial-repair probe', [[4, 8, 2, 1, 8, 8, 6, 3, 7], 14, 0, 3, 2, 3], [[1, 4], [3, 13], [1, 8], [1, 8], [2, 10], [1, 7]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[4, 4, 4, 2, 8, 5, 8, 2, 4, 7], 24, 0, 3, 2, 3], [[4, 17], [3, 23], [3, 15]]), ('control layout', [[8, 6, 8, 5], 15, 2, 4, 2, 4], [[1, 7], [1, 6], [2, 14]])], [('regression: line fit boundary', [[5, 8, 5, 4, 1, 5, 5, 1, 1, 5, 5, 2], 24, 2, 2, 2, 3], [[3, 19], [5, 20], [4, 16]]), ('regression: line fit boundary', [[1, 2, 3, 4, 7, 4, 2, 4, 8, 7, 3], 15, 2, 5, 1, 2], [[3, 7], [1, 4], [3, 15], [2, 13], [2, 11]]), ('partial-repair probe', [[3, 8, 7, 8], 19, 3, 3, 1, 3], [[2, 11], [1, 7], [1, 8]]), ('partial-repair probe', [[3, 7, 5, 3, 1, 7, 5], 24, 0, 2, 2, 2], [[4, 21], [3, 15]]), ('three-line drop cap', [[5, 3, 4, 6, 2, 5, 4, 3], 14, 3, 3, 1, 2], [[2, 8], [1, 4], [2, 9], [3, 14]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('control layout', [[1, 7, 4, 7], 13, 3, 2, 2, 3], [[2, 8], [1, 4], [1, 7]]), ('control layout', [[4, 4, 5, 4, 8], 19, 0, 3, 2, 2], [[3, 15], [2, 13]])]]
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
three-line drop cap[[2, 8], [1, 4], [2, 9], [3, 14]][[2, 8], [1, 4], [2, 9], [3, 14]]Passed
regression: line fit boundary[[3, 11], [3, 13], [2, 11]][[3, 11], [3, 13], [2, 11]]Passed
partial-repair probe[[1, 4], [1, 6], [2, 7], [2, 11]][[1, 4], [1, 6], [2, 7], [2, 11]]Passed
regression: line fit boundary[[2, 11], [2, 13], [3, 16], [3, 15], [1, 8]][[2, 11], [2, 13], [3, 16], [3, 15], [1, 8]]Passed
no cap uses indent[[2, 9], [2, 11], [1, 2]][[2, 9], [2, 11], [1, 2]]Passed
control layout[[3, 17], [1, 8]][[3, 17], [1, 8]]Passed
control layout[[2, 7], [1, 8], [1, 7]][[2, 7], [1, 8], [1, 7]]Passed
control layout[[4, 15], [1, 2]][[4, 15], [1, 2]]Passed

SHA-256 / a183f466c4ab6c20091e73fd6e5905e816d632da8bb13dc7107295855fa33708

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

Case digest / deaea4ff5d3d3302598a25aab5173e3d7e5b7c7173cb891904b7537e5c90fe94