FAILURE MAP
← Case archive

FA-96946 / Recipe scaling and nutrition / Open access

Baker's percentage calculator: milk water content · case 01

Milk-based doughs report hydration as if milk were pure water.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Milk is counted at 100% water instead of 87%.

VERIFIED REPAIR

Count milk at 87% water.

Unsuccessful approach: Using 13% counts the milk solids instead of its water.

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') + 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(1)
        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: milk water content',
   [[['rye0', 200, 'flour'], ['salt', 9, 'other'], ['milk', 100, 'milk'], ['water', 150, 'water'],
     ['egg', 50, 'egg']]],
   {'flour_total': '200',
    'hydration': '137.3',
    'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'],
                    ['egg', '25.0']]}],
  ['repair check: milk water content',
   [[['bread flour1', 100, 'flour'], ['rye0', 250, 'flour'], ['whole wheat2', 300, 'flour'],
     ['water', 200, 'water'], ['levain', 100, 'starter'], ['salt', 10, 'other'], ['milk', 100, 'milk']]],
   {'flour_total': '700',
    'hydration': '48.1',
    'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'],
                    ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}],
  ['generated control 1', [[['salt', 10, 'other'], ['spelt0', 333, 'flour'], ['whole wheat1', 333, 'flour']]],
   {'flour_total': '666',
    'hydration': '0.0',
    'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}],
  ['generated control 2',
   [[['whole wheat1', 200, 'flour'], ['whole wheat0', 250, 'flour'], ['salt', 11, 'other'],
     ['water', 325, 'water'], ['egg', 100, 'egg'], ['levain', 150, 'starter']]],
   {'flour_total': '525',
    'hydration': '90.5',
    'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'],
                    ['egg', '19.0'], ['levain', '28.6']]}],
  ['generated control 3',
   [[['bread flour0', 300, 'flour'], ['rye2', 100, 'flour'], ['levain', 60, 'starter'],
     ['whole wheat1', 500, 'flour'], ['salt', 10, 'other'], ['milk', 50, 'milk']]],
   {'flour_total': '930',
    'hydration': '7.9',
    'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'],
                    ['salt', '1.1'], ['milk', '5.4']]}]],
 [['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: milk water content',
   [[['levain', 60, 'starter'], ['spelt0', 500, 'flour'], ['milk', 100, 'milk'], ['salt', 9, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '530',
    'hydration': '83.4',
    'percentages': [['levain', '11.3'], ['spelt0', '94.3'], ['milk', '18.9'], ['salt', '1.7'],
                    ['water', '61.3']]}],
  ['repair check: milk water content',
   [[['bread flour1', 200, 'flour'], ['milk', 100, 'milk'], ['salt', 11, 'other'], ['water', 325, 'water'],
     ['spelt0', 100, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '300',
    'hydration': '162.3',
    'percentages': [['bread flour1', '66.7'], ['milk', '33.3'], ['salt', '3.7'], ['water', '108.3'],
                    ['spelt0', '33.3'], ['egg', '33.3']]}],
  ['generated control 1',
   [[['spelt1', 250, 'flour'], ['water', 325, 'water'], ['levain', 90, 'starter'], ['spelt0', 250, 'flour'],
     ['salt', 11, 'other'], ['whole wheat2', 450, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '995',
    'hydration': '44.7',
    'percentages': [['spelt1', '25.1'], ['water', '32.7'], ['levain', '9.0'], ['spelt0', '25.1'],
                    ['salt', '1.1'], ['whole wheat2', '45.2'], ['egg', '10.1']]}],
  ['generated control 2',
   [[['spelt1', 100, 'flour'], ['spelt0', 250, 'flour'], ['salt', 11, 'other'], ['egg', 50, 'egg'],
     ['levain', 150, 'starter']]],
   {'flour_total': '425',
    'hydration': '26.5',
    'percentages': [['spelt1', '23.5'], ['spelt0', '58.8'], ['salt', '2.6'], ['egg', '11.8'],
                    ['levain', '35.3']]}],
  ['generated control 3',
   [[['rye0', 500, 'flour'], ['egg', 50, 'egg'], ['rye1', 333, 'flour'], ['water', 150, 'water'],
     ['levain', 100, 'starter'], ['milk', 120, 'milk'], ['salt', 11, 'other']]],
   {'flour_total': '883',
    'hydration': '38.7',
    'percentages': [['rye0', '56.6'], ['egg', '5.7'], ['rye1', '37.7'], ['water', '17.0'], ['levain', '11.3'],
                    ['milk', '13.6'], ['salt', '1.2']]}]],
 [['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: milk water content',
   [[['milk', 50, 'milk'], ['spelt1', 300, 'flour'], ['egg', 50, 'egg'], ['salt', 10, 'other'],
     ['whole wheat0', 333, 'flour']]],
   {'flour_total': '633',
    'hydration': '12.8',
    'percentages': [['milk', '7.9'], ['spelt1', '47.4'], ['egg', '7.9'], ['salt', '1.6'],
                    ['whole wheat0', '52.6']]}],
  ['repair check: milk water content',
   [[['levain', 90, 'starter'], ['salt', 9, 'other'], ['milk', 120, 'milk'], ['rye0', 200, 'flour']]],
   {'flour_total': '245',
    'hydration': '61.0',
    'percentages': [['levain', '36.7'], ['salt', '3.7'], ['milk', '49.0'], ['rye0', '81.6']]}],
  ['generated control 1',
   [[['spelt0', 250, 'flour'], ['egg', 100, 'egg'], ['bread flour1', 100, 'flour'], ['water', 200, 'water'],
     ['salt', 10, 'other']]],
   {'flour_total': '350',
    'hydration': '78.6',
    'percentages': [['spelt0', '71.4'], ['egg', '28.6'], ['bread flour1', '28.6'], ['water', '57.1'],
                    ['salt', '2.9']]}],
  ['generated control 2',
   [[['salt', 11, 'other'], ['spelt0', 100, 'flour'], ['water', 350, 'water'], ['spelt1', 250, 'flour']]],
   {'flour_total': '350',
    'hydration': '100.0',
    'percentages': [['salt', '3.1'], ['spelt0', '28.6'], ['water', '100.0'], ['spelt1', '71.4']]}],
  ['generated control 3',
   [[['spelt1', 100, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other'], ['egg', 50, 'egg'],
     ['levain', 90, 'starter'], ['bread flour0', 450, 'flour']]],
   {'flour_total': '595',
    'hydration': '72.7',
    'percentages': [['spelt1', '16.8'], ['water', '58.8'], ['salt', '1.7'], ['egg', '8.4'],
                    ['levain', '15.1'], ['bread flour0', '75.6']]}]],
 [['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: milk water content',
   [[['salt', 9, 'other'], ['milk', 50, 'milk'], ['bread flour0', 450, 'flour'], ['water', 150, 'water'],
     ['spelt1', 300, 'flour']]],
   {'flour_total': '750',
    'hydration': '25.8',
    'percentages': [['salt', '1.2'], ['milk', '6.7'], ['bread flour0', '60.0'], ['water', '20.0'],
                    ['spelt1', '40.0']]}],
  ['repair check: milk water content',
   [[['rye0', 250, 'flour'], ['milk', 100, 'milk'], ['whole wheat1', 450, 'flour'], ['salt', 11, 'other'],
     ['water', 200, 'water']]],
   {'flour_total': '700',
    'hydration': '41.0',
    'percentages': [['rye0', '35.7'], ['milk', '14.3'], ['whole wheat1', '64.3'], ['salt', '1.6'],
                    ['water', '28.6']]}],
  ['generated control 1',
   [[['rye0', 200, 'flour'], ['salt', 11, 'other'], ['levain', 100, 'starter'], ['water', 200, 'water'],
     ['whole wheat1', 500, 'flour']]],
   {'flour_total': '750',
    'hydration': '33.3',
    'percentages': [['rye0', '26.7'], ['salt', '1.5'], ['levain', '13.3'], ['water', '26.7'],
                    ['whole wheat1', '66.7']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['salt', 11, 'other'], ['bread flour0', 300, 'flour']]],
   {'flour_total': '330',
    'hydration': '9.1',
    'percentages': [['levain', '18.2'], ['salt', '3.3'], ['bread flour0', '90.9']]}],
  ['generated control 3',
   [[['bread flour2', 250, 'flour'], ['rye1', 300, 'flour'], ['milk', 50, 'milk'], ['salt', 10, 'other'],
     ['whole wheat0', 450, 'flour']]],
   {'flour_total': '1000',
    'hydration': '4.4',
    'percentages': [['bread flour2', '25.0'], ['rye1', '30.0'], ['milk', '5.0'], ['salt', '1.0'],
                    ['whole wheat0', '45.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: milk water content',
   [[['milk', 120, 'milk'], ['salt', 10, 'other'], ['whole wheat0', 100, 'flour']]],
   {'flour_total': '100',
    'hydration': '104.4',
    'percentages': [['milk', '120.0'], ['salt', '10.0'], ['whole wheat0', '100.0']]}],
  ['repair check: milk water content',
   [[['salt', 9, 'other'], ['water', 150, 'water'], ['spelt0', 100, 'flour'], ['levain', 60, 'starter'],
     ['milk', 100, 'milk']]],
   {'flour_total': '130',
    'hydration': '205.4',
    'percentages': [['salt', '6.9'], ['water', '115.4'], ['spelt0', '76.9'], ['levain', '46.2'],
                    ['milk', '76.9']]}],
  ['generated control 1',
   [[['spelt1', 100, 'flour'], ['rye2', 450, 'flour'], ['rye0', 250, 'flour'], ['water', 350, 'water'],
     ['salt', 10, 'other'], ['egg', 100, 'egg']]],
   {'flour_total': '800',
    'hydration': '53.1',
    'percentages': [['spelt1', '12.5'], ['rye2', '56.3'], ['rye0', '31.3'], ['water', '43.8'],
                    ['salt', '1.3'], ['egg', '12.5']]}],
  ['generated control 2',
   [[['bread flour0', 333, 'flour'], ['bread flour1', 500, 'flour'], ['bread flour2', 333, 'flour'],
     ['salt', 11, 'other'], ['water', 150, 'water'], ['egg', 100, 'egg']]],
   {'flour_total': '1166',
    'hydration': '19.3',
    'percentages': [['bread flour0', '28.6'], ['bread flour1', '42.9'], ['bread flour2', '28.6'],
                    ['salt', '0.9'], ['water', '12.9'], ['egg', '8.6']]}],
  ['generated control 3',
   [[['salt', 9, 'other'], ['milk', 100, 'milk'], ['whole wheat0', 333, 'flour'], ['egg', 50, 'egg'],
     ['water', 350, 'water']]],
   {'flour_total': '333',
    'hydration': '142.5',
    'percentages': [['salt', '2.7'], ['milk', '30.0'], ['whole wheat0', '100.0'], ['egg', '15.0'],
                    ['water', '105.1']]}]]]
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 fixtureActualExpectedOutcome
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 flourerror: no flourerror: no flourPassed
enriched dough{'flour_total': '400', 'hydration': '68.8', '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']]}Failed
regression: milk water content{'flour_total': '200', 'hydration': '143.8', 'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'], ['egg', '25.0']]}{'flour_total': '200', 'hydration': '137.3', 'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'], ['egg', '25.0']]}Failed
repair check: milk water content{'flour_total': '700', 'hydration': '50.0', 'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'], ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}{'flour_total': '700', 'hydration': '48.1', 'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'], ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}Failed
generated control 1{'flour_total': '666', 'hydration': '0.0', 'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}{'flour_total': '666', 'hydration': '0.0', 'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}Passed
generated control 2{'flour_total': '525', 'hydration': '90.5', 'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'], ['egg', '19.0'], ['levain', '28.6']]}{'flour_total': '525', 'hydration': '90.5', 'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'], ['egg', '19.0'], ['levain', '28.6']]}Passed
generated control 3{'flour_total': '930', 'hydration': '8.6', 'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'], ['salt', '1.1'], ['milk', '5.4']]}{'flour_total': '930', 'hydration': '7.9', 'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'], ['salt', '1.1'], ['milk', '5.4']]}Failed

