FAILURE MAP
← Case archive

FA-80256 / Typography line breaking / Open access

Hanging-indent list labels: column fit boundary · case 01

Words that end exactly at the right edge are wrapped.

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

ROOT CAUSE

The wrap test uses >= width.

THE FAILURE

The wrap test uses >= width.

Unsuccessful approach: Allowing one column past the width overflows.

Case contract

Input [label, words, width, hang]. The label starts at column 0; first-line text starts at column hang when label+1 space fits, else right after label plus one space. Continuation lines are indented by hang. Greedy fill with unit spaces measuring absolute columns. Return padded 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):
    label, words, width, hang = x
    lines = []
    first = True
    start = hang if len(label) + 1 <= hang else len(label) + 1
    cur = []
    col = start
    for w in words:
        need = col + len(w) if not cur else col + 1 + len(w)
        if cur and need >= width:
            prefix = label.ljust(start) if first else ' ' * hang
            lines.append(prefix + ' '.join(cur))
            first = False
            cur = [w]
            col = hang + len(w)
        else:
            cur.append(w)
            col = need
    if cur:
        prefix = label.ljust(start) if first else ' ' * hang
        lines.append(prefix + ' '.join(cur))
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('regression: column fit boundary', ['1.', ['is', 'type', 'kerning', 'kerning', 'kerning', 'ink', 'measure', 'a', 'ink'], 18, 3], ['1. is type kerning', '   kerning kerning', '   ink measure a', '   ink']), ('partial-repair probe', ['Note:', ['type', 'type', 'of', 'on', 'on', 'kerning'], 20, 5], ['Note: type type of', '     on on kerning']), ('partial-repair probe', ['iv.', ['x', 'a', 'ink', 'at', 'serif', 'of', 'is', 'x', 'kerning'], 14, 5], ['iv.  x a ink', '     at serif', '     of is x', '     kerning']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('control layout', ['A.1.2', ['on', 'of', 'the'], 16, 4], ['A.1.2 on of the']), ('control layout', ['Note:', ['is', 'serif'], 22, 4], ['Note: is serif']), ('control layout', ['•', ['a', 'is', 'measure', 'baseline', 'ink'], 21, 5], ['•    a is measure', '     baseline ink'])], [('regression: column fit boundary', ['•', ['the', 'ink', 'of', 'of', 'is'], 18, 5], ['•    the ink of of', '     is']), ('regression: column fit boundary', ['1.', ['kerning', 'baseline', 'measure', 'a', 'serif', 'x'], 18, 2], ['1. kerning', '  baseline measure', '  a serif x']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('partial-repair probe', ['1.', ['a', 'of', 'serif', 'type', 'the', 'ink', 'is', 'at', 'kerning'], 14, 3], ['1. a of serif', '   type the', '   ink is at', '   kerning']), ('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('control layout', ['•', ['of', 'x', 'is'], 18, 4], ['•   of x is']), ('control layout', ['1.', ['serif', 'at'], 14, 3], ['1. serif at']), ('control layout', ['iv.', ['of', 'is'], 17, 2], ['iv. of is'])], [('regression: column fit boundary', ['iv.', ['type', 'a', 'of', 'of', 'is', 'is', 'baseline', 'kerning'], 13, 4], ['iv. type a of', '    of is is', '    baseline', '    kerning']), ('regression: column fit boundary', ['Note:', ['on', 'at', 'a', 'x', 'baseline', 'x', 'grid'], 18, 3], ['Note: on at a x', '   baseline x grid']), ('regression: column fit boundary', ['A.1.2', ['measure', 'is', 'grid', 'type', 'type', 'of', 'serif', 'at', 'ink'], 20, 3], ['A.1.2 measure is', '   grid type type of', '   serif at ink']), ('partial-repair probe', ['A.1.2', ['ink', 'grid', 'ink', 'serif', 'is', 'baseline'], 13, 2], ['A.1.2 ink', '  grid ink', '  serif is', '  baseline']), ('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('control layout', ['•', ['a', 'kerning', 'measure', 'the', 'the', 'kerning', 'is'], 15, 3], ['•  a kerning', '   measure the', '   the kerning', '   is']), ('control layout', ['1.', ['is', 'x'], 18, 3], ['1. is x'])], [('regression: column fit boundary', ['•', ['is', 'x', 'at', 'type', 'kerning', 'the'], 14, 3], ['•  is x at', '   type', '   kerning the']), ('regression: column fit boundary', ['A.1.2', ['a', 'kerning', 'measure', 'a', 'at', 'measure'], 22, 2], ['A.1.2 a kerning', '  measure a at measure']), ('regression: column fit boundary', ['Note:', ['is', 'measure', 'a', 'x', 'type', 'on', 'measure', 'of'], 18, 2], ['Note: is measure a', '  x type on', '  measure of']), ('partial-repair probe', ['(a)', ['type', 'ink'], 12, 5], ['(a)  type', '     ink']), ('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('control layout', ['A.1.2', ['baseline', 'grid', 'on', 'is', 'kerning'], 13, 2], ['A.1.2 baseline', '  grid on is', '  kerning']), ('control layout', ['Note:', ['ink', 'baseline', 'measure', 'type', 'type', 'ink', 'kerning', 'at', 'kerning'], 19, 5], ['Note: ink baseline', '     measure type', '     type ink', '     kerning at', '     kerning'])], [('regression: column fit boundary', ['•', ['measure', 'kerning', 'grid', 'of'], 20, 5], ['•    measure kerning', '     grid of']), ('regression: column fit boundary', ['10.', ['grid', 'is', 'type', 'of', 'of', 'of', 'a', 'on', 'ink'], 19, 3], ['10. grid is type of', '   of of a on ink']), ('regression: column fit boundary', ['(a)', ['of', 'ink', 'baseline', 'ink', 'on', 'type', 'measure', 'baseline', 'grid'], 14, 2], ['(a) of ink', '  baseline ink', '  on type', '  measure', '  baseline', '  grid']), ('partial-repair probe', ['1.', ['of', 'type', 'kerning', 'the', 'on', 'kerning', 'type', 'x', 'kerning'], 22, 4], ['1.  of type kerning', '    the on kerning', '    type x kerning']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('control layout', ['•', ['of', 'of'], 20, 4], ['•   of of']), ('control layout', ['1.', ['ink', 'kerning'], 22, 5], ['1.   ink kerning'])]]
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
label overflows hang['Note: the', ' type grid', ' is on', ' serif']['Note: the type', ' grid is on', ' serif']Failed
regression: column fit boundary['1. is type', ' kerning', ' kerning', ' kerning ink', ' measure a ink']['1. is type kerning', ' kerning kerning', ' ink measure a', ' ink']Failed
partial-repair probe['Note: type type of', ' on on kerning']['Note: type type of', ' on on kerning']Passed
partial-repair probe['iv. x a ink', ' at serif', ' of is x', ' kerning']['iv. x a ink', ' at serif', ' of is x', ' kerning']Passed
label exactly one short of hang['1. the type', ' grid is', ' on']['1. the type', ' grid is', ' on']Passed
control layout['A.1.2 on of the']['A.1.2 on of the']Passed
control layout['Note: is serif']['Note: is serif']Passed
control layout['• a is measure', ' baseline ink']['• a is measure', ' baseline ink']Passed

SHA-256 / 40a1e72e24fc03abbb953fadff5ee0b3f0e2596ff3bb2d143fb5309ac75b3218

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    label, words, width, hang = x
    lines = []
    first = True
    start = hang if len(label) + 1 <= hang else len(label) + 1
    cur = []
    col = start
    for w in words:
        need = col + len(w) if not cur else col + 1 + len(w)
        if cur and need > width + 1:
            prefix = label.ljust(start) if first else ' ' * hang
            lines.append(prefix + ' '.join(cur))
            first = False
            cur = [w]
            col = hang + len(w)
        else:
            cur.append(w)
            col = need
    if cur:
        prefix = label.ljust(start) if first else ' ' * hang
        lines.append(prefix + ' '.join(cur))
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('regression: column fit boundary', ['1.', ['is', 'type', 'kerning', 'kerning', 'kerning', 'ink', 'measure', 'a', 'ink'], 18, 3], ['1. is type kerning', '   kerning kerning', '   ink measure a', '   ink']), ('partial-repair probe', ['Note:', ['type', 'type', 'of', 'on', 'on', 'kerning'], 20, 5], ['Note: type type of', '     on on kerning']), ('partial-repair probe', ['iv.', ['x', 'a', 'ink', 'at', 'serif', 'of', 'is', 'x', 'kerning'], 14, 5], ['iv.  x a ink', '     at serif', '     of is x', '     kerning']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('control layout', ['A.1.2', ['on', 'of', 'the'], 16, 4], ['A.1.2 on of the']), ('control layout', ['Note:', ['is', 'serif'], 22, 4], ['Note: is serif']), ('control layout', ['•', ['a', 'is', 'measure', 'baseline', 'ink'], 21, 5], ['•    a is measure', '     baseline ink'])], [('regression: column fit boundary', ['•', ['the', 'ink', 'of', 'of', 'is'], 18, 5], ['•    the ink of of', '     is']), ('regression: column fit boundary', ['1.', ['kerning', 'baseline', 'measure', 'a', 'serif', 'x'], 18, 2], ['1. kerning', '  baseline measure', '  a serif x']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('partial-repair probe', ['1.', ['a', 'of', 'serif', 'type', 'the', 'ink', 'is', 'at', 'kerning'], 14, 3], ['1. a of serif', '   type the', '   ink is at', '   kerning']), ('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('control layout', ['•', ['of', 'x', 'is'], 18, 4], ['•   of x is']), ('control layout', ['1.', ['serif', 'at'], 14, 3], ['1. serif at']), ('control layout', ['iv.', ['of', 'is'], 17, 2], ['iv. of is'])], [('regression: column fit boundary', ['iv.', ['type', 'a', 'of', 'of', 'is', 'is', 'baseline', 'kerning'], 13, 4], ['iv. type a of', '    of is is', '    baseline', '    kerning']), ('regression: column fit boundary', ['Note:', ['on', 'at', 'a', 'x', 'baseline', 'x', 'grid'], 18, 3], ['Note: on at a x', '   baseline x grid']), ('regression: column fit boundary', ['A.1.2', ['measure', 'is', 'grid', 'type', 'type', 'of', 'serif', 'at', 'ink'], 20, 3], ['A.1.2 measure is', '   grid type type of', '   serif at ink']), ('partial-repair probe', ['A.1.2', ['ink', 'grid', 'ink', 'serif', 'is', 'baseline'], 13, 2], ['A.1.2 ink', '  grid ink', '  serif is', '  baseline']), ('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('control layout', ['•', ['a', 'kerning', 'measure', 'the', 'the', 'kerning', 'is'], 15, 3], ['•  a kerning', '   measure the', '   the kerning', '   is']), ('control layout', ['1.', ['is', 'x'], 18, 3], ['1. is x'])], [('regression: column fit boundary', ['•', ['is', 'x', 'at', 'type', 'kerning', 'the'], 14, 3], ['•  is x at', '   type', '   kerning the']), ('regression: column fit boundary', ['A.1.2', ['a', 'kerning', 'measure', 'a', 'at', 'measure'], 22, 2], ['A.1.2 a kerning', '  measure a at measure']), ('regression: column fit boundary', ['Note:', ['is', 'measure', 'a', 'x', 'type', 'on', 'measure', 'of'], 18, 2], ['Note: is measure a', '  x type on', '  measure of']), ('partial-repair probe', ['(a)', ['type', 'ink'], 12, 5], ['(a)  type', '     ink']), ('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('control layout', ['A.1.2', ['baseline', 'grid', 'on', 'is', 'kerning'], 13, 2], ['A.1.2 baseline', '  grid on is', '  kerning']), ('control layout', ['Note:', ['ink', 'baseline', 'measure', 'type', 'type', 'ink', 'kerning', 'at', 'kerning'], 19, 5], ['Note: ink baseline', '     measure type', '     type ink', '     kerning at', '     kerning'])], [('regression: column fit boundary', ['•', ['measure', 'kerning', 'grid', 'of'], 20, 5], ['•    measure kerning', '     grid of']), ('regression: column fit boundary', ['10.', ['grid', 'is', 'type', 'of', 'of', 'of', 'a', 'on', 'ink'], 19, 3], ['10. grid is type of', '   of of a on ink']), ('regression: column fit boundary', ['(a)', ['of', 'ink', 'baseline', 'ink', 'on', 'type', 'measure', 'baseline', 'grid'], 14, 2], ['(a) of ink', '  baseline ink', '  on type', '  measure', '  baseline', '  grid']), ('partial-repair probe', ['1.', ['of', 'type', 'kerning', 'the', 'on', 'kerning', 'type', 'x', 'kerning'], 22, 4], ['1.  of type kerning', '    the on kerning', '    type x kerning']), ('label exactly one short of hang', ['1.', ['the', 'type', 'grid', 'is', 'on'], 12, 3], ['1. the type', '   grid is', '   on']), ('label overflows hang', ['Note:', ['the', 'type', 'grid', 'is', 'on', 'serif'], 14, 3], ['Note: the type', '   grid is on', '   serif']), ('control layout', ['•', ['of', 'of'], 20, 4], ['•   of of']), ('control layout', ['1.', ['ink', 'kerning'], 22, 5], ['1.   ink kerning'])]]
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
label overflows hang['Note: the type', ' grid is on', ' serif']['Note: the type', ' grid is on', ' serif']Passed
regression: column fit boundary['1. is type kerning', ' kerning kerning', ' ink measure a', ' ink']['1. is type kerning', ' kerning kerning', ' ink measure a', ' ink']Passed
partial-repair probe['Note: type type of on', ' on kerning']['Note: type type of', ' on on kerning']Failed
partial-repair probe['iv. x a ink at', ' serif of', ' is x', ' kerning']['iv. x a ink', ' at serif', ' of is x', ' kerning']Failed
label exactly one short of hang['1. the type', ' grid is on']['1. the type', ' grid is', ' on']Failed
control layout['A.1.2 on of the']['A.1.2 on of the']Passed
control layout['Note: is serif']['Note: is serif']Passed
control layout['• a is measure', ' baseline ink']['• a is measure', ' baseline ink']Passed

SHA-256 / 135ef44a49194d226e794bc0220829dad31792c9b8180da2057b7f67553c20c0

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

Case digest / 3ce4b7cc6e9e45f893de5546bc73afdd33d4293dc81b11850cf0f387e81fb696