FAILURE MAP
← Case archive

FA-80326 / Typography line breaking / Open access

URL line breaking: equals and ampersand sides · case 01

Query strings only break on one side of = and &.

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

ROOT CAUSE

Only the position before = or & is offered.

THE FAILURE

Only the position before = or & is offered.

Unsuccessful approach: Offering only the position after is the mirror image mistake.

Case contract

Input [url, width]. Break opportunities (no hyphen added): after ":"; after "//" (never between its slashes); before a single "/"; before . - _ ? # % ~; before or after = and &. While the rest exceeds the width, break at the latest opportunity within width characters, else hard-break at width. Return 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):
    url, width = x
    n = len(url)
    ok = set()
    for p in range(1, n):
        a, b = url[p - 1], url[p]
        if a == ':':
            ok.add(p)
        elif a == '/' and url[p - 2:p] == '//':
            ok.add(p)
        elif b == '/' and a != '/' and url[p + 1:p + 2] != '/':
            ok.add(p)
        elif b in '.-_?#%~':
            ok.add(p)
        elif b in '=&':
            ok.add(p)
    lines = []
    start = 0
    while n - start > width:
        cands = [p for p in ok if start < p <= start + width]
        cut = max(cands) if cands else start + width
        lines.append(url[start:cut])
        start = cut
    lines.append(url[start:])
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 6], ['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak&', 'lang=', 'en']), ('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 13], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 9], ['http://a', '.b.org', '/x//y?q=1', '&r=2']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 9], ['http://a', '.b.org', '/x//y?q=1', '&r=2']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('control layout', ['https://sub.domain.example.co.uk/~user/page', 7], ['https:', '//sub', '.domain', '.exampl', 'e.co.uk', '/~user', '/page']), ('control layout', ['https://example.com/path/to/page.html', 7], ['https:', '//', 'example', '.com', '/path', '/to', '/page', '.html'])], [('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 14], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 13], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 13], ['http://a.b', '.org/x//y?q=1', '&r=2']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 13], ['http://a.b', '.org/x//y?q=1', '&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('control layout', ['file:///usr/local/share/doc', 7], ['file://', '/usr', '/local', '/share', '/doc']), ('control layout', ['mailto:someone@example.com', 16], ['mailto:', 'someone@example', '.com'])], [('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 16], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('regression: equals and ampersand sides', ['http://a.b.org/x//y?q=1&r=2', 5], ['http:', '//a.b', '.org', '/x//y', '?q=1&', 'r=2']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 13], ['http://a.b', '.org/x//y?q=1', '&r=2']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 7], ['http://', 'a.b.org', '/x//y?q', '=1&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('control layout', ['file:///usr/local/share/doc', 6], ['file:', '///usr', '/local', '/share', '/doc']), ('control layout', ['ftp://files.site.net/pub/file-name_v2.tar.gz', 12], ['ftp://files', '.site.net', '/pub/file', '-name_v2.tar', '.gz'])], [('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 13], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 6], ['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak&', 'lang=', 'en']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 6], ['http:', '//a.b', '.org', '/x//y', '?q=1&r', '=2']), ('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 6], ['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak&', 'lang=', 'en']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('control layout', ['ftp://files.site.net/pub/file-name_v2.tar.gz', 9], ['ftp://', 'files', '.site.net', '/pub/file', '-name_v2', '.tar.gz']), ('control layout', ['http://a.b.org/x//y?q=1&r=2', 14], ['http://a.b.org', '/x//y?q=1&r=2'])], [('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 4], ['http', 's://', 'x.io', '/sea', 'rch', '?ter', 'm=', 'line', '%20b', 'reak', '&', 'lang', '=en']), ('regression: equals and ampersand sides', ['http://a.b.org/x//y?q=1&r=2', 12], ['http://a.b', '.org/x//y?q=', '1&r=2']), ('partial-repair probe', ['https://w.org/a=b/c&d', 6], ['https:', '//w', '.org/a', '=b/c&d']), ('partial-repair probe', ['https://w.org/a=b/c&d', 6], ['https:', '//w', '.org/a', '=b/c&d']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('control layout', ['https://sub.domain.example.co.uk/~user/page', 5], ['https', '://', 'sub', '.doma', 'in', '.exam', 'ple', '.co', '.uk/', '~user', '/page']), ('control layout', ['https://example.com/path/to/page.html', 12], ['https://', 'example.com', '/path/to', '/page.html'])]]
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
regression: equals and ampersand sides['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak', '&lang', '=en']['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak&', 'lang=', 'en']Failed
regression: equals and ampersand sides['https://x.io', '/search?term', '=line%20break', '&lang=en']['https://x.io', '/search?term=', 'line%20break&', 'lang=en']Failed
partial-repair probe['http://a', '.b.org', '/x//y?q=1', '&r=2']['http://a', '.b.org', '/x//y?q=1', '&r=2']Passed
partial-repair probe['http://a', '.b.org', '/x//y?q=1', '&r=2']['http://a', '.b.org', '/x//y?q=1', '&r=2']Passed
double slash inside path['http://a.b', '.org/x//y', '?q=1&r=2']['http://a.b', '.org/x//y', '?q=1&r=2']Passed
break after scheme['https://', 'example', '.com', '/path/to', '/page', '.html']['https://', 'example', '.com', '/path/to', '/page', '.html']Passed
control layout['https:', '//sub', '.domain', '.exampl', 'e.co.uk', '/~user', '/page']['https:', '//sub', '.domain', '.exampl', 'e.co.uk', '/~user', '/page']Passed
control layout['https:', '//', 'example', '.com', '/path', '/to', '/page', '.html']['https:', '//', 'example', '.com', '/path', '/to', '/page', '.html']Passed

SHA-256 / 922430ddac3220f151d5c836cd2513dd658d1058c76f6a7e9e17c674927196fe

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    url, width = x
    n = len(url)
    ok = set()
    for p in range(1, n):
        a, b = url[p - 1], url[p]
        if a == ':':
            ok.add(p)
        elif a == '/' and url[p - 2:p] == '//':
            ok.add(p)
        elif b == '/' and a != '/' and url[p + 1:p + 2] != '/':
            ok.add(p)
        elif b in '.-_?#%~':
            ok.add(p)
        elif a in '=&':
            ok.add(p)
    lines = []
    start = 0
    while n - start > width:
        cands = [p for p in ok if start < p <= start + width]
        cut = max(cands) if cands else start + width
        lines.append(url[start:cut])
        start = cut
    lines.append(url[start:])
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 6], ['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak&', 'lang=', 'en']), ('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 13], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 9], ['http://a', '.b.org', '/x//y?q=1', '&r=2']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 9], ['http://a', '.b.org', '/x//y?q=1', '&r=2']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('control layout', ['https://sub.domain.example.co.uk/~user/page', 7], ['https:', '//sub', '.domain', '.exampl', 'e.co.uk', '/~user', '/page']), ('control layout', ['https://example.com/path/to/page.html', 7], ['https:', '//', 'example', '.com', '/path', '/to', '/page', '.html'])], [('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 14], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 13], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 13], ['http://a.b', '.org/x//y?q=1', '&r=2']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 13], ['http://a.b', '.org/x//y?q=1', '&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('control layout', ['file:///usr/local/share/doc', 7], ['file://', '/usr', '/local', '/share', '/doc']), ('control layout', ['mailto:someone@example.com', 16], ['mailto:', 'someone@example', '.com'])], [('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 16], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('regression: equals and ampersand sides', ['http://a.b.org/x//y?q=1&r=2', 5], ['http:', '//a.b', '.org', '/x//y', '?q=1&', 'r=2']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 13], ['http://a.b', '.org/x//y?q=1', '&r=2']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 7], ['http://', 'a.b.org', '/x//y?q', '=1&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('control layout', ['file:///usr/local/share/doc', 6], ['file:', '///usr', '/local', '/share', '/doc']), ('control layout', ['ftp://files.site.net/pub/file-name_v2.tar.gz', 12], ['ftp://files', '.site.net', '/pub/file', '-name_v2.tar', '.gz'])], [('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 13], ['https://x.io', '/search?term=', 'line%20break&', 'lang=en']), ('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 6], ['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak&', 'lang=', 'en']), ('partial-repair probe', ['http://a.b.org/x//y?q=1&r=2', 6], ['http:', '//a.b', '.org', '/x//y', '?q=1&r', '=2']), ('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 6], ['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak&', 'lang=', 'en']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('control layout', ['ftp://files.site.net/pub/file-name_v2.tar.gz', 9], ['ftp://', 'files', '.site.net', '/pub/file', '-name_v2', '.tar.gz']), ('control layout', ['http://a.b.org/x//y?q=1&r=2', 14], ['http://a.b.org', '/x//y?q=1&r=2'])], [('regression: equals and ampersand sides', ['https://x.io/search?term=line%20break&lang=en', 4], ['http', 's://', 'x.io', '/sea', 'rch', '?ter', 'm=', 'line', '%20b', 'reak', '&', 'lang', '=en']), ('regression: equals and ampersand sides', ['http://a.b.org/x//y?q=1&r=2', 12], ['http://a.b', '.org/x//y?q=', '1&r=2']), ('partial-repair probe', ['https://w.org/a=b/c&d', 6], ['https:', '//w', '.org/a', '=b/c&d']), ('partial-repair probe', ['https://w.org/a=b/c&d', 6], ['https:', '//w', '.org/a', '=b/c&d']), ('double slash inside path', ['http://a.b.org/x//y?q=1&r=2', 10], ['http://a.b', '.org/x//y', '?q=1&r=2']), ('break after scheme', ['https://example.com/path/to/page.html', 8], ['https://', 'example', '.com', '/path/to', '/page', '.html']), ('control layout', ['https://sub.domain.example.co.uk/~user/page', 5], ['https', '://', 'sub', '.doma', 'in', '.exam', 'ple', '.co', '.uk/', '~user', '/page']), ('control layout', ['https://example.com/path/to/page.html', 12], ['https://', 'example.com', '/path/to', '/page.html'])]]
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
regression: equals and ampersand sides['https:', '//x.io', '/searc', 'h', '?term=', 'line', '%20bre', 'ak&', 'lang=', 'en']['https:', '//x.io', '/searc', 'h?term', '=line', '%20bre', 'ak&', 'lang=', 'en']Failed
regression: equals and ampersand sides['https://x.io', '/search?term=', 'line%20break&', 'lang=en']['https://x.io', '/search?term=', 'line%20break&', 'lang=en']Passed
partial-repair probe['http://a', '.b.org', '/x//y?q=', '1&r=2']['http://a', '.b.org', '/x//y?q=1', '&r=2']Failed
partial-repair probe['http://a', '.b.org', '/x//y?q=', '1&r=2']['http://a', '.b.org', '/x//y?q=1', '&r=2']Failed
double slash inside path['http://a.b', '.org/x//y', '?q=1&r=2']['http://a.b', '.org/x//y', '?q=1&r=2']Passed
break after scheme['https://', 'example', '.com', '/path/to', '/page', '.html']['https://', 'example', '.com', '/path/to', '/page', '.html']Passed
control layout['https:', '//sub', '.domain', '.exampl', 'e.co.uk', '/~user', '/page']['https:', '//sub', '.domain', '.exampl', 'e.co.uk', '/~user', '/page']Passed
control layout['https:', '//', 'example', '.com', '/path', '/to', '/page', '.html']['https:', '//', 'example', '.com', '/path', '/to', '/page', '.html']Passed

SHA-256 / d46f31db31f6f873a2e7195490c1455ef3038ca77fb1c0ecfb417f57216e7328

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

Case digest / 31aa7bfacae0c1446802709ebe5d6586b04c32396896335bb27f6d4babb16e1d