{"abstract":"A snack that is half fat by energy reports 6% of energy from fat.","category":"Recipe scaling and nutrition","checks":8,"contract":"Gram amounts as strings. Total carbohydrate includes fiber and polyols; available carb = max(0, carb - fiber - polyol). kcal = 4*protein + 9*fat + 4*available + 2*fiber + 7*alcohol + 2.4*polyol. Return [kcal, kJ, fat_energy_pct]: kcal half-up integer of the exact energy, kJ half-up integer of exact kcal * 4.184, fat pct = half-up of 9*fat/exact kcal*100 (0 if energy is 0).","contract_signature":"protein, fat, carb, fiber, alcohol, polyol","evaluation_group":"w2-recipe_scaling_and_nutrition-atwater-energy","failed_approach":"The simplified 4-9-4 denominator ignores fiber, alcohol and polyol energy.","family":"w2-recipe_scaling_and_nutrition-atwater-energy-fat-energy-share","id":"FA-97001","implementations":{"attempt":{"sha256":"cfd40f4f1a6770982d68ec51218e3e4afc7aedc506507069363711b2f96cf83c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(protein, fat, carb, fiber, alcohol, polyol):\n    p, fat, carb, fib, alc, poly = (Fraction(v) for v in (protein, fat, carb, fiber, alcohol, polyol))\n    avail = carb - fib - poly\n    avail = max(avail, Fraction(0))\n    exact = 4 * p + 9 * fat + 4 * avail + 2 * fib + 7 * alc + Fraction(12, 5) * poly\n    def r(x):\n        return math.floor(x + Fraction(1, 2))\n    kj = r(exact * Fraction(4184, 1000))\n    pct_fat = r(fat * 900 / (4 * p + 9 * fat + 4 * carb)) if exact else 0\n    return [r(exact), kj, pct_fat]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['all zero', ['0', '0', '0', '0', '0', '0'], [0, 0, 0]],\n  ['fat only', ['0', '10', '0', '0', '0', '0'], [90, 377, 100]],\n  ['fiber heavier than carb', ['5', '1', '3', '6', '0', '0'], [41, 172, 22]],\n  ['regression: fat energy share', ['19', '15', '13', '15', '0', '0'], [241, 1008, 56]],\n  ['repair check: fat energy share', ['10', '17', '0', '3', '14', '0'], [297, 1243, 52]],\n  ['generated control 1', ['36', '11/4', '39', '3', '0', '10'], [303, 1267, 8]],\n  ['generated control 2', ['37', '8', '58', '60', '14', '4'], [448, 1873, 16]],\n  ['generated control 3', ['5', '65/4', '30', '8', '0', '10'], [254, 1064, 58]]],\n [['fat only', ['0', '10', '0', '0', '0', '0'], [90, 377, 100]],\n  ['fiber heavier than carb', ['5', '1', '3', '6', '0', '0'], [41, 172, 22]],\n  ['sugar-free candy', ['0', '5', '30', '1', '0', '20'], [131, 548, 34]],\n  ['regression: fat energy share', ['19', '19/4', '59', '3', '0', '0'], [349, 1459, 12]],\n  ['repair check: fat energy share', ['14', '41/2', '14', '3', '14', '4'], [382, 1599, 48]],\n  ['generated control 1', ['18', '3', '18', '3', '14', '4'], [257, 1074, 11]],\n  ['generated control 2', ['40', '21', '14', '1', '5', '10'], [422, 1766, 45]],\n  ['generated control 3', ['17', '0', '59', '3', '0', '4'], [292, 1220, 0]]],\n [['fiber heavier than carb', ['5', '1', '3', '6', '0', '0'], [41, 172, 22]],\n  ['sugar-free candy', ['0', '5', '30', '1', '0', '20'], [131, 548, 34]],\n  ['cocktail', ['0', '0', '12', '0', '14', '0'], [146, 611, 0]],\n  ['regression: fat energy share', ['22', '12', '26', '28', '0', '4'], [262, 1095, 41]],\n  ['repair check: fat energy share', ['20', '29', '32', '5', '5', '0'], [494, 2067, 53]],\n  ['generated control 1', ['11', '13', '49', '0', '0', '0'], [357, 1494, 33]],\n  ['generated control 2', ['6', '23', '9', '0', '0', '0'], [267, 1117, 78]],\n  ['generated control 3', ['3', '23', '4', '8', '0', '0'], [235, 983, 88]]],\n [['sugar-free candy', ['0', '5', '30', '1', '0', '20'], [131, 548, 34]],\n  ['cocktail', ['0', '0', '12', '0', '14', '0'], [146, 611, 0]],\n  ['all zero', ['0', '0', '0', '0', '0', '0'], [0, 0, 0]],\n  ['regression: fat energy share', ['24', '15', '48', '5', '14', '10'], [495, 2071, 27]],\n  ['repair check: fat energy share', ['16', '30', '5', '7', '14', '10'], [470, 1966, 57]],\n  ['generated control 1', ['22', '18', '15', '3', '0', '0'], [304, 1272, 53]],\n  ['generated control 2', ['32', '13', '57', '2', '0', '4'], [463, 1936, 25]],\n  ['generated control 3', ['33', '0', '4', '8', '0', '0'], [148, 619, 0]]],\n [['cocktail', ['0', '0', '12', '0', '14', '0'], [146, 611, 0]],\n  ['all zero', ['0', '0', '0', '0', '0', '0'], [0, 0, 0]],\n  ['fat only', ['0', '10', '0', '0', '0', '0'], [90, 377, 100]],\n  ['regression: fat energy share', ['23', '15', '31', '33', '0', '10'], [317, 1326, 43]],\n  ['repair check: fat energy share', ['13', '4', '17', '5', '0', '10'], [130, 544, 28]],\n  ['generated control 1', ['24', '29', '19', '2', '0', '10'], [413, 1728, 63]],\n  ['generated control 2', ['17', '6', '43', '0', '14', '0'], [392, 1640, 14]],\n  ['generated control 3', ['35', '20', '55', '1', '0', '4'], [532, 2224, 34]]]]\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":"d07d5cd7732a2e51624383454554a5b7ecd6d9cb43a687a0a0c34a1dcfe603a6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(protein, fat, carb, fiber, alcohol, polyol):\n    p, fat, carb, fib, alc, poly = (Fraction(v) for v in (protein, fat, carb, fiber, alcohol, polyol))\n    avail = carb - fib - poly\n    avail = max(avail, Fraction(0))\n    exact = 4 * p + 9 * fat + 4 * avail + 2 * fib + 7 * alc + Fraction(12, 5) * poly\n    def r(x):\n        return math.floor(x + Fraction(1, 2))\n    kj = r(exact * Fraction(4184, 1000))\n    pct_fat = r(fat * 100 / exact) if exact else 0\n    return [r(exact), kj, pct_fat]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['all zero', ['0', '0', '0', '0', '0', '0'], [0, 0, 0]],\n  ['fat only', ['0', '10', '0', '0', '0', '0'], [90, 377, 100]],\n  ['fiber heavier than carb', ['5', '1', '3', '6', '0', '0'], [41, 172, 22]],\n  ['regression: fat energy share', ['19', '15', '13', '15', '0', '0'], [241, 1008, 56]],\n  ['repair check: fat energy share', ['10', '17', '0', '3', '14', '0'], [297, 1243, 52]],\n  ['generated control 1', ['36', '11/4', '39', '3', '0', '10'], [303, 1267, 8]],\n  ['generated control 2', ['37', '8', '58', '60', '14', '4'], [448, 1873, 16]],\n  ['generated control 3', ['5', '65/4', '30', '8', '0', '10'], [254, 1064, 58]]],\n [['fat only', ['0', '10', '0', '0', '0', '0'], [90, 377, 100]],\n  ['fiber heavier than carb', ['5', '1', '3', '6', '0', '0'], [41, 172, 22]],\n  ['sugar-free candy', ['0', '5', '30', '1', '0', '20'], [131, 548, 34]],\n  ['regression: fat energy share', ['19', '19/4', '59', '3', '0', '0'], [349, 1459, 12]],\n  ['repair check: fat energy share', ['14', '41/2', '14', '3', '14', '4'], [382, 1599, 48]],\n  ['generated control 1', ['18', '3', '18', '3', '14', '4'], [257, 1074, 11]],\n  ['generated control 2', ['40', '21', '14', '1', '5', '10'], [422, 1766, 45]],\n  ['generated control 3', ['17', '0', '59', '3', '0', '4'], [292, 1220, 0]]],\n [['fiber heavier than carb', ['5', '1', '3', '6', '0', '0'], [41, 172, 22]],\n  ['sugar-free candy', ['0', '5', '30', '1', '0', '20'], [131, 548, 34]],\n  ['cocktail', ['0', '0', '12', '0', '14', '0'], [146, 611, 0]],\n  ['regression: fat energy share', ['22', '12', '26', '28', '0', '4'], [262, 1095, 41]],\n  ['repair check: fat energy share', ['20', '29', '32', '5', '5', '0'], [494, 2067, 53]],\n  ['generated control 1', ['11', '13', '49', '0', '0', '0'], [357, 1494, 33]],\n  ['generated control 2', ['6', '23', '9', '0', '0', '0'], [267, 1117, 78]],\n  ['generated control 3', ['3', '23', '4', '8', '0', '0'], [235, 983, 88]]],\n [['sugar-free candy', ['0', '5', '30', '1', '0', '20'], [131, 548, 34]],\n  ['cocktail', ['0', '0', '12', '0', '14', '0'], [146, 611, 0]],\n  ['all zero', ['0', '0', '0', '0', '0', '0'], [0, 0, 0]],\n  ['regression: fat energy share', ['24', '15', '48', '5', '14', '10'], [495, 2071, 27]],\n  ['repair check: fat energy share', ['16', '30', '5', '7', '14', '10'], [470, 1966, 57]],\n  ['generated control 1', ['22', '18', '15', '3', '0', '0'], [304, 1272, 53]],\n  ['generated control 2', ['32', '13', '57', '2', '0', '4'], [463, 1936, 25]],\n  ['generated control 3', ['33', '0', '4', '8', '0', '0'], [148, 619, 0]]],\n [['cocktail', ['0', '0', '12', '0', '14', '0'], [146, 611, 0]],\n  ['all zero', ['0', '0', '0', '0', '0', '0'], [0, 0, 0]],\n  ['fat only', ['0', '10', '0', '0', '0', '0'], [90, 377, 100]],\n  ['regression: fat energy share', ['23', '15', '31', '33', '0', '10'], [317, 1326, 43]],\n  ['repair check: fat energy share', ['13', '4', '17', '5', '0', '10'], [130, 544, 28]],\n  ['generated control 1', ['24', '29', '19', '2', '0', '10'], [413, 1728, 63]],\n  ['generated control 2', ['17', '6', '43', '0', '14', '0'], [392, 1640, 14]],\n  ['generated control 3', ['35', '20', '55', '1', '0', '4'], [532, 2224, 34]]]]\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-atwater-energy-fat-energy-share","generated_at":"2026-09-29T14:52:27.928328+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Recipe energy totals use factor systems where fiber and sugar alcohols are not full carbohydrate.","root_cause":"The fat share divides fat grams, not fat energy, by total energy.","sha256":"5c70c92a7dbfd57fec9d19bb9a185051ed1eb13a671f8d8c00ec81e6bfe9794e","title":"Atwater energy calculator: fat energy share · 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":40.378,"exit_code":1,"observations":[{"actual":[0,0,0],"check":"all zero","expected":[0,0,0],"passed":true},{"actual":[90,377,100],"check":"fat only","expected":[90,377,100],"passed":true},{"actual":[41,172,22],"check":"fiber heavier than carb","expected":[41,172,22],"passed":true},{"actual":[241,1008,51],"check":"regression: fat energy share","expected":[241,1008,56],"passed":false},{"actual":[297,1243,79],"check":"repair check: fat energy share","expected":[297,1243,52],"passed":false},{"actual":[303,1267,8],"check":"generated control 1","expected":[303,1267,8],"passed":true},{"actual":[448,1873,16],"check":"generated control 2","expected":[448,1873,16],"passed":true},{"actual":[254,1064,51],"check":"generated control 3","expected":[254,1064,58],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"all zero\", \"actual\": [0, 0, 0], \"expected\": [0, 0, 0], \"passed\": true}, {\"check\": \"fat only\", \"actual\": [90, 377, 100], \"expected\": [90, 377, 100], \"passed\": true}, {\"check\": \"fiber heavier than carb\", \"actual\": [41, 172, 22], \"expected\": [41, 172, 22], \"passed\": true}, {\"check\": \"regression: fat energy share\", \"actual\": [241, 1008, 51], \"expected\": [241, 1008, 56], \"passed\": false}, {\"check\": \"repair check: fat energy share\", \"actual\": [297, 1243, 79], \"expected\": [297, 1243, 52], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [303, 1267, 8], \"expected\": [303, 1267, 8], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [448, 1873, 16], \"expected\": [448, 1873, 16], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [254, 1064, 51], \"expected\": [254, 1064, 58], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.436,"exit_code":1,"observations":[{"actual":[0,0,0],"check":"all zero","expected":[0,0,0],"passed":true},{"actual":[90,377,11],"check":"fat only","expected":[90,377,100],"passed":false},{"actual":[41,172,2],"check":"fiber heavier than carb","expected":[41,172,22],"passed":false},{"actual":[241,1008,6],"check":"regression: fat energy share","expected":[241,1008,56],"passed":false},{"actual":[297,1243,6],"check":"repair check: fat energy share","expected":[297,1243,52],"passed":false},{"actual":[303,1267,1],"check":"generated control 1","expected":[303,1267,8],"passed":false},{"actual":[448,1873,2],"check":"generated control 2","expected":[448,1873,16],"passed":false},{"actual":[254,1064,6],"check":"generated control 3","expected":[254,1064,58],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"all zero\", \"actual\": [0, 0, 0], \"expected\": [0, 0, 0], \"passed\": true}, {\"check\": \"fat only\", \"actual\": [90, 377, 11], \"expected\": [90, 377, 100], \"passed\": false}, {\"check\": \"fiber heavier than carb\", \"actual\": [41, 172, 2], \"expected\": [41, 172, 22], \"passed\": false}, {\"check\": \"regression: fat energy share\", \"actual\": [241, 1008, 6], \"expected\": [241, 1008, 56], \"passed\": false}, {\"check\": \"repair check: fat energy share\", \"actual\": [297, 1243, 6], \"expected\": [297, 1243, 52], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [303, 1267, 1], \"expected\": [303, 1267, 8], \"passed\": false}, {\"check\": \"generated control 2\", \"actual\": [448, 1873, 2], \"expected\": [448, 1873, 16], \"passed\": false}, {\"check\": \"generated control 3\", \"actual\": [254, 1064, 6], \"expected\": [254, 1064, 58], \"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."}}