{"abstract":"Products whose fiber exceeds listed carbohydrate get negative carbohydrate energy.","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).","evaluation_group":"w2-recipe_scaling_and_nutrition-atwater-energy","failed_approach":"abs() turns a 3 g deficit into 3 g of phantom available carbohydrate.","family":"w2-recipe_scaling_and_nutrition-atwater-energy-available-carb-floor","id":"FA-96986","implementations":{"attempt":{"sha256":"3a7f5c6b707c40795b0acc9ebd4b609010a24964fdc1ca24039753fdc4de0457","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 = abs(avail)\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(9 * 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: available carb floor', ['13', '12', '7', '3', '0', '10'], [190, 795, 57]],\n  ['repair check: available carb floor', ['30', '35/4', '10', '3', '14', '10'], [327, 1367, 24]],\n  ['generated control 1', ['23', '6', '35', '1', '5', '4'], [313, 1308, 17]],\n  ['generated control 2', ['1', '24', '59', '0', '5', '0'], [491, 2054, 44]],\n  ['generated control 3', ['18', '5/4', '27', '1', '0', '10'], [173, 725, 6]]],\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: available carb floor', ['21', '28', '0', '5', '0', '0'], [346, 1448, 73]],\n  ['repair check: available carb floor', ['5', '113/4', '13', '15', '0', '10'], [328, 1373, 77]],\n  ['generated control 1', ['5', '13', '34', '5', '5', '0'], [298, 1247, 39]],\n  ['generated control 2', ['0', '1', '23', '0', '5', '10'], [120, 502, 8]],\n  ['generated control 3', ['25', '8', '50', '1', '0', '4'], [364, 1521, 20]]],\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: available carb floor', ['5', '10', '0', '5', '0', '4'], [130, 542, 69]],\n  ['repair check: available carb floor', ['19', '10', '1', '2', '14', '0'], [268, 1121, 34]],\n  ['generated control 1', ['16', '0', '32', '8', '5', '0'], [211, 883, 0]],\n  ['generated control 2', ['7', '49/4', '9', '8', '0', '0'], [158, 662, 70]],\n  ['generated control 3', ['20', '27', '39', '5', '14', '10'], [551, 2305, 44]]],\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: available carb floor', ['29', '25', '53', '55', '0', '4'], [461, 1927, 49]],\n  ['repair check: available carb floor', ['20', '10', '43', '45', '5', '4'], [305, 1274, 30]],\n  ['generated control 1', ['35', '4', '8', '2', '5', '4'], [233, 973, 15]],\n  ['generated control 2', ['36', '49/4', '59', '5', '0', '0'], [480, 2009, 23]],\n  ['generated control 3', ['3', '21', '12', '2', '0', '10'], [229, 958, 83]]],\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: available carb floor', ['23', '117/4', '16', '18', '5', '4'], [436, 1824, 60]],\n  ['repair check: available carb floor', ['14', '47/2', '60', '62', '5', '0'], [427, 1784, 50]],\n  ['generated control 1', ['27', '4', '59', '3', '5', '0'], [409, 1711, 9]],\n  ['generated control 2', ['18', '8', '31', '8', '0', '10'], [236, 987, 31]],\n  ['generated control 3', ['39', '21', '14', '16', '0', '0'], [377, 1577, 50]]]]\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":"a531509aa1477023035eff78f2a278047216b7ee82c23df82019541e8733d696","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 = avail\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(9 * 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: available carb floor', ['13', '12', '7', '3', '0', '10'], [190, 795, 57]],\n  ['repair check: available carb floor', ['30', '35/4', '10', '3', '14', '10'], [327, 1367, 24]],\n  ['generated control 1', ['23', '6', '35', '1', '5', '4'], [313, 1308, 17]],\n  ['generated control 2', ['1', '24', '59', '0', '5', '0'], [491, 2054, 44]],\n  ['generated control 3', ['18', '5/4', '27', '1', '0', '10'], [173, 725, 6]]],\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: available carb floor', ['21', '28', '0', '5', '0', '0'], [346, 1448, 73]],\n  ['repair check: available carb floor', ['5', '113/4', '13', '15', '0', '10'], [328, 1373, 77]],\n  ['generated control 1', ['5', '13', '34', '5', '5', '0'], [298, 1247, 39]],\n  ['generated control 2', ['0', '1', '23', '0', '5', '10'], [120, 502, 8]],\n  ['generated control 3', ['25', '8', '50', '1', '0', '4'], [364, 1521, 20]]],\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: available carb floor', ['5', '10', '0', '5', '0', '4'], [130, 542, 69]],\n  ['repair check: available carb floor', ['19', '10', '1', '2', '14', '0'], [268, 1121, 34]],\n  ['generated control 1', ['16', '0', '32', '8', '5', '0'], [211, 883, 0]],\n  ['generated control 2', ['7', '49/4', '9', '8', '0', '0'], [158, 662, 70]],\n  ['generated control 3', ['20', '27', '39', '5', '14', '10'], [551, 2305, 44]]],\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: available carb floor', ['29', '25', '53', '55', '0', '4'], [461, 1927, 49]],\n  ['repair check: available carb floor', ['20', '10', '43', '45', '5', '4'], [305, 1274, 30]],\n  ['generated control 1', ['35', '4', '8', '2', '5', '4'], [233, 973, 15]],\n  ['generated control 2', ['36', '49/4', '59', '5', '0', '0'], [480, 2009, 23]],\n  ['generated control 3', ['3', '21', '12', '2', '0', '10'], [229, 958, 83]]],\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: available carb floor', ['23', '117/4', '16', '18', '5', '4'], [436, 1824, 60]],\n  ['repair check: available carb floor', ['14', '47/2', '60', '62', '5', '0'], [427, 1784, 50]],\n  ['generated control 1', ['27', '4', '59', '3', '5', '0'], [409, 1711, 9]],\n  ['generated control 2', ['18', '8', '31', '8', '0', '10'], [236, 987, 31]],\n  ['generated control 3', ['39', '21', '14', '16', '0', '0'], [377, 1577, 50]]]]\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":"6015883ccdb9982159de3b866f32306d980c819d378eafc6cd2402232f6ea026","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(9 * 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: available carb floor', ['13', '12', '7', '3', '0', '10'], [190, 795, 57]],\n  ['repair check: available carb floor', ['30', '35/4', '10', '3', '14', '10'], [327, 1367, 24]],\n  ['generated control 1', ['23', '6', '35', '1', '5', '4'], [313, 1308, 17]],\n  ['generated control 2', ['1', '24', '59', '0', '5', '0'], [491, 2054, 44]],\n  ['generated control 3', ['18', '5/4', '27', '1', '0', '10'], [173, 725, 6]]],\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: available carb floor', ['21', '28', '0', '5', '0', '0'], [346, 1448, 73]],\n  ['repair check: available carb floor', ['5', '113/4', '13', '15', '0', '10'], [328, 1373, 77]],\n  ['generated control 1', ['5', '13', '34', '5', '5', '0'], [298, 1247, 39]],\n  ['generated control 2', ['0', '1', '23', '0', '5', '10'], [120, 502, 8]],\n  ['generated control 3', ['25', '8', '50', '1', '0', '4'], [364, 1521, 20]]],\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: available carb floor', ['5', '10', '0', '5', '0', '4'], [130, 542, 69]],\n  ['repair check: available carb floor', ['19', '10', '1', '2', '14', '0'], [268, 1121, 34]],\n  ['generated control 1', ['16', '0', '32', '8', '5', '0'], [211, 883, 0]],\n  ['generated control 2', ['7', '49/4', '9', '8', '0', '0'], [158, 662, 70]],\n  ['generated control 3', ['20', '27', '39', '5', '14', '10'], [551, 2305, 44]]],\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: available carb floor', ['29', '25', '53', '55', '0', '4'], [461, 1927, 49]],\n  ['repair check: available carb floor', ['20', '10', '43', '45', '5', '4'], [305, 1274, 30]],\n  ['generated control 1', ['35', '4', '8', '2', '5', '4'], [233, 973, 15]],\n  ['generated control 2', ['36', '49/4', '59', '5', '0', '0'], [480, 2009, 23]],\n  ['generated control 3', ['3', '21', '12', '2', '0', '10'], [229, 958, 83]]],\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: available carb floor', ['23', '117/4', '16', '18', '5', '4'], [436, 1824, 60]],\n  ['repair check: available carb floor', ['14', '47/2', '60', '62', '5', '0'], [427, 1784, 50]],\n  ['generated control 1', ['27', '4', '59', '3', '5', '0'], [409, 1711, 9]],\n  ['generated control 2', ['18', '8', '31', '8', '0', '10'], [236, 987, 31]],\n  ['generated control 3', ['39', '21', '14', '16', '0', '0'], [377, 1577, 50]]]]\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-available-carb-floor","generated_at":"2026-09-29T14:52:27.735998+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.","repair":"Clamp available carbohydrate at zero.","root_cause":"Available carbohydrate is not clamped at zero.","sha256":"9ab23378259e54ed5ff72936c14fbfc721342f0f241243c288deabb431d07455","title":"Atwater energy calculator: available carb floor · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.578,"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":[53,222,17],"check":"fiber heavier than carb","expected":[41,172,22],"passed":false},{"actual":[214,895,50],"check":"regression: available carb floor","expected":[190,795,57],"passed":false},{"actual":[339,1417,23],"check":"repair check: available carb floor","expected":[327,1367,24],"passed":false},{"actual":[313,1308,17],"check":"generated control 1","expected":[313,1308,17],"passed":true},{"actual":[491,2054,44],"check":"generated control 2","expected":[491,2054,44],"passed":true},{"actual":[173,725,6],"check":"generated control 3","expected":[173,725,6],"passed":true}],"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\": [53, 222, 17], \"expected\": [41, 172, 22], \"passed\": false}, {\"check\": \"regression: available carb floor\", \"actual\": [214, 895, 50], \"expected\": [190, 795, 57], \"passed\": false}, {\"check\": \"repair check: available carb floor\", \"actual\": [339, 1417, 23], \"expected\": [327, 1367, 24], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [313, 1308, 17], \"expected\": [313, 1308, 17], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [491, 2054, 44], \"expected\": [491, 2054, 44], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [173, 725, 6], \"expected\": [173, 725, 6], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.756,"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":[29,121,31],"check":"fiber heavier than carb","expected":[41,172,22],"passed":false},{"actual":[166,695,65],"check":"regression: available carb floor","expected":[190,795,57],"passed":false},{"actual":[315,1317,25],"check":"repair check: available carb floor","expected":[327,1367,24],"passed":false},{"actual":[313,1308,17],"check":"generated control 1","expected":[313,1308,17],"passed":true},{"actual":[491,2054,44],"check":"generated control 2","expected":[491,2054,44],"passed":true},{"actual":[173,725,6],"check":"generated control 3","expected":[173,725,6],"passed":true}],"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\": [29, 121, 31], \"expected\": [41, 172, 22], \"passed\": false}, {\"check\": \"regression: available carb floor\", \"actual\": [166, 695, 65], \"expected\": [190, 795, 57], \"passed\": false}, {\"check\": \"repair check: available carb floor\", \"actual\": [315, 1317, 25], \"expected\": [327, 1367, 24], \"passed\": false}, {\"check\": \"generated control 1\", \"actual\": [313, 1308, 17], \"expected\": [313, 1308, 17], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [491, 2054, 44], \"expected\": [491, 2054, 44], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [173, 725, 6], \"expected\": [173, 725, 6], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.897,"exit_code":0,"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":[190,795,57],"check":"regression: available carb floor","expected":[190,795,57],"passed":true},{"actual":[327,1367,24],"check":"repair check: available carb floor","expected":[327,1367,24],"passed":true},{"actual":[313,1308,17],"check":"generated control 1","expected":[313,1308,17],"passed":true},{"actual":[491,2054,44],"check":"generated control 2","expected":[491,2054,44],"passed":true},{"actual":[173,725,6],"check":"generated control 3","expected":[173,725,6],"passed":true}],"passed":true,"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: available carb floor\", \"actual\": [190, 795, 57], \"expected\": [190, 795, 57], \"passed\": true}, {\"check\": \"repair check: available carb floor\", \"actual\": [327, 1367, 24], \"expected\": [327, 1367, 24], \"passed\": true}, {\"check\": \"generated control 1\", \"actual\": [313, 1308, 17], \"expected\": [313, 1308, 17], \"passed\": true}, {\"check\": \"generated control 2\", \"actual\": [491, 2054, 44], \"expected\": [491, 2054, 44], \"passed\": true}, {\"check\": \"generated control 3\", \"actual\": [173, 725, 6], \"expected\": [173, 725, 6], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}