FAILURE MAP
← Case archive

FA-80206 / Typography line breaking / Open access

Ties and discretionary hyphens: chunk fit comparison · case 01

Chunks that exactly fill the line are wrapped.

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

ROOT CAUSE

The chunk fit uses a strict comparison.

VERIFIED REPAIR

Accept a line equal to the width.

Unsuccessful approach: Accepting one unit over overfills lines.

Case contract

Input [source, width]. Runs of spaces are one breakable space; "~" is an unbreakable space rendered " "; "\-" is a discretionary hyphen: invisible unless the line breaks there, then rendered "-"; "|" is an invisible break opportunity. Greedy: append the next chunk if the line (without a potential hyphen) fits, else break at that opportunity. Return rendered 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):
    src, width = x
    chunks = ['']
    ops = []
    i = 0
    while i < len(src):
        c = src[i]
        if src.startswith('\\-', i):
            ops.append('d')
            chunks.append('')
            i += 2
            continue
        if c == ' ':
            j = i
            while j < len(src) and src[j] == ' ':
                j += 1
            ops.append('s')
            chunks.append('')
            i = j
            continue
        if c == '|':
            ops.append('z')
            chunks.append('')
            i += 1
            continue
        chunks[-1] += ' ' if c == '~' else c
        i += 1
    line = chunks[0]
    lines = []
    for op, ch in zip(ops, chunks[1:]):
        sep = ' ' if op == 's' else ''
        if len(line + sep + ch) < width:
            line = line + sep + ch
        else:
            lines.append(line + ('-' if op == 'd' else ''))
            line = ch
    lines.append(line)
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('regression: chunk fit comparison', ['set ~com\\-po\\-si\\-tion a word  hy\\-phen Dr.~Knuth b|c', 16], ['set  composition', 'a word hyphen', 'Dr. Knuth bc']), ('partial-repair probe', ['hy\\-phen x hy\\-phen  x a ~com\\-po\\-si\\-tion  hy\\-phen  word ~type', 5], ['hy-', 'phen', 'x hy-', 'phen', 'x a', ' com-', 'posi-', 'tion', 'hy-', 'phen', 'word', ' type']), ('partial-repair probe', ['x url|path hy\\-phen ~com\\-po\\-si\\-tion  b|c  ink  com\\-po\\-si\\-tion hy\\-phen word', 10], ['x urlpath', 'hyphen', ' composi-', 'tion bc', 'ink compo-', 'sition hy-', 'phen word']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['10~pt ink 10~pt  Dr.~Knuth', 5], ['10 pt', 'ink', '10 pt', 'Dr. Knuth']), ('control layout', ['word b|c  Dr.~Knuth word 10~pt', 8], ['word bc', 'Dr. Knuth', 'word', '10 pt'])], [('regression: chunk fit comparison', ['x  word word word', 6], ['x word', 'word', 'word']), ('regression: chunk fit comparison', ['com\\-po\\-si\\-tion  set a', 10], ['composi-', 'tion set a']), ('partial-repair probe', ['set type  a  a  type  Dr.~Knuth  Dr.~Knuth a', 9], ['set type', 'a a type', 'Dr. Knuth', 'Dr. Knuth', 'a']), ('regression: chunk fit comparison', ['hy\\-phen  a ~set url|path ~url|path', 16], ['hyphen a  set', 'urlpath  urlpath']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['ink  ~Dr.~Knuth  ~Dr.~Knuth', 11], ['ink', ' Dr. Knuth', ' Dr. Knuth']), ('control layout', ['x Dr.~Knuth word  hy\\-phen', 8], ['x', 'Dr. Knuth', 'word hy-', 'phen'])], [('regression: chunk fit comparison', ['ink  a b|c  url|path ~url|path 10~pt word', 5], ['ink a', 'bc', 'url', 'path', ' url', 'path', '10 pt', 'word']), ('regression: chunk fit comparison', ['type a ~hy\\-phen  word hy\\-phen ~b|c', 12], ['type a  hy-', 'phen word hy-', 'phen  bc']), ('regression: chunk fit comparison', ['set url|path ~x com\\-po\\-si\\-tion ~10~pt hy\\-phen url|path url|path hy\\-phen', 6], ['set', 'url', 'path', ' x com-', 'posi-', 'tion', ' 10 pt', 'hyphen', 'url', 'path', 'url', 'path', 'hyphen']), ('partial-repair probe', ['word ink  Dr.~Knuth x  b|c  type  a', 5], ['word', 'ink', 'Dr. Knuth', 'x bc', 'type', 'a']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['hy\\-phen 10~pt hy\\-phen x', 9], ['hyphen', '10 pt hy-', 'phen x']), ('control layout', ['url|path x Dr.~Knuth ~10~pt', 12], ['urlpath x', 'Dr. Knuth', ' 10 pt'])], [('regression: chunk fit comparison', ['10~pt b|c a set word  word  ~a Dr.~Knuth', 7], ['10 pt b', 'c a set', 'word', 'word  a', 'Dr. Knuth']), ('regression: chunk fit comparison', ['a word url|path  ~x Dr.~Knuth  hy\\-phen 10~pt', 6], ['a word', 'url', 'path', ' x', 'Dr. Knuth', 'hyphen', '10 pt']), ('regression: chunk fit comparison', ['hy\\-phen x  url|path ~x hy\\-phen Dr.~Knuth 10~pt ink ~ink', 6], ['hyphen', 'x url', 'path', ' x hy-', 'phen', 'Dr. Knuth', '10 pt', 'ink', ' ink']), ('partial-repair probe', ['word  Dr.~Knuth Dr.~Knuth Dr.~Knuth type set', 13], ['word', 'Dr. Knuth', 'Dr. Knuth', 'Dr. Knuth', 'type set']), ('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('double space collapses', ['type  set', 20], ['type set']), ('control layout', ['ink b|c ink type 10~pt', 13], ['ink bc ink', 'type 10 pt']), ('control layout', ['ink type 10~pt Dr.~Knuth', 9], ['ink type', '10 pt', 'Dr. Knuth'])], [('regression: chunk fit comparison', ['set  ~url|path url|path word', 12], ['set  urlpath', 'urlpath word']), ('regression: chunk fit comparison', ['10~pt b|c a set word  word  ~a Dr.~Knuth', 7], ['10 pt b', 'c a set', 'word', 'word  a', 'Dr. Knuth']), ('regression: chunk fit comparison', ['b|c ink hy\\-phen url|path type com\\-po\\-si\\-tion', 8], ['bc ink', 'hyphen', 'urlpath', 'type com-', 'position']), ('regression: chunk fit comparison', ['com\\-po\\-si\\-tion  hy\\-phen com\\-po\\-si\\-tion ink  b|c a', 10], ['composi-', 'tion hy-', 'phen compo-', 'sition ink', 'bc a']), ('double space collapses', ['type  set', 20], ['type set']), ('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('control layout', ['Dr.~Knuth type  b|c ink ink url|path url|path hy\\-phen', 12], ['Dr. Knuth', 'type bc ink', 'ink urlpath', 'urlpath hy-', 'phen']), ('control layout', ['a ~a  ~type hy\\-phen type', 15], ['a  a  type hy-', 'phen type'])]]
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
discretionary taken['the com-', 'position']['the compo-', 'sition']Failed
regression: chunk fit comparison['set composi-', 'tion a word hy-', 'phen Dr. Knuth', 'bc']['set composition', 'a word hyphen', 'Dr. Knuth bc']Failed
partial-repair probe['hy-', 'phen', 'x hy-', 'phen', 'x a', ' com-', 'posi-', 'tion', 'hy-', 'phen', 'word', ' type']['hy-', 'phen', 'x hy-', 'phen', 'x a', ' com-', 'posi-', 'tion', 'hy-', 'phen', 'word', ' type']Passed
partial-repair probe['x urlpath', 'hyphen', ' composi-', 'tion bc', 'ink compo-', 'sition hy-', 'phen word']['x urlpath', 'hyphen', ' composi-', 'tion bc', 'ink compo-', 'sition hy-', 'phen word']Passed
invisible break['url', 'path', 'x']['url', 'pathx']Failed
tie keeps title with name['see', 'Dr. Knuth', 'now']['see', 'Dr. Knuth', 'now']Passed
control layout['10 pt', 'ink', '10 pt', 'Dr. Knuth']['10 pt', 'ink', '10 pt', 'Dr. Knuth']Passed
control layout['word bc', 'Dr. Knuth', 'word', '10 pt']['word bc', 'Dr. Knuth', 'word', '10 pt']Passed

