FA-80111 / Typography line breaking / Open access
Drop cap shaped paragraph: initial letter consumption · case 01
The first line measures the initial letter twice.
ROOT CAUSE
The first word keeps its full width although its first letter moved into the cap.
VERIFIED REPAIR
Remove one unit from the first word when a cap is present.
Unsuccessful approach: Trimming even without a cap shortens ordinary paragraphs.
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]
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: initial letter consumption', [[7, 1, 4, 6, 4, 3, 7, 5], 13, 2, 5, 2, 3], [[1, 6], [2, 6], [2, 11], [2, 11], [1, 5]]), ('partial-repair probe', [[7, 1, 8, 5], 16, 0, 5, 1, 3], [[2, 9], [2, 14]]), ('partial-repair probe', [[1, 8, 8, 5, 8, 1, 2, 5], 17, 0, 2, 1, 3], [[2, 10], [2, 14], [3, 13], [1, 5]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('partial-repair probe', [[5, 2, 6, 6, 2, 6, 3, 3, 5, 3], 16, 0, 2, 1, 3], [[2, 8], [3, 16], [3, 14], [2, 9]]), ('partial-repair probe', [[6, 6, 8, 8, 8, 2, 3], 15, 0, 5, 1, 4], [[1, 6], [2, 15], [1, 8], [3, 15]]), ('partial-repair probe', [[1, 2, 6, 7, 1, 8], 20, 0, 3, 2, 2], [[3, 11], [3, 18]])], [('regression: initial letter consumption', [[8, 1, 6, 4, 1, 7, 7], 24, 2, 5, 2, 1], [[3, 16], [3, 14], [1, 7]]), ('regression: initial letter consumption', [[1, 2, 7, 6, 5, 2, 3], 17, 3, 5, 1, 3], [[3, 11], [1, 6], [2, 8], [1, 3]]), ('partial-repair probe', [[1, 8, 7, 5, 7, 8], 15, 0, 2, 2, 3], [[2, 10], [2, 13], [1, 7], [1, 8]]), ('partial-repair probe', [[2, 3, 3, 1, 7, 5, 6, 1, 3, 3, 5], 14, 0, 3, 1, 2], [[4, 12], [2, 13], [3, 12], [2, 9]]), ('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]]), ('regression: initial letter consumption', [[3, 4, 3, 1, 5, 7, 5, 6, 6, 5, 5], 19, 2, 4, 2, 2], [[4, 13], [2, 13], [3, 19], [2, 11]]), ('partial-repair probe', [[6, 8, 2, 2, 5, 4, 5, 7], 24, 0, 2, 1, 2], [[4, 21], [4, 24]])], [('regression: initial letter consumption', [[2, 6, 7, 8, 2, 8, 5, 5, 1, 1, 5], 12, 3, 2, 1, 1], [[2, 8], [1, 7], [1, 8], [2, 11], [2, 11], [3, 9]]), ('regression: initial letter consumption', [[7, 2, 3, 8, 2, 8, 7], 22, 2, 5, 1, 1], [[3, 13], [2, 11], [2, 16]]), ('partial-repair probe', [[1, 6, 4, 2, 2, 2, 8], 15, 0, 4, 1, 3], [[2, 8], [4, 13], [1, 8]]), ('partial-repair probe', [[8, 1, 7, 5, 5, 4, 4, 8, 7], 22, 0, 5, 1, 2], [[3, 18], [4, 21], [2, 16]]), ('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]]), ('partial-repair probe', [[3, 7, 4, 7], 24, 0, 2, 2, 4], [[3, 16], [1, 7]]), ('partial-repair probe', [[8, 2, 3, 5, 8, 1, 2], 12, 0, 4, 1, 1], [[2, 11], [2, 9], [2, 10], [1, 2]])], [('regression: initial letter consumption', [[2, 6, 7, 8, 1, 2, 5, 6, 8], 21, 2, 2, 2, 4], [[3, 16], [3, 13], [3, 21]]), ('regression: initial letter consumption', [[7, 6, 8, 6, 7, 6, 3, 5, 3, 6, 4], 13, 2, 4, 1, 1], [[1, 6], [1, 6], [1, 8], [1, 6], [1, 7], [2, 10], [2, 9], [2, 11]]), ('partial-repair probe', [[7, 4, 4, 1], 21, 0, 2, 2, 3], [[3, 17], [1, 1]]), ('partial-repair probe', [[3, 2, 8, 1, 5, 6, 1, 5, 8], 16, 0, 4, 2, 2], [[2, 6], [3, 16], [3, 14], [1, 8]]), ('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]]), ('partial-repair probe', [[7, 6, 7, 4, 5, 3, 3, 5, 3, 5], 23, 0, 3, 2, 4], [[2, 14], [4, 22], [4, 19]]), ('regression: initial letter consumption', [[5, 4, 1, 4, 5, 5, 2, 7], 21, 3, 2, 1, 2], [[4, 16], [3, 14], [1, 7]])], [('regression: initial letter consumption', [[3, 1, 5, 1, 6], 22, 2, 5, 2, 4], [[4, 12], [1, 6]]), ('regression: initial letter consumption', [[6, 6, 3, 1, 6], 19, 2, 5, 1, 3], [[2, 12], [3, 12]]), ('partial-repair probe', [[3, 5, 6, 1, 6, 8, 2, 6, 1], 15, 0, 2, 2, 3], [[2, 9], [3, 15], [2, 11], [2, 8]]), ('partial-repair probe', [[2, 2, 2, 2, 1, 7, 6, 1, 1, 8, 3, 4], 23, 0, 4, 1, 2], [[6, 21], [5, 23], [1, 4]]), ('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]]), ('regression: initial letter consumption', [[4, 3, 6, 1, 3, 3, 4, 6], 15, 3, 4, 1, 3], [[2, 7], [2, 8], [2, 7], [2, 11]]), ('regression: initial letter consumption', [[1, 5, 6, 6, 3, 7], 22, 2, 4, 2, 4], [[3, 13], [2, 10], [1, 7]])]]
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, 9], [1, 4], [2, 9], [3, 14]] | [[2, 8], [1, 4], [2, 9], [3, 14]] | Failed |
| regression: initial letter consumption | [[1, 7], [2, 6], [2, 11], [2, 11], [1, 5]] | [[1, 6], [2, 6], [2, 11], [2, 11], [1, 5]] | Failed |
| partial-repair probe | [[2, 9], [2, 14]] | [[2, 9], [2, 14]] | Passed |
| partial-repair probe | [[2, 10], [2, 14], [3, 13], [1, 5]] | [[2, 10], [2, 14], [3, 13], [1, 5]] | Passed |
| no cap uses indent | [[2, 9], [2, 11], [1, 2]] | [[2, 9], [2, 11], [1, 2]] | Passed |
| partial-repair probe | [[2, 8], [3, 16], [3, 14], [2, 9]] | [[2, 8], [3, 16], [3, 14], [2, 9]] | Passed |
| partial-repair probe | [[1, 6], [2, 15], [1, 8], [3, 15]] | [[1, 6], [2, 15], [1, 8], [3, 15]] | Passed |
| partial-repair probe | [[3, 11], [3, 18]] | [[3, 11], [3, 18]] | Passed |
SHA-256 / 0c158608dec0a084ad216121a96e05fb9eae6f6b37e3da5f000f539db5d5862f
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) 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: initial letter consumption', [[7, 1, 4, 6, 4, 3, 7, 5], 13, 2, 5, 2, 3], [[1, 6], [2, 6], [2, 11], [2, 11], [1, 5]]), ('partial-repair probe', [[7, 1, 8, 5], 16, 0, 5, 1, 3], [[2, 9], [2, 14]]), ('partial-repair probe', [[1, 8, 8, 5, 8, 1, 2, 5], 17, 0, 2, 1, 3], [[2, 10], [2, 14], [3, 13], [1, 5]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('partial-repair probe', [[5, 2, 6, 6, 2, 6, 3, 3, 5, 3], 16, 0, 2, 1, 3], [[2, 8], [3, 16], [3, 14], [2, 9]]), ('partial-repair probe', [[6, 6, 8, 8, 8, 2, 3], 15, 0, 5, 1, 4], [[1, 6], [2, 15], [1, 8], [3, 15]]), ('partial-repair probe', [[1, 2, 6, 7, 1, 8], 20, 0, 3, 2, 2], [[3, 11], [3, 18]])], [('regression: initial letter consumption', [[8, 1, 6, 4, 1, 7, 7], 24, 2, 5, 2, 1], [[3, 16], [3, 14], [1, 7]]), ('regression: initial letter consumption', [[1, 2, 7, 6, 5, 2, 3], 17, 3, 5, 1, 3], [[3, 11], [1, 6], [2, 8], [1, 3]]), ('partial-repair probe', [[1, 8, 7, 5, 7, 8], 15, 0, 2, 2, 3], [[2, 10], [2, 13], [1, 7], [1, 8]]), ('partial-repair probe', [[2, 3, 3, 1, 7, 5, 6, 1, 3, 3, 5], 14, 0, 3, 1, 2], [[4, 12], [2, 13], [3, 12], [2, 9]]), ('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]]), ('regression: initial letter consumption', [[3, 4, 3, 1, 5, 7, 5, 6, 6, 5, 5], 19, 2, 4, 2, 2], [[4, 13], [2, 13], [3, 19], [2, 11]]), ('partial-repair probe', [[6, 8, 2, 2, 5, 4, 5, 7], 24, 0, 2, 1, 2], [[4, 21], [4, 24]])], [('regression: initial letter consumption', [[2, 6, 7, 8, 2, 8, 5, 5, 1, 1, 5], 12, 3, 2, 1, 1], [[2, 8], [1, 7], [1, 8], [2, 11], [2, 11], [3, 9]]), ('regression: initial letter consumption', [[7, 2, 3, 8, 2, 8, 7], 22, 2, 5, 1, 1], [[3, 13], [2, 11], [2, 16]]), ('partial-repair probe', [[1, 6, 4, 2, 2, 2, 8], 15, 0, 4, 1, 3], [[2, 8], [4, 13], [1, 8]]), ('partial-repair probe', [[8, 1, 7, 5, 5, 4, 4, 8, 7], 22, 0, 5, 1, 2], [[3, 18], [4, 21], [2, 16]]), ('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]]), ('partial-repair probe', [[3, 7, 4, 7], 24, 0, 2, 2, 4], [[3, 16], [1, 7]]), ('partial-repair probe', [[8, 2, 3, 5, 8, 1, 2], 12, 0, 4, 1, 1], [[2, 11], [2, 9], [2, 10], [1, 2]])], [('regression: initial letter consumption', [[2, 6, 7, 8, 1, 2, 5, 6, 8], 21, 2, 2, 2, 4], [[3, 16], [3, 13], [3, 21]]), ('regression: initial letter consumption', [[7, 6, 8, 6, 7, 6, 3, 5, 3, 6, 4], 13, 2, 4, 1, 1], [[1, 6], [1, 6], [1, 8], [1, 6], [1, 7], [2, 10], [2, 9], [2, 11]]), ('partial-repair probe', [[7, 4, 4, 1], 21, 0, 2, 2, 3], [[3, 17], [1, 1]]), ('partial-repair probe', [[3, 2, 8, 1, 5, 6, 1, 5, 8], 16, 0, 4, 2, 2], [[2, 6], [3, 16], [3, 14], [1, 8]]), ('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]]), ('partial-repair probe', [[7, 6, 7, 4, 5, 3, 3, 5, 3, 5], 23, 0, 3, 2, 4], [[2, 14], [4, 22], [4, 19]]), ('regression: initial letter consumption', [[5, 4, 1, 4, 5, 5, 2, 7], 21, 3, 2, 1, 2], [[4, 16], [3, 14], [1, 7]])], [('regression: initial letter consumption', [[3, 1, 5, 1, 6], 22, 2, 5, 2, 4], [[4, 12], [1, 6]]), ('regression: initial letter consumption', [[6, 6, 3, 1, 6], 19, 2, 5, 1, 3], [[2, 12], [3, 12]]), ('partial-repair probe', [[3, 5, 6, 1, 6, 8, 2, 6, 1], 15, 0, 2, 2, 3], [[2, 9], [3, 15], [2, 11], [2, 8]]), ('partial-repair probe', [[2, 2, 2, 2, 1, 7, 6, 1, 1, 8, 3, 4], 23, 0, 4, 1, 2], [[6, 21], [5, 23], [1, 4]]), ('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]]), ('regression: initial letter consumption', [[4, 3, 6, 1, 3, 3, 4, 6], 15, 3, 4, 1, 3], [[2, 7], [2, 8], [2, 7], [2, 11]]), ('regression: initial letter consumption', [[1, 5, 6, 6, 3, 7], 22, 2, 4, 2, 4], [[3, 13], [2, 10], [1, 7]])]]
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: initial letter consumption | [[1, 6], [2, 6], [2, 11], [2, 11], [1, 5]] | [[1, 6], [2, 6], [2, 11], [2, 11], [1, 5]] | Passed |
| partial-repair probe | [[2, 8], [2, 14]] | [[2, 9], [2, 14]] | Failed |
| partial-repair probe | [[2, 9], [2, 14], [3, 13], [1, 5]] | [[2, 10], [2, 14], [3, 13], [1, 5]] | Failed |
| no cap uses indent | [[2, 8], [2, 11], [1, 2]] | [[2, 9], [2, 11], [1, 2]] | Failed |
| partial-repair probe | [[2, 7], [3, 16], [3, 14], [2, 9]] | [[2, 8], [3, 16], [3, 14], [2, 9]] | Failed |
| partial-repair probe | [[1, 5], [2, 15], [1, 8], [3, 15]] | [[1, 6], [2, 15], [1, 8], [3, 15]] | Failed |
| partial-repair probe | [[4, 18], [2, 10]] | [[3, 11], [3, 18]] | Failed |
SHA-256 / afc8f4adc8489904db706b33f355fabce81bb5a1c5c1239edd1122f8d74a0216
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: initial letter consumption', [[7, 1, 4, 6, 4, 3, 7, 5], 13, 2, 5, 2, 3], [[1, 6], [2, 6], [2, 11], [2, 11], [1, 5]]), ('partial-repair probe', [[7, 1, 8, 5], 16, 0, 5, 1, 3], [[2, 9], [2, 14]]), ('partial-repair probe', [[1, 8, 8, 5, 8, 1, 2, 5], 17, 0, 2, 1, 3], [[2, 10], [2, 14], [3, 13], [1, 5]]), ('no cap uses indent', [[5, 3, 4, 6, 2], 12, 0, 3, 1, 3], [[2, 9], [2, 11], [1, 2]]), ('partial-repair probe', [[5, 2, 6, 6, 2, 6, 3, 3, 5, 3], 16, 0, 2, 1, 3], [[2, 8], [3, 16], [3, 14], [2, 9]]), ('partial-repair probe', [[6, 6, 8, 8, 8, 2, 3], 15, 0, 5, 1, 4], [[1, 6], [2, 15], [1, 8], [3, 15]]), ('partial-repair probe', [[1, 2, 6, 7, 1, 8], 20, 0, 3, 2, 2], [[3, 11], [3, 18]])], [('regression: initial letter consumption', [[8, 1, 6, 4, 1, 7, 7], 24, 2, 5, 2, 1], [[3, 16], [3, 14], [1, 7]]), ('regression: initial letter consumption', [[1, 2, 7, 6, 5, 2, 3], 17, 3, 5, 1, 3], [[3, 11], [1, 6], [2, 8], [1, 3]]), ('partial-repair probe', [[1, 8, 7, 5, 7, 8], 15, 0, 2, 2, 3], [[2, 10], [2, 13], [1, 7], [1, 8]]), ('partial-repair probe', [[2, 3, 3, 1, 7, 5, 6, 1, 3, 3, 5], 14, 0, 3, 1, 2], [[4, 12], [2, 13], [3, 12], [2, 9]]), ('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]]), ('regression: initial letter consumption', [[3, 4, 3, 1, 5, 7, 5, 6, 6, 5, 5], 19, 2, 4, 2, 2], [[4, 13], [2, 13], [3, 19], [2, 11]]), ('partial-repair probe', [[6, 8, 2, 2, 5, 4, 5, 7], 24, 0, 2, 1, 2], [[4, 21], [4, 24]])], [('regression: initial letter consumption', [[2, 6, 7, 8, 2, 8, 5, 5, 1, 1, 5], 12, 3, 2, 1, 1], [[2, 8], [1, 7], [1, 8], [2, 11], [2, 11], [3, 9]]), ('regression: initial letter consumption', [[7, 2, 3, 8, 2, 8, 7], 22, 2, 5, 1, 1], [[3, 13], [2, 11], [2, 16]]), ('partial-repair probe', [[1, 6, 4, 2, 2, 2, 8], 15, 0, 4, 1, 3], [[2, 8], [4, 13], [1, 8]]), ('partial-repair probe', [[8, 1, 7, 5, 5, 4, 4, 8, 7], 22, 0, 5, 1, 2], [[3, 18], [4, 21], [2, 16]]), ('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]]), ('partial-repair probe', [[3, 7, 4, 7], 24, 0, 2, 2, 4], [[3, 16], [1, 7]]), ('partial-repair probe', [[8, 2, 3, 5, 8, 1, 2], 12, 0, 4, 1, 1], [[2, 11], [2, 9], [2, 10], [1, 2]])], [('regression: initial letter consumption', [[2, 6, 7, 8, 1, 2, 5, 6, 8], 21, 2, 2, 2, 4], [[3, 16], [3, 13], [3, 21]]), ('regression: initial letter consumption', [[7, 6, 8, 6, 7, 6, 3, 5, 3, 6, 4], 13, 2, 4, 1, 1], [[1, 6], [1, 6], [1, 8], [1, 6], [1, 7], [2, 10], [2, 9], [2, 11]]), ('partial-repair probe', [[7, 4, 4, 1], 21, 0, 2, 2, 3], [[3, 17], [1, 1]]), ('partial-repair probe', [[3, 2, 8, 1, 5, 6, 1, 5, 8], 16, 0, 4, 2, 2], [[2, 6], [3, 16], [3, 14], [1, 8]]), ('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]]), ('partial-repair probe', [[7, 6, 7, 4, 5, 3, 3, 5, 3, 5], 23, 0, 3, 2, 4], [[2, 14], [4, 22], [4, 19]]), ('regression: initial letter consumption', [[5, 4, 1, 4, 5, 5, 2, 7], 21, 3, 2, 1, 2], [[4, 16], [3, 14], [1, 7]])], [('regression: initial letter consumption', [[3, 1, 5, 1, 6], 22, 2, 5, 2, 4], [[4, 12], [1, 6]]), ('regression: initial letter consumption', [[6, 6, 3, 1, 6], 19, 2, 5, 1, 3], [[2, 12], [3, 12]]), ('partial-repair probe', [[3, 5, 6, 1, 6, 8, 2, 6, 1], 15, 0, 2, 2, 3], [[2, 9], [3, 15], [2, 11], [2, 8]]), ('partial-repair probe', [[2, 2, 2, 2, 1, 7, 6, 1, 1, 8, 3, 4], 23, 0, 4, 1, 2], [[6, 21], [5, 23], [1, 4]]), ('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]]), ('regression: initial letter consumption', [[4, 3, 6, 1, 3, 3, 4, 6], 15, 3, 4, 1, 3], [[2, 7], [2, 8], [2, 7], [2, 11]]), ('regression: initial letter consumption', [[1, 5, 6, 6, 3, 7], 22, 2, 4, 2, 4], [[3, 13], [2, 10], [1, 7]])]]
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: initial letter consumption | [[1, 6], [2, 6], [2, 11], [2, 11], [1, 5]] | [[1, 6], [2, 6], [2, 11], [2, 11], [1, 5]] | Passed |
| partial-repair probe | [[2, 9], [2, 14]] | [[2, 9], [2, 14]] | Passed |
| partial-repair probe | [[2, 10], [2, 14], [3, 13], [1, 5]] | [[2, 10], [2, 14], [3, 13], [1, 5]] | Passed |
| no cap uses indent | [[2, 9], [2, 11], [1, 2]] | [[2, 9], [2, 11], [1, 2]] | Passed |
| partial-repair probe | [[2, 8], [3, 16], [3, 14], [2, 9]] | [[2, 8], [3, 16], [3, 14], [2, 9]] | Passed |
| partial-repair probe | [[1, 6], [2, 15], [1, 8], [3, 15]] | [[1, 6], [2, 15], [1, 8], [3, 15]] | Passed |
| partial-repair probe | [[3, 11], [3, 18]] | [[3, 11], [3, 18]] | Passed |
SHA-256 / 4d5d6bccc37cf5991b0fade8460243c855e8e12c62da218899cf514dab1d5973
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.893641+00:00.
Case digest / 89ffdae90f9b7738c0475a132272615229b70fb64f2e0e60e853c142ecfa72ef