SHA-256 / b169189c8688bb0197594fdfc91ceeec468926f4b14566f2f01120eb0119f5d4

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 / 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(13, 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: milk water content',
   [[['rye0', 200, 'flour'], ['salt', 9, 'other'], ['milk', 100, 'milk'], ['water', 150, 'water'],
     ['egg', 50, 'egg']]],
   {'flour_total': '200',
    'hydration': '137.3',
    'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'],
                    ['egg', '25.0']]}],
  ['repair check: milk water content',
   [[['bread flour1', 100, 'flour'], ['rye0', 250, 'flour'], ['whole wheat2', 300, 'flour'],
     ['water', 200, 'water'], ['levain', 100, 'starter'], ['salt', 10, 'other'], ['milk', 100, 'milk']]],
   {'flour_total': '700',
    'hydration': '48.1',
    'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'],
                    ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}],
  ['generated control 1', [[['salt', 10, 'other'], ['spelt0', 333, 'flour'], ['whole wheat1', 333, 'flour']]],
   {'flour_total': '666',
    'hydration': '0.0',
    'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}],
  ['generated control 2',
   [[['whole wheat1', 200, 'flour'], ['whole wheat0', 250, 'flour'], ['salt', 11, 'other'],
     ['water', 325, 'water'], ['egg', 100, 'egg'], ['levain', 150, 'starter']]],
   {'flour_total': '525',
    'hydration': '90.5',
    'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'],
                    ['egg', '19.0'], ['levain', '28.6']]}],
  ['generated control 3',
   [[['bread flour0', 300, 'flour'], ['rye2', 100, 'flour'], ['levain', 60, 'starter'],
     ['whole wheat1', 500, 'flour'], ['salt', 10, 'other'], ['milk', 50, 'milk']]],
   {'flour_total': '930',
    'hydration': '7.9',
    'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'],
                    ['salt', '1.1'], ['milk', '5.4']]}]],
 [['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: milk water content',
   [[['levain', 60, 'starter'], ['spelt0', 500, 'flour'], ['milk', 100, 'milk'], ['salt', 9, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '530',
    'hydration': '83.4',
    'percentages': [['levain', '11.3'], ['spelt0', '94.3'], ['milk', '18.9'], ['salt', '1.7'],
                    ['water', '61.3']]}],
  ['repair check: milk water content',
   [[['bread flour1', 200, 'flour'], ['milk', 100, 'milk'], ['salt', 11, 'other'], ['water', 325, 'water'],
     ['spelt0', 100, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '300',
    'hydration': '162.3',
    'percentages': [['bread flour1', '66.7'], ['milk', '33.3'], ['salt', '3.7'], ['water', '108.3'],
                    ['spelt0', '33.3'], ['egg', '33.3']]}],
  ['generated control 1',
   [[['spelt1', 250, 'flour'], ['water', 325, 'water'], ['levain', 90, 'starter'], ['spelt0', 250, 'flour'],
     ['salt', 11, 'other'], ['whole wheat2', 450, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '995',
    'hydration': '44.7',
    'percentages': [['spelt1', '25.1'], ['water', '32.7'], ['levain', '9.0'], ['spelt0', '25.1'],
                    ['salt', '1.1'], ['whole wheat2', '45.2'], ['egg', '10.1']]}],
  ['generated control 2',
   [[['spelt1', 100, 'flour'], ['spelt0', 250, 'flour'], ['salt', 11, 'other'], ['egg', 50, 'egg'],
     ['levain', 150, 'starter']]],
   {'flour_total': '425',
    'hydration': '26.5',
    'percentages': [['spelt1', '23.5'], ['spelt0', '58.8'], ['salt', '2.6'], ['egg', '11.8'],
                    ['levain', '35.3']]}],
  ['generated control 3',
   [[['rye0', 500, 'flour'], ['egg', 50, 'egg'], ['rye1', 333, 'flour'], ['water', 150, 'water'],
     ['levain', 100, 'starter'], ['milk', 120, 'milk'], ['salt', 11, 'other']]],
   {'flour_total': '883',
    'hydration': '38.7',
    'percentages': [['rye0', '56.6'], ['egg', '5.7'], ['rye1', '37.7'], ['water', '17.0'], ['levain', '11.3'],
                    ['milk', '13.6'], ['salt', '1.2']]}]],
 [['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: milk water content',
   [[['milk', 50, 'milk'], ['spelt1', 300, 'flour'], ['egg', 50, 'egg'], ['salt', 10, 'other'],
     ['whole wheat0', 333, 'flour']]],
   {'flour_total': '633',
    'hydration': '12.8',
    'percentages': [['milk', '7.9'], ['spelt1', '47.4'], ['egg', '7.9'], ['salt', '1.6'],
                    ['whole wheat0', '52.6']]}],
  ['repair check: milk water content',
   [[['levain', 90, 'starter'], ['salt', 9, 'other'], ['milk', 120, 'milk'], ['rye0', 200, 'flour']]],
   {'flour_total': '245',
    'hydration': '61.0',
    'percentages': [['levain', '36.7'], ['salt', '3.7'], ['milk', '49.0'], ['rye0', '81.6']]}],
  ['generated control 1',
   [[['spelt0', 250, 'flour'], ['egg', 100, 'egg'], ['bread flour1', 100, 'flour'], ['water', 200, 'water'],
     ['salt', 10, 'other']]],
   {'flour_total': '350',
    'hydration': '78.6',
    'percentages': [['spelt0', '71.4'], ['egg', '28.6'], ['bread flour1', '28.6'], ['water', '57.1'],
                    ['salt', '2.9']]}],
  ['generated control 2',
   [[['salt', 11, 'other'], ['spelt0', 100, 'flour'], ['water', 350, 'water'], ['spelt1', 250, 'flour']]],
   {'flour_total': '350',
    'hydration': '100.0',
    'percentages': [['salt', '3.1'], ['spelt0', '28.6'], ['water', '100.0'], ['spelt1', '71.4']]}],
  ['generated control 3',
   [[['spelt1', 100, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other'], ['egg', 50, 'egg'],
     ['levain', 90, 'starter'], ['bread flour0', 450, 'flour']]],
   {'flour_total': '595',
    'hydration': '72.7',
    'percentages': [['spelt1', '16.8'], ['water', '58.8'], ['salt', '1.7'], ['egg', '8.4'],
                    ['levain', '15.1'], ['bread flour0', '75.6']]}]],
 [['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: milk water content',
   [[['salt', 9, 'other'], ['milk', 50, 'milk'], ['bread flour0', 450, 'flour'], ['water', 150, 'water'],
     ['spelt1', 300, 'flour']]],
   {'flour_total': '750',
    'hydration': '25.8',
    'percentages': [['salt', '1.2'], ['milk', '6.7'], ['bread flour0', '60.0'], ['water', '20.0'],
                    ['spelt1', '40.0']]}],
  ['repair check: milk water content',
   [[['rye0', 250, 'flour'], ['milk', 100, 'milk'], ['whole wheat1', 450, 'flour'], ['salt', 11, 'other'],
     ['water', 200, 'water']]],
   {'flour_total': '700',
    'hydration': '41.0',
    'percentages': [['rye0', '35.7'], ['milk', '14.3'], ['whole wheat1', '64.3'], ['salt', '1.6'],
                    ['water', '28.6']]}],
  ['generated control 1',
   [[['rye0', 200, 'flour'], ['salt', 11, 'other'], ['levain', 100, 'starter'], ['water', 200, 'water'],
     ['whole wheat1', 500, 'flour']]],
   {'flour_total': '750',
    'hydration': '33.3',
    'percentages': [['rye0', '26.7'], ['salt', '1.5'], ['levain', '13.3'], ['water', '26.7'],
                    ['whole wheat1', '66.7']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['salt', 11, 'other'], ['bread flour0', 300, 'flour']]],
   {'flour_total': '330',
    'hydration': '9.1',
    'percentages': [['levain', '18.2'], ['salt', '3.3'], ['bread flour0', '90.9']]}],
  ['generated control 3',
   [[['bread flour2', 250, 'flour'], ['rye1', 300, 'flour'], ['milk', 50, 'milk'], ['salt', 10, 'other'],
     ['whole wheat0', 450, 'flour']]],
   {'flour_total': '1000',
    'hydration': '4.4',
    'percentages': [['bread flour2', '25.0'], ['rye1', '30.0'], ['milk', '5.0'], ['salt', '1.0'],
                    ['whole wheat0', '45.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: milk water content',
   [[['milk', 120, 'milk'], ['salt', 10, 'other'], ['whole wheat0', 100, 'flour']]],
   {'flour_total': '100',
    'hydration': '104.4',
    'percentages': [['milk', '120.0'], ['salt', '10.0'], ['whole wheat0', '100.0']]}],
  ['repair check: milk water content',
   [[['salt', 9, 'other'], ['water', 150, 'water'], ['spelt0', 100, 'flour'], ['levain', 60, 'starter'],
     ['milk', 100, 'milk']]],
   {'flour_total': '130',
    'hydration': '205.4',
    'percentages': [['salt', '6.9'], ['water', '115.4'], ['spelt0', '76.9'], ['levain', '46.2'],
                    ['milk', '76.9']]}],
  ['generated control 1',
   [[['spelt1', 100, 'flour'], ['rye2', 450, 'flour'], ['rye0', 250, 'flour'], ['water', 350, 'water'],
     ['salt', 10, 'other'], ['egg', 100, 'egg']]],
   {'flour_total': '800',
    'hydration': '53.1',
    'percentages': [['spelt1', '12.5'], ['rye2', '56.3'], ['rye0', '31.3'], ['water', '43.8'],
                    ['salt', '1.3'], ['egg', '12.5']]}],
  ['generated control 2',
   [[['bread flour0', 333, 'flour'], ['bread flour1', 500, 'flour'], ['bread flour2', 333, 'flour'],
     ['salt', 11, 'other'], ['water', 150, 'water'], ['egg', 100, 'egg']]],
   {'flour_total': '1166',
    'hydration': '19.3',
    'percentages': [['bread flour0', '28.6'], ['bread flour1', '42.9'], ['bread flour2', '28.6'],
                    ['salt', '0.9'], ['water', '12.9'], ['egg', '8.6']]}],
  ['generated control 3',
   [[['salt', 9, 'other'], ['milk', 100, 'milk'], ['whole wheat0', 333, 'flour'], ['egg', 50, 'egg'],
     ['water', 350, 'water']]],
   {'flour_total': '333',
    'hydration': '142.5',
    'percentages': [['salt', '2.7'], ['milk', '30.0'], ['whole wheat0', '100.0'], ['egg', '15.0'],
                    ['water', '105.1']]}]]]
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 fixtureActualExpectedOutcome
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 flourerror: no flourerror: no flourPassed
enriched dough{'flour_total': '400', 'hydration': '25.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']]}Failed
regression: milk water content{'flour_total': '200', 'hydration': '100.3', 'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'], ['egg', '25.0']]}{'flour_total': '200', 'hydration': '137.3', 'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'], ['egg', '25.0']]}Failed
repair check: milk water content{'flour_total': '700', 'hydration': '37.6', 'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'], ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}{'flour_total': '700', 'hydration': '48.1', 'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'], ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}Failed
generated control 1{'flour_total': '666', 'hydration': '0.0', 'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}{'flour_total': '666', 'hydration': '0.0', 'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}Passed
generated control 2{'flour_total': '525', 'hydration': '90.5', 'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'], ['egg', '19.0'], ['levain', '28.6']]}{'flour_total': '525', 'hydration': '90.5', 'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'], ['egg', '19.0'], ['levain', '28.6']]}Passed
generated control 3{'flour_total': '930', 'hydration': '3.9', 'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'], ['salt', '1.1'], ['milk', '5.4']]}{'flour_total': '930', 'hydration': '7.9', 'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'], ['salt', '1.1'], ['milk', '5.4']]}Failed

