FA-80076 / Typography line breaking / Open access
Justified interword spacing: minimum space check · case 01
Lines set at exactly the minimum space are rejected as overfull.
ROOT CAUSE
The minimum-space test uses <=.
THE FAILURE
The minimum-space test uses <=.
Unsuccessful approach: Comparing the whole space budget with the minimum misses multi-gap lines.
Case contract
Input [word widths, target width, is_last, natural space, min space, max space]. Last lines and single-word lines are set ragged with natural spaces. Otherwise distribute target-sum(words) over the gaps: equal share with the remainder units added to the rightmost gaps; a share below min space is ["overfull"]; if any gap would exceed max space fall back to ragged. Return word x positions.
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, target, is_last, sp, lo, hi = x
n = len(words)
gaps = n - 1
def natural():
pos, xx = [], 0
for w in words:
pos.append(xx)
xx += w + sp
return pos
if is_last or gaps == 0:
return natural()
space = target - sum(words)
per, rem = divmod(space, gaps)
if per <= lo:
return ['overfull']
if per + (1 if rem else 0) > hi:
return natural()
pos, xx = [], 0
for k, w in enumerate(words):
pos.append(xx)
if k < gaps:
xx += w + per + (1 if k >= gaps - rem else 0)
return pos
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('regression: minimum space check', [[5, 2], 10, False, 3, 3, 7], [0, 8]), ('partial-repair probe', [[7, 2, 5, 6, 9], 33, False, 2, 2, 3], ['overfull']), ('partial-repair probe', [[2, 5, 2], 12, False, 2, 2, 4], ['overfull']), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('control layout', [[5, 7, 9, 9, 7], 53, False, 2, 2, 5], [0, 9, 20, 33, 46]), ('control layout', [[8, 7, 3], 35, True, 2, 1, 6], [0, 10, 19])], [('regression: minimum space check', [[4, 6, 3], 20, False, 3, 3, 7], [0, 7, 17]), ('regression: minimum space check', [[8, 2], 12, False, 3, 2, 5], [0, 10]), ('partial-repair probe', [[7, 8, 8, 5, 8, 3], 41, False, 2, 1, 6], ['overfull']), ('partial-repair probe', [[9, 6, 3, 5], 28, False, 2, 2, 5], ['overfull']), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('control layout', [[6, 3], 10, True, 3, 3, 4], [0, 9]), ('control layout', [[4], 7, False, 2, 1, 3], [0])], [('regression: minimum space check', [[5, 7, 5, 6, 9, 5], 43, False, 3, 1, 6], [0, 6, 14, 20, 27, 38]), ('regression: minimum space check', [[6, 4, 4, 7, 3, 5], 38, False, 3, 1, 6], [0, 7, 13, 19, 28, 33]), ('partial-repair probe', [[6, 5, 9], 23, False, 2, 2, 3], ['overfull']), ('partial-repair probe', [[8, 6, 4], 22, False, 3, 3, 5], ['overfull']), ('last line ragged', [[3, 4, 5], 20, True, 2, 1, 6], [0, 5, 11]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[7], 10, False, 2, 1, 4], [0]), ('control layout', [[7], 10, False, 3, 3, 7], [0])], [('regression: minimum space check', [[4, 6, 3], 20, False, 3, 3, 7], [0, 7, 17]), ('regression: minimum space check', [[2, 2, 5, 5, 2], 24, False, 3, 2, 7], [0, 4, 8, 15, 22]), ('partial-repair probe', [[8, 5, 3, 2, 5, 9], 35, False, 2, 1, 3], ['overfull']), ('partial-repair probe', [[5, 7, 8, 5, 5], 31, False, 3, 1, 5], ['overfull']), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[4, 7, 7, 4, 6, 3], 50, False, 2, 2, 3], [0, 6, 15, 24, 30, 38]), ('control layout', [[5, 6, 7], 24, False, 3, 2, 7], [0, 8, 17])], [('regression: minimum space check', [[6, 3, 2], 14, False, 2, 1, 5], [0, 7, 12]), ('regression: minimum space check', [[9, 5], 17, False, 3, 3, 5], [0, 12]), ('partial-repair probe', [[4, 8, 8], 23, False, 2, 2, 5], ['overfull']), ('partial-repair probe', [[7, 2, 5, 6, 9], 33, False, 2, 2, 3], ['overfull']), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[9], 9, False, 3, 3, 6], [0]), ('control layout', [[3, 9, 2, 3], 26, False, 3, 2, 5], [0, 6, 18, 23])]]
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 |
|---|---|---|---|
| exactly minimum share | ['overfull'] | [0, 4, 8] | Failed |
| regression: minimum space check | ['overfull'] | [0, 8] | Failed |
| partial-repair probe | ['overfull'] | ['overfull'] | Passed |
| partial-repair probe | ['overfull'] | ['overfull'] | Passed |
| remainder goes to right gaps | [0, 5, 11, 18] | [0, 5, 11, 18] | Passed |
| single word line | [0] | [0] | Passed |
| control layout | [0, 9, 20, 33, 46] | [0, 9, 20, 33, 46] | Passed |
| control layout | [0, 10, 19] | [0, 10, 19] | Passed |
SHA-256 / ac0577b6842adb73818b9a154a77ad22fd4568cc35aa4edbe60711f6e12bedc1
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, target, is_last, sp, lo, hi = x
n = len(words)
gaps = n - 1
def natural():
pos, xx = [], 0
for w in words:
pos.append(xx)
xx += w + sp
return pos
if is_last or gaps == 0:
return natural()
space = target - sum(words)
per, rem = divmod(space, gaps)
if space < lo:
return ['overfull']
if per + (1 if rem else 0) > hi:
return natural()
pos, xx = [], 0
for k, w in enumerate(words):
pos.append(xx)
if k < gaps:
xx += w + per + (1 if k >= gaps - rem else 0)
return pos
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('regression: minimum space check', [[5, 2], 10, False, 3, 3, 7], [0, 8]), ('partial-repair probe', [[7, 2, 5, 6, 9], 33, False, 2, 2, 3], ['overfull']), ('partial-repair probe', [[2, 5, 2], 12, False, 2, 2, 4], ['overfull']), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('control layout', [[5, 7, 9, 9, 7], 53, False, 2, 2, 5], [0, 9, 20, 33, 46]), ('control layout', [[8, 7, 3], 35, True, 2, 1, 6], [0, 10, 19])], [('regression: minimum space check', [[4, 6, 3], 20, False, 3, 3, 7], [0, 7, 17]), ('regression: minimum space check', [[8, 2], 12, False, 3, 2, 5], [0, 10]), ('partial-repair probe', [[7, 8, 8, 5, 8, 3], 41, False, 2, 1, 6], ['overfull']), ('partial-repair probe', [[9, 6, 3, 5], 28, False, 2, 2, 5], ['overfull']), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('control layout', [[6, 3], 10, True, 3, 3, 4], [0, 9]), ('control layout', [[4], 7, False, 2, 1, 3], [0])], [('regression: minimum space check', [[5, 7, 5, 6, 9, 5], 43, False, 3, 1, 6], [0, 6, 14, 20, 27, 38]), ('regression: minimum space check', [[6, 4, 4, 7, 3, 5], 38, False, 3, 1, 6], [0, 7, 13, 19, 28, 33]), ('partial-repair probe', [[6, 5, 9], 23, False, 2, 2, 3], ['overfull']), ('partial-repair probe', [[8, 6, 4], 22, False, 3, 3, 5], ['overfull']), ('last line ragged', [[3, 4, 5], 20, True, 2, 1, 6], [0, 5, 11]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[7], 10, False, 2, 1, 4], [0]), ('control layout', [[7], 10, False, 3, 3, 7], [0])], [('regression: minimum space check', [[4, 6, 3], 20, False, 3, 3, 7], [0, 7, 17]), ('regression: minimum space check', [[2, 2, 5, 5, 2], 24, False, 3, 2, 7], [0, 4, 8, 15, 22]), ('partial-repair probe', [[8, 5, 3, 2, 5, 9], 35, False, 2, 1, 3], ['overfull']), ('partial-repair probe', [[5, 7, 8, 5, 5], 31, False, 3, 1, 5], ['overfull']), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[4, 7, 7, 4, 6, 3], 50, False, 2, 2, 3], [0, 6, 15, 24, 30, 38]), ('control layout', [[5, 6, 7], 24, False, 3, 2, 7], [0, 8, 17])], [('regression: minimum space check', [[6, 3, 2], 14, False, 2, 1, 5], [0, 7, 12]), ('regression: minimum space check', [[9, 5], 17, False, 3, 3, 5], [0, 12]), ('partial-repair probe', [[4, 8, 8], 23, False, 2, 2, 5], ['overfull']), ('partial-repair probe', [[7, 2, 5, 6, 9], 33, False, 2, 2, 3], ['overfull']), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[9], 9, False, 3, 3, 6], [0]), ('control layout', [[3, 9, 2, 3], 26, False, 3, 2, 5], [0, 6, 18, 23])]]
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 |
|---|---|---|---|
| exactly minimum share | [0, 4, 8] | [0, 4, 8] | Passed |
| regression: minimum space check | [0, 8] | [0, 8] | Passed |
| partial-repair probe | [0, 8, 11, 17, 24] | ['overfull'] | Failed |
| partial-repair probe | [0, 3, 10] | ['overfull'] | Failed |
| remainder goes to right gaps | [0, 5, 11, 18] | [0, 5, 11, 18] | Passed |
| single word line | [0] | [0] | Passed |
| control layout | [0, 9, 20, 33, 46] | [0, 9, 20, 33, 46] | Passed |
| control layout | [0, 10, 19] | [0, 10, 19] | Passed |
SHA-256 / 88e135d7023edeee38bcdfbfe1f59f9d031920ba927b6829fd1cdb085a60f9e8
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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.333908+00:00.
Case digest / ba2e243bab634108d2a64279d7180098d60e7dd6b8910cb8b0da4b2d99a339be