{"abstract":"A line with slack but no stretchable glue is accepted as perfect.","category":"Typography line breaking","checks":8,"contract":"Input [natural, stretch, shrink, width, tolerance] (ints). shortfall=width-natural. Positive shortfall with zero stretch is underfull 10000 very_loose; shrinking past total shrink is overfull 1000000 tight. r=shortfall/stretch (or /shrink when negative); badness=min(10000, floor(100*|r|^3+1/2)); fitness tight r<-1/2, decent r<=1/2, loose r<=1, else very_loose; status ok iff badness<=tolerance. Return [status, badness, fitness].","contract_signature":"x","evaluation_group":"w2-typography-line-breaking-glue-badness","failed_approach":"Returning 10000 but classifying it loose still misreports the fitness class.","family":"w2-typography-line-breaking-glue-badness-rigid-line-with-slack","id":"FA-79866","implementations":{"attempt":{"sha256":"d7d6004e4ea8202b7d4d723e88d4c11dddc57f91c44187f97c6f31c7f3ce07bf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    natural, stretch, shrink, width, tolerance = x\n    shortfall = width - natural\n    if shortfall > 0:\n        if stretch == 0:\n            return ['underfull', 10000, 'loose']\n        r = Fraction(shortfall, stretch)\n    elif shortfall < 0:\n        if -shortfall > shrink:\n            return ['overfull', 1000000, 'tight']\n        r = Fraction(shortfall, shrink)\n    else:\n        r = Fraction(0)\n    badness = min(10000, math.floor(100 * abs(r) ** 3 + Fraction(1, 2)))\n    if r < Fraction(-1, 2):\n        fitness = 'tight'\n    elif r <= Fraction(1, 2):\n        fitness = 'decent'\n    elif r <= 1:\n        fitness = 'loose'\n    else:\n        fitness = 'very_loose'\n    status = 'ok' if badness <= tolerance else 'underfull'\n    return [status, badness, fitness]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('rigid line with slack', [100, 0, 5, 110, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [62, 0, 4, 76, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [91, 0, 10, 106, 500], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [80, 0, 11, 90, 100], ['underfull', 10000, 'very_loose']), ('half stretch ratio rounds 12.5 up', [100, 10, 5, 105, 200], ['ok', 13, 'decent']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('control layout', [69, 10, 7, 69, 100], ['ok', 0, 'decent']), ('control layout', [74, 6, 6, 67, 100], ['overfull', 1000000, 'tight'])], [('regression: rigid line with slack', [94, 0, 10, 118, 500], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [100, 0, 9, 105, 100], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [72, 0, 3, 87, 1000], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [114, 0, 6, 129, 200], ['underfull', 10000, 'very_loose']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('very loose over tolerance', [100, 4, 0, 110, 200], ['underfull', 1563, 'very_loose']), ('control layout', [69, 2, 11, 55, 150], ['overfull', 1000000, 'tight']), ('control layout', [62, 4, 4, 58, 200], ['ok', 100, 'tight'])], [('rigid line with slack', [100, 0, 5, 110, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [90, 0, 6, 102, 1000], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [62, 0, 4, 76, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [79, 0, 11, 96, 1000], ['underfull', 10000, 'very_loose']), ('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('half stretch ratio rounds 12.5 up', [100, 10, 5, 105, 200], ['ok', 13, 'decent']), ('control layout', [118, 6, 5, 121, 100], ['ok', 13, 'decent']), ('control layout', [105, 4, 1, 111, 100], ['underfull', 338, 'very_loose'])], [('regression: rigid line with slack', [114, 0, 6, 129, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [83, 0, 3, 97, 100], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [100, 0, 9, 105, 100], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [116, 0, 11, 126, 100], ['underfull', 10000, 'very_loose']), ('rigid line with slack', [100, 0, 5, 110, 200], ['underfull', 10000, 'very_loose']), ('one unit past total shrink', [100, 10, 5, 94, 200], ['overfull', 1000000, 'tight']), ('control layout', [85, 4, 0, 98, 150], ['underfull', 3433, 'very_loose']), ('control layout', [62, 6, 1, 51, 100], ['overfull', 1000000, 'tight'])], [('regression: rigid line with slack', [90, 0, 6, 102, 1000], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [91, 0, 10, 106, 500], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [75, 0, 11, 88, 100], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [100, 0, 9, 105, 100], ['underfull', 10000, 'very_loose']), ('very loose over tolerance', [100, 4, 0, 110, 200], ['underfull', 1563, 'very_loose']), ('negative half ratio is decent', [100, 10, 6, 97, 200], ['ok', 13, 'decent']), ('control layout', [79, 6, 10, 67, 1000], ['overfull', 1000000, 'tight']), ('control layout', [74, 16, 0, 61, 200], ['overfull', 1000000, 'tight'])]]\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":"dd5753763dae7c9e1681a964f4b76c084a6cd33f38d30891cbcb7b9f0065ce39","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    natural, stretch, shrink, width, tolerance = x\n    shortfall = width - natural\n    if shortfall > 0:\n        if stretch == 0:\n            return ['ok', 0, 'decent']\n        r = Fraction(shortfall, stretch)\n    elif shortfall < 0:\n        if -shortfall > shrink:\n            return ['overfull', 1000000, 'tight']\n        r = Fraction(shortfall, shrink)\n    else:\n        r = Fraction(0)\n    badness = min(10000, math.floor(100 * abs(r) ** 3 + Fraction(1, 2)))\n    if r < Fraction(-1, 2):\n        fitness = 'tight'\n    elif r <= Fraction(1, 2):\n        fitness = 'decent'\n    elif r <= 1:\n        fitness = 'loose'\n    else:\n        fitness = 'very_loose'\n    status = 'ok' if badness <= tolerance else 'underfull'\n    return [status, badness, fitness]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('rigid line with slack', [100, 0, 5, 110, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [62, 0, 4, 76, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [91, 0, 10, 106, 500], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [80, 0, 11, 90, 100], ['underfull', 10000, 'very_loose']), ('half stretch ratio rounds 12.5 up', [100, 10, 5, 105, 200], ['ok', 13, 'decent']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('control layout', [69, 10, 7, 69, 100], ['ok', 0, 'decent']), ('control layout', [74, 6, 6, 67, 100], ['overfull', 1000000, 'tight'])], [('regression: rigid line with slack', [94, 0, 10, 118, 500], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [100, 0, 9, 105, 100], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [72, 0, 3, 87, 1000], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [114, 0, 6, 129, 200], ['underfull', 10000, 'very_loose']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('very loose over tolerance', [100, 4, 0, 110, 200], ['underfull', 1563, 'very_loose']), ('control layout', [69, 2, 11, 55, 150], ['overfull', 1000000, 'tight']), ('control layout', [62, 4, 4, 58, 200], ['ok', 100, 'tight'])], [('rigid line with slack', [100, 0, 5, 110, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [90, 0, 6, 102, 1000], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [62, 0, 4, 76, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [79, 0, 11, 96, 1000], ['underfull', 10000, 'very_loose']), ('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('half stretch ratio rounds 12.5 up', [100, 10, 5, 105, 200], ['ok', 13, 'decent']), ('control layout', [118, 6, 5, 121, 100], ['ok', 13, 'decent']), ('control layout', [105, 4, 1, 111, 100], ['underfull', 338, 'very_loose'])], [('regression: rigid line with slack', [114, 0, 6, 129, 200], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [83, 0, 3, 97, 100], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [100, 0, 9, 105, 100], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [116, 0, 11, 126, 100], ['underfull', 10000, 'very_loose']), ('rigid line with slack', [100, 0, 5, 110, 200], ['underfull', 10000, 'very_loose']), ('one unit past total shrink', [100, 10, 5, 94, 200], ['overfull', 1000000, 'tight']), ('control layout', [85, 4, 0, 98, 150], ['underfull', 3433, 'very_loose']), ('control layout', [62, 6, 1, 51, 100], ['overfull', 1000000, 'tight'])], [('regression: rigid line with slack', [90, 0, 6, 102, 1000], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [91, 0, 10, 106, 500], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [75, 0, 11, 88, 100], ['underfull', 10000, 'very_loose']), ('regression: rigid line with slack', [100, 0, 9, 105, 100], ['underfull', 10000, 'very_loose']), ('very loose over tolerance', [100, 4, 0, 110, 200], ['underfull', 1563, 'very_loose']), ('negative half ratio is decent', [100, 10, 6, 97, 200], ['ok', 13, 'decent']), ('control layout', [79, 6, 10, 67, 1000], ['overfull', 1000000, 'tight']), ('control layout', [74, 16, 0, 61, 200], ['overfull', 1000000, 'tight'])]]\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-glue-badness-rigid-line-with-slack","generated_at":"2026-09-29T14:49:48.298745+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 zero-stretch guard returns an ok decent rating instead of an infinitely bad underfull one.","sha256":"64598dbccc5eb0e92d36a73d1d824b23bc2ef4ae583f16d08552cef55487a75e","title":"Glue-set badness rating: rigid line with slack · 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":41.135,"exit_code":1,"observations":[{"actual":["underfull",10000,"loose"],"check":"rigid line with slack","expected":["underfull",10000,"very_loose"],"passed":false},{"actual":["underfull",10000,"loose"],"check":"regression: rigid line with slack","expected":["underfull",10000,"very_loose"],"passed":false},{"actual":["underfull",10000,"loose"],"check":"regression: rigid line with slack","expected":["underfull",10000,"very_loose"],"passed":false},{"actual":["underfull",10000,"loose"],"check":"regression: rigid line with slack","expected":["underfull",10000,"very_loose"],"passed":false},{"actual":["ok",13,"decent"],"check":"half stretch ratio rounds 12.5 up","expected":["ok",13,"decent"],"passed":true},{"actual":["ok",0,"decent"],"check":"exact natural width","expected":["ok",0,"decent"],"passed":true},{"actual":["ok",0,"decent"],"check":"control layout","expected":["ok",0,"decent"],"passed":true},{"actual":["overfull",1000000,"tight"],"check":"control layout","expected":["overfull",1000000,"tight"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"rigid line with slack\", \"actual\": [\"underfull\", 10000, \"loose\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": false}, {\"check\": \"regression: rigid line with slack\", \"actual\": [\"underfull\", 10000, \"loose\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": false}, {\"check\": \"regression: rigid line with slack\", \"actual\": [\"underfull\", 10000, \"loose\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": false}, {\"check\": \"regression: rigid line with slack\", \"actual\": [\"underfull\", 10000, \"loose\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": false}, {\"check\": \"half stretch ratio rounds 12.5 up\", \"actual\": [\"ok\", 13, \"decent\"], \"expected\": [\"ok\", 13, \"decent\"], \"passed\": true}, {\"check\": \"exact natural width\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 0, \"decent\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 0, \"decent\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"overfull\", 1000000, \"tight\"], \"expected\": [\"overfull\", 1000000, \"tight\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.259,"exit_code":1,"observations":[{"actual":["ok",0,"decent"],"check":"rigid line with slack","expected":["underfull",10000,"very_loose"],"passed":false},{"actual":["ok",0,"decent"],"check":"regression: rigid line with slack","expected":["underfull",10000,"very_loose"],"passed":false},{"actual":["ok",0,"decent"],"check":"regression: rigid line with slack","expected":["underfull",10000,"very_loose"],"passed":false},{"actual":["ok",0,"decent"],"check":"regression: rigid line with slack","expected":["underfull",10000,"very_loose"],"passed":false},{"actual":["ok",13,"decent"],"check":"half stretch ratio rounds 12.5 up","expected":["ok",13,"decent"],"passed":true},{"actual":["ok",0,"decent"],"check":"exact natural width","expected":["ok",0,"decent"],"passed":true},{"actual":["ok",0,"decent"],"check":"control layout","expected":["ok",0,"decent"],"passed":true},{"actual":["overfull",1000000,"tight"],"check":"control layout","expected":["overfull",1000000,"tight"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"rigid line with slack\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": false}, {\"check\": \"regression: rigid line with slack\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": false}, {\"check\": \"regression: rigid line with slack\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": false}, {\"check\": \"regression: rigid line with slack\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": false}, {\"check\": \"half stretch ratio rounds 12.5 up\", \"actual\": [\"ok\", 13, \"decent\"], \"expected\": [\"ok\", 13, \"decent\"], \"passed\": true}, {\"check\": \"exact natural width\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 0, \"decent\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 0, \"decent\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"overfull\", 1000000, \"tight\"], \"expected\": [\"overfull\", 1000000, \"tight\"], \"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."}}