{"abstract":"Lines whose widest gap exceeds the maximum stay justified.","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":"Adding the whole remainder overstates the widest gap.","family":"w2-typography-line-breaking-justify-spaces-maximum-space-with-remainder","id":"FA-80081","implementations":{"attempt":{"sha256":"7333b46f5ca98af88e56f64138506dbf6ea6c47f6853adb7dcd843321ba8a949","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)\n    per, rem = divmod(space, gaps)\n    if per < lo:\n        return ['overfull']\n    if per + rem > 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 = [[('regression: maximum space with remainder', [[3, 5, 4, 9, 8, 2], 67, False, 3, 3, 7], [0, 6, 14, 21, 33, 44]), ('regression: maximum space with remainder', [[4, 3, 7, 3, 7], 42, False, 2, 2, 4], [0, 6, 11, 20, 25]), ('partial-repair probe', [[7, 2, 8, 7, 9], 55, False, 3, 3, 6], [0, 12, 19, 33, 46]), ('partial-repair probe', [[4, 5, 8, 9, 5, 6], 55, False, 3, 2, 4], [0, 7, 15, 27, 40, 49]), ('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', [[2, 9, 6, 5, 6, 5], 53, True, 3, 3, 4], [0, 5, 17, 26, 34, 43]), ('control layout', [[9], 9, False, 3, 3, 6], [0])], [('regression: maximum space with remainder', [[7, 3, 4, 2, 9], 51, False, 3, 3, 6], [0, 10, 16, 23, 28]), ('regression: maximum space with remainder', [[4, 3, 7, 3, 7], 42, False, 2, 2, 4], [0, 6, 11, 20, 25]), ('partial-repair probe', [[8, 9, 2, 3, 5], 46, False, 2, 1, 5], [0, 12, 26, 33, 41]), ('partial-repair probe', [[7, 2, 8, 7, 9], 55, False, 3, 3, 6], [0, 12, 19, 33, 46]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[8, 7, 2, 8, 4, 4], 56, False, 3, 2, 7], [0, 12, 23, 30, 43, 52]), ('control layout', [[8, 9, 3, 7, 9, 8], 51, False, 2, 1, 5], [0, 9, 19, 23, 32, 43])], [('regression: maximum space with remainder', [[3, 5, 4, 9, 8, 2], 67, False, 3, 3, 7], [0, 6, 14, 21, 33, 44]), ('regression: maximum space with remainder', [[9, 8, 7, 8, 9], 59, False, 2, 1, 4], [0, 11, 21, 30, 40]), ('partial-repair probe', [[3, 7, 7, 8, 9], 41, False, 2, 1, 3], [0, 4, 13, 22, 32]), ('partial-repair probe', [[6, 8, 6, 8, 7], 49, False, 2, 2, 4], [0, 9, 20, 30, 42]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[5, 5, 5, 3, 7], 32, False, 3, 2, 6], ['overfull']), ('control layout', [[2, 2, 5, 5, 2], 24, False, 3, 2, 7], [0, 4, 8, 15, 22])], [('regression: maximum space with remainder', [[8, 7, 6, 6, 6], 52, False, 3, 2, 4], [0, 11, 21, 30, 39]), ('regression: maximum space with remainder', [[7, 3, 4, 2, 9], 51, False, 3, 3, 6], [0, 10, 16, 23, 28]), ('partial-repair probe', [[8, 9, 2, 3, 5], 46, False, 2, 1, 5], [0, 12, 26, 33, 41]), ('partial-repair probe', [[6, 8, 6, 8, 7], 49, False, 2, 2, 4], [0, 9, 20, 30, 42]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[7, 7, 7, 6, 2], 37, False, 3, 1, 5], [0, 9, 18, 27, 35]), ('control layout', [[5, 5, 5, 3, 7], 32, False, 3, 2, 6], ['overfull'])], [('regression: maximum space with remainder', [[6, 3, 4, 3], 30, False, 2, 1, 4], [0, 8, 13, 19]), ('regression: maximum space with remainder', [[8, 8, 6, 7], 43, False, 3, 1, 4], [0, 11, 22, 31]), ('partial-repair probe', [[2, 4, 9, 5], 31, False, 3, 2, 4], [0, 5, 13, 26]), ('partial-repair probe', [[2, 2, 3, 9], 30, False, 3, 2, 5], [0, 6, 13, 21]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('last line ragged', [[3, 4, 5], 20, True, 2, 1, 6], [0, 5, 11]), ('control layout', [[7, 7, 7, 6, 2], 37, False, 3, 1, 5], [0, 9, 18, 27, 35]), ('control layout', [[2, 7, 9, 4, 8], 39, False, 3, 3, 7], ['overfull'])]]\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":"90632a4bfe500003236586ebb32559d79773f2e59c5a3857f60ae515c0d2a4a5","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)\n    per, rem = divmod(space, gaps)\n    if per < lo:\n        return ['overfull']\n    if per > 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 = [[('regression: maximum space with remainder', [[3, 5, 4, 9, 8, 2], 67, False, 3, 3, 7], [0, 6, 14, 21, 33, 44]), ('regression: maximum space with remainder', [[4, 3, 7, 3, 7], 42, False, 2, 2, 4], [0, 6, 11, 20, 25]), ('partial-repair probe', [[7, 2, 8, 7, 9], 55, False, 3, 3, 6], [0, 12, 19, 33, 46]), ('partial-repair probe', [[4, 5, 8, 9, 5, 6], 55, False, 3, 2, 4], [0, 7, 15, 27, 40, 49]), ('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', [[2, 9, 6, 5, 6, 5], 53, True, 3, 3, 4], [0, 5, 17, 26, 34, 43]), ('control layout', [[9], 9, False, 3, 3, 6], [0])], [('regression: maximum space with remainder', [[7, 3, 4, 2, 9], 51, False, 3, 3, 6], [0, 10, 16, 23, 28]), ('regression: maximum space with remainder', [[4, 3, 7, 3, 7], 42, False, 2, 2, 4], [0, 6, 11, 20, 25]), ('partial-repair probe', [[8, 9, 2, 3, 5], 46, False, 2, 1, 5], [0, 12, 26, 33, 41]), ('partial-repair probe', [[7, 2, 8, 7, 9], 55, False, 3, 3, 6], [0, 12, 19, 33, 46]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[8, 7, 2, 8, 4, 4], 56, False, 3, 2, 7], [0, 12, 23, 30, 43, 52]), ('control layout', [[8, 9, 3, 7, 9, 8], 51, False, 2, 1, 5], [0, 9, 19, 23, 32, 43])], [('regression: maximum space with remainder', [[3, 5, 4, 9, 8, 2], 67, False, 3, 3, 7], [0, 6, 14, 21, 33, 44]), ('regression: maximum space with remainder', [[9, 8, 7, 8, 9], 59, False, 2, 1, 4], [0, 11, 21, 30, 40]), ('partial-repair probe', [[3, 7, 7, 8, 9], 41, False, 2, 1, 3], [0, 4, 13, 22, 32]), ('partial-repair probe', [[6, 8, 6, 8, 7], 49, False, 2, 2, 4], [0, 9, 20, 30, 42]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[5, 5, 5, 3, 7], 32, False, 3, 2, 6], ['overfull']), ('control layout', [[2, 2, 5, 5, 2], 24, False, 3, 2, 7], [0, 4, 8, 15, 22])], [('regression: maximum space with remainder', [[8, 7, 6, 6, 6], 52, False, 3, 2, 4], [0, 11, 21, 30, 39]), ('regression: maximum space with remainder', [[7, 3, 4, 2, 9], 51, False, 3, 3, 6], [0, 10, 16, 23, 28]), ('partial-repair probe', [[8, 9, 2, 3, 5], 46, False, 2, 1, 5], [0, 12, 26, 33, 41]), ('partial-repair probe', [[6, 8, 6, 8, 7], 49, False, 2, 2, 4], [0, 9, 20, 30, 42]), ('single word line', [[7], 20, False, 2, 1, 4], [0]), ('exactly minimum share', [[3, 3, 3], 11, False, 2, 1, 4], [0, 4, 8]), ('control layout', [[7, 7, 7, 6, 2], 37, False, 3, 1, 5], [0, 9, 18, 27, 35]), ('control layout', [[5, 5, 5, 3, 7], 32, False, 3, 2, 6], ['overfull'])], [('regression: maximum space with remainder', [[6, 3, 4, 3], 30, False, 2, 1, 4], [0, 8, 13, 19]), ('regression: maximum space with remainder', [[8, 8, 6, 7], 43, False, 3, 1, 4], [0, 11, 22, 31]), ('partial-repair probe', [[2, 4, 9, 5], 31, False, 3, 2, 4], [0, 5, 13, 26]), ('partial-repair probe', [[2, 2, 3, 9], 30, False, 3, 2, 5], [0, 6, 13, 21]), ('remainder goes to right gaps', [[3, 4, 5, 2], 20, False, 2, 1, 4], [0, 5, 11, 18]), ('last line ragged', [[3, 4, 5], 20, True, 2, 1, 6], [0, 5, 11]), ('control layout', [[7, 7, 7, 6, 2], 37, False, 3, 1, 5], [0, 9, 18, 27, 35]), ('control layout', [[2, 7, 9, 4, 8], 39, False, 3, 3, 7], ['overfull'])]]\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-maximum-space-with-remainder","generated_at":"2026-09-29T14:49:50.512273+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 loose check ignores the extra remainder unit on the widest gaps.","sha256":"24a3de9fbfe0455ce877c85079fe56c9d3d167fc2a45cab00691d9e04b35c411","title":"Justified interword spacing: maximum space with remainder · 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.833,"exit_code":1,"observations":[{"actual":[0,6,14,21,33,44],"check":"regression: maximum space with remainder","expected":[0,6,14,21,33,44],"passed":true},{"actual":[0,6,11,20,25],"check":"regression: maximum space with remainder","expected":[0,6,11,20,25],"passed":true},{"actual":[0,10,15,26,36],"check":"partial-repair probe","expected":[0,12,19,33,46],"passed":false},{"actual":[0,7,15,26,38,46],"check":"partial-repair probe","expected":[0,7,15,27,40,49],"passed":false},{"actual":[0,5,11],"check":"last line ragged","expected":[0,5,11],"passed":true},{"actual":[0,4,8],"check":"exactly minimum share","expected":[0,4,8],"passed":true},{"actual":[0,5,17,26,34,43],"check":"control layout","expected":[0,5,17,26,34,43],"passed":true},{"actual":[0],"check":"control layout","expected":[0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: maximum space with remainder\", \"actual\": [0, 6, 14, 21, 33, 44], \"expected\": [0, 6, 14, 21, 33, 44], \"passed\": true}, {\"check\": \"regression: maximum space with remainder\", \"actual\": [0, 6, 11, 20, 25], \"expected\": [0, 6, 11, 20, 25], \"passed\": true}, {\"check\": \"partial-repair probe\", \"actual\": [0, 10, 15, 26, 36], \"expected\": [0, 12, 19, 33, 46], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [0, 7, 15, 26, 38, 46], \"expected\": [0, 7, 15, 27, 40, 49], \"passed\": false}, {\"check\": \"last line ragged\", \"actual\": [0, 5, 11], \"expected\": [0, 5, 11], \"passed\": true}, {\"check\": \"exactly minimum share\", \"actual\": [0, 4, 8], \"expected\": [0, 4, 8], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [0, 5, 17, 26, 34, 43], \"expected\": [0, 5, 17, 26, 34, 43], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [0], \"expected\": [0], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.724,"exit_code":1,"observations":[{"actual":[0,10,22,33,49,65],"check":"regression: maximum space with remainder","expected":[0,6,14,21,33,44],"passed":false},{"actual":[0,8,15,27,35],"check":"regression: maximum space with remainder","expected":[0,6,11,20,25],"passed":false},{"actual":[0,12,19,33,46],"check":"partial-repair probe","expected":[0,12,19,33,46],"passed":true},{"actual":[0,7,15,27,40,49],"check":"partial-repair probe","expected":[0,7,15,27,40,49],"passed":true},{"actual":[0,5,11],"check":"last line ragged","expected":[0,5,11],"passed":true},{"actual":[0,4,8],"check":"exactly minimum share","expected":[0,4,8],"passed":true},{"actual":[0,5,17,26,34,43],"check":"control layout","expected":[0,5,17,26,34,43],"passed":true},{"actual":[0],"check":"control layout","expected":[0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: maximum space with remainder\", \"actual\": [0, 10, 22, 33, 49, 65], \"expected\": [0, 6, 14, 21, 33, 44], \"passed\": false}, {\"check\": \"regression: maximum space with remainder\", \"actual\": [0, 8, 15, 27, 35], \"expected\": [0, 6, 11, 20, 25], \"passed\": false}, {\"check\": \"partial-repair probe\", \"actual\": [0, 12, 19, 33, 46], \"expected\": [0, 12, 19, 33, 46], \"passed\": true}, {\"check\": \"partial-repair probe\", \"actual\": [0, 7, 15, 27, 40, 49], \"expected\": [0, 7, 15, 27, 40, 49], \"passed\": true}, {\"check\": \"last line ragged\", \"actual\": [0, 5, 11], \"expected\": [0, 5, 11], \"passed\": true}, {\"check\": \"exactly minimum share\", \"actual\": [0, 4, 8], \"expected\": [0, 4, 8], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [0, 5, 17, 26, 34, 43], \"expected\": [0, 5, 17, 26, 34, 43], \"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."}}