SHA-256 / e40f9ac453050cfbdacb76f4a1b36bb6385987db8c119d2b8ea96994bc317748

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    src, width = x
    chunks = ['']
    ops = []
    i = 0
    while i < len(src):
        c = src[i]
        if src.startswith('\\-', i):
            ops.append('d')
            chunks.append('')
            i += 2
            continue
        if c == ' ':
            j = i
            while j < len(src) and src[j] == ' ':
                j += 1
            ops.append('s')
            chunks.append('')
            i = j
            continue
        if c == '|':
            ops.append('z')
            chunks.append('')
            i += 1
            continue
        chunks[-1] += ' ' if c == '~' else c
        i += 1
    line = chunks[0]
    lines = []
    for op, ch in zip(ops, chunks[1:]):
        sep = ' ' if op == 's' else ''
        if len(line + sep + ch) <= width + 1:
            line = line + sep + ch
        else:
            lines.append(line + ('-' if op == 'd' else ''))
            line = ch
    lines.append(line)
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('regression: chunk fit comparison', ['set ~com\\-po\\-si\\-tion a word  hy\\-phen Dr.~Knuth b|c', 16], ['set  composition', 'a word hyphen', 'Dr. Knuth bc']), ('partial-repair probe', ['hy\\-phen x hy\\-phen  x a ~com\\-po\\-si\\-tion  hy\\-phen  word ~type', 5], ['hy-', 'phen', 'x hy-', 'phen', 'x a', ' com-', 'posi-', 'tion', 'hy-', 'phen', 'word', ' type']), ('partial-repair probe', ['x url|path hy\\-phen ~com\\-po\\-si\\-tion  b|c  ink  com\\-po\\-si\\-tion hy\\-phen word', 10], ['x urlpath', 'hyphen', ' composi-', 'tion bc', 'ink compo-', 'sition hy-', 'phen word']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['10~pt ink 10~pt  Dr.~Knuth', 5], ['10 pt', 'ink', '10 pt', 'Dr. Knuth']), ('control layout', ['word b|c  Dr.~Knuth word 10~pt', 8], ['word bc', 'Dr. Knuth', 'word', '10 pt'])], [('regression: chunk fit comparison', ['x  word word word', 6], ['x word', 'word', 'word']), ('regression: chunk fit comparison', ['com\\-po\\-si\\-tion  set a', 10], ['composi-', 'tion set a']), ('partial-repair probe', ['set type  a  a  type  Dr.~Knuth  Dr.~Knuth a', 9], ['set type', 'a a type', 'Dr. Knuth', 'Dr. Knuth', 'a']), ('regression: chunk fit comparison', ['hy\\-phen  a ~set url|path ~url|path', 16], ['hyphen a  set', 'urlpath  urlpath']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['ink  ~Dr.~Knuth  ~Dr.~Knuth', 11], ['ink', ' Dr. Knuth', ' Dr. Knuth']), ('control layout', ['x Dr.~Knuth word  hy\\-phen', 8], ['x', 'Dr. Knuth', 'word hy-', 'phen'])], [('regression: chunk fit comparison', ['ink  a b|c  url|path ~url|path 10~pt word', 5], ['ink a', 'bc', 'url', 'path', ' url', 'path', '10 pt', 'word']), ('regression: chunk fit comparison', ['type a ~hy\\-phen  word hy\\-phen ~b|c', 12], ['type a  hy-', 'phen word hy-', 'phen  bc']), ('regression: chunk fit comparison', ['set url|path ~x com\\-po\\-si\\-tion ~10~pt hy\\-phen url|path url|path hy\\-phen', 6], ['set', 'url', 'path', ' x com-', 'posi-', 'tion', ' 10 pt', 'hyphen', 'url', 'path', 'url', 'path', 'hyphen']), ('partial-repair probe', ['word ink  Dr.~Knuth x  b|c  type  a', 5], ['word', 'ink', 'Dr. Knuth', 'x bc', 'type', 'a']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['hy\\-phen 10~pt hy\\-phen x', 9], ['hyphen', '10 pt hy-', 'phen x']), ('control layout', ['url|path x Dr.~Knuth ~10~pt', 12], ['urlpath x', 'Dr. Knuth', ' 10 pt'])], [('regression: chunk fit comparison', ['10~pt b|c a set word  word  ~a Dr.~Knuth', 7], ['10 pt b', 'c a set', 'word', 'word  a', 'Dr. Knuth']), ('regression: chunk fit comparison', ['a word url|path  ~x Dr.~Knuth  hy\\-phen 10~pt', 6], ['a word', 'url', 'path', ' x', 'Dr. Knuth', 'hyphen', '10 pt']), ('regression: chunk fit comparison', ['hy\\-phen x  url|path ~x hy\\-phen Dr.~Knuth 10~pt ink ~ink', 6], ['hyphen', 'x url', 'path', ' x hy-', 'phen', 'Dr. Knuth', '10 pt', 'ink', ' ink']), ('partial-repair probe', ['word  Dr.~Knuth Dr.~Knuth Dr.~Knuth type set', 13], ['word', 'Dr. Knuth', 'Dr. Knuth', 'Dr. Knuth', 'type set']), ('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('double space collapses', ['type  set', 20], ['type set']), ('control layout', ['ink b|c ink type 10~pt', 13], ['ink bc ink', 'type 10 pt']), ('control layout', ['ink type 10~pt Dr.~Knuth', 9], ['ink type', '10 pt', 'Dr. Knuth'])], [('regression: chunk fit comparison', ['set  ~url|path url|path word', 12], ['set  urlpath', 'urlpath word']), ('regression: chunk fit comparison', ['10~pt b|c a set word  word  ~a Dr.~Knuth', 7], ['10 pt b', 'c a set', 'word', 'word  a', 'Dr. Knuth']), ('regression: chunk fit comparison', ['b|c ink hy\\-phen url|path type com\\-po\\-si\\-tion', 8], ['bc ink', 'hyphen', 'urlpath', 'type com-', 'position']), ('regression: chunk fit comparison', ['com\\-po\\-si\\-tion  hy\\-phen com\\-po\\-si\\-tion ink  b|c a', 10], ['composi-', 'tion hy-', 'phen compo-', 'sition ink', 'bc a']), ('double space collapses', ['type  set', 20], ['type set']), ('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('control layout', ['Dr.~Knuth type  b|c ink ink url|path url|path hy\\-phen', 12], ['Dr. Knuth', 'type bc ink', 'ink urlpath', 'urlpath hy-', 'phen']), ('control layout', ['a ~a  ~type hy\\-phen type', 15], ['a  a  type hy-', 'phen type'])]]
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
discretionary taken['the compo-', 'sition']['the compo-', 'sition']Passed
regression: chunk fit comparison['set composition', 'a word hyphen', 'Dr. Knuth bc']['set composition', 'a word hyphen', 'Dr. Knuth bc']Passed
partial-repair probe['hyphen', 'x hy-', 'phen x', 'a com-', 'posi-', 'tion', 'hyphen', 'word', ' type']['hy-', 'phen', 'x hy-', 'phen', 'x a', ' com-', 'posi-', 'tion', 'hy-', 'phen', 'word', ' type']Failed
partial-repair probe['x urlpath', 'hyphen com-', 'position bc', 'ink composi-', 'tion hyphen', 'word']['x urlpath', 'hyphen', ' composi-', 'tion bc', 'ink compo-', 'sition hy-', 'phen word']Failed
invisible break['url', 'pathx']['url', 'pathx']Passed
tie keeps title with name['see', 'Dr. Knuth', 'now']['see', 'Dr. Knuth', 'now']Passed
control layout['10 pt', 'ink', '10 pt', 'Dr. Knuth']['10 pt', 'ink', '10 pt', 'Dr. Knuth']Passed
control layout['word bc', 'Dr. Knuth', 'word', '10 pt']['word bc', 'Dr. Knuth', 'word', '10 pt']Passed

