FA-80096 / Typography line breaking / Open access
Drop cap shaped paragraph: cap line count · case 01
One line too many is narrowed around the drop cap.
ROOT CAUSE
The narrowed-line test uses <= cap_lines.
VERIFIED REPAIR
Narrow exactly the first cap_lines lines.
Unsuccessful approach: Narrowing cap_lines - 1 lines lets text collide with the cap.
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: cap line count', [[4, 2, 7, 3, 8, 6, 3, 7, 1, 6, 6], 20, 3, 5, 1, 2], [[3, 14], [2, 12], [2, 10], [3, 16], [1, 6]]), ('partial-repair probe', [[5, 2, 8, 7, 8], 17, 3, 5, 2, 3], [[2, 7], [1, 8], [1, 7], [1, 8]]), ('regression: cap line count', [[5, 4, 2, 7, 7, 7, 5, 8, 6, 5], 16, 3, 3, 2, 1], [[2, 9], [2, 10], [1, 7], [2, 13], [2, 15], [1, 5]]), ('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', [[7, 1, 2, 7], 15, 0, 3, 1, 4], [[2, 9], [2, 10]]), ('control layout', [[1, 3, 4, 7, 7, 7, 1, 1, 1, 4, 2], 22, 3, 2, 2, 2], [[4, 17], [3, 17], [4, 11]])], [('regression: cap line count', [[8, 7, 8, 7, 2, 1, 4, 7, 2, 5, 3, 4], 18, 3, 4, 2, 4], [[1, 7], [1, 7], [1, 8], [4, 17], [3, 16], [2, 8]]), ('regression: cap line count', [[2, 6, 4, 5, 1, 8, 2, 8, 5, 1, 2, 2], 23, 2, 2, 2, 1], [[4, 19], [3, 13], [5, 22]]), ('partial-repair probe', [[4, 6, 1, 3, 2, 6, 7, 7, 4, 2, 7], 21, 3, 5, 1, 1], [[3, 12], [3, 13], [2, 15], [3, 15]]), ('partial-repair probe', [[2, 5, 6, 7, 8, 3], 22, 2, 4, 2, 4], [[3, 14], [2, 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', [[1, 2, 3, 2, 5, 8, 3], 18, 0, 2, 1, 4], [[4, 11], [3, 18]]), ('control layout', [[6, 2, 4, 6, 4, 2, 6, 5, 4, 7], 21, 0, 2, 2, 2], [[3, 14], [4, 21], [3, 18]])], [('regression: cap line count', [[5, 5, 1, 2, 3, 5, 2, 6, 5, 6, 1], 22, 0, 3, 1, 1], [[5, 20], [4, 21], [2, 8]]), ('regression: cap line count', [[6, 6, 6, 6, 8], 22, 0, 2, 1, 2], [[3, 20], [2, 15]]), ('partial-repair probe', [[8, 1, 6, 4, 1, 7, 7], 24, 2, 5, 2, 1], [[3, 16], [3, 14], [1, 7]]), ('partial-repair probe', [[7, 7, 3, 3, 6, 5, 4], 20, 2, 4, 1, 4], [[2, 14], [3, 14], [2, 10]]), ('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', [[5, 7, 1, 6, 7, 3, 3], 22, 0, 3, 1, 3], [[3, 15], [4, 22]]), ('control layout', [[7, 7, 3, 4, 2, 1, 3], 19, 3, 3, 2, 4], [[2, 14], [4, 13], [1, 3]])], [('regression: cap line count', [[2, 4, 4, 5, 6, 5], 15, 2, 4, 1, 4], [[2, 6], [2, 10], [2, 12]]), ('regression: cap line count', [[3, 5, 6, 3, 7, 1, 2, 3, 2, 4], 17, 3, 5, 1, 2], [[2, 8], [2, 10], [2, 9], [4, 14]]), ('partial-repair probe', [[7, 7, 3, 3, 6, 5, 4], 20, 2, 4, 1, 4], [[2, 14], [3, 14], [2, 10]]), ('regression: cap line count', [[1, 1, 2, 8, 1, 4, 1, 1, 5, 5, 3, 6], 15, 2, 5, 1, 1], [[3, 5], [1, 8], [4, 10], [3, 15], [1, 6]]), ('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', [[5, 1, 2, 3], 20, 0, 2, 2, 2], [[4, 14]]), ('control layout', [[8, 2, 5, 2, 7], 19, 3, 4, 2, 3], [[2, 10], [2, 8], [1, 7]])], [('regression: cap line count', [[1, 4, 5, 4, 2, 4, 7, 1], 22, 0, 5, 2, 1], [[5, 20], [3, 14]]), ('regression: cap line count', [[6, 5, 5, 5, 6, 6, 8, 2, 3, 8, 3, 1], 16, 0, 4, 1, 4], [[2, 12], [2, 11], [2, 13], [3, 15], [3, 14]]), ('partial-repair probe', [[1, 5, 5, 4, 2, 3, 3], 13, 2, 2, 1, 3], [[2, 6], [2, 10], [3, 10]]), ('partial-repair probe', [[5, 5, 5, 5, 7, 7, 7, 2], 23, 2, 4, 1, 3], [[3, 16], [2, 13], [3, 18]]), ('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, 1, 1, 8, 2], 20, 2, 3, 1, 4], [[4, 15], [1, 2]]), ('control layout', [[7, 1, 4, 6], 19, 0, 4, 1, 4], [[3, 14], [1, 6]])]]
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 |
|---|---|---|---|
| three-line drop cap | [[2, 8], [1, 4], [2, 9], [2, 10], [1, 3]] | [[2, 8], [1, 4], [2, 9], [3, 14]] | Failed |
| regression: cap line count | [[3, 14], [2, 12], [2, 10], [2, 9], [2, 13]] | [[3, 14], [2, 12], [2, 10], [3, 16], [1, 6]] | Failed |
| partial-repair probe | [[2, 7], [1, 8], [1, 7], [1, 8]] | [[2, 7], [1, 8], [1, 7], [1, 8]] | Passed |
| regression: cap line count | [[2, 9], [2, 10], [1, 7], [1, 7], [2, 14], [2, 12]] | [[2, 9], [2, 10], [1, 7], [2, 13], [2, 15], [1, 5]] | Failed |
| no cap uses indent | [[1, 5], [2, 8], [2, 9]] | [[2, 9], [2, 11], [1, 2]] | Failed |
| control layout | [[4, 17], [3, 23], [3, 15]] | [[4, 17], [3, 23], [3, 15]] | Passed |
| control layout | [[2, 9], [2, 10]] | [[2, 9], [2, 10]] | Passed |
| control layout | [[4, 17], [3, 17], [4, 11]] | [[4, 17], [3, 17], [4, 11]] | Passed |
SHA-256 / 7640acc8e4ca4e5aef1f1cbe91f97ef7b9a2a29f18867b76ef9d5cf270db3ee1
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 - 1:
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: cap line count', [[4, 2, 7, 3, 8, 6, 3, 7, 1, 6, 6], 20, 3, 5, 1, 2], [[3, 14], [2, 12], [2, 10], [3, 16], [1, 6]]), ('partial-repair probe', [[5, 2, 8, 7, 8], 17, 3, 5, 2, 3], [[2, 7], [1, 8], [1, 7], [1, 8]]), ('regression: cap line count', [[5, 4, 2, 7, 7, 7, 5, 8, 6, 5], 16, 3, 3, 2, 1], [[2, 9], [2, 10], [1, 7], [2, 13], [2, 15], [1, 5]]), ('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', [[7, 1, 2, 7], 15, 0, 3, 1, 4], [[2, 9], [2, 10]]), ('control layout', [[1, 3, 4, 7, 7, 7, 1, 1, 1, 4, 2], 22, 3, 2, 2, 2], [[4, 17], [3, 17], [4, 11]])], [('regression: cap line count', [[8, 7, 8, 7, 2, 1, 4, 7, 2, 5, 3, 4], 18, 3, 4, 2, 4], [[1, 7], [1, 7], [1, 8], [4, 17], [3, 16], [2, 8]]), ('regression: cap line count', [[2, 6, 4, 5, 1, 8, 2, 8, 5, 1, 2, 2], 23, 2, 2, 2, 1], [[4, 19], [3, 13], [5, 22]]), ('partial-repair probe', [[4, 6, 1, 3, 2, 6, 7, 7, 4, 2, 7], 21, 3, 5, 1, 1], [[3, 12], [3, 13], [2, 15], [3, 15]]), ('partial-repair probe', [[2, 5, 6, 7, 8, 3], 22, 2, 4, 2, 4], [[3, 14], [2, 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', [[1, 2, 3, 2, 5, 8, 3], 18, 0, 2, 1, 4], [[4, 11], [3, 18]]), ('control layout', [[6, 2, 4, 6, 4, 2, 6, 5, 4, 7], 21, 0, 2, 2, 2], [[3, 14], [4, 21], [3, 18]])], [('regression: cap line count', [[5, 5, 1, 2, 3, 5, 2, 6, 5, 6, 1], 22, 0, 3, 1, 1], [[5, 20], [4, 21], [2, 8]]), ('regression: cap line count', [[6, 6, 6, 6, 8], 22, 0, 2, 1, 2], [[3, 20], [2, 15]]), ('partial-repair probe', [[8, 1, 6, 4, 1, 7, 7], 24, 2, 5, 2, 1], [[3, 16], [3, 14], [1, 7]]), ('partial-repair probe', [[7, 7, 3, 3, 6, 5, 4], 20, 2, 4, 1, 4], [[2, 14], [3, 14], [2, 10]]), ('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', [[5, 7, 1, 6, 7, 3, 3], 22, 0, 3, 1, 3], [[3, 15], [4, 22]]), ('control layout', [[7, 7, 3, 4, 2, 1, 3], 19, 3, 3, 2, 4], [[2, 14], [4, 13], [1, 3]])], [('regression: cap line count', [[2, 4, 4, 5, 6, 5], 15, 2, 4, 1, 4], [[2, 6], [2, 10], [2, 12]]), ('regression: cap line count', [[3, 5, 6, 3, 7, 1, 2, 3, 2, 4], 17, 3, 5, 1, 2], [[2, 8], [2, 10], [2, 9], [4, 14]]), ('partial-repair probe', [[7, 7, 3, 3, 6, 5, 4], 20, 2, 4, 1, 4], [[2, 14], [3, 14], [2, 10]]), ('regression: cap line count', [[1, 1, 2, 8, 1, 4, 1, 1, 5, 5, 3, 6], 15, 2, 5, 1, 1], [[3, 5], [1, 8], [4, 10], [3, 15], [1, 6]]), ('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', [[5, 1, 2, 3], 20, 0, 2, 2, 2], [[4, 14]]), ('control layout', [[8, 2, 5, 2, 7], 19, 3, 4, 2, 3], [[2, 10], [2, 8], [1, 7]])], [('regression: cap line count', [[1, 4, 5, 4, 2, 4, 7, 1], 22, 0, 5, 2, 1], [[5, 20], [3, 14]]), ('regression: cap line count', [[6, 5, 5, 5, 6, 6, 8, 2, 3, 8, 3, 1], 16, 0, 4, 1, 4], [[2, 12], [2, 11], [2, 13], [3, 15], [3, 14]]), ('partial-repair probe', [[1, 5, 5, 4, 2, 3, 3], 13, 2, 2, 1, 3], [[2, 6], [2, 10], [3, 10]]), ('partial-repair probe', [[5, 5, 5, 5, 7, 7, 7, 2], 23, 2, 4, 1, 3], [[3, 16], [2, 13], [3, 18]]), ('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, 1, 1, 8, 2], 20, 2, 3, 1, 4], [[4, 15], [1, 2]]), ('control layout', [[7, 1, 4, 6], 19, 0, 4, 1, 4], [[3, 14], [1, 6]])]]
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 |
|---|---|---|---|
| three-line drop cap | [[2, 8], [1, 4], [2, 9], [3, 14]] | [[2, 8], [1, 4], [2, 9], [3, 14]] | Passed |
| regression: cap line count | [[3, 14], [2, 12], [4, 20], [2, 13]] | [[3, 14], [2, 12], [2, 10], [3, 16], [1, 6]] | Failed |
| partial-repair probe | [[2, 7], [1, 8], [2, 16]] | [[2, 7], [1, 8], [1, 7], [1, 8]] | Failed |
| regression: cap line count | [[2, 9], [2, 10], [2, 15], [2, 14], [2, 12]] | [[2, 9], [2, 10], [1, 7], [2, 13], [2, 15], [1, 5]] | Failed |
| no cap uses indent | [[2, 9], [2, 11], [1, 2]] | [[2, 9], [2, 11], [1, 2]] | Passed |
| control layout | [[4, 17], [3, 23], [3, 15]] | [[4, 17], [3, 23], [3, 15]] | Passed |
| control layout | [[2, 9], [2, 10]] | [[2, 9], [2, 10]] | Passed |
| control layout | [[4, 17], [3, 17], [4, 11]] | [[4, 17], [3, 17], [4, 11]] | Passed |
SHA-256 / a663cb2e41a94de30a8acc78c9c4ef747758a4fa4c5f56893a9c0bf33d5577dd
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: cap line count', [[4, 2, 7, 3, 8, 6, 3, 7, 1, 6, 6], 20, 3, 5, 1, 2], [[3, 14], [2, 12], [2, 10], [3, 16], [1, 6]]), ('partial-repair probe', [[5, 2, 8, 7, 8], 17, 3, 5, 2, 3], [[2, 7], [1, 8], [1, 7], [1, 8]]), ('regression: cap line count', [[5, 4, 2, 7, 7, 7, 5, 8, 6, 5], 16, 3, 3, 2, 1], [[2, 9], [2, 10], [1, 7], [2, 13], [2, 15], [1, 5]]), ('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', [[7, 1, 2, 7], 15, 0, 3, 1, 4], [[2, 9], [2, 10]]), ('control layout', [[1, 3, 4, 7, 7, 7, 1, 1, 1, 4, 2], 22, 3, 2, 2, 2], [[4, 17], [3, 17], [4, 11]])], [('regression: cap line count', [[8, 7, 8, 7, 2, 1, 4, 7, 2, 5, 3, 4], 18, 3, 4, 2, 4], [[1, 7], [1, 7], [1, 8], [4, 17], [3, 16], [2, 8]]), ('regression: cap line count', [[2, 6, 4, 5, 1, 8, 2, 8, 5, 1, 2, 2], 23, 2, 2, 2, 1], [[4, 19], [3, 13], [5, 22]]), ('partial-repair probe', [[4, 6, 1, 3, 2, 6, 7, 7, 4, 2, 7], 21, 3, 5, 1, 1], [[3, 12], [3, 13], [2, 15], [3, 15]]), ('partial-repair probe', [[2, 5, 6, 7, 8, 3], 22, 2, 4, 2, 4], [[3, 14], [2, 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', [[1, 2, 3, 2, 5, 8, 3], 18, 0, 2, 1, 4], [[4, 11], [3, 18]]), ('control layout', [[6, 2, 4, 6, 4, 2, 6, 5, 4, 7], 21, 0, 2, 2, 2], [[3, 14], [4, 21], [3, 18]])], [('regression: cap line count', [[5, 5, 1, 2, 3, 5, 2, 6, 5, 6, 1], 22, 0, 3, 1, 1], [[5, 20], [4, 21], [2, 8]]), ('regression: cap line count', [[6, 6, 6, 6, 8], 22, 0, 2, 1, 2], [[3, 20], [2, 15]]), ('partial-repair probe', [[8, 1, 6, 4, 1, 7, 7], 24, 2, 5, 2, 1], [[3, 16], [3, 14], [1, 7]]), ('partial-repair probe', [[7, 7, 3, 3, 6, 5, 4], 20, 2, 4, 1, 4], [[2, 14], [3, 14], [2, 10]]), ('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', [[5, 7, 1, 6, 7, 3, 3], 22, 0, 3, 1, 3], [[3, 15], [4, 22]]), ('control layout', [[7, 7, 3, 4, 2, 1, 3], 19, 3, 3, 2, 4], [[2, 14], [4, 13], [1, 3]])], [('regression: cap line count', [[2, 4, 4, 5, 6, 5], 15, 2, 4, 1, 4], [[2, 6], [2, 10], [2, 12]]), ('regression: cap line count', [[3, 5, 6, 3, 7, 1, 2, 3, 2, 4], 17, 3, 5, 1, 2], [[2, 8], [2, 10], [2, 9], [4, 14]]), ('partial-repair probe', [[7, 7, 3, 3, 6, 5, 4], 20, 2, 4, 1, 4], [[2, 14], [3, 14], [2, 10]]), ('regression: cap line count', [[1, 1, 2, 8, 1, 4, 1, 1, 5, 5, 3, 6], 15, 2, 5, 1, 1], [[3, 5], [1, 8], [4, 10], [3, 15], [1, 6]]), ('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', [[5, 1, 2, 3], 20, 0, 2, 2, 2], [[4, 14]]), ('control layout', [[8, 2, 5, 2, 7], 19, 3, 4, 2, 3], [[2, 10], [2, 8], [1, 7]])], [('regression: cap line count', [[1, 4, 5, 4, 2, 4, 7, 1], 22, 0, 5, 2, 1], [[5, 20], [3, 14]]), ('regression: cap line count', [[6, 5, 5, 5, 6, 6, 8, 2, 3, 8, 3, 1], 16, 0, 4, 1, 4], [[2, 12], [2, 11], [2, 13], [3, 15], [3, 14]]), ('partial-repair probe', [[1, 5, 5, 4, 2, 3, 3], 13, 2, 2, 1, 3], [[2, 6], [2, 10], [3, 10]]), ('partial-repair probe', [[5, 5, 5, 5, 7, 7, 7, 2], 23, 2, 4, 1, 3], [[3, 16], [2, 13], [3, 18]]), ('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, 1, 1, 8, 2], 20, 2, 3, 1, 4], [[4, 15], [1, 2]]), ('control layout', [[7, 1, 4, 6], 19, 0, 4, 1, 4], [[3, 14], [1, 6]])]]
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 |
|---|---|---|---|
| three-line drop cap | [[2, 8], [1, 4], [2, 9], [3, 14]] | [[2, 8], [1, 4], [2, 9], [3, 14]] | Passed |
| regression: cap line count | [[3, 14], [2, 12], [2, 10], [3, 16], [1, 6]] | [[3, 14], [2, 12], [2, 10], [3, 16], [1, 6]] | Passed |
| partial-repair probe | [[2, 7], [1, 8], [1, 7], [1, 8]] | [[2, 7], [1, 8], [1, 7], [1, 8]] | Passed |
| regression: cap line count | [[2, 9], [2, 10], [1, 7], [2, 13], [2, 15], [1, 5]] | [[2, 9], [2, 10], [1, 7], [2, 13], [2, 15], [1, 5]] | Passed |
| no cap uses indent | [[2, 9], [2, 11], [1, 2]] | [[2, 9], [2, 11], [1, 2]] | Passed |
| control layout | [[4, 17], [3, 23], [3, 15]] | [[4, 17], [3, 23], [3, 15]] | Passed |
| control layout | [[2, 9], [2, 10]] | [[2, 9], [2, 10]] | Passed |
| control layout | [[4, 17], [3, 17], [4, 11]] | [[4, 17], [3, 17], [4, 11]] | Passed |
SHA-256 / 82d82c93044504288ba568f286c49d169e2edea7e5155118855849fd08ec351d
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.844719+00:00.
Case digest / ca74c180817986b4ea219c1c227e8934db1f6e39ad30c022cca1be567f4a0d5e