{"abstract":"A 120 kg athlete on 1500 kcal gets 56 g protein.","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].","evaluation_group":"w2-recipe_scaling_and_nutrition-macro-split","failed_approach":"Flooring the per-kg target lets protein fall a gram short.","family":"w2-recipe_scaling_and_nutrition-macro-split-protein-floor","id":"FA-97271","implementations":{"attempt":{"sha256":"239b21bbc5273d50e7224e1984db0a376defc1f01e9be708b31151cbfdafc844","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.floor(Fraction(16, 10) * weight_kg))\n    rem = kcal - 4 * 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: protein floor', [2500, 91, [15, 55, 30]], [146, 310, 75]],\n  ['repair check: protein floor', [1500, 118, [30, 40, 30]], [189, 107, 35]],\n  ['generated control 1', [3000, 120, [20, 50, 25]], 'error: split'],\n  ['generated control 2', [1500, 118, [30, 40, 29]], 'error: split'],\n  ['generated control 3', [2000, 50, [40, 30, 30]], [200, 149, 67]]],\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: protein floor', [1500, 118, [25, 45, 30]], [189, 112, 33]],\n  ['repair check: protein floor', [1800, 118, [25, 45, 30]], [189, 158, 46]],\n  ['generated control 1', [2200, 91, [40, 30, 30]], [220, 166, 73]],\n  ['generated control 2', [2200, 118, [40, 30, 30]], [220, 166, 73]],\n  ['generated control 3', [2500, 72, [20, 50, 30]], [125, 313, 83]]],\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: protein floor', [1500, 100, [25, 45, 30]], [160, 130, 38]],\n  ['repair check: protein floor', [2000, 118, [10, 60, 30]], [189, 208, 46]],\n  ['generated control 1', [2200, 50, [10, 60, 30]], [80, 313, 70]],\n  ['generated control 2', [1500, 50, [35, 35, 30]], [131, 132, 50]],\n  ['generated control 3', [1500, 60, [30, 40, 29]], '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  ['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['regression: protein floor', [2000, 60, [15, 55, 30]], [96, 262, 63]],\n  ['repair check: protein floor', [1800, 118, [40, 30, 30]], [189, 131, 58]],\n  ['generated control 1', [2500, 100, [35, 35, 30]], [219, 219, 83]],\n  ['generated control 2', [3000, 83, [30, 40, 29]], 'error: split'],\n  ['generated control 3', [1500, 60, [30, 40, 29]], 'error: split']],\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: protein floor', [2500, 120, [15, 55, 30]], [192, 280, 68]],\n  ['repair check: protein floor', [3000, 91, [15, 55, 30]], [146, 390, 95]],\n  ['generated control 1', [3000, 91, [35, 35, 30]], [263, 262, 100]],\n  ['generated control 2', [2000, 72, [25, 45, 30]], [125, 224, 67]],\n  ['generated control 3', [3000, 50, [15, 55, 30]], [113, 412, 100]]]]\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":"8b6cbc5fac9463172b55385ec217da3c125926fd4d771227a81edaca9907d6b5","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)), 0)\n    rem = kcal - 4 * 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: protein floor', [2500, 91, [15, 55, 30]], [146, 310, 75]],\n  ['repair check: protein floor', [1500, 118, [30, 40, 30]], [189, 107, 35]],\n  ['generated control 1', [3000, 120, [20, 50, 25]], 'error: split'],\n  ['generated control 2', [1500, 118, [30, 40, 29]], 'error: split'],\n  ['generated control 3', [2000, 50, [40, 30, 30]], [200, 149, 67]]],\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: protein floor', [1500, 118, [25, 45, 30]], [189, 112, 33]],\n  ['repair check: protein floor', [1800, 118, [25, 45, 30]], [189, 158, 46]],\n  ['generated control 1', [2200, 91, [40, 30, 30]], [220, 166, 73]],\n  ['generated control 2', [2200, 118, [40, 30, 30]], [220, 166, 73]],\n  ['generated control 3', [2500, 72, [20, 50, 30]], [125, 313, 83]]],\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: protein floor', [1500, 100, [25, 45, 30]], [160, 130, 38]],\n  ['repair check: protein floor', [2000, 118, [10, 60, 30]], [189, 208, 46]],\n  ['generated control 1', [2200, 50, [10, 60, 30]], [80, 313, 70]],\n  ['generated control 2', [1500, 50, [35, 35, 30]], [131, 132, 50]],\n  ['generated control 3', [1500, 60, [30, 40, 29]], '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  ['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['regression: protein floor', [2000, 60, [15, 55, 30]], [96, 262, 63]],\n  ['repair check: protein floor', [1800, 118, [40, 30, 30]], [189, 131, 58]],\n  ['generated control 1', [2500, 100, [35, 35, 30]], [219, 219, 83]],\n  ['generated control 2', [3000, 83, [30, 40, 29]], 'error: split'],\n  ['generated control 3', [1500, 60, [30, 40, 29]], 'error: split']],\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: protein floor', [2500, 120, [15, 55, 30]], [192, 280, 68]],\n  ['repair check: protein floor', [3000, 91, [15, 55, 30]], [146, 390, 95]],\n  ['generated control 1', [3000, 91, [35, 35, 30]], [263, 262, 100]],\n  ['generated control 2', [2000, 72, [25, 45, 30]], [125, 224, 67]],\n  ['generated control 3', [3000, 50, [15, 55, 30]], [113, 412, 100]]]]\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"},"fixed":{"sha256":"30facebc75308d0251a67e7a4ff9d0b156de6aa7dede51f5d02ed25aef432037","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 - 4 * 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: protein floor', [2500, 91, [15, 55, 30]], [146, 310, 75]],\n  ['repair check: protein floor', [1500, 118, [30, 40, 30]], [189, 107, 35]],\n  ['generated control 1', [3000, 120, [20, 50, 25]], 'error: split'],\n  ['generated control 2', [1500, 118, [30, 40, 29]], 'error: split'],\n  ['generated control 3', [2000, 50, [40, 30, 30]], [200, 149, 67]]],\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: protein floor', [1500, 118, [25, 45, 30]], [189, 112, 33]],\n  ['repair check: protein floor', [1800, 118, [25, 45, 30]], [189, 158, 46]],\n  ['generated control 1', [2200, 91, [40, 30, 30]], [220, 166, 73]],\n  ['generated control 2', [2200, 118, [40, 30, 30]], [220, 166, 73]],\n  ['generated control 3', [2500, 72, [20, 50, 30]], [125, 313, 83]]],\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: protein floor', [1500, 100, [25, 45, 30]], [160, 130, 38]],\n  ['repair check: protein floor', [2000, 118, [10, 60, 30]], [189, 208, 46]],\n  ['generated control 1', [2200, 50, [10, 60, 30]], [80, 313, 70]],\n  ['generated control 2', [1500, 50, [35, 35, 30]], [131, 132, 50]],\n  ['generated control 3', [1500, 60, [30, 40, 29]], '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  ['balanced', [2000, 70, [30, 40, 30]], [150, 199, 67]],\n  ['regression: protein floor', [2000, 60, [15, 55, 30]], [96, 262, 63]],\n  ['repair check: protein floor', [1800, 118, [40, 30, 30]], [189, 131, 58]],\n  ['generated control 1', [2500, 100, [35, 35, 30]], [219, 219, 83]],\n  ['generated control 2', [3000, 83, [30, 40, 29]], 'error: split'],\n  ['generated control 3', [1500, 60, [30, 40, 29]], 'error: split']],\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: protein floor', [2500, 120, [15, 55, 30]], [192, 280, 68]],\n  ['repair check: protein floor', [3000, 91, [15, 55, 30]], [146, 390, 95]],\n  ['generated control 1', [3000, 91, [35, 35, 30]], [263, 262, 100]],\n  ['generated control 2', [2000, 72, [25, 45, 30]], [125, 224, 67]],\n  ['generated control 3', [3000, 50, [15, 55, 30]], [113, 412, 100]]]]\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-protein-floor","generated_at":"2026-09-29T14:52:30.533801+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.","repair":"Apply ceiling(1.6*weight) as a floor.","root_cause":"The 1.6 g/kg protein floor is not applied.","sha256":"7be8c0797ba6b08588ecc60bfeb5bb3cf56d88fca75ffa808feba89551198c13","title":"Macronutrient target splitter: protein floor · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.458,"exit_code":1,"observations":[{"actual":[150,199,67],"check":"balanced","expected":[150,199,67],"passed":true},{"actual":[192,118,29],"check":"protein floor binds","expected":[192,118,29],"passed":true},{"actual":"error: split","check":"bad split","expected":"error: split","passed":true},{"actual":[145,311,75],"check":"regression: protein floor","expected":[146,310,75],"passed":false},{"actual":[188,106,36],"check":"repair check: protein floor","expected":[189,107,35],"passed":false},{"actual":"error: split","check":"generated control 1","expected":"error: split","passed":true},{"actual":"error: split","check":"generated control 2","expected":"error: split","passed":true},{"actual":[200,149,67],"check":"generated control 3","expected":[200,149,67],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"balanced\", \"actual\": [150, 199, 67], \"expected\": [150, 199, 67], \"passed\": true}, {\"check\": \"protein floor binds\", \"actual\": [192, 118, 29], \"expected\": [192, 118, 29], \"passed\": true}, {\"check\": \"bad split\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"regression: protein floor\", \"actual\": [145, 311, 75], \"expected\": [146, 310, 75], \"passed\": false}, {\"check\": \"repair check: protein floor\", \"actual\": [188, 106, 36], \"expected\": [189, 107, 35], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [200, 149, 67], \"expected\": [200, 149, 67], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.299,"exit_code":1,"observations":[{"actual":[150,199,67],"check":"balanced","expected":[150,199,67],"passed":true},{"actual":[56,207,50],"check":"protein floor binds","expected":[192,118,29],"passed":false},{"actual":"error: split","check":"bad split","expected":"error: split","passed":true},{"actual":[94,344,83],"check":"regression: protein floor","expected":[146,310,75],"passed":false},{"actual":[113,150,50],"check":"repair check: protein floor","expected":[189,107,35],"passed":false},{"actual":"error: split","check":"generated control 1","expected":"error: split","passed":true},{"actual":"error: split","check":"generated control 2","expected":"error: split","passed":true},{"actual":[200,149,67],"check":"generated control 3","expected":[200,149,67],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"balanced\", \"actual\": [150, 199, 67], \"expected\": [150, 199, 67], \"passed\": true}, {\"check\": \"protein floor binds\", \"actual\": [56, 207, 50], \"expected\": [192, 118, 29], \"passed\": false}, {\"check\": \"bad split\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"regression: protein floor\", \"actual\": [94, 344, 83], \"expected\": [146, 310, 75], \"passed\": false}, {\"check\": \"repair check: protein floor\", \"actual\": [113, 150, 50], \"expected\": [189, 107, 35], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [200, 149, 67], \"expected\": [200, 149, 67], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.268,"exit_code":0,"observations":[{"actual":[150,199,67],"check":"balanced","expected":[150,199,67],"passed":true},{"actual":[192,118,29],"check":"protein floor binds","expected":[192,118,29],"passed":true},{"actual":"error: split","check":"bad split","expected":"error: split","passed":true},{"actual":[146,310,75],"check":"regression: protein floor","expected":[146,310,75],"passed":true},{"actual":[189,107,35],"check":"repair check: protein floor","expected":[189,107,35],"passed":true},{"actual":"error: split","check":"generated control 1","expected":"error: split","passed":true},{"actual":"error: split","check":"generated control 2","expected":"error: split","passed":true},{"actual":[200,149,67],"check":"generated control 3","expected":[200,149,67],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"balanced\", \"actual\": [150, 199, 67], \"expected\": [150, 199, 67], \"passed\": true}, {\"check\": \"protein floor binds\", \"actual\": [192, 118, 29], \"expected\": [192, 118, 29], \"passed\": true}, {\"check\": \"bad split\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"regression: protein floor\", \"actual\": [146, 310, 75], \"expected\": [146, 310, 75], \"passed\": true}, {\"check\": \"repair check: protein floor\", \"actual\": [189, 107, 35], \"expected\": [189, 107, 35], \"passed\": true}, {\"check\": \"generated control 1\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": \"error: split\", \"expected\": \"error: split\", \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [200, 149, 67], \"expected\": [200, 149, 67], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}