{"abstract":"Words exactly as wide as a candidate width are rejected.","category":"Typography line breaking","checks":8,"contract":"Input [words, width]. Let L be the greedy line count at width ([\"overflow\"] if a word is wider). Find the smallest width w (>= longest word) whose greedy wrap needs no more than L lines, then return the greedy wrap at w.","contract_signature":"x","evaluation_group":"w2-typography-line-breaking-balanced-headline","failed_approach":"Allowing one character overflow accepts impossible widths.","family":"w2-typography-line-breaking-balanced-headline-overwide-word-test","id":"FA-80291","implementations":{"attempt":{"sha256":"cd0b6958a53ab8cd34d2f3c5950519f98f10db083f106389eb1f11e12b2bf29e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    words, width = x\n    def lines_for(w):\n        count, cur = 0, -1\n        for t in words:\n            if len(t) > w + 1:\n                return None\n            if cur == -1:\n                cur = len(t)\n                count = 1\n            elif cur + 1 + len(t) <= w:\n                cur += 1 + len(t)\n            else:\n                count += 1\n                cur = len(t)\n        return count\n    target = lines_for(width)\n    if target is None:\n        return ['overflow']\n    lo = max(len(t) for t in words)\n    hi = width\n    while lo < hi:\n        mid = (lo + hi) // 2\n        c = lines_for(mid)\n        if c is not None and c <= target:\n            hi = mid\n        else:\n            lo = mid + 1\n    out, cur = [], ''\n    for t in words:\n        cand = t if not cur else cur + ' ' + t\n        if len(cand) <= lo:\n            cur = cand\n        else:\n            out.append(cur)\n            cur = t\n    out.append(cur)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('regression: overwide word test', [['grid', 'serif', 'serif', 'grid', 'x', 'of'], 7], ['grid', 'serif', 'serif', 'grid', 'x of']), ('partial-repair probe', [['is', 'ink', 'serif', 'kerning', 'x', 'baseline', 'kerning', 'of', 'is'], 7], ['overflow']), ('partial-repair probe', [['a', 'serif', 'baseline', 'ink', 'at', 'measure', 'baseline'], 7], ['overflow']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('control layout', [['ink', 'x'], 28], ['ink x']), ('control layout', [['measure', 'on', 'kerning'], 13], ['measure on', 'kerning']), ('control layout', [['kerning', 'x', 'is'], 27], ['kerning x is'])], [('regression: overwide word test', [['grid', 'serif', 'serif', 'grid', 'x', 'of'], 7], ['grid', 'serif', 'serif', 'grid', 'x of']), ('regression: overwide word test', [['kerning', 'type', 'is', 'is', 'is', 'measure', 'measure', 'type', 'at'], 7], ['kerning', 'type is', 'is is', 'measure', 'measure', 'type at']), ('partial-repair probe', [['type', 'the', 'measure', 'kerning', 'is'], 6], ['overflow']), ('partial-repair probe', [['a', 'serif', 'baseline', 'ink', 'at', 'measure', 'baseline'], 7], ['overflow']), ('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('control layout', [['x', 'x'], 11], ['x x']), ('control layout', [['on', 'serif', 'measure', 'ink', 'a', 'on', 'x', 'of'], 22], ['on serif measure', 'ink a on x of'])], [('regression: overwide word test', [['at', 'grid', 'measure', 'a', 'x', 'is', 'baseline', 'is'], 10], ['at grid', 'measure', 'a x is', 'baseline', 'is']), ('regression: overwide word test', [['x', 'baseline', 'is', 'ink', 'type', 'measure', 'on', 'a', 'the'], 8], ['x', 'baseline', 'is ink', 'type', 'measure', 'on a the']), ('partial-repair probe', [['on', 'a', 'grid', 'ink', 'baseline'], 7], ['overflow']), ('partial-repair probe', [['measure', 'x'], 6], ['overflow']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('control layout', [['kerning', 'a', 'on', 'x', 'of', 'the', 'a', 'grid'], 16], ['kerning a on x', 'of the a grid']), ('control layout', [['at', 'baseline', 'baseline', 'grid', 'a', 'on', 'baseline', 'of'], 21], ['at baseline baseline', 'grid a on baseline of'])], [('regression: overwide word test', [['is', 'is', 'the', 'serif'], 5], ['is is', 'the', 'serif']), ('regression: overwide word test', [['on', 'baseline'], 8], ['on', 'baseline']), ('partial-repair probe', [['is', 'ink', 'serif', 'kerning', 'x', 'baseline', 'kerning', 'of', 'is'], 7], ['overflow']), ('partial-repair probe', [['at', 'type', 'is', 'baseline', 'ink'], 7], ['overflow']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('control layout', [['the', 'ink', 'a'], 19], ['the ink a']), ('control layout', [['a', 'baseline', 'type'], 6], ['overflow'])], [('regression: overwide word test', [['kerning', 'type', 'is', 'is', 'is', 'measure', 'measure', 'type', 'at'], 7], ['kerning', 'type is', 'is is', 'measure', 'measure', 'type at']), ('regression: overwide word test', [['grid', 'serif', 'serif', 'grid', 'x', 'of'], 7], ['grid', 'serif', 'serif', 'grid', 'x of']), ('partial-repair probe', [['measure', 'x', 'serif', 'a', 'a', 'x', 'is', 'of', 'x'], 6], ['overflow']), ('partial-repair probe', [['kerning', 'serif', 'of', 'grid', 'serif', 'on', 'grid', 'x'], 6], ['overflow']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('control layout', [['the', 'on', 'at', 'of', 'is', 'measure', 'type'], 10], ['the on', 'at of is', 'measure', 'type']), ('control layout', [['type', 'at', 'ink', 'of', 'measure'], 14], ['type at ink', 'of measure'])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"f795ba468781141313afa21cd4b35dda0c8c2020b232b623f6cdafe7472ffb92","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    words, width = x\n    def lines_for(w):\n        count, cur = 0, -1\n        for t in words:\n            if len(t) >= w:\n                return None\n            if cur == -1:\n                cur = len(t)\n                count = 1\n            elif cur + 1 + len(t) <= w:\n                cur += 1 + len(t)\n            else:\n                count += 1\n                cur = len(t)\n        return count\n    target = lines_for(width)\n    if target is None:\n        return ['overflow']\n    lo = max(len(t) for t in words)\n    hi = width\n    while lo < hi:\n        mid = (lo + hi) // 2\n        c = lines_for(mid)\n        if c is not None and c <= target:\n            hi = mid\n        else:\n            lo = mid + 1\n    out, cur = [], ''\n    for t in words:\n        cand = t if not cur else cur + ' ' + t\n        if len(cand) <= lo:\n            cur = cand\n        else:\n            out.append(cur)\n            cur = t\n    out.append(cur)\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('regression: overwide word test', [['grid', 'serif', 'serif', 'grid', 'x', 'of'], 7], ['grid', 'serif', 'serif', 'grid', 'x of']), ('partial-repair probe', [['is', 'ink', 'serif', 'kerning', 'x', 'baseline', 'kerning', 'of', 'is'], 7], ['overflow']), ('partial-repair probe', [['a', 'serif', 'baseline', 'ink', 'at', 'measure', 'baseline'], 7], ['overflow']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('control layout', [['ink', 'x'], 28], ['ink x']), ('control layout', [['measure', 'on', 'kerning'], 13], ['measure on', 'kerning']), ('control layout', [['kerning', 'x', 'is'], 27], ['kerning x is'])], [('regression: overwide word test', [['grid', 'serif', 'serif', 'grid', 'x', 'of'], 7], ['grid', 'serif', 'serif', 'grid', 'x of']), ('regression: overwide word test', [['kerning', 'type', 'is', 'is', 'is', 'measure', 'measure', 'type', 'at'], 7], ['kerning', 'type is', 'is is', 'measure', 'measure', 'type at']), ('partial-repair probe', [['type', 'the', 'measure', 'kerning', 'is'], 6], ['overflow']), ('partial-repair probe', [['a', 'serif', 'baseline', 'ink', 'at', 'measure', 'baseline'], 7], ['overflow']), ('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('control layout', [['x', 'x'], 11], ['x x']), ('control layout', [['on', 'serif', 'measure', 'ink', 'a', 'on', 'x', 'of'], 22], ['on serif measure', 'ink a on x of'])], [('regression: overwide word test', [['at', 'grid', 'measure', 'a', 'x', 'is', 'baseline', 'is'], 10], ['at grid', 'measure', 'a x is', 'baseline', 'is']), ('regression: overwide word test', [['x', 'baseline', 'is', 'ink', 'type', 'measure', 'on', 'a', 'the'], 8], ['x', 'baseline', 'is ink', 'type', 'measure', 'on a the']), ('partial-repair probe', [['on', 'a', 'grid', 'ink', 'baseline'], 7], ['overflow']), ('partial-repair probe', [['measure', 'x'], 6], ['overflow']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('control layout', [['kerning', 'a', 'on', 'x', 'of', 'the', 'a', 'grid'], 16], ['kerning a on x', 'of the a grid']), ('control layout', [['at', 'baseline', 'baseline', 'grid', 'a', 'on', 'baseline', 'of'], 21], ['at baseline baseline', 'grid a on baseline of'])], [('regression: overwide word test', [['is', 'is', 'the', 'serif'], 5], ['is is', 'the', 'serif']), ('regression: overwide word test', [['on', 'baseline'], 8], ['on', 'baseline']), ('partial-repair probe', [['is', 'ink', 'serif', 'kerning', 'x', 'baseline', 'kerning', 'of', 'is'], 7], ['overflow']), ('partial-repair probe', [['at', 'type', 'is', 'baseline', 'ink'], 7], ['overflow']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('control layout', [['the', 'ink', 'a'], 19], ['the ink a']), ('control layout', [['a', 'baseline', 'type'], 6], ['overflow'])], [('regression: overwide word test', [['kerning', 'type', 'is', 'is', 'is', 'measure', 'measure', 'type', 'at'], 7], ['kerning', 'type is', 'is is', 'measure', 'measure', 'type at']), ('regression: overwide word test', [['grid', 'serif', 'serif', 'grid', 'x', 'of'], 7], ['grid', 'serif', 'serif', 'grid', 'x of']), ('partial-repair probe', [['measure', 'x', 'serif', 'a', 'a', 'x', 'is', 'of', 'x'], 6], ['overflow']), ('partial-repair probe', [['kerning', 'serif', 'of', 'grid', 'serif', 'on', 'grid', 'x'], 6], ['overflow']), ('two balanced lines', [['the', 'type', 'grid', 'is', 'on', 'serif'], 22], ['the type grid', 'is on serif']), ('word exactly the width', [['baseline', 'x'], 8], ['baseline', 'x']), ('control layout', [['the', 'on', 'at', 'of', 'is', 'measure', 'type'], 10], ['the on', 'at of is', 'measure', 'type']), ('control layout', [['type', 'at', 'ink', 'of', 'measure'], 14], ['type at ink', 'of measure'])]]\nfor label, args, expected in fixtures[N - 1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-typography-line-breaking-balanced-headline-overwide-word-test","generated_at":"2026-09-29T14:49:52.467563+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Line breaking decides where paragraphs wrap on screen and in print; a wrong decision point shifts every following line.","root_cause":"The overwide test uses >=.","sha256":"8ea57da29af63f60b80800d57ed59dfaed53b1017b21068470af6d3953e33c7b","title":"Balanced headline wrapping: overwide word test · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":42.099,"exit_code":1,"observations":[{"actual":["baseline","x"],"check":"word exactly the width","expected":["baseline","x"],"passed":true},{"actual":["grid","serif","serif","grid","x of"],"check":"regression: overwide word test","expected":["grid","serif","serif","grid","x of"],"passed":true},{"actual":["is ink","serif","kerning","x","baseline","kerning","of is"],"check":"partial-repair probe","expected":["overflow"],"passed":false},{"actual":["a serif","baseline","ink at","measure","baseline"],"check":"partial-repair probe","expected":["overflow"],"passed":false},{"actual":["the type grid","is on serif"],"check":"two balanced lines","expected":["the type grid","is on serif"],"passed":true},{"actual":["ink x"],"check":"control layout","expected":["ink x"],"passed":true},{"actual":["measure on","kerning"],"check":"control layout","expected":["measure on","kerning"],"passed":true},{"actual":["kerning x is"],"check":"control layout","expected":["kerning x is"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"word exactly the width\", \"actual\": [\"baseline\", \"x\"], \"expected\": [\"baseline\", \"x\"], \"passed\": true}, {\"check\": \"regression: overwide word test\", \"actual\": [\"grid\", \"serif\", \"serif\", \"grid\", \"x of\"], \"expected\": [\"grid\", \"serif\", \"serif\", \"grid\", \"x of\"], \"passed\": true}, {\"check\": \"partial-repair probe\", \"actual\": [\"is ink\", \"serif\", \"kerning\", \"x\", \"baseline\", \"kerning\", \"of is\"], \"expected\": [\"overflow\"], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"a serif\", \"baseline\", \"ink at\", \"measure\", \"baseline\"], \"expected\": [\"overflow\"], \"passed\": false}, {\"check\": \"two balanced lines\", \"actual\": [\"the type grid\", \"is on serif\"], \"expected\": [\"the type grid\", \"is on serif\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ink x\"], \"expected\": [\"ink x\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"measure on\", \"kerning\"], \"expected\": [\"measure on\", \"kerning\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"kerning x is\"], \"expected\": [\"kerning x is\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.717,"exit_code":1,"observations":[{"actual":["overflow"],"check":"word exactly the width","expected":["baseline","x"],"passed":false},{"actual":["grid","serif","serif","grid x","of"],"check":"regression: overwide word test","expected":["grid","serif","serif","grid","x of"],"passed":false},{"actual":["overflow"],"check":"partial-repair probe","expected":["overflow"],"passed":true},{"actual":["overflow"],"check":"partial-repair probe","expected":["overflow"],"passed":true},{"actual":["the type grid","is on serif"],"check":"two balanced lines","expected":["the type grid","is on serif"],"passed":true},{"actual":["ink x"],"check":"control layout","expected":["ink x"],"passed":true},{"actual":["measure on","kerning"],"check":"control layout","expected":["measure on","kerning"],"passed":true},{"actual":["kerning x is"],"check":"control layout","expected":["kerning x is"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"word exactly the width\", \"actual\": [\"overflow\"], \"expected\": [\"baseline\", \"x\"], \"passed\": false}, {\"check\": \"regression: overwide word test\", \"actual\": [\"grid\", \"serif\", \"serif\", \"grid x\", \"of\"], \"expected\": [\"grid\", \"serif\", \"serif\", \"grid\", \"x of\"], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"overflow\"], \"expected\": [\"overflow\"], \"passed\": true}, {\"check\": \"partial-repair probe\", \"actual\": [\"overflow\"], \"expected\": [\"overflow\"], \"passed\": true}, {\"check\": \"two balanced lines\", \"actual\": [\"the type grid\", \"is on serif\"], \"expected\": [\"the type grid\", \"is on serif\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ink x\"], \"expected\": [\"ink x\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"measure on\", \"kerning\"], \"expected\": [\"measure on\", \"kerning\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"kerning x is\"], \"expected\": [\"kerning x is\"], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}