{"abstract":"Tight lines get badness and fitness computed from the wrong glue total.","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":"Dividing by shrink plus stretch dilutes the ratio and still misrates compressed lines.","family":"w2-typography-line-breaking-glue-badness-shrink-ratio-denominator","id":"FA-79846","implementations":{"attempt":{"sha256":"199c09faffdf6463343114025fd380f3f13f337dafe0dc323d03a738ab752a07","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, 'very_loose']\n        r = Fraction(shortfall, stretch)\n    elif shortfall < 0:\n        if -shortfall > shrink:\n            return ['overfull', 1000000, 'tight']\n        r = Fraction(shortfall, shrink + stretch)\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 = [[('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('regression: shrink ratio denominator', [105, 12, 6, 100, 1000], ['ok', 58, 'tight']), ('regression: shrink ratio denominator', [82, 3, 10, 77, 100], ['ok', 13, 'decent']), ('regression: shrink ratio denominator', [90, 12, 2, 88, 150], ['ok', 100, 'tight']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('badness cap at 10000', [100, 2, 0, 150, 200], ['underfull', 10000, 'very_loose']), ('control layout', [116, 20, 6, 127, 1000], ['ok', 17, 'loose']), ('control layout', [69, 10, 7, 69, 100], ['ok', 0, 'decent'])], [('regression: shrink ratio denominator', [96, 4, 10, 87, 1000], ['ok', 73, 'tight']), ('regression: shrink ratio denominator', [67, 1, 8, 64, 1000], ['ok', 5, 'decent']), ('regression: shrink ratio denominator', [85, 1, 11, 80, 200], ['ok', 9, 'decent']), ('regression: shrink ratio denominator', [104, 16, 8, 96, 150], ['ok', 100, 'tight']), ('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('one unit past total shrink', [100, 10, 5, 94, 200], ['overfull', 1000000, 'tight']), ('control layout', [103, 8, 4, 116, 500], ['ok', 429, 'very_loose']), ('control layout', [92, 10, 3, 102, 1000], ['ok', 100, 'loose'])], [('regression: shrink ratio denominator', [107, 20, 11, 102, 100], ['ok', 9, 'decent']), ('regression: shrink ratio denominator', [85, 3, 7, 78, 150], ['ok', 100, 'tight']), ('regression: shrink ratio denominator', [96, 12, 2, 95, 200], ['ok', 13, 'decent']), ('partial-repair probe', [88, 8, 8, 84, 150], ['ok', 13, 'decent']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('badness cap at 10000', [100, 2, 0, 150, 200], ['underfull', 10000, 'very_loose']), ('control layout', [100, 0, 9, 105, 100], ['underfull', 10000, 'very_loose']), ('control layout', [76, 20, 1, 72, 200], ['overfull', 1000000, 'tight'])], [('regression: shrink ratio denominator', [76, 10, 6, 74, 500], ['ok', 4, 'decent']), ('regression: shrink ratio denominator', [82, 3, 7, 76, 200], ['ok', 63, 'tight']), ('regression: shrink ratio denominator', [112, 16, 9, 104, 150], ['ok', 70, 'tight']), ('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('very loose over tolerance', [100, 4, 0, 110, 200], ['underfull', 1563, 'very_loose']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('control layout', [113, 8, 3, 103, 150], ['overfull', 1000000, 'tight']), ('control layout', [105, 12, 8, 111, 100], ['ok', 13, 'decent'])], [('regression: shrink ratio denominator', [107, 20, 11, 102, 100], ['ok', 9, 'decent']), ('regression: shrink ratio denominator', [92, 6, 12, 80, 100], ['ok', 100, 'tight']), ('regression: shrink ratio denominator', [96, 12, 2, 95, 200], ['ok', 13, 'decent']), ('regression: shrink ratio denominator', [105, 12, 5, 103, 1000], ['ok', 6, 'decent']), ('one unit past total shrink', [100, 10, 5, 94, 200], ['overfull', 1000000, 'tight']), ('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('control layout', [114, 0, 0, 136, 500], ['underfull', 10000, 'very_loose']), ('control layout', [95, 20, 10, 113, 500], ['ok', 73, 'loose'])]]\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":"d99f0e7ea36cbb896db48a83fc1fb14e2644e4d084c623c8eb4336fbc1d6c00e","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, 'very_loose']\n        r = Fraction(shortfall, stretch)\n    elif shortfall < 0:\n        if -shortfall > shrink:\n            return ['overfull', 1000000, 'tight']\n        r = Fraction(shortfall, stretch)\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 = [[('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('regression: shrink ratio denominator', [105, 12, 6, 100, 1000], ['ok', 58, 'tight']), ('regression: shrink ratio denominator', [82, 3, 10, 77, 100], ['ok', 13, 'decent']), ('regression: shrink ratio denominator', [90, 12, 2, 88, 150], ['ok', 100, 'tight']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('badness cap at 10000', [100, 2, 0, 150, 200], ['underfull', 10000, 'very_loose']), ('control layout', [116, 20, 6, 127, 1000], ['ok', 17, 'loose']), ('control layout', [69, 10, 7, 69, 100], ['ok', 0, 'decent'])], [('regression: shrink ratio denominator', [96, 4, 10, 87, 1000], ['ok', 73, 'tight']), ('regression: shrink ratio denominator', [67, 1, 8, 64, 1000], ['ok', 5, 'decent']), ('regression: shrink ratio denominator', [85, 1, 11, 80, 200], ['ok', 9, 'decent']), ('regression: shrink ratio denominator', [104, 16, 8, 96, 150], ['ok', 100, 'tight']), ('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('one unit past total shrink', [100, 10, 5, 94, 200], ['overfull', 1000000, 'tight']), ('control layout', [103, 8, 4, 116, 500], ['ok', 429, 'very_loose']), ('control layout', [92, 10, 3, 102, 1000], ['ok', 100, 'loose'])], [('regression: shrink ratio denominator', [107, 20, 11, 102, 100], ['ok', 9, 'decent']), ('regression: shrink ratio denominator', [85, 3, 7, 78, 150], ['ok', 100, 'tight']), ('regression: shrink ratio denominator', [96, 12, 2, 95, 200], ['ok', 13, 'decent']), ('partial-repair probe', [88, 8, 8, 84, 150], ['ok', 13, 'decent']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('badness cap at 10000', [100, 2, 0, 150, 200], ['underfull', 10000, 'very_loose']), ('control layout', [100, 0, 9, 105, 100], ['underfull', 10000, 'very_loose']), ('control layout', [76, 20, 1, 72, 200], ['overfull', 1000000, 'tight'])], [('regression: shrink ratio denominator', [76, 10, 6, 74, 500], ['ok', 4, 'decent']), ('regression: shrink ratio denominator', [82, 3, 7, 76, 200], ['ok', 63, 'tight']), ('regression: shrink ratio denominator', [112, 16, 9, 104, 150], ['ok', 70, 'tight']), ('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('very loose over tolerance', [100, 4, 0, 110, 200], ['underfull', 1563, 'very_loose']), ('exact natural width', [100, 10, 5, 100, 200], ['ok', 0, 'decent']), ('control layout', [113, 8, 3, 103, 150], ['overfull', 1000000, 'tight']), ('control layout', [105, 12, 8, 111, 100], ['ok', 13, 'decent'])], [('regression: shrink ratio denominator', [107, 20, 11, 102, 100], ['ok', 9, 'decent']), ('regression: shrink ratio denominator', [92, 6, 12, 80, 100], ['ok', 100, 'tight']), ('regression: shrink ratio denominator', [96, 12, 2, 95, 200], ['ok', 13, 'decent']), ('regression: shrink ratio denominator', [105, 12, 5, 103, 1000], ['ok', 6, 'decent']), ('one unit past total shrink', [100, 10, 5, 94, 200], ['overfull', 1000000, 'tight']), ('full shrink is still acceptable', [100, 10, 5, 95, 200], ['ok', 100, 'tight']), ('control layout', [114, 0, 0, 136, 500], ['underfull', 10000, 'very_loose']), ('control layout', [95, 20, 10, 113, 500], ['ok', 73, 'loose'])]]\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-shrink-ratio-denominator","generated_at":"2026-09-29T14:49:48.255660+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 adjustment ratio for a compressed line divides by the stretch total instead of the shrink total.","sha256":"649656fff59534e6c065b43eca66dec84dbc50b1674702361e26f9475b94ae24","title":"Glue-set badness rating: shrink ratio denominator · 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":44.527,"exit_code":1,"observations":[{"actual":["ok",4,"decent"],"check":"full shrink is still acceptable","expected":["ok",100,"tight"],"passed":false},{"actual":["ok",2,"decent"],"check":"regression: shrink ratio denominator","expected":["ok",58,"tight"],"passed":false},{"actual":["ok",6,"decent"],"check":"regression: shrink ratio denominator","expected":["ok",13,"decent"],"passed":false},{"actual":["ok",0,"decent"],"check":"regression: shrink ratio denominator","expected":["ok",100,"tight"],"passed":false},{"actual":["ok",0,"decent"],"check":"exact natural width","expected":["ok",0,"decent"],"passed":true},{"actual":["underfull",10000,"very_loose"],"check":"badness cap at 10000","expected":["underfull",10000,"very_loose"],"passed":true},{"actual":["ok",17,"loose"],"check":"control layout","expected":["ok",17,"loose"],"passed":true},{"actual":["ok",0,"decent"],"check":"control layout","expected":["ok",0,"decent"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"full shrink is still acceptable\", \"actual\": [\"ok\", 4, \"decent\"], \"expected\": [\"ok\", 100, \"tight\"], \"passed\": false}, {\"check\": \"regression: shrink ratio denominator\", \"actual\": [\"ok\", 2, \"decent\"], \"expected\": [\"ok\", 58, \"tight\"], \"passed\": false}, {\"check\": \"regression: shrink ratio denominator\", \"actual\": [\"ok\", 6, \"decent\"], \"expected\": [\"ok\", 13, \"decent\"], \"passed\": false}, {\"check\": \"regression: shrink ratio denominator\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 100, \"tight\"], \"passed\": false}, {\"check\": \"exact natural width\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 0, \"decent\"], \"passed\": true}, {\"check\": \"badness cap at 10000\", \"actual\": [\"underfull\", 10000, \"very_loose\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ok\", 17, \"loose\"], \"expected\": [\"ok\", 17, \"loose\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 0, \"decent\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.424,"exit_code":1,"observations":[{"actual":["ok",13,"decent"],"check":"full shrink is still acceptable","expected":["ok",100,"tight"],"passed":false},{"actual":["ok",7,"decent"],"check":"regression: shrink ratio denominator","expected":["ok",58,"tight"],"passed":false},{"actual":["underfull",463,"tight"],"check":"regression: shrink ratio denominator","expected":["ok",13,"decent"],"passed":false},{"actual":["ok",0,"decent"],"check":"regression: shrink ratio denominator","expected":["ok",100,"tight"],"passed":false},{"actual":["ok",0,"decent"],"check":"exact natural width","expected":["ok",0,"decent"],"passed":true},{"actual":["underfull",10000,"very_loose"],"check":"badness cap at 10000","expected":["underfull",10000,"very_loose"],"passed":true},{"actual":["ok",17,"loose"],"check":"control layout","expected":["ok",17,"loose"],"passed":true},{"actual":["ok",0,"decent"],"check":"control layout","expected":["ok",0,"decent"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"full shrink is still acceptable\", \"actual\": [\"ok\", 13, \"decent\"], \"expected\": [\"ok\", 100, \"tight\"], \"passed\": false}, {\"check\": \"regression: shrink ratio denominator\", \"actual\": [\"ok\", 7, \"decent\"], \"expected\": [\"ok\", 58, \"tight\"], \"passed\": false}, {\"check\": \"regression: shrink ratio denominator\", \"actual\": [\"underfull\", 463, \"tight\"], \"expected\": [\"ok\", 13, \"decent\"], \"passed\": false}, {\"check\": \"regression: shrink ratio denominator\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 100, \"tight\"], \"passed\": false}, {\"check\": \"exact natural width\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 0, \"decent\"], \"passed\": true}, {\"check\": \"badness cap at 10000\", \"actual\": [\"underfull\", 10000, \"very_loose\"], \"expected\": [\"underfull\", 10000, \"very_loose\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ok\", 17, \"loose\"], \"expected\": [\"ok\", 17, \"loose\"], \"passed\": true}, {\"check\": \"control layout\", \"actual\": [\"ok\", 0, \"decent\"], \"expected\": [\"ok\", 0, \"decent\"], \"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."}}