{"abstract":"Justified lines come out too wide.","category":"Typography line breaking","checks":8,"contract":"Input [word widths, target width, is_last, natural space, min space, max space]. Last lines and single-word lines are set ragged with natural spaces. Otherwise distribute target-sum(words) over the gaps: equal share with the remainder units added to the rightmost gaps; a share below min space is [\"overfull\"]; if any gap would exceed max space fall back to ragged. Return word x positions.","contract_signature":"x","evaluation_group":"w2-typography-line-breaking-justify-spaces","failed_approach":"Excluding the last word from the sum inflates the budget.","family":"w2-typography-line-breaking-justify-spaces-space-budget","id":"FA-80091","implementations":{"attempt":{"sha256":"1f984f92271ff7369c48b51b4d694f5e6fb1b2579f34fd7b8668593580d44569","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    words, target, is_last, sp, lo, hi = x\n    n = len(words)\n    gaps = n - 1\n    def natural():\n        pos, xx = [], 0\n        for w in words:\n            pos.append(xx)\n            xx += w + sp\n        return pos\n    if is_last or gaps == 0:\n        return natural()\n    space = target - sum(words[:-1])\n    per, rem = divmod(space, gaps)\n    if per < lo:\n        return ['overfull']\n    if per + (1 if rem else 0) > hi:\n        return natural()\n    pos, xx = [], 0\n    for k, w in enumerate(words):\n        pos.append(xx)\n        if k < gaps:\n            xx += w + per + (1 if k >= gaps - rem else 0)\n    return pos\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('regression: space budget', [[9, 8, 5, 8, 9], 51, False, 2, 1, 4], [0, 12, 23, 31, 42]), ('regression: space budget', [[5, 3, 6, 5, 6, 4], 49, False, 3, 3, 5], [0, 9, 16, 26, 35, 45]), ('partial-repair probe', [[6, 2, 9], 19, False, 2, 2, 3], ['overfull']), ('last line ragged', [[3, 4, 5], 20, True, 2, 1, 6], [0, 5, 11]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[3, 9, 3, 2, 3, 5], 49, True, 2, 2, 6], [0, 5, 16, 21, 25, 30]), ('control layout', [[5], 7, False, 3, 3, 7], [0])], [('regression: space budget', [[8, 7, 6, 6, 6], 52, False, 3, 2, 4], [0, 11, 21, 30, 39]), ('regression: space budget', [[4, 8], 20, False, 3, 1, 5], [0, 7]), ('partial-repair probe', [[2, 6, 2, 7], 22, False, 2, 2, 5], ['overfull']), ('regression: space budget', [[6, 8, 2, 8, 3], 42, False, 3, 1, 5], [0, 9, 21, 27, 39]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[6], 6, False, 2, 1, 4], [0]), ('control layout', [[2, 5, 3, 7, 9, 7], 44, True, 3, 3, 7], [0, 5, 13, 19, 29, 41])], [('regression: space budget', [[6, 8, 6, 8, 7], 49, False, 2, 2, 4], [0, 9, 20, 30, 42]), ('regression: space budget', [[3, 6, 3], 26, False, 2, 2, 5], [0, 5, 13]), ('regression: space budget', [[5, 6, 7, 8], 38, False, 2, 2, 5], [0, 9, 19, 30]), ('regression: space budget', [[3, 9, 2, 3], 26, False, 3, 2, 5], [0, 6, 18, 23]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('control layout', [[6], 7, False, 2, 2, 4], [0]), ('control layout', [[9, 8, 3, 8], 40, False, 2, 1, 3], [0, 11, 21, 26])], [('regression: space budget', [[3, 5, 9, 6, 8], 39, False, 2, 2, 5], [0, 5, 12, 23, 31]), ('regression: space budget', [[5, 6, 7, 6, 3], 47, False, 3, 1, 5], [0, 10, 21, 33, 44]), ('regression: space budget', [[2, 2, 4, 5], 19, False, 2, 2, 4], [0, 4, 8, 14]), ('regression: space budget', [[2, 6, 9, 2], 28, False, 2, 2, 3], [0, 5, 14, 26]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('control layout', [[2, 5, 3, 7, 9, 7], 44, True, 3, 3, 7], [0, 5, 13, 19, 29, 41]), ('control layout', [[2, 2], 4, True, 3, 2, 7], [0, 5])], [('regression: space budget', [[5, 4, 3, 2], 23, False, 2, 2, 5], [0, 8, 15, 21]), ('regression: space budget', [[2, 6, 8, 6, 6, 9], 75, False, 2, 1, 6], [0, 4, 12, 22, 30, 38]), ('regression: space budget', [[2, 4, 6, 4, 7, 2], 43, False, 2, 1, 6], [0, 5, 12, 22, 30, 41]), ('regression: space budget', [[5, 7, 5, 6, 9, 5], 43, False, 3, 1, 6], [0, 6, 14, 20, 27, 38]), ('last line ragged', [[3, 4, 5], 20, True, 2, 1, 6], [0, 5, 11]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('control layout', [[2], 6, False, 2, 1, 4], [0]), ('control layout', [[2], 6, False, 3, 1, 5], [0])]]\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":"54c34947f02b7b0edaac70e1a03f686b8ef0a8b43be421bc2a0e2c2eb534f472","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    words, target, is_last, sp, lo, hi = x\n    n = len(words)\n    gaps = n - 1\n    def natural():\n        pos, xx = [], 0\n        for w in words:\n            pos.append(xx)\n            xx += w + sp\n        return pos\n    if is_last or gaps == 0:\n        return natural()\n    space = target - sum(words) - sp * gaps\n    per, rem = divmod(space, gaps)\n    if per < lo:\n        return ['overfull']\n    if per + (1 if rem else 0) > hi:\n        return natural()\n    pos, xx = [], 0\n    for k, w in enumerate(words):\n        pos.append(xx)\n        if k < gaps:\n            xx += w + per + (1 if k >= gaps - rem else 0)\n    return pos\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('regression: space budget', [[9, 8, 5, 8, 9], 51, False, 2, 1, 4], [0, 12, 23, 31, 42]), ('regression: space budget', [[5, 3, 6, 5, 6, 4], 49, False, 3, 3, 5], [0, 9, 16, 26, 35, 45]), ('partial-repair probe', [[6, 2, 9], 19, False, 2, 2, 3], ['overfull']), ('last line ragged', [[3, 4, 5], 20, True, 2, 1, 6], [0, 5, 11]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[3, 9, 3, 2, 3, 5], 49, True, 2, 2, 6], [0, 5, 16, 21, 25, 30]), ('control layout', [[5], 7, False, 3, 3, 7], [0])], [('regression: space budget', [[8, 7, 6, 6, 6], 52, False, 3, 2, 4], [0, 11, 21, 30, 39]), ('regression: space budget', [[4, 8], 20, False, 3, 1, 5], [0, 7]), ('partial-repair probe', [[2, 6, 2, 7], 22, False, 2, 2, 5], ['overfull']), ('regression: space budget', [[6, 8, 2, 8, 3], 42, False, 3, 1, 5], [0, 9, 21, 27, 39]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[6], 6, False, 2, 1, 4], [0]), ('control layout', [[2, 5, 3, 7, 9, 7], 44, True, 3, 3, 7], [0, 5, 13, 19, 29, 41])], [('regression: space budget', [[6, 8, 6, 8, 7], 49, False, 2, 2, 4], [0, 9, 20, 30, 42]), ('regression: space budget', [[3, 6, 3], 26, False, 2, 2, 5], [0, 5, 13]), ('regression: space budget', [[5, 6, 7, 8], 38, False, 2, 2, 5], [0, 9, 19, 30]), ('regression: space budget', [[3, 9, 2, 3], 26, False, 3, 2, 5], [0, 6, 18, 23]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('control layout', [[6], 7, False, 2, 2, 4], [0]), ('control layout', [[9, 8, 3, 8], 40, False, 2, 1, 3], [0, 11, 21, 26])], [('regression: space budget', [[3, 5, 9, 6, 8], 39, False, 2, 2, 5], [0, 5, 12, 23, 31]), ('regression: space budget', [[5, 6, 7, 6, 3], 47, False, 3, 1, 5], [0, 10, 21, 33, 44]), ('regression: space budget', [[2, 2, 4, 5], 19, False, 2, 2, 4], [0, 4, 8, 14]), ('regression: space budget', [[2, 6, 9, 2], 28, False, 2, 2, 3], [0, 5, 14, 26]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('control layout', [[2, 5, 3, 7, 9, 7], 44, True, 3, 3, 7], [0, 5, 13, 19, 29, 41]), ('control layout', [[2, 2], 4, True, 3, 2, 7], [0, 5])], [('regression: space budget', [[5, 4, 3, 2], 23, False, 2, 2, 5], [0, 8, 15, 21]), ('regression: space budget', [[2, 6, 8, 6, 6, 9], 75, False, 2, 1, 6], [0, 4, 12, 22, 30, 38]), ('regression: space budget', [[2, 4, 6, 4, 7, 2], 43, False, 2, 1, 6], [0, 5, 12, 22, 30, 41]), ('regression: space budget', [[5, 7, 5, 6, 9, 5], 43, False, 3, 1, 6], [0, 6, 14, 20, 27, 38]), ('last line ragged', [[3, 4, 5], 20, True, 2, 1, 6], [0, 5, 11]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('control layout', [[2], 6, False, 2, 1, 4], [0]), ('control layout', [[2], 6, False, 3, 1, 5], [0])]]\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-justify-spaces-space-budget","generated_at":"2026-09-29T14:49:50.633440+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 space budget subtracts natural spacing again, then treats the leftover as the whole gap.","sha256":"cb0f18ec34e8f1fc6770a46dd67856ea0aef5135171ed5219f0c3e4e4a8ac8ed","title":"Justified interword spacing: space budget · 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":40.91,"exit_code":1,"observations":[{"actual":[0,5,12,20],"check":"remainder goes to right gaps","expected":[0,5,11,18],"passed":false},{"actual":[0,11,21,28,38],"check":"regression: space budget","expected":[0,12,23,31,42],"passed":false},{"actual":[0,9,17,28,38,49],"check":"regression: space budget","expected":[0,9,16,26,35,45],"passed":false},{"actual":[0,8,12],"check":"partial-repair probe","expected":["overfull"],"passed":false},{"actual":[0,5,11],"check":"last line ragged","expected":[0,5,11],"passed":true},{"actual":[0,5,11],"check":"exactly minimum share","expected":[0,4,8],"passed":false},{"actual":[0,5,16,21,25,30],"check":"control layout","expected":[0,5,16,21,25,30],"passed":true},{"actual":[0],"check":"control layout","expected":[0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"remainder goes to right gaps\", \"actual\": [0, 5, 12, 20], \"expected\": [0, 5, 11, 18], \"passed\": false}, {\"check\": \"regression: space budget\", \"actual\": [0, 11, 21, 28, 38], \"expected\": [0, 12, 23, 31, 42], \"passed\": false}, {\"check\": \"regression: space budget\", \"actual\": [0, 9, 17, 28, 38, 49], \"expected\": [0, 9, 16, 26, 35, 45], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [0, 8, 12], \"expected\": [\"overfull\"], \"passed\": false}, {\"check\": \"last line ragged\", \"actual\": [0, 5, 11], \"expected\": [0, 5, 11], \"passed\": true}, {\"check\": \"exactly minimum share\", \"actual\": [0, 5, 11], \"expected\": [0, 4, 8], \"passed\": false}, {\"check\": \"control layout\", \"actual\": [0, 5, 16, 21, 25, 30], \"expected\": [0, 5, 16, 21, 25, 30], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [0], \"expected\": [0], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.929,"exit_code":1,"observations":[{"actual":["overfull"],"check":"remainder goes to right gaps","expected":[0,5,11,18],"passed":false},{"actual":[0,10,19,25,34],"check":"regression: space budget","expected":[0,12,23,31,42],"passed":false},{"actual":["overfull"],"check":"regression: space budget","expected":[0,9,16,26,35,45],"passed":false},{"actual":["overfull"],"check":"partial-repair probe","expected":["overfull"],"passed":true},{"actual":[0,5,11],"check":"last line ragged","expected":[0,5,11],"passed":true},{"actual":["overfull"],"check":"exactly minimum share","expected":[0,4,8],"passed":false},{"actual":[0,5,16,21,25,30],"check":"control layout","expected":[0,5,16,21,25,30],"passed":true},{"actual":[0],"check":"control layout","expected":[0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"remainder goes to right gaps\", \"actual\": [\"overfull\"], \"expected\": [0, 5, 11, 18], \"passed\": false}, {\"check\": \"regression: space budget\", \"actual\": [0, 10, 19, 25, 34], \"expected\": [0, 12, 23, 31, 42], \"passed\": false}, {\"check\": \"regression: space budget\", \"actual\": [\"overfull\"], \"expected\": [0, 9, 16, 26, 35, 45], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [\"overfull\"], \"expected\": [\"overfull\"], \"passed\": true}, {\"check\": \"last line ragged\", \"actual\": [0, 5, 11], \"expected\": [0, 5, 11], \"passed\": true}, {\"check\": \"exactly minimum share\", \"actual\": [\"overfull\"], \"expected\": [0, 4, 8], \"passed\": false}, {\"check\": \"control layout\", \"actual\": [0, 5, 16, 21, 25, 30], \"expected\": [0, 5, 16, 21, 25, 30], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [0], \"expected\": [0], \"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."}}