{"abstract":"Carry-overs one line short of the widow minimum are left in place.","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":"Handling only a shortfall of exactly one line misses larger widow minimums.","family":"w2-typography-line-breaking-widow-orphan-widow-threshold","id":"FA-79976","implementations":{"attempt":{"sha256":"d860536336f7523eb0b149ec785fb64f23e578293620dae2acb608f8dadb97f4","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 - 1:\n                    a = max(rem - 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 threshold', [[9, 8, 5, 2, 1, 8], 8, 2, 2], [8, 7, 7, 8, 3]), ('regression: widow threshold', [[1, 7, 1, 3, 3, 9, 6, 9], 6, 1, 3], [5, 4, 6, 6, 6, 6, 6]), ('regression: widow threshold', [[2, 3, 3, 3, 5, 6, 5, 5], 4, 2, 3], [2, 3, 3, 3, 4, 4, 3, 4, 3, 3]), ('orphan pushed forward', [[5, 3], 6, 2, 2], [5, 3]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('control layout', [[3, 1, 4], 11, 1, 3], [8]), ('control layout', [[2, 1, 8, 4, 9, 8, 1, 6], 5, 2, 1], [5, 5, 5, 5, 4, 5, 4, 5, 1])], [('regression: widow threshold', [[6, 8, 1, 3, 8, 9], 4, 1, 3], [4, 4, 4, 3, 4, 4, 4, 4, 4]), ('regression: widow threshold', [[6, 6, 4, 1, 5, 3, 3], 12, 1, 2], [12, 11, 5]), ('regression: widow threshold', [[5, 1, 2, 7, 6, 9], 10, 2, 3], [10, 8, 9, 3]), ('partial-repair probe', [[2, 4, 6, 3], 7, 1, 3], [7, 5, 3]), ('orphan pushed forward', [[5, 3], 6, 2, 2], [5, 3]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('control layout', [[6, 9, 3, 7, 9, 3, 8], 5, 2, 1], [5, 5, 5, 5, 5, 5, 4, 5, 5, 1]), ('control layout', [[9, 7, 6], 12, 2, 3], [12, 10])], [('regression: widow threshold', [[5, 5, 4, 3], 8, 1, 2], [8, 7, 2]), ('regression: widow threshold', [[6, 5, 2, 6, 6], 10, 2, 2], [9, 10, 6]), ('regression: widow threshold', [[7, 1, 1, 6, 3, 6, 4], 4, 1, 3], [4, 4, 4, 3, 4, 4, 2, 3]), ('partial-repair probe', [[5, 1, 5, 6, 7, 7, 5, 1], 10, 2, 3], [8, 9, 10, 10]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('control layout', [[4, 8, 9, 4], 9, 3, 2], [9, 9, 7]), ('control layout', [[4, 5, 1], 4, 3, 1], [4, 4, 2])], [('regression: widow threshold', [[7, 5, 1, 9, 6, 4, 1, 7], 9, 1, 2], [9, 9, 8, 9, 5]), ('regression: widow threshold', [[8, 4, 3, 3, 3, 1, 4], 5, 2, 2], [5, 5, 5, 3, 4, 4]), ('partial-repair probe', [[9, 5, 1, 9, 8, 5], 8, 2, 3], [8, 7, 8, 6, 8]), ('regression: widow threshold', [[7, 7, 4, 4, 2, 3], 4, 1, 3], [4, 4, 4, 3, 4, 3, 2, 3]), ('orphan pushed forward', [[5, 3], 6, 2, 2], [5, 3]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('control layout', [[6, 3, 8], 4, 3, 1], [4, 2, 3, 4, 4]), ('control layout', [[1, 8, 1, 2], 4, 2, 1], [4, 4, 4])], [('regression: widow threshold', [[9, 5, 1, 5, 7, 8, 8], 4, 2, 3], [4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4]), ('regression: widow threshold', [[2, 6, 4, 5, 7, 9], 10, 2, 3], [8, 9, 10, 6]), ('regression: widow threshold', [[7, 1, 1, 6, 3, 6, 4], 4, 1, 3], [4, 4, 4, 3, 4, 4, 2, 3]), ('partial-repair probe', [[5, 8, 8], 12, 1, 3], [10, 11]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('control layout', [[4, 1, 9, 5], 7, 3, 3], [5, 7, 7]), ('control layout', [[9, 9, 9], 4, 3, 3], [4, 4, 4, 4, 2, 4, 4, 1])]]\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":"11041f68082bb58cffb4ad5747f8c71ed41d4aca1f1a05817ace386c4f15018f","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 - 1:\n                    a = max(rem - 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 threshold', [[9, 8, 5, 2, 1, 8], 8, 2, 2], [8, 7, 7, 8, 3]), ('regression: widow threshold', [[1, 7, 1, 3, 3, 9, 6, 9], 6, 1, 3], [5, 4, 6, 6, 6, 6, 6]), ('regression: widow threshold', [[2, 3, 3, 3, 5, 6, 5, 5], 4, 2, 3], [2, 3, 3, 3, 4, 4, 3, 4, 3, 3]), ('orphan pushed forward', [[5, 3], 6, 2, 2], [5, 3]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('control layout', [[3, 1, 4], 11, 1, 3], [8]), ('control layout', [[2, 1, 8, 4, 9, 8, 1, 6], 5, 2, 1], [5, 5, 5, 5, 4, 5, 4, 5, 1])], [('regression: widow threshold', [[6, 8, 1, 3, 8, 9], 4, 1, 3], [4, 4, 4, 3, 4, 4, 4, 4, 4]), ('regression: widow threshold', [[6, 6, 4, 1, 5, 3, 3], 12, 1, 2], [12, 11, 5]), ('regression: widow threshold', [[5, 1, 2, 7, 6, 9], 10, 2, 3], [10, 8, 9, 3]), ('partial-repair probe', [[2, 4, 6, 3], 7, 1, 3], [7, 5, 3]), ('orphan pushed forward', [[5, 3], 6, 2, 2], [5, 3]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('control layout', [[6, 9, 3, 7, 9, 3, 8], 5, 2, 1], [5, 5, 5, 5, 5, 5, 4, 5, 5, 1]), ('control layout', [[9, 7, 6], 12, 2, 3], [12, 10])], [('regression: widow threshold', [[5, 5, 4, 3], 8, 1, 2], [8, 7, 2]), ('regression: widow threshold', [[6, 5, 2, 6, 6], 10, 2, 2], [9, 10, 6]), ('regression: widow threshold', [[7, 1, 1, 6, 3, 6, 4], 4, 1, 3], [4, 4, 4, 3, 4, 4, 2, 3]), ('partial-repair probe', [[5, 1, 5, 6, 7, 7, 5, 1], 10, 2, 3], [8, 9, 10, 10]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('control layout', [[4, 8, 9, 4], 9, 3, 2], [9, 9, 7]), ('control layout', [[4, 5, 1], 4, 3, 1], [4, 4, 2])], [('regression: widow threshold', [[7, 5, 1, 9, 6, 4, 1, 7], 9, 1, 2], [9, 9, 8, 9, 5]), ('regression: widow threshold', [[8, 4, 3, 3, 3, 1, 4], 5, 2, 2], [5, 5, 5, 3, 4, 4]), ('partial-repair probe', [[9, 5, 1, 9, 8, 5], 8, 2, 3], [8, 7, 8, 6, 8]), ('regression: widow threshold', [[7, 7, 4, 4, 2, 3], 4, 1, 3], [4, 4, 4, 3, 4, 3, 2, 3]), ('orphan pushed forward', [[5, 3], 6, 2, 2], [5, 3]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('control layout', [[6, 3, 8], 4, 3, 1], [4, 2, 3, 4, 4]), ('control layout', [[1, 8, 1, 2], 4, 2, 1], [4, 4, 4])], [('regression: widow threshold', [[9, 5, 1, 5, 7, 8, 8], 4, 2, 3], [4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4]), ('regression: widow threshold', [[2, 6, 4, 5, 7, 9], 10, 2, 3], [8, 9, 10, 6]), ('regression: widow threshold', [[7, 1, 1, 6, 3, 6, 4], 4, 1, 3], [4, 4, 4, 3, 4, 4, 2, 3]), ('partial-repair probe', [[5, 8, 8], 12, 1, 3], [10, 11]), ('single widow pulled back', [[3, 4], 6, 2, 2], [5, 2]), ('long paragraph continuation', [[2, 14], 6, 2, 2], [6, 6, 4]), ('control layout', [[4, 1, 9, 5], 7, 3, 3], [5, 7, 7]), ('control layout', [[9, 9, 9], 4, 3, 3], [4, 4, 4, 4, 2, 4, 4, 1])]]\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-threshold","generated_at":"2026-09-29T14:49:49.614174+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 widow test compares against widow - 1, so only multi-line shortfalls are cured.","sha256":"e0c47bd227cf4ea77a4a3e3eee3001b071bfb4bce807e45b6ee9742eeba1a34f","title":"Widow and orphan page breaking: widow threshold · 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":43.456,"exit_code":1,"observations":[{"actual":[5,2],"check":"single widow pulled back","expected":[5,2],"passed":true},{"actual":[8,7,7,8,3],"check":"regression: widow threshold","expected":[8,7,7,8,3],"passed":true},{"actual":[5,6,6,6,6,6,4],"check":"regression: widow threshold","expected":[5,4,6,6,6,6,6],"passed":false},{"actual":[4,4,3,4,4,3,4,3,3],"check":"regression: widow threshold","expected":[2,3,3,3,4,4,3,4,3,3],"passed":false},{"actual":[5,3],"check":"orphan pushed forward","expected":[5,3],"passed":true},{"actual":[6,6,4],"check":"long paragraph continuation","expected":[6,6,4],"passed":true},{"actual":[8],"check":"control layout","expected":[8],"passed":true},{"actual":[5,5,5,5,4,5,4,5,1],"check":"control layout","expected":[5,5,5,5,4,5,4,5,1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"single widow pulled back\", \"actual\": [5, 2], \"expected\": [5, 2], \"passed\": true}, {\"check\": \"regression: widow threshold\", \"actual\": [8, 7, 7, 8, 3], \"expected\": [8, 7, 7, 8, 3], \"passed\": true}, {\"check\": \"regression: widow threshold\", \"actual\": [5, 6, 6, 6, 6, 6, 4], \"expected\": [5, 4, 6, 6, 6, 6, 6], \"passed\": false}, {\"check\": \"regression: widow threshold\", \"actual\": [4, 4, 3, 4, 4, 3, 4, 3, 3], \"expected\": [2, 3, 3, 3, 4, 4, 3, 4, 3, 3], \"passed\": false}, {\"check\": \"orphan pushed forward\", \"actual\": [5, 3], \"expected\": [5, 3], \"passed\": true}, {\"check\": \"long paragraph continuation\", \"actual\": [6, 6, 4], \"expected\": [6, 6, 4], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [8], \"expected\": [8], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [5, 5, 5, 5, 4, 5, 4, 5, 1], \"expected\": [5, 5, 5, 5, 4, 5, 4, 5, 1], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.352,"exit_code":1,"observations":[{"actual":[6,1],"check":"single widow pulled back","expected":[5,2],"passed":false},{"actual":[8,8,8,8,1],"check":"regression: widow threshold","expected":[8,7,7,8,3],"passed":false},{"actual":[6,6,6,6,6,6,3],"check":"regression: widow threshold","expected":[5,4,6,6,6,6,6],"passed":false},{"actual":[2,3,3,3,4,4,3,4,4,2],"check":"regression: widow threshold","expected":[2,3,3,3,4,4,3,4,3,3],"passed":false},{"actual":[5,3],"check":"orphan pushed forward","expected":[5,3],"passed":true},{"actual":[6,6,4],"check":"long paragraph continuation","expected":[6,6,4],"passed":true},{"actual":[8],"check":"control layout","expected":[8],"passed":true},{"actual":[5,5,5,5,4,5,4,5,1],"check":"control layout","expected":[5,5,5,5,4,5,4,5,1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"single widow pulled back\", \"actual\": [6, 1], \"expected\": [5, 2], \"passed\": false}, {\"check\": \"regression: widow threshold\", \"actual\": [8, 8, 8, 8, 1], \"expected\": [8, 7, 7, 8, 3], \"passed\": false}, {\"check\": \"regression: widow threshold\", \"actual\": [6, 6, 6, 6, 6, 6, 3], \"expected\": [5, 4, 6, 6, 6, 6, 6], \"passed\": false}, {\"check\": \"regression: widow threshold\", \"actual\": [2, 3, 3, 3, 4, 4, 3, 4, 4, 2], \"expected\": [2, 3, 3, 3, 4, 4, 3, 4, 3, 3], \"passed\": false}, {\"check\": \"orphan pushed forward\", \"actual\": [5, 3], \"expected\": [5, 3], \"passed\": true}, {\"check\": \"long paragraph continuation\", \"actual\": [6, 6, 4], \"expected\": [6, 6, 4], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [8], \"expected\": [8], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [5, 5, 5, 5, 4, 5, 4, 5, 1], \"expected\": [5, 5, 5, 5, 4, 5, 4, 5, 1], \"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."}}