{"abstract":"The wrong number of lines is moved to the next page to cure a widow.","category":"Typography line breaking","checks":8,"contract":"Input [paragraph line counts, page height, min orphan lines, min widow lines]. Lines flow onto pages. When a paragraph must break on a page that already holds lines, at least min widow lines must carry to the next page (move lines forward) and, if the paragraph starts on this page, at least min orphan lines must stay (else move it all). A paragraph that exactly fits stays. Constraints are waived on an empty page. Return lines per page.","contract_signature":"x","evaluation_group":"w2-typography-line-breaking-widow-orphan","failed_approach":"Keeping one extra line re-creates the widow.","family":"w2-typography-line-breaking-widow-orphan-widow-pull-back-amount","id":"FA-79981","implementations":{"attempt":{"sha256":"170c95223e147eae7ab439921252bee7af4f3079e2cb129e88530382aa7c1cf6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    paras, H, orphan, widow = x\n    pages = []\n    used = 0\n    for p in paras:\n        rem = p\n        started = True\n        while rem > 0:\n            room = H - used\n            if rem <= room:\n                used += rem\n                rem = 0\n                continue\n            a = room\n            if used > 0:\n                if rem - a < widow:\n                    a = max(rem - widow + 1, 0)\n                if started and a < orphan:\n                    a = 0\n            used += a\n            rem -= a\n            if a > 0:\n                started = False\n            pages.append(used)\n            used = 0\n    if used > 0:\n        pages.append(used)\n    return pages\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('regression: widow pull-back amount', [[5, 5, 3], 9, 1, 3], [7, 6]), ('regression: widow pull-back amount', [[1, 5, 6, 1, 2, 4, 2, 6], 7, 2, 3], [6, 7, 6, 5, 3]), ('regression: widow pull-back amount', [[5, 5, 4, 3], 8, 1, 2], [8, 7, 2]), ('paragraph exactly fills page', [[2, 4, 3], 6, 2, 2], [6, 3]), ('orphan pushed forward', [[5, 3], 6, 2, 2], [5, 3]), ('control layout', [[8, 7, 6, 3, 8], 10, 3, 3], [8, 10, 10, 4]), ('control layout', [[4, 1, 9, 9, 1], 12, 1, 2], [12, 12])], [('regression: widow pull-back amount', [[4, 6, 5, 6, 1, 7, 3, 4], 9, 3, 3], [7, 8, 7, 7, 7]), ('regression: widow pull-back amount', [[3, 2, 1, 1, 5, 5, 6], 5, 2, 3], [5, 4, 5, 5, 4]), ('regression: widow pull-back amount', [[1, 2, 2, 4, 6, 2], 8, 1, 2], [7, 8, 2]), ('regression: widow pull-back amount', [[6, 4, 6, 7, 5, 3], 8, 3, 2], [6, 8, 7, 7, 3]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('paragraph exactly fills page', [[2, 4, 3], 6, 2, 2], [6, 3]), ('control layout', [[1, 3, 9, 4, 3, 6], 10, 3, 1], [10, 10, 6]), ('control layout', [[5, 1, 9, 2, 5, 1, 7, 1], 7, 2, 1], [6, 7, 7, 7, 4])], [('regression: widow pull-back amount', [[9, 7, 3, 7, 4, 4, 7], 10, 1, 3], [10, 10, 10, 8, 3]), ('regression: widow pull-back amount', [[8, 7, 5, 1, 8, 2, 2], 6, 2, 3], [6, 6, 5, 6, 6, 4]), ('regression: widow pull-back amount', [[6, 4, 6, 7, 5, 3], 8, 3, 2], [6, 8, 7, 7, 3]), ('regression: widow pull-back amount', [[2, 3, 3, 3, 5, 6, 5, 5], 4, 2, 3], [2, 3, 3, 3, 4, 4, 3, 4, 3, 3]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('control layout', [[2, 2, 4, 6], 4, 3, 3], [4, 4, 4, 2]), ('control layout', [[6, 9, 1, 3], 8, 1, 2], [8, 8, 3])], [('regression: widow pull-back amount', [[2, 8, 4, 5, 9, 5, 8, 2], 9, 3, 3], [7, 7, 9, 5, 9, 6]), ('regression: widow pull-back amount', [[2, 1, 4, 9, 4, 3], 5, 1, 3], [4, 5, 5, 3, 3, 3]), ('regression: widow pull-back amount', [[4, 6, 5, 8, 9], 5, 2, 2], [4, 5, 4, 5, 5, 5, 4]), ('partial-repair probe', [[7, 9, 3, 9, 7, 5], 5, 3, 3], [5, 5, 5, 4, 5, 4, 5, 2, 5]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('paragraph exactly fills page', [[2, 4, 3], 6, 2, 2], [6, 3]), ('control layout', [[4, 9, 6], 5, 3, 1], [4, 5, 4, 5, 1]), ('control layout', [[5, 5, 8, 4, 2], 10, 2, 1], [10, 10, 4])], [('regression: widow pull-back amount', [[4, 6, 5, 6, 1, 7, 3, 4], 9, 3, 3], [7, 8, 7, 7, 7]), ('regression: widow pull-back amount', [[1, 5, 2, 2, 2, 6], 9, 3, 3], [8, 7, 3]), ('regression: widow pull-back amount', [[1, 2, 6, 8, 5, 2], 8, 2, 2], [7, 8, 7, 2]), ('regression: widow pull-back amount', [[8, 7, 6, 5, 6, 5, 5, 3], 11, 1, 2], [11, 11, 11, 10, 2]), ('paragraph exactly fills page', [[2, 4, 3], 6, 2, 2], [6, 3]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('control layout', [[3, 6, 2, 3], 11, 2, 1], [11, 3]), ('control layout', [[2, 2, 9, 7, 5, 4], 6, 2, 1], [6, 6, 6, 6, 5])]]\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":"b3c8b6b942bac90e5bc6deec54d110255179bc62b2a7b04a47d283db58480e87","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    paras, H, orphan, widow = x\n    pages = []\n    used = 0\n    for p in paras:\n        rem = p\n        started = True\n        while rem > 0:\n            room = H - used\n            if rem <= room:\n                used += rem\n                rem = 0\n                continue\n            a = room\n            if used > 0:\n                if rem - a < widow:\n                    a = max(room - widow, 0)\n                if started and a < orphan:\n                    a = 0\n            used += a\n            rem -= a\n            if a > 0:\n                started = False\n            pages.append(used)\n            used = 0\n    if used > 0:\n        pages.append(used)\n    return pages\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('regression: widow pull-back amount', [[5, 5, 3], 9, 1, 3], [7, 6]), ('regression: widow pull-back amount', [[1, 5, 6, 1, 2, 4, 2, 6], 7, 2, 3], [6, 7, 6, 5, 3]), ('regression: widow pull-back amount', [[5, 5, 4, 3], 8, 1, 2], [8, 7, 2]), ('paragraph exactly fills page', [[2, 4, 3], 6, 2, 2], [6, 3]), ('orphan pushed forward', [[5, 3], 6, 2, 2], [5, 3]), ('control layout', [[8, 7, 6, 3, 8], 10, 3, 3], [8, 10, 10, 4]), ('control layout', [[4, 1, 9, 9, 1], 12, 1, 2], [12, 12])], [('regression: widow pull-back amount', [[4, 6, 5, 6, 1, 7, 3, 4], 9, 3, 3], [7, 8, 7, 7, 7]), ('regression: widow pull-back amount', [[3, 2, 1, 1, 5, 5, 6], 5, 2, 3], [5, 4, 5, 5, 4]), ('regression: widow pull-back amount', [[1, 2, 2, 4, 6, 2], 8, 1, 2], [7, 8, 2]), ('regression: widow pull-back amount', [[6, 4, 6, 7, 5, 3], 8, 3, 2], [6, 8, 7, 7, 3]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('paragraph exactly fills page', [[2, 4, 3], 6, 2, 2], [6, 3]), ('control layout', [[1, 3, 9, 4, 3, 6], 10, 3, 1], [10, 10, 6]), ('control layout', [[5, 1, 9, 2, 5, 1, 7, 1], 7, 2, 1], [6, 7, 7, 7, 4])], [('regression: widow pull-back amount', [[9, 7, 3, 7, 4, 4, 7], 10, 1, 3], [10, 10, 10, 8, 3]), ('regression: widow pull-back amount', [[8, 7, 5, 1, 8, 2, 2], 6, 2, 3], [6, 6, 5, 6, 6, 4]), ('regression: widow pull-back amount', [[6, 4, 6, 7, 5, 3], 8, 3, 2], [6, 8, 7, 7, 3]), ('regression: widow pull-back amount', [[2, 3, 3, 3, 5, 6, 5, 5], 4, 2, 3], [2, 3, 3, 3, 4, 4, 3, 4, 3, 3]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('control layout', [[2, 2, 4, 6], 4, 3, 3], [4, 4, 4, 2]), ('control layout', [[6, 9, 1, 3], 8, 1, 2], [8, 8, 3])], [('regression: widow pull-back amount', [[2, 8, 4, 5, 9, 5, 8, 2], 9, 3, 3], [7, 7, 9, 5, 9, 6]), ('regression: widow pull-back amount', [[2, 1, 4, 9, 4, 3], 5, 1, 3], [4, 5, 5, 3, 3, 3]), ('regression: widow pull-back amount', [[4, 6, 5, 8, 9], 5, 2, 2], [4, 5, 4, 5, 5, 5, 4]), ('partial-repair probe', [[7, 9, 3, 9, 7, 5], 5, 3, 3], [5, 5, 5, 4, 5, 4, 5, 2, 5]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('paragraph exactly fills page', [[2, 4, 3], 6, 2, 2], [6, 3]), ('control layout', [[4, 9, 6], 5, 3, 1], [4, 5, 4, 5, 1]), ('control layout', [[5, 5, 8, 4, 2], 10, 2, 1], [10, 10, 4])], [('regression: widow pull-back amount', [[4, 6, 5, 6, 1, 7, 3, 4], 9, 3, 3], [7, 8, 7, 7, 7]), ('regression: widow pull-back amount', [[1, 5, 2, 2, 2, 6], 9, 3, 3], [8, 7, 3]), ('regression: widow pull-back amount', [[1, 2, 6, 8, 5, 2], 8, 2, 2], [7, 8, 7, 2]), ('regression: widow pull-back amount', [[8, 7, 6, 5, 6, 5, 5, 3], 11, 1, 2], [11, 11, 11, 10, 2]), ('paragraph exactly fills page', [[2, 4, 3], 6, 2, 2], [6, 3]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('control layout', [[3, 6, 2, 3], 11, 2, 1], [11, 3]), ('control layout', [[2, 2, 9, 7, 5, 4], 6, 2, 1], [6, 6, 6, 6, 5])]]\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-widow-orphan-widow-pull-back-amount","generated_at":"2026-09-29T14:49:49.644392+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":"Lines kept are computed from the page room instead of the remaining paragraph lines.","sha256":"4b5930fab9420941ae832468642aefd10612f8ee1c4e487e46bbcd6745ae3207","title":"Widow and orphan page breaking: widow pull-back amount · 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.859,"exit_code":1,"observations":[{"actual":[6,1],"check":"single widow pulled back","expected":[5,2],"passed":false},{"actual":[8,5],"check":"regression: widow pull-back amount","expected":[7,6],"passed":false},{"actual":[6,7,6,6,2],"check":"regression: widow pull-back amount","expected":[6,7,6,5,3],"passed":false},{"actual":[8,8,1],"check":"regression: widow pull-back amount","expected":[8,7,2],"passed":false},{"actual":[6,3],"check":"paragraph exactly fills page","expected":[6,3],"passed":true},{"actual":[5,3],"check":"orphan pushed forward","expected":[5,3],"passed":true},{"actual":[8,10,10,4],"check":"control layout","expected":[8,10,10,4],"passed":true},{"actual":[12,12],"check":"control layout","expected":[12,12],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"single widow pulled back\", \"actual\": [6, 1], \"expected\": [5, 2], \"passed\": false}, {\"check\": \"regression: widow pull-back amount\", \"actual\": [8, 5], \"expected\": [7, 6], \"passed\": false}, {\"check\": \"regression: widow pull-back amount\", \"actual\": [6, 7, 6, 6, 2], \"expected\": [6, 7, 6, 5, 3], \"passed\": false}, {\"check\": \"regression: widow pull-back amount\", \"actual\": [8, 8, 1], \"expected\": [8, 7, 2], \"passed\": false}, {\"check\": \"paragraph exactly fills page\", \"actual\": [6, 3], \"expected\": [6, 3], \"passed\": true}, {\"check\": \"orphan pushed forward\", \"actual\": [5, 3], \"expected\": [5, 3], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [8, 10, 10, 4], \"expected\": [8, 10, 10, 4], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [12, 12], \"expected\": [12, 12], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.184,"exit_code":1,"observations":[{"actual":[3,4],"check":"single widow pulled back","expected":[5,2],"passed":false},{"actual":[6,7],"check":"regression: widow pull-back amount","expected":[7,6],"passed":false},{"actual":[6,7,6,4,4],"check":"regression: widow pull-back amount","expected":[6,7,6,5,3],"passed":false},{"actual":[8,6,3],"check":"regression: widow pull-back amount","expected":[8,7,2],"passed":false},{"actual":[6,3],"check":"paragraph exactly fills page","expected":[6,3],"passed":true},{"actual":[5,3],"check":"orphan pushed forward","expected":[5,3],"passed":true},{"actual":[8,10,10,4],"check":"control layout","expected":[8,10,10,4],"passed":true},{"actual":[12,12],"check":"control layout","expected":[12,12],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"single widow pulled back\", \"actual\": [3, 4], \"expected\": [5, 2], \"passed\": false}, {\"check\": \"regression: widow pull-back amount\", \"actual\": [6, 7], \"expected\": [7, 6], \"passed\": false}, {\"check\": \"regression: widow pull-back amount\", \"actual\": [6, 7, 6, 4, 4], \"expected\": [6, 7, 6, 5, 3], \"passed\": false}, {\"check\": \"regression: widow pull-back amount\", \"actual\": [8, 6, 3], \"expected\": [8, 7, 2], \"passed\": false}, {\"check\": \"paragraph exactly fills page\", \"actual\": [6, 3], \"expected\": [6, 3], \"passed\": true}, {\"check\": \"orphan pushed forward\", \"actual\": [5, 3], \"expected\": [5, 3], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [8, 10, 10, 4], \"expected\": [8, 10, 10, 4], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [12, 12], \"expected\": [12, 12], \"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."}}