{"abstract":"When the protein floor binds, total energy exceeds the target.","category":"Recipe scaling and nutrition","checks":8,"contract":"split = [protein%, carb%, fat%] must sum to 100 else \"error: split\". protein_g = max(half-up kcal*p/400, ceiling(1.6*weight_kg)). Remaining kcal = kcal - 4*protein_g is divided between carb and fat in the ratio c:f; fat_g = half-up(rem*f/(c+f)/9); carb_g = half-up((rem - 9*fat_g)/4). Return [protein_g, carb_g, fat_g].","contract_signature":"kcal, weight_kg, split","evaluation_group":"w2-recipe_scaling_and_nutrition-macro-split","failed_approach":"Using 9 kcal per gram of protein removes too much energy.","family":"w2-recipe_scaling_and_nutrition-macro-split-remaining-energy","id":"FA-97276","implementations":{"attempt":{"sha256":"5049e34e90e59964f949debef12c475ff8ee9db6bbf5a002b2adb7255031fd82","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(kcal, weight_kg, split):\n    p, c, f = split\n    if p + c + f != 100:\n        return 'error: split'\n    def r(x):\n        return math.floor(x + Fraction(1, 2))\n    protein_g = max(r(Fraction(kcal * p, 400)), math.ceil(Fraction(16, 10) * weight_kg))\n    rem = kcal - 9 * protein_g\n    fat_g = r(Fraction(rem * f, c + f) / 9)\n    carb_g = r(Fraction(rem - 9 * fat_g, 4))\n    return [protein_g, carb_g, fat_g]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['protein floor binds', [1500, 120, [15, 55, 30]], [192, 118, 29]],\n  ['bad split', [2000, 70, [30, 40, 31]], 'error: split'],\n  ['regression: remaining energy', [2200, 72, [10, 60, 30]], [116, 290, 64]],\n  ['repair check: remaining energy', [2000, 72, [40, 30, 30]], [200, 149, 67]],\n  ['generated control 1', [1800, 118, [40, 30, 30]], [189, 131, 58]],\n  ['generated control 2', [2200, 60, [40, 30, 30]], [220, 166, 73]],\n  ['generated control 3', [2200, 83, [20, 50, 30]], [133, 260, 70]]],\n [['protein floor binds', [1500, 120, [15, 55, 30]], [192, 118, 29]],\n  ['bad split', [2000, 70, [30, 40, 31]], 'error: split'],\n  ['split under 100', [2000, 70, [30, 40, 20]], 'error: split'],\n  ['regression: remaining energy', [2000, 91, [15, 55, 30]], [146, 228, 56]],\n  ['repair check: remaining energy', [3000, 91, [40, 30, 30]], [300, 225, 100]],\n  ['generated control 1', [1500, 72, [20, 50, 25]], 'error: split'],\n  ['generated control 2', [2000, 60, [10, 60, 30]], [96, 269, 60]],\n  ['generated control 3', [2200, 100, [30, 40, 30]], [165, 221, 73]]],\n [['bad split', [2000, 70, [30, 40, 31]], 'error: split'],\n  ['split under 100', [2000, 70, [30, 40, 20]], 'error: split'],\n  ['fractional floor', [1200, 83, [20, 50, 30]], [133, 104, 28]],\n  ['regression: remaining energy', [1800, 91, [10, 60, 30]], [146, 203, 45]],\n  ['repair check: remaining energy', [1800, 60, [15, 55, 30]], [96, 228, 56]],\n  ['generated control 1', [2500, 83, [15, 55, 30]], [133, 319, 77]],\n  ['generated control 2', [2200, 50, [15, 55, 30]], [83, 303, 73]],\n  ['generated control 3', [1500, 91, [40, 30, 30]], [150, 113, 50]]],\n [['split under 100', [2000, 70, [30, 40, 20]], 'error: split'],\n  ['fractional floor', [1200, 83, [20, 50, 30]], [133, 104, 28]],\n  ['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['regression: remaining energy', [1500, 118, [20, 50, 30]], [189, 116, 31]],\n  ['repair check: remaining energy', [1800, 50, [40, 30, 30]], [180, 135, 60]],\n  ['generated control 1', [2000, 72, [30, 40, 29]], 'error: split'],\n  ['generated control 2', [2500, 83, [30, 40, 30]], [188, 250, 83]],\n  ['generated control 3', [2500, 100, [10, 60, 30]], [160, 310, 69]]],\n [['fractional floor', [1200, 83, [20, 50, 30]], [133, 104, 28]],\n  ['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['protein floor binds', [1500, 120, [15, 55, 30]], [192, 118, 29]],\n  ['regression: remaining energy', [2500, 118, [30, 40, 30]], [189, 249, 83]],\n  ['repair check: remaining energy', [1800, 72, [10, 60, 30]], [116, 224, 49]],\n  ['generated control 1', [2200, 91, [20, 50, 30]], [146, 253, 67]],\n  ['generated control 2', [1500, 60, [30, 40, 31]], 'error: split'],\n  ['generated control 3', [1500, 91, [30, 40, 29]], 'error: split']]]\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":"a09cb2bdd74ec5ff1c5786c6249bc44c67fb9f35d8ea46e1cca06143c343a0fb","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(kcal, weight_kg, split):\n    p, c, f = split\n    if p + c + f != 100:\n        return 'error: split'\n    def r(x):\n        return math.floor(x + Fraction(1, 2))\n    protein_g = max(r(Fraction(kcal * p, 400)), math.ceil(Fraction(16, 10) * weight_kg))\n    rem = kcal - Fraction(kcal * p, 100)\n    fat_g = r(Fraction(rem * f, c + f) / 9)\n    carb_g = r(Fraction(rem - 9 * fat_g, 4))\n    return [protein_g, carb_g, fat_g]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['protein floor binds', [1500, 120, [15, 55, 30]], [192, 118, 29]],\n  ['bad split', [2000, 70, [30, 40, 31]], 'error: split'],\n  ['regression: remaining energy', [2200, 72, [10, 60, 30]], [116, 290, 64]],\n  ['repair check: remaining energy', [2000, 72, [40, 30, 30]], [200, 149, 67]],\n  ['generated control 1', [1800, 118, [40, 30, 30]], [189, 131, 58]],\n  ['generated control 2', [2200, 60, [40, 30, 30]], [220, 166, 73]],\n  ['generated control 3', [2200, 83, [20, 50, 30]], [133, 260, 70]]],\n [['protein floor binds', [1500, 120, [15, 55, 30]], [192, 118, 29]],\n  ['bad split', [2000, 70, [30, 40, 31]], 'error: split'],\n  ['split under 100', [2000, 70, [30, 40, 20]], 'error: split'],\n  ['regression: remaining energy', [2000, 91, [15, 55, 30]], [146, 228, 56]],\n  ['repair check: remaining energy', [3000, 91, [40, 30, 30]], [300, 225, 100]],\n  ['generated control 1', [1500, 72, [20, 50, 25]], 'error: split'],\n  ['generated control 2', [2000, 60, [10, 60, 30]], [96, 269, 60]],\n  ['generated control 3', [2200, 100, [30, 40, 30]], [165, 221, 73]]],\n [['bad split', [2000, 70, [30, 40, 31]], 'error: split'],\n  ['split under 100', [2000, 70, [30, 40, 20]], 'error: split'],\n  ['fractional floor', [1200, 83, [20, 50, 30]], [133, 104, 28]],\n  ['regression: remaining energy', [1800, 91, [10, 60, 30]], [146, 203, 45]],\n  ['repair check: remaining energy', [1800, 60, [15, 55, 30]], [96, 228, 56]],\n  ['generated control 1', [2500, 83, [15, 55, 30]], [133, 319, 77]],\n  ['generated control 2', [2200, 50, [15, 55, 30]], [83, 303, 73]],\n  ['generated control 3', [1500, 91, [40, 30, 30]], [150, 113, 50]]],\n [['split under 100', [2000, 70, [30, 40, 20]], 'error: split'],\n  ['fractional floor', [1200, 83, [20, 50, 30]], [133, 104, 28]],\n  ['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['regression: remaining energy', [1500, 118, [20, 50, 30]], [189, 116, 31]],\n  ['repair check: remaining energy', [1800, 50, [40, 30, 30]], [180, 135, 60]],\n  ['generated control 1', [2000, 72, [30, 40, 29]], 'error: split'],\n  ['generated control 2', [2500, 83, [30, 40, 30]], [188, 250, 83]],\n  ['generated control 3', [2500, 100, [10, 60, 30]], [160, 310, 69]]],\n [['fractional floor', [1200, 83, [20, 50, 30]], [133, 104, 28]],\n  ['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['protein floor binds', [1500, 120, [15, 55, 30]], [192, 118, 29]],\n  ['regression: remaining energy', [2500, 118, [30, 40, 30]], [189, 249, 83]],\n  ['repair check: remaining energy', [1800, 72, [10, 60, 30]], [116, 224, 49]],\n  ['generated control 1', [2200, 91, [20, 50, 30]], [146, 253, 67]],\n  ['generated control 2', [1500, 60, [30, 40, 31]], 'error: split'],\n  ['generated control 3', [1500, 91, [30, 40, 29]], 'error: split']]]\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 contract stated in full here; it is a bounded teaching model, not an authoritative reference or standards implementation. 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-recipe_scaling_and_nutrition-macro-split-remaining-energy","generated_at":"2026-09-29T14:52:30.585655+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Meal-plan generators turn calorie targets into gram targets with a protein floor by body weight.","root_cause":"Remaining energy subtracts the nominal protein share, not the actual protein grams.","sha256":"da860b8730efe28f629d537ff20b35ac6004afb73d564a61f38881d610bbe805","title":"Macronutrient target splitter: remaining energy · 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.916,"exit_code":1,"observations":[{"actual":[150,93,31],"check":"balanced","expected":[150,199,67],"passed":false},{"actual":[192,-37,-9],"check":"protein floor binds","expected":[192,118,29],"passed":false},{"actual":"error: split","check":"bad split","expected":"error: split","passed":true},{"actual":[116,192,43],"check":"regression: remaining energy","expected":[116,290,64],"passed":false},{"actual":[200,25,11],"check":"repair check: remaining energy","expected":[200,149,67],"passed":false},{"actual":[189,11,6],"check":"generated control 1","expected":[189,131,58],"passed":false},{"actual":[220,28,12],"check":"generated control 2","expected":[220,166,73],"passed":false},{"actual":[133,156,42],"check":"generated control 3","expected":[133,260,70],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"balanced\", \"actual\": [150, 93, 31], \"expected\": [150, 199, 67], \"passed\": false}, {\"check\": \"protein floor binds\", \"actual\": [192, -37, -9], \"expected\": [192, 118, 29], \"passed\": false}, {\"check\": \"bad split\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"regression: remaining energy\", \"actual\": [116, 192, 43], \"expected\": [116, 290, 64], \"passed\": false}, {\"check\": \"repair check: remaining energy\", \"actual\": [200, 25, 11], \"expected\": [200, 149, 67], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [189, 11, 6], \"expected\": [189, 131, 58], \"passed\": false}, {\"check\": \"generated control 2\", \"actual\": [220, 28, 12], \"expected\": [220, 166, 73], \"passed\": false}, {\"check\": \"generated control 3\", \"actual\": [133, 156, 42], \"expected\": [133, 260, 70], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.8,"exit_code":1,"observations":[{"actual":[150,199,67],"check":"balanced","expected":[150,199,67],"passed":true},{"actual":[192,206,50],"check":"protein floor binds","expected":[192,118,29],"passed":false},{"actual":"error: split","check":"bad split","expected":"error: split","passed":true},{"actual":[116,331,73],"check":"regression: remaining energy","expected":[116,290,64],"passed":false},{"actual":[200,149,67],"check":"repair check: remaining energy","expected":[200,149,67],"passed":true},{"actual":[189,135,60],"check":"generated control 1","expected":[189,131,58],"passed":false},{"actual":[220,166,73],"check":"generated control 2","expected":[220,166,73],"passed":true},{"actual":[133,276,73],"check":"generated control 3","expected":[133,260,70],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"balanced\", \"actual\": [150, 199, 67], \"expected\": [150, 199, 67], \"passed\": true}, {\"check\": \"protein floor binds\", \"actual\": [192, 206, 50], \"expected\": [192, 118, 29], \"passed\": false}, {\"check\": \"bad split\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"regression: remaining energy\", \"actual\": [116, 331, 73], \"expected\": [116, 290, 64], \"passed\": false}, {\"check\": \"repair check: remaining energy\", \"actual\": [200, 149, 67], \"expected\": [200, 149, 67], \"passed\": true}, {\"check\": \"generated control 1\", \"actual\": [189, 135, 60], \"expected\": [189, 131, 58], \"passed\": false}, {\"check\": \"generated control 2\", \"actual\": [220, 166, 73], \"expected\": [220, 166, 73], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [133, 276, 73], \"expected\": [133, 260, 70], \"passed\": false}], \"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."}}