SHA-256 / 37dc15e3d84e8a187155058920d13aecacd3ce117e894d3211750e27230f1c2c

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    src, width = x
    chunks = ['']
    ops = []
    i = 0
    while i < len(src):
        c = src[i]
        if src.startswith('\\-', i):
            ops.append('d')
            chunks.append('')
            i += 2
            continue
        if c == ' ':
            j = i
            while j < len(src) and src[j] == ' ':
                j += 1
            ops.append('s')
            chunks.append('')
            i = j
            continue
        if c == '|':
            ops.append('z')
            chunks.append('')
            i += 1
            continue
        chunks[-1] += ' ' if c == '~' else c
        i += 1
    line = chunks[0]
    lines = []
    for op, ch in zip(ops, chunks[1:]):
        sep = ' ' if op == 's' else ''
        if len(line + sep + ch) <= width:
            line = line + sep + ch
        else:
            lines.append(line + ('-' if op == 'd' else ''))
            line = ch
    lines.append(line)
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('regression: chunk fit comparison', ['set ~com\\-po\\-si\\-tion a word  hy\\-phen Dr.~Knuth b|c', 16], ['set  composition', 'a word hyphen', 'Dr. Knuth bc']), ('partial-repair probe', ['hy\\-phen x hy\\-phen  x a ~com\\-po\\-si\\-tion  hy\\-phen  word ~type', 5], ['hy-', 'phen', 'x hy-', 'phen', 'x a', ' com-', 'posi-', 'tion', 'hy-', 'phen', 'word', ' type']), ('partial-repair probe', ['x url|path hy\\-phen ~com\\-po\\-si\\-tion  b|c  ink  com\\-po\\-si\\-tion hy\\-phen word', 10], ['x urlpath', 'hyphen', ' composi-', 'tion bc', 'ink compo-', 'sition hy-', 'phen word']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['10~pt ink 10~pt  Dr.~Knuth', 5], ['10 pt', 'ink', '10 pt', 'Dr. Knuth']), ('control layout', ['word b|c  Dr.~Knuth word 10~pt', 8], ['word bc', 'Dr. Knuth', 'word', '10 pt'])], [('regression: chunk fit comparison', ['x  word word word', 6], ['x word', 'word', 'word']), ('regression: chunk fit comparison', ['com\\-po\\-si\\-tion  set a', 10], ['composi-', 'tion set a']), ('partial-repair probe', ['set type  a  a  type  Dr.~Knuth  Dr.~Knuth a', 9], ['set type', 'a a type', 'Dr. Knuth', 'Dr. Knuth', 'a']), ('regression: chunk fit comparison', ['hy\\-phen  a ~set url|path ~url|path', 16], ['hyphen a  set', 'urlpath  urlpath']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['ink  ~Dr.~Knuth  ~Dr.~Knuth', 11], ['ink', ' Dr. Knuth', ' Dr. Knuth']), ('control layout', ['x Dr.~Knuth word  hy\\-phen', 8], ['x', 'Dr. Knuth', 'word hy-', 'phen'])], [('regression: chunk fit comparison', ['ink  a b|c  url|path ~url|path 10~pt word', 5], ['ink a', 'bc', 'url', 'path', ' url', 'path', '10 pt', 'word']), ('regression: chunk fit comparison', ['type a ~hy\\-phen  word hy\\-phen ~b|c', 12], ['type a  hy-', 'phen word hy-', 'phen  bc']), ('regression: chunk fit comparison', ['set url|path ~x com\\-po\\-si\\-tion ~10~pt hy\\-phen url|path url|path hy\\-phen', 6], ['set', 'url', 'path', ' x com-', 'posi-', 'tion', ' 10 pt', 'hyphen', 'url', 'path', 'url', 'path', 'hyphen']), ('partial-repair probe', ['word ink  Dr.~Knuth x  b|c  type  a', 5], ['word', 'ink', 'Dr. Knuth', 'x bc', 'type', 'a']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['hy\\-phen 10~pt hy\\-phen x', 9], ['hyphen', '10 pt hy-', 'phen x']), ('control layout', ['url|path x Dr.~Knuth ~10~pt', 12], ['urlpath x', 'Dr. Knuth', ' 10 pt'])], [('regression: chunk fit comparison', ['10~pt b|c a set word  word  ~a Dr.~Knuth', 7], ['10 pt b', 'c a set', 'word', 'word  a', 'Dr. Knuth']), ('regression: chunk fit comparison', ['a word url|path  ~x Dr.~Knuth  hy\\-phen 10~pt', 6], ['a word', 'url', 'path', ' x', 'Dr. Knuth', 'hyphen', '10 pt']), ('regression: chunk fit comparison', ['hy\\-phen x  url|path ~x hy\\-phen Dr.~Knuth 10~pt ink ~ink', 6], ['hyphen', 'x url', 'path', ' x hy-', 'phen', 'Dr. Knuth', '10 pt', 'ink', ' ink']), ('partial-repair probe', ['word  Dr.~Knuth Dr.~Knuth Dr.~Knuth type set', 13], ['word', 'Dr. Knuth', 'Dr. Knuth', 'Dr. Knuth', 'type set']), ('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('double space collapses', ['type  set', 20], ['type set']), ('control layout', ['ink b|c ink type 10~pt', 13], ['ink bc ink', 'type 10 pt']), ('control layout', ['ink type 10~pt Dr.~Knuth', 9], ['ink type', '10 pt', 'Dr. Knuth'])], [('regression: chunk fit comparison', ['set  ~url|path url|path word', 12], ['set  urlpath', 'urlpath word']), ('regression: chunk fit comparison', ['10~pt b|c a set word  word  ~a Dr.~Knuth', 7], ['10 pt b', 'c a set', 'word', 'word  a', 'Dr. Knuth']), ('regression: chunk fit comparison', ['b|c ink hy\\-phen url|path type com\\-po\\-si\\-tion', 8], ['bc ink', 'hyphen', 'urlpath', 'type com-', 'position']), ('regression: chunk fit comparison', ['com\\-po\\-si\\-tion  hy\\-phen com\\-po\\-si\\-tion ink  b|c a', 10], ['composi-', 'tion hy-', 'phen compo-', 'sition ink', 'bc a']), ('double space collapses', ['type  set', 20], ['type set']), ('discretionary taken', ['the com\\-po\\-si\\-tion', 9], ['the compo-', 'sition']), ('control layout', ['Dr.~Knuth type  b|c ink ink url|path url|path hy\\-phen', 12], ['Dr. Knuth', 'type bc ink', 'ink urlpath', 'urlpath hy-', 'phen']), ('control layout', ['a ~a  ~type hy\\-phen type', 15], ['a  a  type hy-', 'phen type'])]]
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
discretionary taken['the compo-', 'sition']['the compo-', 'sition']Passed
regression: chunk fit comparison['set composition', 'a word hyphen', 'Dr. Knuth bc']['set composition', 'a word hyphen', 'Dr. Knuth bc']Passed
partial-repair probe['hy-', 'phen', 'x hy-', 'phen', 'x a', ' com-', 'posi-', 'tion', 'hy-', 'phen', 'word', ' type']['hy-', 'phen', 'x hy-', 'phen', 'x a', ' com-', 'posi-', 'tion', 'hy-', 'phen', 'word', ' type']Passed
partial-repair probe['x urlpath', 'hyphen', ' composi-', 'tion bc', 'ink compo-', 'sition hy-', 'phen word']['x urlpath', 'hyphen', ' composi-', 'tion bc', 'ink compo-', 'sition hy-', 'phen word']Passed
invisible break['url', 'pathx']['url', 'pathx']Passed
tie keeps title with name['see', 'Dr. Knuth', 'now']['see', 'Dr. Knuth', 'now']Passed
control layout['10 pt', 'ink', '10 pt', 'Dr. Knuth']['10 pt', 'ink', '10 pt', 'Dr. Knuth']Passed
control layout['word bc', 'Dr. Knuth', 'word', '10 pt']['word bc', 'Dr. Knuth', 'word', '10 pt']Passed

SHA-256 / 6901944fec59080f9644d387c0d1dd39fb39c2a889cf72cf7ea0b3bdb80a79dc

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

Case digest / 8ab697323930e26a235eb7a94cd77c2a7dee086a6d2ca17f01f7dabee8afc486