SHA-256 / 30bbdade416a0f2da8c70e80a116324114a6568f338dea52c25e18e6aa3c21a2

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: milk water content',
   [[['rye0', 200, 'flour'], ['salt', 9, 'other'], ['milk', 100, 'milk'], ['water', 150, 'water'],
     ['egg', 50, 'egg']]],
   {'flour_total': '200',
    'hydration': '137.3',
    'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'],
                    ['egg', '25.0']]}],
  ['repair check: milk water content',
   [[['bread flour1', 100, 'flour'], ['rye0', 250, 'flour'], ['whole wheat2', 300, 'flour'],
     ['water', 200, 'water'], ['levain', 100, 'starter'], ['salt', 10, 'other'], ['milk', 100, 'milk']]],
   {'flour_total': '700',
    'hydration': '48.1',
    'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'],
                    ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}],
  ['generated control 1', [[['salt', 10, 'other'], ['spelt0', 333, 'flour'], ['whole wheat1', 333, 'flour']]],
   {'flour_total': '666',
    'hydration': '0.0',
    'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}],
  ['generated control 2',
   [[['whole wheat1', 200, 'flour'], ['whole wheat0', 250, 'flour'], ['salt', 11, 'other'],
     ['water', 325, 'water'], ['egg', 100, 'egg'], ['levain', 150, 'starter']]],
   {'flour_total': '525',
    'hydration': '90.5',
    'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'],
                    ['egg', '19.0'], ['levain', '28.6']]}],
  ['generated control 3',
   [[['bread flour0', 300, 'flour'], ['rye2', 100, 'flour'], ['levain', 60, 'starter'],
     ['whole wheat1', 500, 'flour'], ['salt', 10, 'other'], ['milk', 50, 'milk']]],
   {'flour_total': '930',
    'hydration': '7.9',
    'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'],
                    ['salt', '1.1'], ['milk', '5.4']]}]],
 [['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: milk water content',
   [[['levain', 60, 'starter'], ['spelt0', 500, 'flour'], ['milk', 100, 'milk'], ['salt', 9, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '530',
    'hydration': '83.4',
    'percentages': [['levain', '11.3'], ['spelt0', '94.3'], ['milk', '18.9'], ['salt', '1.7'],
                    ['water', '61.3']]}],
  ['repair check: milk water content',
   [[['bread flour1', 200, 'flour'], ['milk', 100, 'milk'], ['salt', 11, 'other'], ['water', 325, 'water'],
     ['spelt0', 100, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '300',
    'hydration': '162.3',
    'percentages': [['bread flour1', '66.7'], ['milk', '33.3'], ['salt', '3.7'], ['water', '108.3'],
                    ['spelt0', '33.3'], ['egg', '33.3']]}],
  ['generated control 1',
   [[['spelt1', 250, 'flour'], ['water', 325, 'water'], ['levain', 90, 'starter'], ['spelt0', 250, 'flour'],
     ['salt', 11, 'other'], ['whole wheat2', 450, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '995',
    'hydration': '44.7',
    'percentages': [['spelt1', '25.1'], ['water', '32.7'], ['levain', '9.0'], ['spelt0', '25.1'],
                    ['salt', '1.1'], ['whole wheat2', '45.2'], ['egg', '10.1']]}],
  ['generated control 2',
   [[['spelt1', 100, 'flour'], ['spelt0', 250, 'flour'], ['salt', 11, 'other'], ['egg', 50, 'egg'],
     ['levain', 150, 'starter']]],
   {'flour_total': '425',
    'hydration': '26.5',
    'percentages': [['spelt1', '23.5'], ['spelt0', '58.8'], ['salt', '2.6'], ['egg', '11.8'],
                    ['levain', '35.3']]}],
  ['generated control 3',
   [[['rye0', 500, 'flour'], ['egg', 50, 'egg'], ['rye1', 333, 'flour'], ['water', 150, 'water'],
     ['levain', 100, 'starter'], ['milk', 120, 'milk'], ['salt', 11, 'other']]],
   {'flour_total': '883',
    'hydration': '38.7',
    'percentages': [['rye0', '56.6'], ['egg', '5.7'], ['rye1', '37.7'], ['water', '17.0'], ['levain', '11.3'],
                    ['milk', '13.6'], ['salt', '1.2']]}]],
 [['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: milk water content',
   [[['milk', 50, 'milk'], ['spelt1', 300, 'flour'], ['egg', 50, 'egg'], ['salt', 10, 'other'],
     ['whole wheat0', 333, 'flour']]],
   {'flour_total': '633',
    'hydration': '12.8',
    'percentages': [['milk', '7.9'], ['spelt1', '47.4'], ['egg', '7.9'], ['salt', '1.6'],
                    ['whole wheat0', '52.6']]}],
  ['repair check: milk water content',
   [[['levain', 90, 'starter'], ['salt', 9, 'other'], ['milk', 120, 'milk'], ['rye0', 200, 'flour']]],
   {'flour_total': '245',
    'hydration': '61.0',
    'percentages': [['levain', '36.7'], ['salt', '3.7'], ['milk', '49.0'], ['rye0', '81.6']]}],
  ['generated control 1',
   [[['spelt0', 250, 'flour'], ['egg', 100, 'egg'], ['bread flour1', 100, 'flour'], ['water', 200, 'water'],
     ['salt', 10, 'other']]],
   {'flour_total': '350',
    'hydration': '78.6',
    'percentages': [['spelt0', '71.4'], ['egg', '28.6'], ['bread flour1', '28.6'], ['water', '57.1'],
                    ['salt', '2.9']]}],
  ['generated control 2',
   [[['salt', 11, 'other'], ['spelt0', 100, 'flour'], ['water', 350, 'water'], ['spelt1', 250, 'flour']]],
   {'flour_total': '350',
    'hydration': '100.0',
    'percentages': [['salt', '3.1'], ['spelt0', '28.6'], ['water', '100.0'], ['spelt1', '71.4']]}],
  ['generated control 3',
   [[['spelt1', 100, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other'], ['egg', 50, 'egg'],
     ['levain', 90, 'starter'], ['bread flour0', 450, 'flour']]],
   {'flour_total': '595',
    'hydration': '72.7',
    'percentages': [['spelt1', '16.8'], ['water', '58.8'], ['salt', '1.7'], ['egg', '8.4'],
                    ['levain', '15.1'], ['bread flour0', '75.6']]}]],
 [['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: milk water content',
   [[['salt', 9, 'other'], ['milk', 50, 'milk'], ['bread flour0', 450, 'flour'], ['water', 150, 'water'],
     ['spelt1', 300, 'flour']]],
   {'flour_total': '750',
    'hydration': '25.8',
    'percentages': [['salt', '1.2'], ['milk', '6.7'], ['bread flour0', '60.0'], ['water', '20.0'],
                    ['spelt1', '40.0']]}],
  ['repair check: milk water content',
   [[['rye0', 250, 'flour'], ['milk', 100, 'milk'], ['whole wheat1', 450, 'flour'], ['salt', 11, 'other'],
     ['water', 200, 'water']]],
   {'flour_total': '700',
    'hydration': '41.0',
    'percentages': [['rye0', '35.7'], ['milk', '14.3'], ['whole wheat1', '64.3'], ['salt', '1.6'],
                    ['water', '28.6']]}],
  ['generated control 1',
   [[['rye0', 200, 'flour'], ['salt', 11, 'other'], ['levain', 100, 'starter'], ['water', 200, 'water'],
     ['whole wheat1', 500, 'flour']]],
   {'flour_total': '750',
    'hydration': '33.3',
    'percentages': [['rye0', '26.7'], ['salt', '1.5'], ['levain', '13.3'], ['water', '26.7'],
                    ['whole wheat1', '66.7']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['salt', 11, 'other'], ['bread flour0', 300, 'flour']]],
   {'flour_total': '330',
    'hydration': '9.1',
    'percentages': [['levain', '18.2'], ['salt', '3.3'], ['bread flour0', '90.9']]}],
  ['generated control 3',
   [[['bread flour2', 250, 'flour'], ['rye1', 300, 'flour'], ['milk', 50, 'milk'], ['salt', 10, 'other'],
     ['whole wheat0', 450, 'flour']]],
   {'flour_total': '1000',
    'hydration': '4.4',
    'percentages': [['bread flour2', '25.0'], ['rye1', '30.0'], ['milk', '5.0'], ['salt', '1.0'],
                    ['whole wheat0', '45.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: milk water content',
   [[['milk', 120, 'milk'], ['salt', 10, 'other'], ['whole wheat0', 100, 'flour']]],
   {'flour_total': '100',
    'hydration': '104.4',
    'percentages': [['milk', '120.0'], ['salt', '10.0'], ['whole wheat0', '100.0']]}],
  ['repair check: milk water content',
   [[['salt', 9, 'other'], ['water', 150, 'water'], ['spelt0', 100, 'flour'], ['levain', 60, 'starter'],
     ['milk', 100, 'milk']]],
   {'flour_total': '130',
    'hydration': '205.4',
    'percentages': [['salt', '6.9'], ['water', '115.4'], ['spelt0', '76.9'], ['levain', '46.2'],
                    ['milk', '76.9']]}],
  ['generated control 1',
   [[['spelt1', 100, 'flour'], ['rye2', 450, 'flour'], ['rye0', 250, 'flour'], ['water', 350, 'water'],
     ['salt', 10, 'other'], ['egg', 100, 'egg']]],
   {'flour_total': '800',
    'hydration': '53.1',
    'percentages': [['spelt1', '12.5'], ['rye2', '56.3'], ['rye0', '31.3'], ['water', '43.8'],
                    ['salt', '1.3'], ['egg', '12.5']]}],
  ['generated control 2',
   [[['bread flour0', 333, 'flour'], ['bread flour1', 500, 'flour'], ['bread flour2', 333, 'flour'],
     ['salt', 11, 'other'], ['water', 150, 'water'], ['egg', 100, 'egg']]],
   {'flour_total': '1166',
    'hydration': '19.3',
    'percentages': [['bread flour0', '28.6'], ['bread flour1', '42.9'], ['bread flour2', '28.6'],
                    ['salt', '0.9'], ['water', '12.9'], ['egg', '8.6']]}],
  ['generated control 3',
   [[['salt', 9, 'other'], ['milk', 100, 'milk'], ['whole wheat0', 333, 'flour'], ['egg', 50, 'egg'],
     ['water', 350, 'water']]],
   {'flour_total': '333',
    'hydration': '142.5',
    'percentages': [['salt', '2.7'], ['milk', '30.0'], ['whole wheat0', '100.0'], ['egg', '15.0'],
                    ['water', '105.1']]}]]]
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 fixtureActualExpectedOutcome
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 flourerror: no flourerror: no flourPassed
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: milk water content{'flour_total': '200', 'hydration': '137.3', 'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'], ['egg', '25.0']]}{'flour_total': '200', 'hydration': '137.3', 'percentages': [['rye0', '100.0'], ['salt', '4.5'], ['milk', '50.0'], ['water', '75.0'], ['egg', '25.0']]}Passed
repair check: milk water content{'flour_total': '700', 'hydration': '48.1', 'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'], ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}{'flour_total': '700', 'hydration': '48.1', 'percentages': [['bread flour1', '14.3'], ['rye0', '35.7'], ['whole wheat2', '42.9'], ['water', '28.6'], ['levain', '14.3'], ['salt', '1.4'], ['milk', '14.3']]}Passed
generated control 1{'flour_total': '666', 'hydration': '0.0', 'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}{'flour_total': '666', 'hydration': '0.0', 'percentages': [['salt', '1.5'], ['spelt0', '50.0'], ['whole wheat1', '50.0']]}Passed
generated control 2{'flour_total': '525', 'hydration': '90.5', 'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'], ['egg', '19.0'], ['levain', '28.6']]}{'flour_total': '525', 'hydration': '90.5', 'percentages': [['whole wheat1', '38.1'], ['whole wheat0', '47.6'], ['salt', '2.1'], ['water', '61.9'], ['egg', '19.0'], ['levain', '28.6']]}Passed
generated control 3{'flour_total': '930', 'hydration': '7.9', 'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'], ['salt', '1.1'], ['milk', '5.4']]}{'flour_total': '930', 'hydration': '7.9', 'percentages': [['bread flour0', '32.3'], ['rye2', '10.8'], ['levain', '6.5'], ['whole wheat1', '53.8'], ['salt', '1.1'], ['milk', '5.4']]}Passed

SHA-256 / af61358fd1bf9bf540da1643bded1ef3ccfdec604501c2e02bb6dd4095fb14bb

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.334530+00:00.

Case digest / 56af4fc8bddb84881e2380a39c9b69686763c3d2e6cbca4e7789f091934b4745