FA-79951 / Typography line breaking / Open access
Consecutive hyphen limit: streak reset on plain break · case 01
Hyphenation stops for the rest of the paragraph after the first ladder.
ROOT CAUSE
Ending a line at a space does not reset the consecutive-hyphen counter.
THE FAILURE
Ending a line at a space does not reset the consecutive-hyphen counter.
Unsuccessful approach: Decrementing instead of resetting still blocks legitimate hyphens later.
Case contract
Input [words as syllable lists, width, limit]. Greedy fill with 1-unit spaces and characters. A word that does not fit may be split at the latest syllable boundary whose head plus "-" fits, only if fewer than limit immediately preceding lines ended in a hyphen and the word is not the paragraph's last word. A line ended without hyphen resets the streak; a word too long for an empty line is set alone. Return the 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, limit = x
queue = [list(w) for w in words]
lines = []
cur = ''
streak = 0
k = 0
while k < len(queue):
syl = queue[k]
token = ''.join(syl)
need = len(token) if cur == '' else len(cur) + 1 + len(token)
if need <= width:
cur = token if cur == '' else cur + ' ' + token
k += 1
continue
split = None
if streak < limit and k < len(queue) - 1:
for cut in range(len(syl) - 1, 0, -1):
head = ''.join(syl[:cut]) + '-'
room = len(head) if cur == '' else len(cur) + len(head) + 1
if room <= width:
split = cut
break
if split is not None:
head = ''.join(syl[:split]) + '-'
lines.append(head if cur == '' else cur + ' ' + head)
queue[k] = syl[split:]
cur = ''
streak += 1
elif cur == '':
lines.append(token)
k += 1
streak = 0
else:
lines.append(cur)
cur, streak = '', streak
if cur:
lines.append(cur)
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('regression: streak reset on plain break', [[['line'], ['set', 'ting'], ['in', 'ter', 'na', 'tion', 'al'], ['jus', 'ti', 'fied'], ['a'], ['kern', 'ing'], ['text'], ['col', 'umn'], ['break', 'ing'], ['text'], ['col', 'umn']], 9, 1], ['line set-', 'ting', 'interna-', 'tional', 'justified', 'a kerning', 'text col-', 'umn', 'breaking', 'text', 'column']), ('regression: streak reset on plain break', [[['to'], ['jus', 'ti', 'fied'], ['set', 'ting'], ['type'], ['hy', 'phen', 'a', 'tion'], ['set', 'ting'], ['in', 'ter', 'na', 'tion', 'al'], ['set', 'ting'], ['kern', 'ing'], ['text'], ['pa', 'ra', 'graph']], 10, 3], ['to justi-', 'fied set-', 'ting type', 'hyphena-', 'tion set-', 'ting in-', 'ternational', 'setting', 'kerning', 'text', 'paragraph']), ('regression: streak reset on plain break', [[['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['lead', 'ing'], ['lead', 'ing'], ['hy', 'phen', 'a', 'tion'], ['of'], ['to']], 6, 3], ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phena-', 'tion', 'of to']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('control layout', [[['hy', 'phen', 'a', 'tion'], ['break', 'ing'], ['of'], ['set', 'ting'], ['col', 'umn'], ['a']], 11, 1], ['hyphenation', 'breaking of', 'setting', 'column a']), ('control layout', [[['col', 'umn'], ['lead', 'ing'], ['of'], ['jus', 'ti', 'fied'], ['line']], 12, 3], ['column lead-', 'ing of jus-', 'tified line']), ('control layout', [[['kern', 'ing'], ['jus', 'ti', 'fied'], ['in', 'ter', 'na', 'tion', 'al'], ['set', 'ting'], ['a'], ['break', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['to'], ['com', 'po', 'si', 'tion']], 10, 3], ['kerning', 'justified', 'interna-', 'tional', 'setting a', 'breaking', 'interna-', 'tional to', 'composition'])], [('regression: streak reset on plain break', [[['a'], ['break', 'ing'], ['text'], ['to'], ['mar', 'gin'], ['set', 'ting'], ['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al']], 6, 3], ['a', 'break-', 'ing', 'text', 'to', 'margin', 'set-', 'ting', 'inter-', 'na-', 'tional', 'international']), ('regression: streak reset on plain break', [[['pa', 'ra', 'graph'], ['hy', 'phen', 'a', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['to'], ['kern', 'ing'], ['mar', 'gin'], ['to'], ['lead', 'ing']], 6, 2], ['para-', 'graph', 'hy-', 'phena-', 'tion', 'inter-', 'na-', 'tional', 'justi-', 'fied', 'hy-', 'phena-', 'tion', 'to', 'kern-', 'ing', 'margin', 'to', 'leading']), ('regression: streak reset on plain break', [[['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al'], ['pa', 'ra', 'graph'], ['set', 'ting'], ['to'], ['mar', 'gin'], ['to'], ['jus', 'ti', 'fied'], ['jus', 'ti', 'fied'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'a', 'tion'], ['text']], 6, 2], ['inter-', 'na-', 'tional', 'inter-', 'na-', 'tional', 'para-', 'graph', 'set-', 'ting', 'to', 'margin', 'to', 'justi-', 'fied', 'justi-', 'fied', 'inter-', 'na-', 'tional', 'hy-', 'phena-', 'tion', 'text']), ('regression: streak reset on plain break', [[['type'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'a', 'tion'], ['type'], ['hy', 'phen', 'a', 'tion'], ['hy', 'phen', 'a', 'tion'], ['lead', 'ing'], ['mar', 'gin'], ['com', 'po', 'si', 'tion'], ['col', 'umn']], 12, 3], ['type inter-', 'national hy-', 'phenation', 'type hyphen-', 'ation hy-', 'phenation', 'leading mar-', 'gin composi-', 'tion column']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('control layout', [[['type'], ['col', 'umn'], ['lead', 'ing'], ['lead', 'ing'], ['of'], ['mar', 'gin'], ['in', 'ter', 'na', 'tion', 'al']], 10, 1], ['type col-', 'umn', 'leading', 'leading of', 'margin', 'international']), ('control layout', [[['a'], ['of'], ['type'], ['to'], ['col', 'umn'], ['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['pa', 'ra', 'graph'], ['break', 'ing'], ['col', 'umn'], ['lead', 'ing'], ['com', 'po', 'si', 'tion']], 8, 3], ['a of', 'type to', 'column', 'interna-', 'tional', 'composi-', 'tion pa-', 'ragraph', 'breaking', 'column', 'leading', 'composition'])], [('regression: streak reset on plain break', [[['set', 'ting'], ['lead', 'ing'], ['jus', 'ti', 'fied'], ['of'], ['in', 'ter', 'na', 'tion', 'al'], ['to'], ['jus', 'ti', 'fied'], ['mar', 'gin'], ['line']], 8, 1], ['setting', 'leading', 'justi-', 'fied of', 'interna-', 'tional', 'to jus-', 'tified', 'margin', 'line']), ('regression: streak reset on plain break', [[['hy', 'phen', 'a', 'tion'], ['hy', 'phen', 'a', 'tion'], ['set', 'ting'], ['jus', 'ti', 'fied'], ['col', 'umn'], ['text'], ['pa', 'ra', 'graph'], ['jus', 'ti', 'fied'], ['a']], 9, 1], ['hyphena-', 'tion', 'hyphena-', 'tion', 'setting', 'justified', 'column', 'text pa-', 'ragraph', 'justified', 'a']), ('regression: streak reset on plain break', [[['set', 'ting'], ['set', 'ting'], ['pa', 'ra', 'graph'], ['col', 'umn'], ['to'], ['type'], ['col', 'umn'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['com', 'po', 'si', 'tion'], ['kern', 'ing'], ['col', 'umn']], 12, 2], ['setting set-', 'ting para-', 'graph column', 'to type col-', 'umn interna-', 'tional a', 'composition', 'kerning', 'column']), ('regression: streak reset on plain break', [[['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['lead', 'ing'], ['lead', 'ing'], ['hy', 'phen', 'a', 'tion'], ['of'], ['to']], 6, 3], ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phena-', 'tion', 'of to']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('control layout', [[['col', 'umn'], ['pa', 'ra', 'graph'], ['text'], ['pa', 'ra', 'graph'], ['break', 'ing'], ['of'], ['hy', 'phen', 'a', 'tion'], ['kern', 'ing'], ['of'], ['jus', 'ti', 'fied'], ['in', 'ter', 'na', 'tion', 'al']], 11, 2], ['column pa-', 'ragraph', 'text para-', 'graph', 'breaking of', 'hyphenation', 'kerning of', 'justified', 'international']), ('control layout', [[['in', 'ter', 'na', 'tion', 'al'], ['of'], ['mar', 'gin'], ['set', 'ting'], ['pa', 'ra', 'graph'], ['com', 'po', 'si', 'tion']], 13, 2], ['international', 'of margin', 'setting para-', 'graph', 'composition'])], [('regression: streak reset on plain break', [[['line'], ['mar', 'gin'], ['lead', 'ing'], ['pa', 'ra', 'graph'], ['hy', 'phen', 'a', 'tion'], ['of'], ['jus', 'ti', 'fied'], ['pa', 'ra', 'graph'], ['a'], ['type']], 7, 1], ['line', 'margin', 'leading', 'para-', 'graph', 'hyphen-', 'ation', 'of jus-', 'tified', 'para-', 'graph a', 'type']), ('regression: streak reset on plain break', [[['a'], ['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['of'], ['text'], ['line'], ['pa', 'ra', 'graph'], ['of']], 7, 1], ['a jus-', 'tified', 'hyphen-', 'ation', 'inter-', 'national', 'of text', 'line', 'para-', 'graph', 'of']), ('regression: streak reset on plain break', [[['of'], ['jus', 'ti', 'fied'], ['set', 'ting'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['pa', 'ra', 'graph'], ['break', 'ing']], 8, 3], ['of jus-', 'tified', 'setting', 'composi-', 'tion in-', 'terna-', 'tional', 'composi-', 'tion in-', 'terna-', 'tional', 'para-', 'graph', 'breaking']), ('regression: streak reset on plain break', [[['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['lead', 'ing'], ['lead', 'ing'], ['hy', 'phen', 'a', 'tion'], ['of'], ['to']], 6, 3], ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phena-', 'tion', 'of to']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('control layout', [[['pa', 'ra', 'graph'], ['line'], ['col', 'umn'], ['jus', 'ti', 'fied'], ['mar', 'gin'], ['mar', 'gin'], ['to'], ['a'], ['col', 'umn'], ['hy', 'phen', 'a', 'tion'], ['jus', 'ti', 'fied'], ['break', 'ing']], 11, 3], ['paragraph', 'line column', 'justified', 'margin mar-', 'gin to a', 'column hy-', 'phenation', 'justified', 'breaking']), ('control layout', [[['jus', 'ti', 'fied'], ['col', 'umn'], ['line'], ['mar', 'gin'], ['hy', 'phen', 'a', 'tion'], ['a'], ['jus', 'ti', 'fied'], ['pa', 'ra', 'graph'], ['type'], ['mar', 'gin']], 11, 2], ['justified', 'column line', 'margin hy-', 'phenation a', 'justified', 'paragraph', 'type margin'])], [('regression: streak reset on plain break', [[['col', 'umn'], ['of'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['lead', 'ing'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['set', 'ting'], ['line'], ['col', 'umn']], 6, 3], ['column', 'of', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'a', 'lead-', 'ing', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'set-', 'ting', 'line', 'column']), ('regression: streak reset on plain break', [[['hy', 'phen', 'a', 'tion'], ['lead', 'ing'], ['col', 'umn'], ['of'], ['set', 'ting'], ['pa', 'ra', 'graph'], ['kern', 'ing']], 13, 1], ['hyphenation', 'leading col-', 'umn of', 'setting para-', 'graph kerning']), ('regression: streak reset on plain break', [[['in', 'ter', 'na', 'tion', 'al'], ['to'], ['com', 'po', 'si', 'tion'], ['jus', 'ti', 'fied'], ['jus', 'ti', 'fied'], ['break', 'ing'], ['pa', 'ra', 'graph'], ['type']], 7, 2], ['inter-', 'nation-', 'al to', 'compo-', 'sition', 'justi-', 'fied', 'justi-', 'fied', 'break-', 'ing pa-', 'ragraph', 'type']), ('regression: streak reset on plain break', [[['col', 'umn'], ['kern', 'ing'], ['com', 'po', 'si', 'tion'], ['a'], ['in', 'ter', 'na', 'tion', 'al'], ['lead', 'ing'], ['kern', 'ing'], ['hy', 'phen', 'a', 'tion'], ['text'], ['mar', 'gin'], ['to']], 13, 3], ['column kern-', 'ing composi-', 'tion a inter-', 'national', 'leading kern-', 'ing hyphena-', 'tion text', 'margin to']), ('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('control layout', [[['mar', 'gin'], ['pa', 'ra', 'graph'], ['jus', 'ti', 'fied'], ['kern', 'ing'], ['col', 'umn'], ['jus', 'ti', 'fied'], ['text'], ['a'], ['jus', 'ti', 'fied'], ['break', 'ing']], 11, 2], ['margin pa-', 'ragraph', 'justified', 'kerning', 'column jus-', 'tified text', 'a justified', 'breaking']), ('control layout', [[['lead', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['break', 'ing'], ['mar', 'gin'], ['pa', 'ra', 'graph'], ['lead', 'ing']], 10, 3], ['leading', 'interna-', 'tional', 'composi-', 'tion', 'breaking', 'margin pa-', 'ragraph', 'leading'])]]
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 |
|---|---|---|---|
| ladder of three hyphenated lines | ['inter-', 'nation-', 'al', 'composition', 'hyphen-', 'ation', 'text'] | ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text'] | Failed |
| regression: streak reset on plain break | ['line set-', 'ting', 'international', 'justified', 'a kerning', 'text col-', 'umn', 'breaking', 'text', 'column'] | ['line set-', 'ting', 'interna-', 'tional', 'justified', 'a kerning', 'text col-', 'umn', 'breaking', 'text', 'column'] | Failed |
| regression: streak reset on plain break | ['to justi-', 'fied set-', 'ting type', 'hyphena-', 'tion', 'setting', 'international', 'setting', 'kerning', 'text', 'paragraph'] | ['to justi-', 'fied set-', 'ting type', 'hyphena-', 'tion set-', 'ting in-', 'ternational', 'setting', 'kerning', 'text', 'paragraph'] | Failed |
| regression: streak reset on plain break | ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'composition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'leading', 'hy-', 'phena-', 'tion', 'of to'] | ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phena-', 'tion', 'of to'] | Failed |
| last word never hyphenated | ['a', 'composition'] | ['a', 'composition'] | Passed |
| control layout | ['hyphenation', 'breaking of', 'setting', 'column a'] | ['hyphenation', 'breaking of', 'setting', 'column a'] | Passed |
| control layout | ['column lead-', 'ing of jus-', 'tified line'] | ['column lead-', 'ing of jus-', 'tified line'] | Passed |
| control layout | ['kerning', 'justified', 'interna-', 'tional', 'setting a', 'breaking', 'interna-', 'tional to', 'composition'] | ['kerning', 'justified', 'interna-', 'tional', 'setting a', 'breaking', 'interna-', 'tional to', 'composition'] | Passed |
SHA-256 / 134321ddc73ff1f8ccb473d832e4ee3252c97df5b4c26cb78286e13de2bd98d5
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width, limit = x
queue = [list(w) for w in words]
lines = []
cur = ''
streak = 0
k = 0
while k < len(queue):
syl = queue[k]
token = ''.join(syl)
need = len(token) if cur == '' else len(cur) + 1 + len(token)
if need <= width:
cur = token if cur == '' else cur + ' ' + token
k += 1
continue
split = None
if streak < limit and k < len(queue) - 1:
for cut in range(len(syl) - 1, 0, -1):
head = ''.join(syl[:cut]) + '-'
room = len(head) if cur == '' else len(cur) + len(head) + 1
if room <= width:
split = cut
break
if split is not None:
head = ''.join(syl[:split]) + '-'
lines.append(head if cur == '' else cur + ' ' + head)
queue[k] = syl[split:]
cur = ''
streak += 1
elif cur == '':
lines.append(token)
k += 1
streak = 0
else:
lines.append(cur)
cur, streak = '', max(streak - 1, 0)
if cur:
lines.append(cur)
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('regression: streak reset on plain break', [[['line'], ['set', 'ting'], ['in', 'ter', 'na', 'tion', 'al'], ['jus', 'ti', 'fied'], ['a'], ['kern', 'ing'], ['text'], ['col', 'umn'], ['break', 'ing'], ['text'], ['col', 'umn']], 9, 1], ['line set-', 'ting', 'interna-', 'tional', 'justified', 'a kerning', 'text col-', 'umn', 'breaking', 'text', 'column']), ('regression: streak reset on plain break', [[['to'], ['jus', 'ti', 'fied'], ['set', 'ting'], ['type'], ['hy', 'phen', 'a', 'tion'], ['set', 'ting'], ['in', 'ter', 'na', 'tion', 'al'], ['set', 'ting'], ['kern', 'ing'], ['text'], ['pa', 'ra', 'graph']], 10, 3], ['to justi-', 'fied set-', 'ting type', 'hyphena-', 'tion set-', 'ting in-', 'ternational', 'setting', 'kerning', 'text', 'paragraph']), ('regression: streak reset on plain break', [[['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['lead', 'ing'], ['lead', 'ing'], ['hy', 'phen', 'a', 'tion'], ['of'], ['to']], 6, 3], ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phena-', 'tion', 'of to']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('control layout', [[['hy', 'phen', 'a', 'tion'], ['break', 'ing'], ['of'], ['set', 'ting'], ['col', 'umn'], ['a']], 11, 1], ['hyphenation', 'breaking of', 'setting', 'column a']), ('control layout', [[['col', 'umn'], ['lead', 'ing'], ['of'], ['jus', 'ti', 'fied'], ['line']], 12, 3], ['column lead-', 'ing of jus-', 'tified line']), ('control layout', [[['kern', 'ing'], ['jus', 'ti', 'fied'], ['in', 'ter', 'na', 'tion', 'al'], ['set', 'ting'], ['a'], ['break', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['to'], ['com', 'po', 'si', 'tion']], 10, 3], ['kerning', 'justified', 'interna-', 'tional', 'setting a', 'breaking', 'interna-', 'tional to', 'composition'])], [('regression: streak reset on plain break', [[['a'], ['break', 'ing'], ['text'], ['to'], ['mar', 'gin'], ['set', 'ting'], ['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al']], 6, 3], ['a', 'break-', 'ing', 'text', 'to', 'margin', 'set-', 'ting', 'inter-', 'na-', 'tional', 'international']), ('regression: streak reset on plain break', [[['pa', 'ra', 'graph'], ['hy', 'phen', 'a', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['to'], ['kern', 'ing'], ['mar', 'gin'], ['to'], ['lead', 'ing']], 6, 2], ['para-', 'graph', 'hy-', 'phena-', 'tion', 'inter-', 'na-', 'tional', 'justi-', 'fied', 'hy-', 'phena-', 'tion', 'to', 'kern-', 'ing', 'margin', 'to', 'leading']), ('regression: streak reset on plain break', [[['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al'], ['pa', 'ra', 'graph'], ['set', 'ting'], ['to'], ['mar', 'gin'], ['to'], ['jus', 'ti', 'fied'], ['jus', 'ti', 'fied'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'a', 'tion'], ['text']], 6, 2], ['inter-', 'na-', 'tional', 'inter-', 'na-', 'tional', 'para-', 'graph', 'set-', 'ting', 'to', 'margin', 'to', 'justi-', 'fied', 'justi-', 'fied', 'inter-', 'na-', 'tional', 'hy-', 'phena-', 'tion', 'text']), ('regression: streak reset on plain break', [[['type'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'a', 'tion'], ['type'], ['hy', 'phen', 'a', 'tion'], ['hy', 'phen', 'a', 'tion'], ['lead', 'ing'], ['mar', 'gin'], ['com', 'po', 'si', 'tion'], ['col', 'umn']], 12, 3], ['type inter-', 'national hy-', 'phenation', 'type hyphen-', 'ation hy-', 'phenation', 'leading mar-', 'gin composi-', 'tion column']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('control layout', [[['type'], ['col', 'umn'], ['lead', 'ing'], ['lead', 'ing'], ['of'], ['mar', 'gin'], ['in', 'ter', 'na', 'tion', 'al']], 10, 1], ['type col-', 'umn', 'leading', 'leading of', 'margin', 'international']), ('control layout', [[['a'], ['of'], ['type'], ['to'], ['col', 'umn'], ['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['pa', 'ra', 'graph'], ['break', 'ing'], ['col', 'umn'], ['lead', 'ing'], ['com', 'po', 'si', 'tion']], 8, 3], ['a of', 'type to', 'column', 'interna-', 'tional', 'composi-', 'tion pa-', 'ragraph', 'breaking', 'column', 'leading', 'composition'])], [('regression: streak reset on plain break', [[['set', 'ting'], ['lead', 'ing'], ['jus', 'ti', 'fied'], ['of'], ['in', 'ter', 'na', 'tion', 'al'], ['to'], ['jus', 'ti', 'fied'], ['mar', 'gin'], ['line']], 8, 1], ['setting', 'leading', 'justi-', 'fied of', 'interna-', 'tional', 'to jus-', 'tified', 'margin', 'line']), ('regression: streak reset on plain break', [[['hy', 'phen', 'a', 'tion'], ['hy', 'phen', 'a', 'tion'], ['set', 'ting'], ['jus', 'ti', 'fied'], ['col', 'umn'], ['text'], ['pa', 'ra', 'graph'], ['jus', 'ti', 'fied'], ['a']], 9, 1], ['hyphena-', 'tion', 'hyphena-', 'tion', 'setting', 'justified', 'column', 'text pa-', 'ragraph', 'justified', 'a']), ('regression: streak reset on plain break', [[['set', 'ting'], ['set', 'ting'], ['pa', 'ra', 'graph'], ['col', 'umn'], ['to'], ['type'], ['col', 'umn'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['com', 'po', 'si', 'tion'], ['kern', 'ing'], ['col', 'umn']], 12, 2], ['setting set-', 'ting para-', 'graph column', 'to type col-', 'umn interna-', 'tional a', 'composition', 'kerning', 'column']), ('regression: streak reset on plain break', [[['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['lead', 'ing'], ['lead', 'ing'], ['hy', 'phen', 'a', 'tion'], ['of'], ['to']], 6, 3], ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phena-', 'tion', 'of to']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('control layout', [[['col', 'umn'], ['pa', 'ra', 'graph'], ['text'], ['pa', 'ra', 'graph'], ['break', 'ing'], ['of'], ['hy', 'phen', 'a', 'tion'], ['kern', 'ing'], ['of'], ['jus', 'ti', 'fied'], ['in', 'ter', 'na', 'tion', 'al']], 11, 2], ['column pa-', 'ragraph', 'text para-', 'graph', 'breaking of', 'hyphenation', 'kerning of', 'justified', 'international']), ('control layout', [[['in', 'ter', 'na', 'tion', 'al'], ['of'], ['mar', 'gin'], ['set', 'ting'], ['pa', 'ra', 'graph'], ['com', 'po', 'si', 'tion']], 13, 2], ['international', 'of margin', 'setting para-', 'graph', 'composition'])], [('regression: streak reset on plain break', [[['line'], ['mar', 'gin'], ['lead', 'ing'], ['pa', 'ra', 'graph'], ['hy', 'phen', 'a', 'tion'], ['of'], ['jus', 'ti', 'fied'], ['pa', 'ra', 'graph'], ['a'], ['type']], 7, 1], ['line', 'margin', 'leading', 'para-', 'graph', 'hyphen-', 'ation', 'of jus-', 'tified', 'para-', 'graph a', 'type']), ('regression: streak reset on plain break', [[['a'], ['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['of'], ['text'], ['line'], ['pa', 'ra', 'graph'], ['of']], 7, 1], ['a jus-', 'tified', 'hyphen-', 'ation', 'inter-', 'national', 'of text', 'line', 'para-', 'graph', 'of']), ('regression: streak reset on plain break', [[['of'], ['jus', 'ti', 'fied'], ['set', 'ting'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['pa', 'ra', 'graph'], ['break', 'ing']], 8, 3], ['of jus-', 'tified', 'setting', 'composi-', 'tion in-', 'terna-', 'tional', 'composi-', 'tion in-', 'terna-', 'tional', 'para-', 'graph', 'breaking']), ('regression: streak reset on plain break', [[['jus', 'ti', 'fied'], ['hy', 'phen', 'a', 'tion'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['lead', 'ing'], ['lead', 'ing'], ['hy', 'phen', 'a', 'tion'], ['of'], ['to']], 6, 3], ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phena-', 'tion', 'of to']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('control layout', [[['pa', 'ra', 'graph'], ['line'], ['col', 'umn'], ['jus', 'ti', 'fied'], ['mar', 'gin'], ['mar', 'gin'], ['to'], ['a'], ['col', 'umn'], ['hy', 'phen', 'a', 'tion'], ['jus', 'ti', 'fied'], ['break', 'ing']], 11, 3], ['paragraph', 'line column', 'justified', 'margin mar-', 'gin to a', 'column hy-', 'phenation', 'justified', 'breaking']), ('control layout', [[['jus', 'ti', 'fied'], ['col', 'umn'], ['line'], ['mar', 'gin'], ['hy', 'phen', 'a', 'tion'], ['a'], ['jus', 'ti', 'fied'], ['pa', 'ra', 'graph'], ['type'], ['mar', 'gin']], 11, 2], ['justified', 'column line', 'margin hy-', 'phenation a', 'justified', 'paragraph', 'type margin'])], [('regression: streak reset on plain break', [[['col', 'umn'], ['of'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['lead', 'ing'], ['com', 'po', 'si', 'tion'], ['in', 'ter', 'na', 'tion', 'al'], ['set', 'ting'], ['line'], ['col', 'umn']], 6, 3], ['column', 'of', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'a', 'lead-', 'ing', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'set-', 'ting', 'line', 'column']), ('regression: streak reset on plain break', [[['hy', 'phen', 'a', 'tion'], ['lead', 'ing'], ['col', 'umn'], ['of'], ['set', 'ting'], ['pa', 'ra', 'graph'], ['kern', 'ing']], 13, 1], ['hyphenation', 'leading col-', 'umn of', 'setting para-', 'graph kerning']), ('regression: streak reset on plain break', [[['in', 'ter', 'na', 'tion', 'al'], ['to'], ['com', 'po', 'si', 'tion'], ['jus', 'ti', 'fied'], ['jus', 'ti', 'fied'], ['break', 'ing'], ['pa', 'ra', 'graph'], ['type']], 7, 2], ['inter-', 'nation-', 'al to', 'compo-', 'sition', 'justi-', 'fied', 'justi-', 'fied', 'break-', 'ing pa-', 'ragraph', 'type']), ('regression: streak reset on plain break', [[['col', 'umn'], ['kern', 'ing'], ['com', 'po', 'si', 'tion'], ['a'], ['in', 'ter', 'na', 'tion', 'al'], ['lead', 'ing'], ['kern', 'ing'], ['hy', 'phen', 'a', 'tion'], ['text'], ['mar', 'gin'], ['to']], 13, 3], ['column kern-', 'ing composi-', 'tion a inter-', 'national', 'leading kern-', 'ing hyphena-', 'tion text', 'margin to']), ('ladder of three hyphenated lines', [[['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['hy', 'phen', 'a', 'tion'], ['text']], 7, 2], ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text']), ('last word never hyphenated', [[['a'], ['com', 'po', 'si', 'tion']], 8, 2], ['a', 'composition']), ('control layout', [[['mar', 'gin'], ['pa', 'ra', 'graph'], ['jus', 'ti', 'fied'], ['kern', 'ing'], ['col', 'umn'], ['jus', 'ti', 'fied'], ['text'], ['a'], ['jus', 'ti', 'fied'], ['break', 'ing']], 11, 2], ['margin pa-', 'ragraph', 'justified', 'kerning', 'column jus-', 'tified text', 'a justified', 'breaking']), ('control layout', [[['lead', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['com', 'po', 'si', 'tion'], ['break', 'ing'], ['mar', 'gin'], ['pa', 'ra', 'graph'], ['lead', 'ing']], 10, 3], ['leading', 'interna-', 'tional', 'composi-', 'tion', 'breaking', 'margin pa-', 'ragraph', 'leading'])]]
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 |
|---|---|---|---|
| ladder of three hyphenated lines | ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text'] | ['inter-', 'nation-', 'al', 'compo-', 'sition', 'hyphen-', 'ation', 'text'] | Passed |
| regression: streak reset on plain break | ['line set-', 'ting', 'interna-', 'tional', 'justified', 'a kerning', 'text col-', 'umn', 'breaking', 'text', 'column'] | ['line set-', 'ting', 'interna-', 'tional', 'justified', 'a kerning', 'text col-', 'umn', 'breaking', 'text', 'column'] | Passed |
| regression: streak reset on plain break | ['to justi-', 'fied set-', 'ting type', 'hyphena-', 'tion set-', 'ting', 'interna-', 'tional', 'setting', 'kerning', 'text', 'paragraph'] | ['to justi-', 'fied set-', 'ting type', 'hyphena-', 'tion set-', 'ting in-', 'ternational', 'setting', 'kerning', 'text', 'paragraph'] | Failed |
| regression: streak reset on plain break | ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phenation', 'of to'] | ['justi-', 'fied', 'hy-', 'phena-', 'tion', 'compo-', 'sition', 'inter-', 'na-', 'tional', 'lead-', 'ing', 'lead-', 'ing', 'hy-', 'phena-', 'tion', 'of to'] | Failed |
| last word never hyphenated | ['a', 'composition'] | ['a', 'composition'] | Passed |
| control layout | ['hyphenation', 'breaking of', 'setting', 'column a'] | ['hyphenation', 'breaking of', 'setting', 'column a'] | Passed |
| control layout | ['column lead-', 'ing of jus-', 'tified line'] | ['column lead-', 'ing of jus-', 'tified line'] | Passed |
| control layout | ['kerning', 'justified', 'interna-', 'tional', 'setting a', 'breaking', 'interna-', 'tional to', 'composition'] | ['kerning', 'justified', 'interna-', 'tional', 'setting a', 'breaking', 'interna-', 'tional to', 'composition'] | Passed |
SHA-256 / 23c4fa22d11242818cbe9dd3d429110c1fb86aeb8fe3ed84026b7ae01850ffda
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:49.324157+00:00.
Case digest / 06814f4653b8367fd1849103004842cab044791144801a6041bf2d1875293092