FA-96936 / Recipe scaling and nutrition / Open access
Baker's percentage calculator: starter flour share · case 01
Adding 100 g of levain raises every percentage because its flour is ignored.
ROOT CAUSE
The flour contributed by the 100% hydration starter is not added to the basis.
VERIFIED REPAIR
Add half of the starter weight to total flour.
Unsuccessful approach: Adding the whole starter weight counts its water as flour too.
Case contract
Rows [name, grams, role], role in flour/water/milk/egg/starter/other. Total flour = all flour rows plus half of starter weight (100% hydration levain). Each row gets grams/total_flour*100 as "d.d" rounded half-up. Hydration counts water fully, milk at 87%, egg at 75% and half the starter. No flour returns an error string.
Why this case matters
Bread formulas are written and scaled in baker's percentages, and hydration drives dough handling.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(ingredients):
starter = sum((Fraction(str(g)) for n, g, r in ingredients if r == 'starter'), Fraction(0))
flour = sum(Fraction(str(g)) for n, g, r in ingredients if r == 'flour')
if flour == 0:
return 'error: no flour'
def pct(x):
v = math.floor(x * 1000 / flour + Fraction(1, 2))
return '%d.%d' % divmod(v, 10)
rows = [[n, pct(Fraction(str(g)))] for n, g, r in ingredients]
water = Fraction(0)
for n, g, r in ingredients:
if r == 'water':
water += Fraction(str(g))
elif r == 'milk':
water += Fraction(str(g)) * Fraction(87, 100)
elif r == 'egg':
water += Fraction(str(g)) * Fraction(3, 4)
elif r == 'starter':
water += Fraction(str(g)) / 2
return {'flour_total': str(flour), 'percentages': rows, 'hydration': pct(water)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['regression: starter flour share',
[[['egg', 50, 'egg'], ['water', 377, 'water'], ['bread flour1', 450, 'flour'], ['milk', 100, 'milk'],
['bread flour2', 450, 'flour'], ['salt', 10, 'other'], ['whole wheat0', 333, 'flour'],
['levain', 150, 'starter']]],
{'flour_total': '1308',
'hydration': '44.1',
'percentages': [['egg', '3.8'], ['water', '28.8'], ['bread flour1', '34.4'], ['milk', '7.6'],
['bread flour2', '34.4'], ['salt', '0.8'], ['whole wheat0', '25.5'],
['levain', '11.5']]}],
['repair check: starter flour share',
[[['salt', 10, 'other'], ['milk', 100, 'milk'], ['water', 325, 'water'], ['levain', 100, 'starter'],
['spelt0', 300, 'flour']]],
{'flour_total': '350',
'hydration': '132.0',
'percentages': [['salt', '2.9'], ['milk', '28.6'], ['water', '92.9'], ['levain', '28.6'],
['spelt0', '85.7']]}],
['generated control 1',
[[['levain', 100, 'starter'], ['rye0', 450, 'flour'], ['milk', 120, 'milk'], ['salt', 11, 'other']]],
{'flour_total': '500',
'hydration': '30.9',
'percentages': [['levain', '20.0'], ['rye0', '90.0'], ['milk', '24.0'], ['salt', '2.2']]}],
['generated control 2',
[[['egg', 50, 'egg'], ['water', 150, 'water'], ['milk', 120, 'milk'], ['salt', 9, 'other'],
['bread flour0', 250, 'flour'], ['levain', 60, 'starter']]],
{'flour_total': '280',
'hydration': '115.0',
'percentages': [['egg', '17.9'], ['water', '53.6'], ['milk', '42.9'], ['salt', '3.2'],
['bread flour0', '89.3'], ['levain', '21.4']]}],
['generated control 3',
[[['levain', 100, 'starter'], ['water', 150, 'water'], ['milk', 50, 'milk'],
['whole wheat1', 250, 'flour'], ['salt', 10, 'other'], ['spelt0', 300, 'flour']]],
{'flour_total': '600',
'hydration': '40.6',
'percentages': [['levain', '16.7'], ['water', '25.0'], ['milk', '8.3'], ['whole wheat1', '41.7'],
['salt', '1.7'], ['spelt0', '50.0']]}]],
[['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['regression: starter flour share',
[[['water', 150, 'water'], ['bread flour0', 333, 'flour'], ['salt', 10, 'other'], ['milk', 120, 'milk'],
['levain', 100, 'starter']]],
{'flour_total': '383',
'hydration': '79.5',
'percentages': [['water', '39.2'], ['bread flour0', '86.9'], ['salt', '2.6'], ['milk', '31.3'],
['levain', '26.1']]}],
['repair check: starter flour share',
[[['rye1', 450, 'flour'], ['levain', 100, 'starter'], ['salt', 10, 'other'], ['water', 200, 'water'],
['milk', 100, 'milk'], ['spelt0', 100, 'flour']]],
{'flour_total': '600',
'hydration': '56.2',
'percentages': [['rye1', '75.0'], ['levain', '16.7'], ['salt', '1.7'], ['water', '33.3'],
['milk', '16.7'], ['spelt0', '16.7']]}],
['generated control 1',
[[['milk', 100, 'milk'], ['water', 377, 'water'], ['egg', 50, 'egg'], ['whole wheat0', 300, 'flour'],
['salt', 11, 'other']]],
{'flour_total': '300',
'hydration': '167.2',
'percentages': [['milk', '33.3'], ['water', '125.7'], ['egg', '16.7'], ['whole wheat0', '100.0'],
['salt', '3.7']]}],
['generated control 2',
[[['rye1', 333, 'flour'], ['rye0', 250, 'flour'], ['salt', 9, 'other'], ['milk', 50, 'milk'],
['spelt2', 333, 'flour']]],
{'flour_total': '916',
'hydration': '4.7',
'percentages': [['rye1', '36.4'], ['rye0', '27.3'], ['salt', '1.0'], ['milk', '5.5'],
['spelt2', '36.4']]}],
['generated control 3',
[[['water', 150, 'water'], ['milk', 100, 'milk'], ['rye1', 300, 'flour'], ['whole wheat0', 250, 'flour'],
['rye2', 450, 'flour'], ['salt', 9, 'other']]],
{'flour_total': '1000',
'hydration': '23.7',
'percentages': [['water', '15.0'], ['milk', '10.0'], ['rye1', '30.0'], ['whole wheat0', '25.0'],
['rye2', '45.0'], ['salt', '0.9']]}]],
[['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['regression: starter flour share',
[[['salt', 9, 'other'], ['water', 350, 'water'], ['milk', 100, 'milk'], ['whole wheat2', 450, 'flour'],
['whole wheat0', 200, 'flour'], ['egg', 100, 'egg'], ['whole wheat1', 300, 'flour'],
['levain', 60, 'starter']]],
{'flour_total': '980',
'hydration': '55.3',
'percentages': [['salt', '0.9'], ['water', '35.7'], ['milk', '10.2'], ['whole wheat2', '45.9'],
['whole wheat0', '20.4'], ['egg', '10.2'], ['whole wheat1', '30.6'],
['levain', '6.1']]}],
['repair check: starter flour share',
[[['bread flour1', 500, 'flour'], ['levain', 100, 'starter'], ['salt', 10, 'other'],
['bread flour0', 500, 'flour']]],
{'flour_total': '1050',
'hydration': '4.8',
'percentages': [['bread flour1', '47.6'], ['levain', '9.5'], ['salt', '1.0'], ['bread flour0', '47.6']]}],
['generated control 1',
[[['whole wheat1', 100, 'flour'], ['whole wheat0', 300, 'flour'], ['water', 325, 'water'],
['salt', 9, 'other'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '100.0',
'percentages': [['whole wheat1', '25.0'], ['whole wheat0', '75.0'], ['water', '81.3'], ['salt', '2.3'],
['egg', '25.0']]}],
['generated control 2',
[[['bread flour0', 250, 'flour'], ['salt', 9, 'other'], ['rye1', 200, 'flour'], ['water', 150, 'water']]],
{'flour_total': '450',
'hydration': '33.3',
'percentages': [['bread flour0', '55.6'], ['salt', '2.0'], ['rye1', '44.4'], ['water', '33.3']]}],
['generated control 3',
[[['rye2', 333, 'flour'], ['milk', 120, 'milk'], ['whole wheat0', 200, 'flour'], ['salt', 11, 'other'],
['spelt1', 250, 'flour']]],
{'flour_total': '783',
'hydration': '13.3',
'percentages': [['rye2', '42.5'], ['milk', '15.3'], ['whole wheat0', '25.5'], ['salt', '1.4'],
['spelt1', '31.9']]}]],
[['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['regression: starter flour share',
[[['whole wheat0', 200, 'flour'], ['levain', 60, 'starter'], ['salt', 11, 'other'],
['milk', 100, 'milk']]],
{'flour_total': '230',
'hydration': '50.9',
'percentages': [['whole wheat0', '87.0'], ['levain', '26.1'], ['salt', '4.8'], ['milk', '43.5']]}],
['repair check: starter flour share',
[[['salt', 10, 'other'], ['milk', 120, 'milk'], ['water', 150, 'water'], ['levain', 150, 'starter'],
['egg', 50, 'egg'], ['spelt0', 200, 'flour']]],
{'flour_total': '275',
'hydration': '133.4',
'percentages': [['salt', '3.6'], ['milk', '43.6'], ['water', '54.5'], ['levain', '54.5'], ['egg', '18.2'],
['spelt0', '72.7']]}],
['generated control 1',
[[['water', 150, 'water'], ['egg', 100, 'egg'], ['salt', 11, 'other'], ['rye0', 450, 'flour']]],
{'flour_total': '450',
'hydration': '50.0',
'percentages': [['water', '33.3'], ['egg', '22.2'], ['salt', '2.4'], ['rye0', '100.0']]}],
['generated control 2',
[[['whole wheat2', 200, 'flour'], ['milk', 120, 'milk'], ['egg', 100, 'egg'], ['rye0', 333, 'flour'],
['salt', 11, 'other'], ['rye1', 200, 'flour']]],
{'flour_total': '733',
'hydration': '24.5',
'percentages': [['whole wheat2', '27.3'], ['milk', '16.4'], ['egg', '13.6'], ['rye0', '45.4'],
['salt', '1.5'], ['rye1', '27.3']]}],
['generated control 3', [[['salt', 9, 'other'], ['water', 200, 'water'], ['rye0', 100, 'flour']]],
{'flour_total': '100',
'hydration': '200.0',
'percentages': [['salt', '9.0'], ['water', '200.0'], ['rye0', '100.0']]}]],
[['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['regression: starter flour share',
[[['egg', 50, 'egg'], ['levain', 60, 'starter'], ['salt', 11, 'other'], ['whole wheat0', 450, 'flour'],
['milk', 100, 'milk']]],
{'flour_total': '480',
'hydration': '32.2',
'percentages': [['egg', '10.4'], ['levain', '12.5'], ['salt', '2.3'], ['whole wheat0', '93.8'],
['milk', '20.8']]}],
['repair check: starter flour share',
[[['whole wheat1', 450, 'flour'], ['levain', 60, 'starter'], ['salt', 11, 'other'], ['milk', 100, 'milk'],
['spelt0', 450, 'flour'], ['water', 350, 'water']]],
{'flour_total': '930',
'hydration': '50.2',
'percentages': [['whole wheat1', '48.4'], ['levain', '6.5'], ['salt', '1.2'], ['milk', '10.8'],
['spelt0', '48.4'], ['water', '37.6']]}],
['generated control 1',
[[['salt', 11, 'other'], ['water', 325, 'water'], ['spelt1', 333, 'flour'], ['spelt0', 500, 'flour']]],
{'flour_total': '833',
'hydration': '39.0',
'percentages': [['salt', '1.3'], ['water', '39.0'], ['spelt1', '40.0'], ['spelt0', '60.0']]}],
['generated control 2',
[[['whole wheat1', 200, 'flour'], ['salt', 10, 'other'], ['whole wheat0', 333, 'flour']]],
{'flour_total': '533',
'hydration': '0.0',
'percentages': [['whole wheat1', '37.5'], ['salt', '1.9'], ['whole wheat0', '62.5']]}],
['generated control 3',
[[['salt', 10, 'other'], ['bread flour1', 300, 'flour'], ['bread flour0', 333, 'flour']]],
{'flour_total': '633',
'hydration': '0.0',
'percentages': [['salt', '1.6'], ['bread flour1', '47.4'], ['bread flour0', '52.6']]}]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| lean dough control | {'flour_total': '500', 'hydration': '70.0', 'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]} | {'flour_total': '500', 'hydration': '70.0', 'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]} | Passed |
| no flour | error: no flour | error: no flour | Passed |
| enriched dough | {'flour_total': '400', 'hydration': '62.3', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]} | {'flour_total': '400', 'hydration': '62.3', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]} | Passed |
| regression: starter flour share | {'flour_total': '1233', 'hydration': '46.8', 'percentages': [['egg', '4.1'], ['water', '30.6'], ['bread flour1', '36.5'], ['milk', '8.1'], ['bread flour2', '36.5'], ['salt', '0.8'], ['whole wheat0', '27.0'], ['levain', '12.2']]} | {'flour_total': '1308', 'hydration': '44.1', 'percentages': [['egg', '3.8'], ['water', '28.8'], ['bread flour1', '34.4'], ['milk', '7.6'], ['bread flour2', '34.4'], ['salt', '0.8'], ['whole wheat0', '25.5'], ['levain', '11.5']]} | Failed |
| repair check: starter flour share | {'flour_total': '300', 'hydration': '154.0', 'percentages': [['salt', '3.3'], ['milk', '33.3'], ['water', '108.3'], ['levain', '33.3'], ['spelt0', '100.0']]} | {'flour_total': '350', 'hydration': '132.0', 'percentages': [['salt', '2.9'], ['milk', '28.6'], ['water', '92.9'], ['levain', '28.6'], ['spelt0', '85.7']]} | Failed |
| generated control 1 | {'flour_total': '450', 'hydration': '34.3', 'percentages': [['levain', '22.2'], ['rye0', '100.0'], ['milk', '26.7'], ['salt', '2.4']]} | {'flour_total': '500', 'hydration': '30.9', 'percentages': [['levain', '20.0'], ['rye0', '90.0'], ['milk', '24.0'], ['salt', '2.2']]} | Failed |
| generated control 2 | {'flour_total': '250', 'hydration': '128.8', 'percentages': [['egg', '20.0'], ['water', '60.0'], ['milk', '48.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['levain', '24.0']]} | {'flour_total': '280', 'hydration': '115.0', 'percentages': [['egg', '17.9'], ['water', '53.6'], ['milk', '42.9'], ['salt', '3.2'], ['bread flour0', '89.3'], ['levain', '21.4']]} | Failed |
| generated control 3 | {'flour_total': '550', 'hydration': '44.3', 'percentages': [['levain', '18.2'], ['water', '27.3'], ['milk', '9.1'], ['whole wheat1', '45.5'], ['salt', '1.8'], ['spelt0', '54.5']]} | {'flour_total': '600', 'hydration': '40.6', 'percentages': [['levain', '16.7'], ['water', '25.0'], ['milk', '8.3'], ['whole wheat1', '41.7'], ['salt', '1.7'], ['spelt0', '50.0']]} | Failed |
SHA-256 / 9b4e18570281532660f866863bb0b97780650ddb0005e3bbf89df3b9c95c4b68
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(ingredients):
starter = sum((Fraction(str(g)) for n, g, r in ingredients if r == 'starter'), Fraction(0))
flour = sum(Fraction(str(g)) for n, g, r in ingredients if r == 'flour') + starter
if flour == 0:
return 'error: no flour'
def pct(x):
v = math.floor(x * 1000 / flour + Fraction(1, 2))
return '%d.%d' % divmod(v, 10)
rows = [[n, pct(Fraction(str(g)))] for n, g, r in ingredients]
water = Fraction(0)
for n, g, r in ingredients:
if r == 'water':
water += Fraction(str(g))
elif r == 'milk':
water += Fraction(str(g)) * Fraction(87, 100)
elif r == 'egg':
water += Fraction(str(g)) * Fraction(3, 4)
elif r == 'starter':
water += Fraction(str(g)) / 2
return {'flour_total': str(flour), 'percentages': rows, 'hydration': pct(water)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['regression: starter flour share',
[[['egg', 50, 'egg'], ['water', 377, 'water'], ['bread flour1', 450, 'flour'], ['milk', 100, 'milk'],
['bread flour2', 450, 'flour'], ['salt', 10, 'other'], ['whole wheat0', 333, 'flour'],
['levain', 150, 'starter']]],
{'flour_total': '1308',
'hydration': '44.1',
'percentages': [['egg', '3.8'], ['water', '28.8'], ['bread flour1', '34.4'], ['milk', '7.6'],
['bread flour2', '34.4'], ['salt', '0.8'], ['whole wheat0', '25.5'],
['levain', '11.5']]}],
['repair check: starter flour share',
[[['salt', 10, 'other'], ['milk', 100, 'milk'], ['water', 325, 'water'], ['levain', 100, 'starter'],
['spelt0', 300, 'flour']]],
{'flour_total': '350',
'hydration': '132.0',
'percentages': [['salt', '2.9'], ['milk', '28.6'], ['water', '92.9'], ['levain', '28.6'],
['spelt0', '85.7']]}],
['generated control 1',
[[['levain', 100, 'starter'], ['rye0', 450, 'flour'], ['milk', 120, 'milk'], ['salt', 11, 'other']]],
{'flour_total': '500',
'hydration': '30.9',
'percentages': [['levain', '20.0'], ['rye0', '90.0'], ['milk', '24.0'], ['salt', '2.2']]}],
['generated control 2',
[[['egg', 50, 'egg'], ['water', 150, 'water'], ['milk', 120, 'milk'], ['salt', 9, 'other'],
['bread flour0', 250, 'flour'], ['levain', 60, 'starter']]],
{'flour_total': '280',
'hydration': '115.0',
'percentages': [['egg', '17.9'], ['water', '53.6'], ['milk', '42.9'], ['salt', '3.2'],
['bread flour0', '89.3'], ['levain', '21.4']]}],
['generated control 3',
[[['levain', 100, 'starter'], ['water', 150, 'water'], ['milk', 50, 'milk'],
['whole wheat1', 250, 'flour'], ['salt', 10, 'other'], ['spelt0', 300, 'flour']]],
{'flour_total': '600',
'hydration': '40.6',
'percentages': [['levain', '16.7'], ['water', '25.0'], ['milk', '8.3'], ['whole wheat1', '41.7'],
['salt', '1.7'], ['spelt0', '50.0']]}]],
[['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['regression: starter flour share',
[[['water', 150, 'water'], ['bread flour0', 333, 'flour'], ['salt', 10, 'other'], ['milk', 120, 'milk'],
['levain', 100, 'starter']]],
{'flour_total': '383',
'hydration': '79.5',
'percentages': [['water', '39.2'], ['bread flour0', '86.9'], ['salt', '2.6'], ['milk', '31.3'],
['levain', '26.1']]}],
['repair check: starter flour share',
[[['rye1', 450, 'flour'], ['levain', 100, 'starter'], ['salt', 10, 'other'], ['water', 200, 'water'],
['milk', 100, 'milk'], ['spelt0', 100, 'flour']]],
{'flour_total': '600',
'hydration': '56.2',
'percentages': [['rye1', '75.0'], ['levain', '16.7'], ['salt', '1.7'], ['water', '33.3'],
['milk', '16.7'], ['spelt0', '16.7']]}],
['generated control 1',
[[['milk', 100, 'milk'], ['water', 377, 'water'], ['egg', 50, 'egg'], ['whole wheat0', 300, 'flour'],
['salt', 11, 'other']]],
{'flour_total': '300',
'hydration': '167.2',
'percentages': [['milk', '33.3'], ['water', '125.7'], ['egg', '16.7'], ['whole wheat0', '100.0'],
['salt', '3.7']]}],
['generated control 2',
[[['rye1', 333, 'flour'], ['rye0', 250, 'flour'], ['salt', 9, 'other'], ['milk', 50, 'milk'],
['spelt2', 333, 'flour']]],
{'flour_total': '916',
'hydration': '4.7',
'percentages': [['rye1', '36.4'], ['rye0', '27.3'], ['salt', '1.0'], ['milk', '5.5'],
['spelt2', '36.4']]}],
['generated control 3',
[[['water', 150, 'water'], ['milk', 100, 'milk'], ['rye1', 300, 'flour'], ['whole wheat0', 250, 'flour'],
['rye2', 450, 'flour'], ['salt', 9, 'other']]],
{'flour_total': '1000',
'hydration': '23.7',
'percentages': [['water', '15.0'], ['milk', '10.0'], ['rye1', '30.0'], ['whole wheat0', '25.0'],
['rye2', '45.0'], ['salt', '0.9']]}]],
[['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['regression: starter flour share',
[[['salt', 9, 'other'], ['water', 350, 'water'], ['milk', 100, 'milk'], ['whole wheat2', 450, 'flour'],
['whole wheat0', 200, 'flour'], ['egg', 100, 'egg'], ['whole wheat1', 300, 'flour'],
['levain', 60, 'starter']]],
{'flour_total': '980',
'hydration': '55.3',
'percentages': [['salt', '0.9'], ['water', '35.7'], ['milk', '10.2'], ['whole wheat2', '45.9'],
['whole wheat0', '20.4'], ['egg', '10.2'], ['whole wheat1', '30.6'],
['levain', '6.1']]}],
['repair check: starter flour share',
[[['bread flour1', 500, 'flour'], ['levain', 100, 'starter'], ['salt', 10, 'other'],
['bread flour0', 500, 'flour']]],
{'flour_total': '1050',
'hydration': '4.8',
'percentages': [['bread flour1', '47.6'], ['levain', '9.5'], ['salt', '1.0'], ['bread flour0', '47.6']]}],
['generated control 1',
[[['whole wheat1', 100, 'flour'], ['whole wheat0', 300, 'flour'], ['water', 325, 'water'],
['salt', 9, 'other'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '100.0',
'percentages': [['whole wheat1', '25.0'], ['whole wheat0', '75.0'], ['water', '81.3'], ['salt', '2.3'],
['egg', '25.0']]}],
['generated control 2',
[[['bread flour0', 250, 'flour'], ['salt', 9, 'other'], ['rye1', 200, 'flour'], ['water', 150, 'water']]],
{'flour_total': '450',
'hydration': '33.3',
'percentages': [['bread flour0', '55.6'], ['salt', '2.0'], ['rye1', '44.4'], ['water', '33.3']]}],
['generated control 3',
[[['rye2', 333, 'flour'], ['milk', 120, 'milk'], ['whole wheat0', 200, 'flour'], ['salt', 11, 'other'],
['spelt1', 250, 'flour']]],
{'flour_total': '783',
'hydration': '13.3',
'percentages': [['rye2', '42.5'], ['milk', '15.3'], ['whole wheat0', '25.5'], ['salt', '1.4'],
['spelt1', '31.9']]}]],
[['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['regression: starter flour share',
[[['whole wheat0', 200, 'flour'], ['levain', 60, 'starter'], ['salt', 11, 'other'],
['milk', 100, 'milk']]],
{'flour_total': '230',
'hydration': '50.9',
'percentages': [['whole wheat0', '87.0'], ['levain', '26.1'], ['salt', '4.8'], ['milk', '43.5']]}],
['repair check: starter flour share',
[[['salt', 10, 'other'], ['milk', 120, 'milk'], ['water', 150, 'water'], ['levain', 150, 'starter'],
['egg', 50, 'egg'], ['spelt0', 200, 'flour']]],
{'flour_total': '275',
'hydration': '133.4',
'percentages': [['salt', '3.6'], ['milk', '43.6'], ['water', '54.5'], ['levain', '54.5'], ['egg', '18.2'],
['spelt0', '72.7']]}],
['generated control 1',
[[['water', 150, 'water'], ['egg', 100, 'egg'], ['salt', 11, 'other'], ['rye0', 450, 'flour']]],
{'flour_total': '450',
'hydration': '50.0',
'percentages': [['water', '33.3'], ['egg', '22.2'], ['salt', '2.4'], ['rye0', '100.0']]}],
['generated control 2',
[[['whole wheat2', 200, 'flour'], ['milk', 120, 'milk'], ['egg', 100, 'egg'], ['rye0', 333, 'flour'],
['salt', 11, 'other'], ['rye1', 200, 'flour']]],
{'flour_total': '733',
'hydration': '24.5',
'percentages': [['whole wheat2', '27.3'], ['milk', '16.4'], ['egg', '13.6'], ['rye0', '45.4'],
['salt', '1.5'], ['rye1', '27.3']]}],
['generated control 3', [[['salt', 9, 'other'], ['water', 200, 'water'], ['rye0', 100, 'flour']]],
{'flour_total': '100',
'hydration': '200.0',
'percentages': [['salt', '9.0'], ['water', '200.0'], ['rye0', '100.0']]}]],
[['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['regression: starter flour share',
[[['egg', 50, 'egg'], ['levain', 60, 'starter'], ['salt', 11, 'other'], ['whole wheat0', 450, 'flour'],
['milk', 100, 'milk']]],
{'flour_total': '480',
'hydration': '32.2',
'percentages': [['egg', '10.4'], ['levain', '12.5'], ['salt', '2.3'], ['whole wheat0', '93.8'],
['milk', '20.8']]}],
['repair check: starter flour share',
[[['whole wheat1', 450, 'flour'], ['levain', 60, 'starter'], ['salt', 11, 'other'], ['milk', 100, 'milk'],
['spelt0', 450, 'flour'], ['water', 350, 'water']]],
{'flour_total': '930',
'hydration': '50.2',
'percentages': [['whole wheat1', '48.4'], ['levain', '6.5'], ['salt', '1.2'], ['milk', '10.8'],
['spelt0', '48.4'], ['water', '37.6']]}],
['generated control 1',
[[['salt', 11, 'other'], ['water', 325, 'water'], ['spelt1', 333, 'flour'], ['spelt0', 500, 'flour']]],
{'flour_total': '833',
'hydration': '39.0',
'percentages': [['salt', '1.3'], ['water', '39.0'], ['spelt1', '40.0'], ['spelt0', '60.0']]}],
['generated control 2',
[[['whole wheat1', 200, 'flour'], ['salt', 10, 'other'], ['whole wheat0', 333, 'flour']]],
{'flour_total': '533',
'hydration': '0.0',
'percentages': [['whole wheat1', '37.5'], ['salt', '1.9'], ['whole wheat0', '62.5']]}],
['generated control 3',
[[['salt', 10, 'other'], ['bread flour1', 300, 'flour'], ['bread flour0', 333, 'flour']]],
{'flour_total': '633',
'hydration': '0.0',
'percentages': [['salt', '1.6'], ['bread flour1', '47.4'], ['bread flour0', '52.6']]}]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| lean dough control | {'flour_total': '500', 'hydration': '70.0', 'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]} | {'flour_total': '500', 'hydration': '70.0', 'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]} | Passed |
| no flour | error: no flour | error: no flour | Passed |
| enriched dough | {'flour_total': '400', 'hydration': '62.3', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]} | {'flour_total': '400', 'hydration': '62.3', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]} | Passed |
| regression: starter flour share | {'flour_total': '1383', 'hydration': '41.7', 'percentages': [['egg', '3.6'], ['water', '27.3'], ['bread flour1', '32.5'], ['milk', '7.2'], ['bread flour2', '32.5'], ['salt', '0.7'], ['whole wheat0', '24.1'], ['levain', '10.8']]} | {'flour_total': '1308', 'hydration': '44.1', 'percentages': [['egg', '3.8'], ['water', '28.8'], ['bread flour1', '34.4'], ['milk', '7.6'], ['bread flour2', '34.4'], ['salt', '0.8'], ['whole wheat0', '25.5'], ['levain', '11.5']]} | Failed |
| repair check: starter flour share | {'flour_total': '400', 'hydration': '115.5', 'percentages': [['salt', '2.5'], ['milk', '25.0'], ['water', '81.3'], ['levain', '25.0'], ['spelt0', '75.0']]} | {'flour_total': '350', 'hydration': '132.0', 'percentages': [['salt', '2.9'], ['milk', '28.6'], ['water', '92.9'], ['levain', '28.6'], ['spelt0', '85.7']]} | Failed |
| generated control 1 | {'flour_total': '550', 'hydration': '28.1', 'percentages': [['levain', '18.2'], ['rye0', '81.8'], ['milk', '21.8'], ['salt', '2.0']]} | {'flour_total': '500', 'hydration': '30.9', 'percentages': [['levain', '20.0'], ['rye0', '90.0'], ['milk', '24.0'], ['salt', '2.2']]} | Failed |
| generated control 2 | {'flour_total': '310', 'hydration': '103.8', 'percentages': [['egg', '16.1'], ['water', '48.4'], ['milk', '38.7'], ['salt', '2.9'], ['bread flour0', '80.6'], ['levain', '19.4']]} | {'flour_total': '280', 'hydration': '115.0', 'percentages': [['egg', '17.9'], ['water', '53.6'], ['milk', '42.9'], ['salt', '3.2'], ['bread flour0', '89.3'], ['levain', '21.4']]} | Failed |
| generated control 3 | {'flour_total': '650', 'hydration': '37.5', 'percentages': [['levain', '15.4'], ['water', '23.1'], ['milk', '7.7'], ['whole wheat1', '38.5'], ['salt', '1.5'], ['spelt0', '46.2']]} | {'flour_total': '600', 'hydration': '40.6', 'percentages': [['levain', '16.7'], ['water', '25.0'], ['milk', '8.3'], ['whole wheat1', '41.7'], ['salt', '1.7'], ['spelt0', '50.0']]} | Failed |
SHA-256 / 2a0befe05ec91d6db82265abfad32c3dba97af14ba396438ac2178b543fa0f35
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(ingredients):
starter = sum((Fraction(str(g)) for n, g, r in ingredients if r == 'starter'), Fraction(0))
flour = sum(Fraction(str(g)) for n, g, r in ingredients if r == 'flour') + starter / 2
if flour == 0:
return 'error: no flour'
def pct(x):
v = math.floor(x * 1000 / flour + Fraction(1, 2))
return '%d.%d' % divmod(v, 10)
rows = [[n, pct(Fraction(str(g)))] for n, g, r in ingredients]
water = Fraction(0)
for n, g, r in ingredients:
if r == 'water':
water += Fraction(str(g))
elif r == 'milk':
water += Fraction(str(g)) * Fraction(87, 100)
elif r == 'egg':
water += Fraction(str(g)) * Fraction(3, 4)
elif r == 'starter':
water += Fraction(str(g)) / 2
return {'flour_total': str(flour), 'percentages': rows, 'hydration': pct(water)}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['regression: starter flour share',
[[['egg', 50, 'egg'], ['water', 377, 'water'], ['bread flour1', 450, 'flour'], ['milk', 100, 'milk'],
['bread flour2', 450, 'flour'], ['salt', 10, 'other'], ['whole wheat0', 333, 'flour'],
['levain', 150, 'starter']]],
{'flour_total': '1308',
'hydration': '44.1',
'percentages': [['egg', '3.8'], ['water', '28.8'], ['bread flour1', '34.4'], ['milk', '7.6'],
['bread flour2', '34.4'], ['salt', '0.8'], ['whole wheat0', '25.5'],
['levain', '11.5']]}],
['repair check: starter flour share',
[[['salt', 10, 'other'], ['milk', 100, 'milk'], ['water', 325, 'water'], ['levain', 100, 'starter'],
['spelt0', 300, 'flour']]],
{'flour_total': '350',
'hydration': '132.0',
'percentages': [['salt', '2.9'], ['milk', '28.6'], ['water', '92.9'], ['levain', '28.6'],
['spelt0', '85.7']]}],
['generated control 1',
[[['levain', 100, 'starter'], ['rye0', 450, 'flour'], ['milk', 120, 'milk'], ['salt', 11, 'other']]],
{'flour_total': '500',
'hydration': '30.9',
'percentages': [['levain', '20.0'], ['rye0', '90.0'], ['milk', '24.0'], ['salt', '2.2']]}],
['generated control 2',
[[['egg', 50, 'egg'], ['water', 150, 'water'], ['milk', 120, 'milk'], ['salt', 9, 'other'],
['bread flour0', 250, 'flour'], ['levain', 60, 'starter']]],
{'flour_total': '280',
'hydration': '115.0',
'percentages': [['egg', '17.9'], ['water', '53.6'], ['milk', '42.9'], ['salt', '3.2'],
['bread flour0', '89.3'], ['levain', '21.4']]}],
['generated control 3',
[[['levain', 100, 'starter'], ['water', 150, 'water'], ['milk', 50, 'milk'],
['whole wheat1', 250, 'flour'], ['salt', 10, 'other'], ['spelt0', 300, 'flour']]],
{'flour_total': '600',
'hydration': '40.6',
'percentages': [['levain', '16.7'], ['water', '25.0'], ['milk', '8.3'], ['whole wheat1', '41.7'],
['salt', '1.7'], ['spelt0', '50.0']]}]],
[['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['regression: starter flour share',
[[['water', 150, 'water'], ['bread flour0', 333, 'flour'], ['salt', 10, 'other'], ['milk', 120, 'milk'],
['levain', 100, 'starter']]],
{'flour_total': '383',
'hydration': '79.5',
'percentages': [['water', '39.2'], ['bread flour0', '86.9'], ['salt', '2.6'], ['milk', '31.3'],
['levain', '26.1']]}],
['repair check: starter flour share',
[[['rye1', 450, 'flour'], ['levain', 100, 'starter'], ['salt', 10, 'other'], ['water', 200, 'water'],
['milk', 100, 'milk'], ['spelt0', 100, 'flour']]],
{'flour_total': '600',
'hydration': '56.2',
'percentages': [['rye1', '75.0'], ['levain', '16.7'], ['salt', '1.7'], ['water', '33.3'],
['milk', '16.7'], ['spelt0', '16.7']]}],
['generated control 1',
[[['milk', 100, 'milk'], ['water', 377, 'water'], ['egg', 50, 'egg'], ['whole wheat0', 300, 'flour'],
['salt', 11, 'other']]],
{'flour_total': '300',
'hydration': '167.2',
'percentages': [['milk', '33.3'], ['water', '125.7'], ['egg', '16.7'], ['whole wheat0', '100.0'],
['salt', '3.7']]}],
['generated control 2',
[[['rye1', 333, 'flour'], ['rye0', 250, 'flour'], ['salt', 9, 'other'], ['milk', 50, 'milk'],
['spelt2', 333, 'flour']]],
{'flour_total': '916',
'hydration': '4.7',
'percentages': [['rye1', '36.4'], ['rye0', '27.3'], ['salt', '1.0'], ['milk', '5.5'],
['spelt2', '36.4']]}],
['generated control 3',
[[['water', 150, 'water'], ['milk', 100, 'milk'], ['rye1', 300, 'flour'], ['whole wheat0', 250, 'flour'],
['rye2', 450, 'flour'], ['salt', 9, 'other']]],
{'flour_total': '1000',
'hydration': '23.7',
'percentages': [['water', '15.0'], ['milk', '10.0'], ['rye1', '30.0'], ['whole wheat0', '25.0'],
['rye2', '45.0'], ['salt', '0.9']]}]],
[['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['regression: starter flour share',
[[['salt', 9, 'other'], ['water', 350, 'water'], ['milk', 100, 'milk'], ['whole wheat2', 450, 'flour'],
['whole wheat0', 200, 'flour'], ['egg', 100, 'egg'], ['whole wheat1', 300, 'flour'],
['levain', 60, 'starter']]],
{'flour_total': '980',
'hydration': '55.3',
'percentages': [['salt', '0.9'], ['water', '35.7'], ['milk', '10.2'], ['whole wheat2', '45.9'],
['whole wheat0', '20.4'], ['egg', '10.2'], ['whole wheat1', '30.6'],
['levain', '6.1']]}],
['repair check: starter flour share',
[[['bread flour1', 500, 'flour'], ['levain', 100, 'starter'], ['salt', 10, 'other'],
['bread flour0', 500, 'flour']]],
{'flour_total': '1050',
'hydration': '4.8',
'percentages': [['bread flour1', '47.6'], ['levain', '9.5'], ['salt', '1.0'], ['bread flour0', '47.6']]}],
['generated control 1',
[[['whole wheat1', 100, 'flour'], ['whole wheat0', 300, 'flour'], ['water', 325, 'water'],
['salt', 9, 'other'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '100.0',
'percentages': [['whole wheat1', '25.0'], ['whole wheat0', '75.0'], ['water', '81.3'], ['salt', '2.3'],
['egg', '25.0']]}],
['generated control 2',
[[['bread flour0', 250, 'flour'], ['salt', 9, 'other'], ['rye1', 200, 'flour'], ['water', 150, 'water']]],
{'flour_total': '450',
'hydration': '33.3',
'percentages': [['bread flour0', '55.6'], ['salt', '2.0'], ['rye1', '44.4'], ['water', '33.3']]}],
['generated control 3',
[[['rye2', 333, 'flour'], ['milk', 120, 'milk'], ['whole wheat0', 200, 'flour'], ['salt', 11, 'other'],
['spelt1', 250, 'flour']]],
{'flour_total': '783',
'hydration': '13.3',
'percentages': [['rye2', '42.5'], ['milk', '15.3'], ['whole wheat0', '25.5'], ['salt', '1.4'],
['spelt1', '31.9']]}]],
[['two flours with levain',
[[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
{'flour_total': '550',
'hydration': '69.1',
'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['regression: starter flour share',
[[['whole wheat0', 200, 'flour'], ['levain', 60, 'starter'], ['salt', 11, 'other'],
['milk', 100, 'milk']]],
{'flour_total': '230',
'hydration': '50.9',
'percentages': [['whole wheat0', '87.0'], ['levain', '26.1'], ['salt', '4.8'], ['milk', '43.5']]}],
['repair check: starter flour share',
[[['salt', 10, 'other'], ['milk', 120, 'milk'], ['water', 150, 'water'], ['levain', 150, 'starter'],
['egg', 50, 'egg'], ['spelt0', 200, 'flour']]],
{'flour_total': '275',
'hydration': '133.4',
'percentages': [['salt', '3.6'], ['milk', '43.6'], ['water', '54.5'], ['levain', '54.5'], ['egg', '18.2'],
['spelt0', '72.7']]}],
['generated control 1',
[[['water', 150, 'water'], ['egg', 100, 'egg'], ['salt', 11, 'other'], ['rye0', 450, 'flour']]],
{'flour_total': '450',
'hydration': '50.0',
'percentages': [['water', '33.3'], ['egg', '22.2'], ['salt', '2.4'], ['rye0', '100.0']]}],
['generated control 2',
[[['whole wheat2', 200, 'flour'], ['milk', 120, 'milk'], ['egg', 100, 'egg'], ['rye0', 333, 'flour'],
['salt', 11, 'other'], ['rye1', 200, 'flour']]],
{'flour_total': '733',
'hydration': '24.5',
'percentages': [['whole wheat2', '27.3'], ['milk', '16.4'], ['egg', '13.6'], ['rye0', '45.4'],
['salt', '1.5'], ['rye1', '27.3']]}],
['generated control 3', [[['salt', 9, 'other'], ['water', 200, 'water'], ['rye0', 100, 'flour']]],
{'flour_total': '100',
'hydration': '200.0',
'percentages': [['salt', '9.0'], ['water', '200.0'], ['rye0', '100.0']]}]],
[['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
{'flour_total': '500',
'hydration': '70.0',
'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
['no flour', [[['water', 100, 'water']]], 'error: no flour'],
['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
{'flour_total': '400',
'hydration': '62.3',
'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
['regression: starter flour share',
[[['egg', 50, 'egg'], ['levain', 60, 'starter'], ['salt', 11, 'other'], ['whole wheat0', 450, 'flour'],
['milk', 100, 'milk']]],
{'flour_total': '480',
'hydration': '32.2',
'percentages': [['egg', '10.4'], ['levain', '12.5'], ['salt', '2.3'], ['whole wheat0', '93.8'],
['milk', '20.8']]}],
['repair check: starter flour share',
[[['whole wheat1', 450, 'flour'], ['levain', 60, 'starter'], ['salt', 11, 'other'], ['milk', 100, 'milk'],
['spelt0', 450, 'flour'], ['water', 350, 'water']]],
{'flour_total': '930',
'hydration': '50.2',
'percentages': [['whole wheat1', '48.4'], ['levain', '6.5'], ['salt', '1.2'], ['milk', '10.8'],
['spelt0', '48.4'], ['water', '37.6']]}],
['generated control 1',
[[['salt', 11, 'other'], ['water', 325, 'water'], ['spelt1', 333, 'flour'], ['spelt0', 500, 'flour']]],
{'flour_total': '833',
'hydration': '39.0',
'percentages': [['salt', '1.3'], ['water', '39.0'], ['spelt1', '40.0'], ['spelt0', '60.0']]}],
['generated control 2',
[[['whole wheat1', 200, 'flour'], ['salt', 10, 'other'], ['whole wheat0', 333, 'flour']]],
{'flour_total': '533',
'hydration': '0.0',
'percentages': [['whole wheat1', '37.5'], ['salt', '1.9'], ['whole wheat0', '62.5']]}],
['generated control 3',
[[['salt', 10, 'other'], ['bread flour1', 300, 'flour'], ['bread flour0', 333, 'flour']]],
{'flour_total': '633',
'hydration': '0.0',
'percentages': [['salt', '1.6'], ['bread flour1', '47.4'], ['bread flour0', '52.6']]}]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| lean dough control | {'flour_total': '500', 'hydration': '70.0', 'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]} | {'flour_total': '500', 'hydration': '70.0', 'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]} | Passed |
| no flour | error: no flour | error: no flour | Passed |
| enriched dough | {'flour_total': '400', 'hydration': '62.3', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]} | {'flour_total': '400', 'hydration': '62.3', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]} | Passed |
| regression: starter flour share | {'flour_total': '1308', 'hydration': '44.1', 'percentages': [['egg', '3.8'], ['water', '28.8'], ['bread flour1', '34.4'], ['milk', '7.6'], ['bread flour2', '34.4'], ['salt', '0.8'], ['whole wheat0', '25.5'], ['levain', '11.5']]} | {'flour_total': '1308', 'hydration': '44.1', 'percentages': [['egg', '3.8'], ['water', '28.8'], ['bread flour1', '34.4'], ['milk', '7.6'], ['bread flour2', '34.4'], ['salt', '0.8'], ['whole wheat0', '25.5'], ['levain', '11.5']]} | Passed |
| repair check: starter flour share | {'flour_total': '350', 'hydration': '132.0', 'percentages': [['salt', '2.9'], ['milk', '28.6'], ['water', '92.9'], ['levain', '28.6'], ['spelt0', '85.7']]} | {'flour_total': '350', 'hydration': '132.0', 'percentages': [['salt', '2.9'], ['milk', '28.6'], ['water', '92.9'], ['levain', '28.6'], ['spelt0', '85.7']]} | Passed |
| generated control 1 | {'flour_total': '500', 'hydration': '30.9', 'percentages': [['levain', '20.0'], ['rye0', '90.0'], ['milk', '24.0'], ['salt', '2.2']]} | {'flour_total': '500', 'hydration': '30.9', 'percentages': [['levain', '20.0'], ['rye0', '90.0'], ['milk', '24.0'], ['salt', '2.2']]} | Passed |
| generated control 2 | {'flour_total': '280', 'hydration': '115.0', 'percentages': [['egg', '17.9'], ['water', '53.6'], ['milk', '42.9'], ['salt', '3.2'], ['bread flour0', '89.3'], ['levain', '21.4']]} | {'flour_total': '280', 'hydration': '115.0', 'percentages': [['egg', '17.9'], ['water', '53.6'], ['milk', '42.9'], ['salt', '3.2'], ['bread flour0', '89.3'], ['levain', '21.4']]} | Passed |
| generated control 3 | {'flour_total': '600', 'hydration': '40.6', 'percentages': [['levain', '16.7'], ['water', '25.0'], ['milk', '8.3'], ['whole wheat1', '41.7'], ['salt', '1.7'], ['spelt0', '50.0']]} | {'flour_total': '600', 'hydration': '40.6', 'percentages': [['levain', '16.7'], ['water', '25.0'], ['milk', '8.3'], ['whole wheat1', '41.7'], ['salt', '1.7'], ['spelt0', '50.0']]} | Passed |
SHA-256 / 81e3f40626eda1f0c77183accbcc658946459aa2b9121a45bf96686caa428f79
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:52:27.289252+00:00.
Case digest / bbaf6d66efbf566227f3cd4ad1799f06f15283b6ccf64a4ae0f8b2276c7da3bf