{"abstract":"Words broken at a discretionary lose their hyphen.","category":"Typography line breaking","checks":8,"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.","contract_signature":"x","evaluation_group":"w2-typography-line-breaking-ties-discretionaries","failed_approach":"Appending a hyphen at every non-space break also hyphenates invisible breaks.","family":"w2-typography-line-breaking-ties-discretionaries-hyphen-at-taken-discretionary","id":"FA-80191","implementations":{"attempt":{"sha256":"c3e2d56adb4be6bb6fbc42b39498989dd1f6e733170f2a28c88e108644c6432f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    src, width = x\n    chunks = ['']\n    ops = []\n    i = 0\n    while i < len(src):\n        c = src[i]\n        if src.startswith('\\\\-', i):\n            ops.append('d')\n            chunks.append('')\n            i += 2\n            continue\n        if c == ' ':\n            j = i\n            while j < len(src) and src[j] == ' ':\n                j += 1\n            ops.append('s')\n            chunks.append('')\n            i = j\n            continue\n        if c == '|':\n            ops.append('z')\n            chunks.append('')\n            i += 1\n            continue\n        chunks[-1] += ' ' if c == '~' else c\n        i += 1\n    line = chunks[0]\n    lines = []\n    for op, ch in zip(ops, chunks[1:]):\n        sep = ' ' if op == 's' else ''\n        if len(line + sep + ch) <= width:\n            line = line + sep + ch\n        else:\n            lines.append(line + ('-' if op != 's' else ''))\n            line = ch\n    lines.append(line)\n    return lines\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('discretionary taken', ['the com\\\\-po\\\\-si\\\\-tion', 9], ['the compo-', 'sition']), ('regression: hyphen at taken discretionary', ['a com\\\\-po\\\\-si\\\\-tion word', 9], ['a composi-', 'tion word']), ('partial-repair probe', ['url|path word a b|c a Dr.~Knuth  url|path  word ~10~pt', 8], ['urlpath', 'word a b', 'c a', 'Dr. Knuth', 'urlpath', 'word', ' 10 pt']), ('partial-repair probe', ['word type x ink url|path set  ~a', 10], ['word type', 'x ink url', 'path set', ' a']), ('double space collapses', ['type  set', 20], ['type set']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['type word  Dr.~Knuth  b|c', 15], ['type word', 'Dr. Knuth bc']), ('control layout', ['ink  a ~a Dr.~Knuth Dr.~Knuth  type b|c', 12], ['ink a  a', 'Dr. Knuth', 'Dr. Knuth', 'type bc'])], [('regression: hyphen at taken discretionary', ['word hy\\\\-phen set word ~set Dr.~Knuth  word  word', 8], ['word hy-', 'phen set', 'word', ' set', 'Dr. Knuth', 'word', 'word']), ('regression: hyphen at taken discretionary', ['Dr.~Knuth Dr.~Knuth ~url|path a a  ~hy\\\\-phen  ~Dr.~Knuth  hy\\\\-phen com\\\\-po\\\\-si\\\\-tion', 14], ['Dr. Knuth', 'Dr. Knuth  url', 'path a a  hy-', 'phen', ' Dr. Knuth hy-', 'phen composi-', 'tion']), ('partial-repair probe', ['x com\\\\-po\\\\-si\\\\-tion b|c', 15], ['x composition b', 'c']), ('partial-repair probe', ['set ink ink word url|path Dr.~Knuth hy\\\\-phen word', 11], ['set ink ink', 'word url', 'path', 'Dr. Knuth', 'hyphen word']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('double space collapses', ['type  set', 20], ['type set']), ('control layout', ['Dr.~Knuth hy\\\\-phen a type ~a type', 7], ['Dr. Knuth', 'hyphen', 'a type', ' a type']), ('control layout', ['ink  a ~a Dr.~Knuth Dr.~Knuth  type b|c', 12], ['ink a  a', 'Dr. Knuth', 'Dr. Knuth', 'type bc'])], [('regression: hyphen at taken discretionary', ['set  url|path a com\\\\-po\\\\-si\\\\-tion x', 12], ['set urlpath', 'a composi-', 'tion x']), ('regression: hyphen at taken discretionary', ['10~pt ink hy\\\\-phen word', 12], ['10 pt ink hy-', 'phen word']), ('partial-repair probe', ['ink 10~pt ink b|c hy\\\\-phen ~set url|path word', 16], ['ink 10 pt ink bc', 'hyphen  set url', 'path word']), ('regression: hyphen at taken discretionary', ['ink  com\\\\-po\\\\-si\\\\-tion a  url|path a  ink url|path  url|path ~10~pt', 6], ['ink', 'compo-', 'sition', 'a url', 'path a', 'ink', 'url', 'path', 'url', 'path', ' 10 pt']), ('discretionary taken', ['the com\\\\-po\\\\-si\\\\-tion', 9], ['the compo-', 'sition']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['a  Dr.~Knuth  Dr.~Knuth  ink', 11], ['a Dr. Knuth', 'Dr. Knuth', 'ink']), ('control layout', ['a  x a Dr.~Knuth ~type set hy\\\\-phen  ~type', 16], ['a x a Dr. Knuth', ' type set hyphen', ' type'])], [('regression: hyphen at taken discretionary', ['x  10~pt a ~Dr.~Knuth b|c  Dr.~Knuth ~hy\\\\-phen  set  com\\\\-po\\\\-si\\\\-tion', 16], ['x 10 pt a', ' Dr. Knuth bc', 'Dr. Knuth  hy-', 'phen set composi-', 'tion']), ('regression: hyphen at taken discretionary', ['x set  type com\\\\-po\\\\-si\\\\-tion a ~ink b|c hy\\\\-phen url|path', 13], ['x set type', 'composition a', ' ink bc hy-', 'phen urlpath']), ('partial-repair probe', ['10~pt b|c  ~Dr.~Knuth  b|c  set', 12], ['10 pt bc', ' Dr. Knuth b', 'c set']), ('partial-repair probe', ['Dr.~Knuth url|path b|c set url|path 10~pt', 10], ['Dr. Knuth', 'urlpath bc', 'set url', 'path 10 pt']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('double space collapses', ['type  set', 20], ['type set']), ('control layout', ['hy\\\\-phen a ~a ~b|c set ~ink', 8], ['hyphen a', ' a  bc', 'set  ink']), ('control layout', ['Dr.~Knuth set 10~pt ink ink', 10], ['Dr. Knuth', 'set 10 pt', 'ink ink'])], [('regression: hyphen at taken discretionary', ['hy\\\\-phen  ~com\\\\-po\\\\-si\\\\-tion 10~pt word  b|c', 15], ['hyphen  composi-', 'tion 10 pt word', 'bc']), ('regression: hyphen at taken discretionary', ['a Dr.~Knuth x ~set word type  ~com\\\\-po\\\\-si\\\\-tion', 6], ['a', 'Dr. Knuth', 'x  set', 'word', 'type', ' compo-', 'sition']), ('partial-repair probe', ['word set  a  x ~set ~set  b|c x', 6], ['word', 'set a', 'x  set', ' set b', 'c x']), ('regression: hyphen at taken discretionary', ['url|path ink  set Dr.~Knuth hy\\\\-phen set type x', 5], ['url', 'path', 'ink', 'set', 'Dr. Knuth', 'hy-', 'phen', 'set', 'type', 'x']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['ink com\\\\-po\\\\-si\\\\-tion Dr.~Knuth', 16], ['ink composition', 'Dr. Knuth']), ('control layout', ['a b|c x b|c', 15], ['a bc x bc'])]]\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":"de9d20626b21bc8dde5676581adf40ed3fa330cef948a43f2b93c54852b84eab","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    src, width = x\n    chunks = ['']\n    ops = []\n    i = 0\n    while i < len(src):\n        c = src[i]\n        if src.startswith('\\\\-', i):\n            ops.append('d')\n            chunks.append('')\n            i += 2\n            continue\n        if c == ' ':\n            j = i\n            while j < len(src) and src[j] == ' ':\n                j += 1\n            ops.append('s')\n            chunks.append('')\n            i = j\n            continue\n        if c == '|':\n            ops.append('z')\n            chunks.append('')\n            i += 1\n            continue\n        chunks[-1] += ' ' if c == '~' else c\n        i += 1\n    line = chunks[0]\n    lines = []\n    for op, ch in zip(ops, chunks[1:]):\n        sep = ' ' if op == 's' else ''\n        if len(line + sep + ch) <= width:\n            line = line + sep + ch\n        else:\n            lines.append(line)\n            line = ch\n    lines.append(line)\n    return lines\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('discretionary taken', ['the com\\\\-po\\\\-si\\\\-tion', 9], ['the compo-', 'sition']), ('regression: hyphen at taken discretionary', ['a com\\\\-po\\\\-si\\\\-tion word', 9], ['a composi-', 'tion word']), ('partial-repair probe', ['url|path word a b|c a Dr.~Knuth  url|path  word ~10~pt', 8], ['urlpath', 'word a b', 'c a', 'Dr. Knuth', 'urlpath', 'word', ' 10 pt']), ('partial-repair probe', ['word type x ink url|path set  ~a', 10], ['word type', 'x ink url', 'path set', ' a']), ('double space collapses', ['type  set', 20], ['type set']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['type word  Dr.~Knuth  b|c', 15], ['type word', 'Dr. Knuth bc']), ('control layout', ['ink  a ~a Dr.~Knuth Dr.~Knuth  type b|c', 12], ['ink a  a', 'Dr. Knuth', 'Dr. Knuth', 'type bc'])], [('regression: hyphen at taken discretionary', ['word hy\\\\-phen set word ~set Dr.~Knuth  word  word', 8], ['word hy-', 'phen set', 'word', ' set', 'Dr. Knuth', 'word', 'word']), ('regression: hyphen at taken discretionary', ['Dr.~Knuth Dr.~Knuth ~url|path a a  ~hy\\\\-phen  ~Dr.~Knuth  hy\\\\-phen com\\\\-po\\\\-si\\\\-tion', 14], ['Dr. Knuth', 'Dr. Knuth  url', 'path a a  hy-', 'phen', ' Dr. Knuth hy-', 'phen composi-', 'tion']), ('partial-repair probe', ['x com\\\\-po\\\\-si\\\\-tion b|c', 15], ['x composition b', 'c']), ('partial-repair probe', ['set ink ink word url|path Dr.~Knuth hy\\\\-phen word', 11], ['set ink ink', 'word url', 'path', 'Dr. Knuth', 'hyphen word']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('double space collapses', ['type  set', 20], ['type set']), ('control layout', ['Dr.~Knuth hy\\\\-phen a type ~a type', 7], ['Dr. Knuth', 'hyphen', 'a type', ' a type']), ('control layout', ['ink  a ~a Dr.~Knuth Dr.~Knuth  type b|c', 12], ['ink a  a', 'Dr. Knuth', 'Dr. Knuth', 'type bc'])], [('regression: hyphen at taken discretionary', ['set  url|path a com\\\\-po\\\\-si\\\\-tion x', 12], ['set urlpath', 'a composi-', 'tion x']), ('regression: hyphen at taken discretionary', ['10~pt ink hy\\\\-phen word', 12], ['10 pt ink hy-', 'phen word']), ('partial-repair probe', ['ink 10~pt ink b|c hy\\\\-phen ~set url|path word', 16], ['ink 10 pt ink bc', 'hyphen  set url', 'path word']), ('regression: hyphen at taken discretionary', ['ink  com\\\\-po\\\\-si\\\\-tion a  url|path a  ink url|path  url|path ~10~pt', 6], ['ink', 'compo-', 'sition', 'a url', 'path a', 'ink', 'url', 'path', 'url', 'path', ' 10 pt']), ('discretionary taken', ['the com\\\\-po\\\\-si\\\\-tion', 9], ['the compo-', 'sition']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('control layout', ['a  Dr.~Knuth  Dr.~Knuth  ink', 11], ['a Dr. Knuth', 'Dr. Knuth', 'ink']), ('control layout', ['a  x a Dr.~Knuth ~type set hy\\\\-phen  ~type', 16], ['a x a Dr. Knuth', ' type set hyphen', ' type'])], [('regression: hyphen at taken discretionary', ['x  10~pt a ~Dr.~Knuth b|c  Dr.~Knuth ~hy\\\\-phen  set  com\\\\-po\\\\-si\\\\-tion', 16], ['x 10 pt a', ' Dr. Knuth bc', 'Dr. Knuth  hy-', 'phen set composi-', 'tion']), ('regression: hyphen at taken discretionary', ['x set  type com\\\\-po\\\\-si\\\\-tion a ~ink b|c hy\\\\-phen url|path', 13], ['x set type', 'composition a', ' ink bc hy-', 'phen urlpath']), ('partial-repair probe', ['10~pt b|c  ~Dr.~Knuth  b|c  set', 12], ['10 pt bc', ' Dr. Knuth b', 'c set']), ('partial-repair probe', ['Dr.~Knuth url|path b|c set url|path 10~pt', 10], ['Dr. Knuth', 'urlpath bc', 'set url', 'path 10 pt']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('double space collapses', ['type  set', 20], ['type set']), ('control layout', ['hy\\\\-phen a ~a ~b|c set ~ink', 8], ['hyphen a', ' a  bc', 'set  ink']), ('control layout', ['Dr.~Knuth set 10~pt ink ink', 10], ['Dr. Knuth', 'set 10 pt', 'ink ink'])], [('regression: hyphen at taken discretionary', ['hy\\\\-phen  ~com\\\\-po\\\\-si\\\\-tion 10~pt word  b|c', 15], ['hyphen  composi-', 'tion 10 pt word', 'bc']), ('regression: hyphen at taken discretionary', ['a Dr.~Knuth x ~set word type  ~com\\\\-po\\\\-si\\\\-tion', 6], ['a', 'Dr. Knuth', 'x  set', 'word', 'type', ' compo-', 'sition']), ('partial-repair probe', ['word set  a  x ~set ~set  b|c x', 6], ['word', 'set a', 'x  set', ' set b', 'c x']), ('regression: hyphen at taken discretionary', ['url|path ink  set Dr.~Knuth hy\\\\-phen set type x', 5], ['url', 'path', 'ink', 'set', 'Dr. Knuth', 'hy-', 'phen', 'set', 'type', 'x']), ('invisible break', ['url|path|x', 5], ['url', 'pathx']), ('tie keeps title with name', ['see Dr.~Knuth now', 9], ['see', 'Dr. Knuth', 'now']), ('control layout', ['ink com\\\\-po\\\\-si\\\\-tion Dr.~Knuth', 16], ['ink composition', 'Dr. Knuth']), ('control layout', ['a b|c x b|c', 15], ['a bc x bc'])]]\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-ties-discretionaries-hyphen-at-taken-discretionary","generated_at":"2026-09-29T14:49:51.592262+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 pre-break text of the discretionary is not emitted at the break.","sha256":"d8788d3a1c76a904b6982fff6c4174954393fd5e9b7215ff64f22a584d178817","title":"Ties and discretionary hyphens: hyphen at taken discretionary · 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":39.873,"exit_code":1,"observations":[{"actual":["the compo-","sition"],"check":"discretionary taken","expected":["the compo-","sition"],"passed":true},{"actual":["a composi-","tion word"],"check":"regression: hyphen at taken discretionary","expected":["a composi-","tion word"],"passed":true},{"actual":["urlpath","word a b-","c a","Dr. Knuth","urlpath","word"," 10 pt"],"check":"partial-repair probe","expected":["urlpath","word a b","c a","Dr. Knuth","urlpath","word"," 10 pt"],"passed":false},{"actual":["word type","x ink url-","path set"," a"],"check":"partial-repair probe","expected":["word type","x ink url","path set"," a"],"passed":false},{"actual":["type set"],"check":"double space collapses","expected":["type set"],"passed":true},{"actual":["see","Dr. Knuth","now"],"check":"tie keeps title with name","expected":["see","Dr. Knuth","now"],"passed":true},{"actual":["type word","Dr. Knuth bc"],"check":"control layout","expected":["type word","Dr. Knuth bc"],"passed":true},{"actual":["ink a  a","Dr. Knuth","Dr. Knuth","type bc"],"check":"control layout","expected":["ink a  a","Dr. Knuth","Dr. Knuth","type bc"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"discretionary taken\", \"actual\": [\"the compo-\", \"sition\"], \"expected\": [\"the compo-\", \"sition\"], \"passed\": true}, {\"check\": \"regression: hyphen at taken discretionary\", \"actual\": [\"a composi-\", \"tion word\"], \"expected\": [\"a composi-\", \"tion word\"], \"passed\": true}, {\"check\": \"partial-repair probe\", \"actual\": [\"urlpath\", \"word a b-\", \"c a\", \"Dr. Knuth\", \"urlpath\", \"word\", \" 10 pt\"], \"expected\": [\"urlpath\", \"word a b\", \"c a\", \"Dr. Knuth\", \"urlpath\", \"word\", \" 10 pt\"], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"word type\", \"x ink url-\", \"path set\", \" a\"], \"expected\": [\"word type\", \"x ink url\", \"path set\", \" a\"], \"passed\": false}, {\"check\": \"double space collapses\", \"actual\": [\"type set\"], \"expected\": [\"type set\"], \"passed\": true}, {\"check\": \"tie keeps title with name\", \"actual\": [\"see\", \"Dr. Knuth\", \"now\"], \"expected\": [\"see\", \"Dr. Knuth\", \"now\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"type word\", \"Dr. Knuth bc\"], \"expected\": [\"type word\", \"Dr. Knuth bc\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ink a  a\", \"Dr. Knuth\", \"Dr. Knuth\", \"type bc\"], \"expected\": [\"ink a  a\", \"Dr. Knuth\", \"Dr. Knuth\", \"type bc\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.437,"exit_code":1,"observations":[{"actual":["the compo","sition"],"check":"discretionary taken","expected":["the compo-","sition"],"passed":false},{"actual":["a composi","tion word"],"check":"regression: hyphen at taken discretionary","expected":["a composi-","tion word"],"passed":false},{"actual":["urlpath","word a b","c a","Dr. Knuth","urlpath","word"," 10 pt"],"check":"partial-repair probe","expected":["urlpath","word a b","c a","Dr. Knuth","urlpath","word"," 10 pt"],"passed":true},{"actual":["word type","x ink url","path set"," a"],"check":"partial-repair probe","expected":["word type","x ink url","path set"," a"],"passed":true},{"actual":["type set"],"check":"double space collapses","expected":["type set"],"passed":true},{"actual":["see","Dr. Knuth","now"],"check":"tie keeps title with name","expected":["see","Dr. Knuth","now"],"passed":true},{"actual":["type word","Dr. Knuth bc"],"check":"control layout","expected":["type word","Dr. Knuth bc"],"passed":true},{"actual":["ink a  a","Dr. Knuth","Dr. Knuth","type bc"],"check":"control layout","expected":["ink a  a","Dr. Knuth","Dr. Knuth","type bc"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"discretionary taken\", \"actual\": [\"the compo\", \"sition\"], \"expected\": [\"the compo-\", \"sition\"], \"passed\": false}, {\"check\": \"regression: hyphen at taken discretionary\", \"actual\": [\"a composi\", \"tion word\"], \"expected\": [\"a composi-\", \"tion word\"], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"urlpath\", \"word a b\", \"c a\", \"Dr. Knuth\", \"urlpath\", \"word\", \" 10 pt\"], \"expected\": [\"urlpath\", \"word a b\", \"c a\", \"Dr. Knuth\", \"urlpath\", \"word\", \" 10 pt\"], \"passed\": true}, {\"check\": \"partial-repair probe\", \"actual\": [\"word type\", \"x ink url\", \"path set\", \" a\"], \"expected\": [\"word type\", \"x ink url\", \"path set\", \" a\"], \"passed\": true}, {\"check\": \"double space collapses\", \"actual\": [\"type set\"], \"expected\": [\"type set\"], \"passed\": true}, {\"check\": \"tie keeps title with name\", \"actual\": [\"see\", \"Dr. Knuth\", \"now\"], \"expected\": [\"see\", \"Dr. Knuth\", \"now\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"type word\", \"Dr. Knuth bc\"], \"expected\": [\"type word\", \"Dr. Knuth bc\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ink a  a\", \"Dr. Knuth\", \"Dr. Knuth\", \"type bc\"], \"expected\": [\"ink a  a\", \"Dr. Knuth\", \"Dr. Knuth\", \"type bc\"], \"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."}}