FAILURE MAP
← Case archive

FA-96941 / Recipe scaling and nutrition / Open access

Baker's percentage calculator: starter water share · case 01

Levain doughs report hydration several points low.

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

ROOT CAUSE

The water half of the starter is left out of hydration.

VERIFIED REPAIR

Add half of the starter weight to hydration water.

Unsuccessful approach: Counting the full starter as water overstates hydration.

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(87, 100)
        elif r == 'egg':
            water += Fraction(str(g)) * Fraction(3, 4)
        elif r == 'starter':
            water += Fraction(0)
    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 water share',
   [[['whole wheat2', 250, 'flour'], ['salt', 9, 'other'], ['levain', 150, 'starter'],
     ['spelt1', 200, 'flour'], ['water', 377, 'water'], ['spelt0', 100, 'flour'], ['milk', 50, 'milk']]],
   {'flour_total': '625',
    'hydration': '79.3',
    'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'],
                    ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}],
  ['repair check: starter water share',
   [[['salt', 9, 'other'], ['levain', 60, 'starter'], ['bread flour1', 200, 'flour'], ['water', 350, 'water'],
     ['rye0', 450, 'flour'], ['milk', 120, 'milk'], ['egg', 50, 'egg']]],
   {'flour_total': '680',
    'hydration': '76.8',
    'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'],
                    ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}],
  ['generated control 1',
   [[['egg', 50, 'egg'], ['bread flour1', 250, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other'],
     ['whole wheat0', 100, 'flour'], ['whole wheat2', 300, 'flour']]],
   {'flour_total': '650',
    'hydration': '59.6',
    'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'],
                    ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['salt', 10, 'other'], ['rye0', 200, 'flour'], ['milk', 100, 'milk'],
     ['spelt1', 450, 'flour']]],
   {'flour_total': '680',
    'hydration': '17.2',
    'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'],
                    ['spelt1', '66.2']]}],
  ['generated control 3',
   [[['levain', 150, 'starter'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat0', 500, 'flour'], ['egg', 50, 'egg']]],
   {'flour_total': '575',
    'hydration': '76.1',
    'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'],
                    ['egg', '8.7']]}]],
 [['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 water share',
   [[['rye2', 450, 'flour'], ['rye0', 100, 'flour'], ['levain', 100, 'starter'], ['water', 325, 'water'],
     ['spelt1', 450, 'flour'], ['salt', 10, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '1050',
    'hydration': '39.3',
    'percentages': [['rye2', '42.9'], ['rye0', '9.5'], ['levain', '9.5'], ['water', '31.0'],
                    ['spelt1', '42.9'], ['salt', '1.0'], ['egg', '4.8']]}],
  ['repair check: starter water share',
   [[['levain', 150, 'starter'], ['rye0', 450, 'flour'], ['salt', 9, 'other'], ['rye1', 500, 'flour'],
     ['water', 325, 'water']]],
   {'flour_total': '1025',
    'hydration': '39.0',
    'percentages': [['levain', '14.6'], ['rye0', '43.9'], ['salt', '0.9'], ['rye1', '48.8'],
                    ['water', '31.7']]}],
  ['generated control 1',
   [[['rye0', 333, 'flour'], ['milk', 100, 'milk'], ['water', 150, 'water'], ['salt', 10, 'other'],
     ['levain', 60, 'starter']]],
   {'flour_total': '363',
    'hydration': '73.6',
    'percentages': [['rye0', '91.7'], ['milk', '27.5'], ['water', '41.3'], ['salt', '2.8'],
                    ['levain', '16.5']]}],
  ['generated control 2',
   [[['rye0', 300, 'flour'], ['salt', 9, 'other'], ['bread flour1', 333, 'flour'], ['milk', 100, 'milk'],
     ['egg', 100, 'egg']]],
   {'flour_total': '633',
    'hydration': '25.6',
    'percentages': [['rye0', '47.4'], ['salt', '1.4'], ['bread flour1', '52.6'], ['milk', '15.8'],
                    ['egg', '15.8']]}],
  ['generated control 3',
   [[['salt', 10, 'other'], ['spelt0', 300, 'flour'], ['egg', 100, 'egg'], ['water', 350, 'water']]],
   {'flour_total': '300',
    'hydration': '141.7',
    'percentages': [['salt', '3.3'], ['spelt0', '100.0'], ['egg', '33.3'], ['water', '116.7']]}]],
 [['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 water share',
   [[['bread flour2', 300, 'flour'], ['milk', 120, 'milk'], ['levain', 150, 'starter'],
     ['rye1', 200, 'flour'], ['salt', 11, 'other'], ['bread flour0', 100, 'flour'],
     ['water', 325, 'water']]],
   {'flour_total': '675',
    'hydration': '74.7',
    'percentages': [['bread flour2', '44.4'], ['milk', '17.8'], ['levain', '22.2'], ['rye1', '29.6'],
                    ['salt', '1.6'], ['bread flour0', '14.8'], ['water', '48.1']]}],
  ['repair check: starter water share',
   [[['whole wheat2', 300, 'flour'], ['rye1', 450, 'flour'], ['whole wheat0', 200, 'flour'],
     ['levain', 150, 'starter'], ['salt', 9, 'other']]],
   {'flour_total': '1025',
    'hydration': '7.3',
    'percentages': [['whole wheat2', '29.3'], ['rye1', '43.9'], ['whole wheat0', '19.5'], ['levain', '14.6'],
                    ['salt', '0.9']]}],
  ['generated control 1',
   [[['spelt1', 100, 'flour'], ['water', 200, 'water'], ['spelt0', 100, 'flour'], ['salt', 10, 'other'],
     ['egg', 50, 'egg']]],
   {'flour_total': '200',
    'hydration': '118.8',
    'percentages': [['spelt1', '50.0'], ['water', '100.0'], ['spelt0', '50.0'], ['salt', '5.0'],
                    ['egg', '25.0']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['water', 325, 'water'], ['salt', 11, 'other'],
     ['bread flour1', 200, 'flour'], ['bread flour0', 500, 'flour'], ['milk', 100, 'milk'],
     ['egg', 100, 'egg']]],
   {'flour_total': '730',
    'hydration': '70.8',
    'percentages': [['levain', '8.2'], ['water', '44.5'], ['salt', '1.5'], ['bread flour1', '27.4'],
                    ['bread flour0', '68.5'], ['milk', '13.7'], ['egg', '13.7']]}],
  ['generated control 3',
   [[['egg', 100, 'egg'], ['whole wheat0', 100, 'flour'], ['salt', 11, 'other'], ['water', 325, 'water'],
     ['levain', 60, 'starter'], ['spelt1', 333, 'flour']]],
   {'flour_total': '463',
    'hydration': '92.9',
    'percentages': [['egg', '21.6'], ['whole wheat0', '21.6'], ['salt', '2.4'], ['water', '70.2'],
                    ['levain', '13.0'], ['spelt1', '71.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 water share',
   [[['spelt0', 250, 'flour'], ['levain', 100, 'starter'], ['bread flour1', 333, 'flour'],
     ['water', 350, 'water'], ['spelt2', 333, 'flour'], ['egg', 50, 'egg'], ['milk', 120, 'milk'],
     ['salt', 10, 'other']]],
   {'flour_total': '966',
    'hydration': '56.1',
    'percentages': [['spelt0', '25.9'], ['levain', '10.4'], ['bread flour1', '34.5'], ['water', '36.2'],
                    ['spelt2', '34.5'], ['egg', '5.2'], ['milk', '12.4'], ['salt', '1.0']]}],
  ['repair check: starter water share',
   [[['levain', 100, 'starter'], ['bread flour0', 100, 'flour'], ['salt', 11, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '150',
    'hydration': '250.0',
    'percentages': [['levain', '66.7'], ['bread flour0', '66.7'], ['salt', '7.3'], ['water', '216.7']]}],
  ['generated control 1',
   [[['salt', 11, 'other'], ['milk', 50, 'milk'], ['rye0', 200, 'flour'], ['water', 150, 'water']]],
   {'flour_total': '200',
    'hydration': '96.8',
    'percentages': [['salt', '5.5'], ['milk', '25.0'], ['rye0', '100.0'], ['water', '75.0']]}],
  ['generated control 2',
   [[['whole wheat1', 500, 'flour'], ['whole wheat0', 250, 'flour'], ['egg', 50, 'egg'],
     ['milk', 120, 'milk'], ['salt', 11, 'other'], ['water', 200, 'water']]],
   {'flour_total': '750',
    'hydration': '45.6',
    'percentages': [['whole wheat1', '66.7'], ['whole wheat0', '33.3'], ['egg', '6.7'], ['milk', '16.0'],
                    ['salt', '1.5'], ['water', '26.7']]}],
  ['generated control 3',
   [[['egg', 100, 'egg'], ['milk', 50, 'milk'], ['whole wheat0', 450, 'flour'], ['salt', 9, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '450',
    'hydration': '98.6',
    'percentages': [['egg', '22.2'], ['milk', '11.1'], ['whole wheat0', '100.0'], ['salt', '2.0'],
                    ['water', '72.2']]}]],
 [['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 water share',
   [[['water', 377, 'water'], ['rye0', 100, 'flour'], ['salt', 9, 'other'], ['milk', 100, 'milk'],
     ['bread flour1', 250, 'flour'], ['levain', 60, 'starter']]],
   {'flour_total': '380',
    'hydration': '130.0',
    'percentages': [['water', '99.2'], ['rye0', '26.3'], ['salt', '2.4'], ['milk', '26.3'],
                    ['bread flour1', '65.8'], ['levain', '15.8']]}],
  ['repair check: starter water share',
   [[['rye1', 450, 'flour'], ['whole wheat2', 333, 'flour'], ['egg', 50, 'egg'], ['salt', 11, 'other'],
     ['water', 325, 'water'], ['levain', 60, 'starter'], ['rye0', 333, 'flour']]],
   {'flour_total': '1146',
    'hydration': '34.2',
    'percentages': [['rye1', '39.3'], ['whole wheat2', '29.1'], ['egg', '4.4'], ['salt', '1.0'],
                    ['water', '28.4'], ['levain', '5.2'], ['rye0', '29.1']]}],
  ['generated control 1',
   [[['rye2', 200, 'flour'], ['whole wheat1', 450, 'flour'], ['water', 150, 'water'], ['salt', 9, 'other'],
     ['milk', 50, 'milk'], ['egg', 50, 'egg'], ['levain', 100, 'starter'], ['rye0', 100, 'flour']]],
   {'flour_total': '800',
    'hydration': '35.1',
    'percentages': [['rye2', '25.0'], ['whole wheat1', '56.3'], ['water', '18.8'], ['salt', '1.1'],
                    ['milk', '6.3'], ['egg', '6.3'], ['levain', '12.5'], ['rye0', '12.5']]}],
  ['generated control 2',
   [[['spelt1', 200, 'flour'], ['whole wheat2', 250, 'flour'], ['rye0', 300, 'flour'],
     ['salt', 11, 'other']]],
   {'flour_total': '750',
    'hydration': '0.0',
    'percentages': [['spelt1', '26.7'], ['whole wheat2', '33.3'], ['rye0', '40.0'], ['salt', '1.5']]}],
  ['generated control 3',
   [[['water', 325, 'water'], ['levain', 150, 'starter'], ['salt', 9, 'other'], ['rye0', 250, 'flour']]],
   {'flour_total': '325',
    'hydration': '123.1',
    'percentages': [['water', '100.0'], ['levain', '46.2'], ['salt', '2.8'], ['rye0', '76.9']]}]]]
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: starter water share{'flour_total': '625', 'hydration': '67.3', 'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'], ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}{'flour_total': '625', 'hydration': '79.3', 'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'], ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}Failed
repair check: starter water share{'flour_total': '680', 'hydration': '72.3', 'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'], ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}{'flour_total': '680', 'hydration': '76.8', 'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'], ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}Failed
generated control 1{'flour_total': '650', 'hydration': '59.6', 'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'], ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}{'flour_total': '650', 'hydration': '59.6', 'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'], ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}Passed
generated control 2{'flour_total': '680', 'hydration': '12.8', 'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'], ['spelt1', '66.2']]}{'flour_total': '680', 'hydration': '17.2', 'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'], ['spelt1', '66.2']]}Failed
generated control 3{'flour_total': '575', 'hydration': '63.0', 'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'], ['egg', '8.7']]}{'flour_total': '575', 'hydration': '76.1', 'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'], ['egg', '8.7']]}Failed

SHA-256 / 480663262394857b4c387ef68bd65a6ceb723d9afd5fe969fc0ee52c0783179f

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(87, 100)
        elif r == 'egg':
            water += Fraction(str(g)) * Fraction(3, 4)
        elif r == 'starter':
            water += Fraction(str(g))
    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 water share',
   [[['whole wheat2', 250, 'flour'], ['salt', 9, 'other'], ['levain', 150, 'starter'],
     ['spelt1', 200, 'flour'], ['water', 377, 'water'], ['spelt0', 100, 'flour'], ['milk', 50, 'milk']]],
   {'flour_total': '625',
    'hydration': '79.3',
    'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'],
                    ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}],
  ['repair check: starter water share',
   [[['salt', 9, 'other'], ['levain', 60, 'starter'], ['bread flour1', 200, 'flour'], ['water', 350, 'water'],
     ['rye0', 450, 'flour'], ['milk', 120, 'milk'], ['egg', 50, 'egg']]],
   {'flour_total': '680',
    'hydration': '76.8',
    'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'],
                    ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}],
  ['generated control 1',
   [[['egg', 50, 'egg'], ['bread flour1', 250, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other'],
     ['whole wheat0', 100, 'flour'], ['whole wheat2', 300, 'flour']]],
   {'flour_total': '650',
    'hydration': '59.6',
    'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'],
                    ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['salt', 10, 'other'], ['rye0', 200, 'flour'], ['milk', 100, 'milk'],
     ['spelt1', 450, 'flour']]],
   {'flour_total': '680',
    'hydration': '17.2',
    'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'],
                    ['spelt1', '66.2']]}],
  ['generated control 3',
   [[['levain', 150, 'starter'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat0', 500, 'flour'], ['egg', 50, 'egg']]],
   {'flour_total': '575',
    'hydration': '76.1',
    'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'],
                    ['egg', '8.7']]}]],
 [['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 water share',
   [[['rye2', 450, 'flour'], ['rye0', 100, 'flour'], ['levain', 100, 'starter'], ['water', 325, 'water'],
     ['spelt1', 450, 'flour'], ['salt', 10, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '1050',
    'hydration': '39.3',
    'percentages': [['rye2', '42.9'], ['rye0', '9.5'], ['levain', '9.5'], ['water', '31.0'],
                    ['spelt1', '42.9'], ['salt', '1.0'], ['egg', '4.8']]}],
  ['repair check: starter water share',
   [[['levain', 150, 'starter'], ['rye0', 450, 'flour'], ['salt', 9, 'other'], ['rye1', 500, 'flour'],
     ['water', 325, 'water']]],
   {'flour_total': '1025',
    'hydration': '39.0',
    'percentages': [['levain', '14.6'], ['rye0', '43.9'], ['salt', '0.9'], ['rye1', '48.8'],
                    ['water', '31.7']]}],
  ['generated control 1',
   [[['rye0', 333, 'flour'], ['milk', 100, 'milk'], ['water', 150, 'water'], ['salt', 10, 'other'],
     ['levain', 60, 'starter']]],
   {'flour_total': '363',
    'hydration': '73.6',
    'percentages': [['rye0', '91.7'], ['milk', '27.5'], ['water', '41.3'], ['salt', '2.8'],
                    ['levain', '16.5']]}],
  ['generated control 2',
   [[['rye0', 300, 'flour'], ['salt', 9, 'other'], ['bread flour1', 333, 'flour'], ['milk', 100, 'milk'],
     ['egg', 100, 'egg']]],
   {'flour_total': '633',
    'hydration': '25.6',
    'percentages': [['rye0', '47.4'], ['salt', '1.4'], ['bread flour1', '52.6'], ['milk', '15.8'],
                    ['egg', '15.8']]}],
  ['generated control 3',
   [[['salt', 10, 'other'], ['spelt0', 300, 'flour'], ['egg', 100, 'egg'], ['water', 350, 'water']]],
   {'flour_total': '300',
    'hydration': '141.7',
    'percentages': [['salt', '3.3'], ['spelt0', '100.0'], ['egg', '33.3'], ['water', '116.7']]}]],
 [['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 water share',
   [[['bread flour2', 300, 'flour'], ['milk', 120, 'milk'], ['levain', 150, 'starter'],
     ['rye1', 200, 'flour'], ['salt', 11, 'other'], ['bread flour0', 100, 'flour'],
     ['water', 325, 'water']]],
   {'flour_total': '675',
    'hydration': '74.7',
    'percentages': [['bread flour2', '44.4'], ['milk', '17.8'], ['levain', '22.2'], ['rye1', '29.6'],
                    ['salt', '1.6'], ['bread flour0', '14.8'], ['water', '48.1']]}],
  ['repair check: starter water share',
   [[['whole wheat2', 300, 'flour'], ['rye1', 450, 'flour'], ['whole wheat0', 200, 'flour'],
     ['levain', 150, 'starter'], ['salt', 9, 'other']]],
   {'flour_total': '1025',
    'hydration': '7.3',
    'percentages': [['whole wheat2', '29.3'], ['rye1', '43.9'], ['whole wheat0', '19.5'], ['levain', '14.6'],
                    ['salt', '0.9']]}],
  ['generated control 1',
   [[['spelt1', 100, 'flour'], ['water', 200, 'water'], ['spelt0', 100, 'flour'], ['salt', 10, 'other'],
     ['egg', 50, 'egg']]],
   {'flour_total': '200',
    'hydration': '118.8',
    'percentages': [['spelt1', '50.0'], ['water', '100.0'], ['spelt0', '50.0'], ['salt', '5.0'],
                    ['egg', '25.0']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['water', 325, 'water'], ['salt', 11, 'other'],
     ['bread flour1', 200, 'flour'], ['bread flour0', 500, 'flour'], ['milk', 100, 'milk'],
     ['egg', 100, 'egg']]],
   {'flour_total': '730',
    'hydration': '70.8',
    'percentages': [['levain', '8.2'], ['water', '44.5'], ['salt', '1.5'], ['bread flour1', '27.4'],
                    ['bread flour0', '68.5'], ['milk', '13.7'], ['egg', '13.7']]}],
  ['generated control 3',
   [[['egg', 100, 'egg'], ['whole wheat0', 100, 'flour'], ['salt', 11, 'other'], ['water', 325, 'water'],
     ['levain', 60, 'starter'], ['spelt1', 333, 'flour']]],
   {'flour_total': '463',
    'hydration': '92.9',
    'percentages': [['egg', '21.6'], ['whole wheat0', '21.6'], ['salt', '2.4'], ['water', '70.2'],
                    ['levain', '13.0'], ['spelt1', '71.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 water share',
   [[['spelt0', 250, 'flour'], ['levain', 100, 'starter'], ['bread flour1', 333, 'flour'],
     ['water', 350, 'water'], ['spelt2', 333, 'flour'], ['egg', 50, 'egg'], ['milk', 120, 'milk'],
     ['salt', 10, 'other']]],
   {'flour_total': '966',
    'hydration': '56.1',
    'percentages': [['spelt0', '25.9'], ['levain', '10.4'], ['bread flour1', '34.5'], ['water', '36.2'],
                    ['spelt2', '34.5'], ['egg', '5.2'], ['milk', '12.4'], ['salt', '1.0']]}],
  ['repair check: starter water share',
   [[['levain', 100, 'starter'], ['bread flour0', 100, 'flour'], ['salt', 11, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '150',
    'hydration': '250.0',
    'percentages': [['levain', '66.7'], ['bread flour0', '66.7'], ['salt', '7.3'], ['water', '216.7']]}],
  ['generated control 1',
   [[['salt', 11, 'other'], ['milk', 50, 'milk'], ['rye0', 200, 'flour'], ['water', 150, 'water']]],
   {'flour_total': '200',
    'hydration': '96.8',
    'percentages': [['salt', '5.5'], ['milk', '25.0'], ['rye0', '100.0'], ['water', '75.0']]}],
  ['generated control 2',
   [[['whole wheat1', 500, 'flour'], ['whole wheat0', 250, 'flour'], ['egg', 50, 'egg'],
     ['milk', 120, 'milk'], ['salt', 11, 'other'], ['water', 200, 'water']]],
   {'flour_total': '750',
    'hydration': '45.6',
    'percentages': [['whole wheat1', '66.7'], ['whole wheat0', '33.3'], ['egg', '6.7'], ['milk', '16.0'],
                    ['salt', '1.5'], ['water', '26.7']]}],
  ['generated control 3',
   [[['egg', 100, 'egg'], ['milk', 50, 'milk'], ['whole wheat0', 450, 'flour'], ['salt', 9, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '450',
    'hydration': '98.6',
    'percentages': [['egg', '22.2'], ['milk', '11.1'], ['whole wheat0', '100.0'], ['salt', '2.0'],
                    ['water', '72.2']]}]],
 [['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 water share',
   [[['water', 377, 'water'], ['rye0', 100, 'flour'], ['salt', 9, 'other'], ['milk', 100, 'milk'],
     ['bread flour1', 250, 'flour'], ['levain', 60, 'starter']]],
   {'flour_total': '380',
    'hydration': '130.0',
    'percentages': [['water', '99.2'], ['rye0', '26.3'], ['salt', '2.4'], ['milk', '26.3'],
                    ['bread flour1', '65.8'], ['levain', '15.8']]}],
  ['repair check: starter water share',
   [[['rye1', 450, 'flour'], ['whole wheat2', 333, 'flour'], ['egg', 50, 'egg'], ['salt', 11, 'other'],
     ['water', 325, 'water'], ['levain', 60, 'starter'], ['rye0', 333, 'flour']]],
   {'flour_total': '1146',
    'hydration': '34.2',
    'percentages': [['rye1', '39.3'], ['whole wheat2', '29.1'], ['egg', '4.4'], ['salt', '1.0'],
                    ['water', '28.4'], ['levain', '5.2'], ['rye0', '29.1']]}],
  ['generated control 1',
   [[['rye2', 200, 'flour'], ['whole wheat1', 450, 'flour'], ['water', 150, 'water'], ['salt', 9, 'other'],
     ['milk', 50, 'milk'], ['egg', 50, 'egg'], ['levain', 100, 'starter'], ['rye0', 100, 'flour']]],
   {'flour_total': '800',
    'hydration': '35.1',
    'percentages': [['rye2', '25.0'], ['whole wheat1', '56.3'], ['water', '18.8'], ['salt', '1.1'],
                    ['milk', '6.3'], ['egg', '6.3'], ['levain', '12.5'], ['rye0', '12.5']]}],
  ['generated control 2',
   [[['spelt1', 200, 'flour'], ['whole wheat2', 250, 'flour'], ['rye0', 300, 'flour'],
     ['salt', 11, 'other']]],
   {'flour_total': '750',
    'hydration': '0.0',
    'percentages': [['spelt1', '26.7'], ['whole wheat2', '33.3'], ['rye0', '40.0'], ['salt', '1.5']]}],
  ['generated control 3',
   [[['water', 325, 'water'], ['levain', 150, 'starter'], ['salt', 9, 'other'], ['rye0', 250, 'flour']]],
   {'flour_total': '325',
    'hydration': '123.1',
    'percentages': [['water', '100.0'], ['levain', '46.2'], ['salt', '2.8'], ['rye0', '76.9']]}]]]
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: starter water share{'flour_total': '625', 'hydration': '91.3', 'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'], ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}{'flour_total': '625', 'hydration': '79.3', 'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'], ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}Failed
repair check: starter water share{'flour_total': '680', 'hydration': '81.2', 'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'], ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}{'flour_total': '680', 'hydration': '76.8', 'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'], ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}Failed
generated control 1{'flour_total': '650', 'hydration': '59.6', 'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'], ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}{'flour_total': '650', 'hydration': '59.6', 'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'], ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}Passed
generated control 2{'flour_total': '680', 'hydration': '21.6', 'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'], ['spelt1', '66.2']]}{'flour_total': '680', 'hydration': '17.2', 'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'], ['spelt1', '66.2']]}Failed
generated control 3{'flour_total': '575', 'hydration': '89.1', 'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'], ['egg', '8.7']]}{'flour_total': '575', 'hydration': '76.1', 'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'], ['egg', '8.7']]}Failed

SHA-256 / d5f14e79950bfc7f7bbfbbd6f8486c2054f8f41e4f1343934d7cfc995dd452d4

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 water share',
   [[['whole wheat2', 250, 'flour'], ['salt', 9, 'other'], ['levain', 150, 'starter'],
     ['spelt1', 200, 'flour'], ['water', 377, 'water'], ['spelt0', 100, 'flour'], ['milk', 50, 'milk']]],
   {'flour_total': '625',
    'hydration': '79.3',
    'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'],
                    ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}],
  ['repair check: starter water share',
   [[['salt', 9, 'other'], ['levain', 60, 'starter'], ['bread flour1', 200, 'flour'], ['water', 350, 'water'],
     ['rye0', 450, 'flour'], ['milk', 120, 'milk'], ['egg', 50, 'egg']]],
   {'flour_total': '680',
    'hydration': '76.8',
    'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'],
                    ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}],
  ['generated control 1',
   [[['egg', 50, 'egg'], ['bread flour1', 250, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other'],
     ['whole wheat0', 100, 'flour'], ['whole wheat2', 300, 'flour']]],
   {'flour_total': '650',
    'hydration': '59.6',
    'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'],
                    ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['salt', 10, 'other'], ['rye0', 200, 'flour'], ['milk', 100, 'milk'],
     ['spelt1', 450, 'flour']]],
   {'flour_total': '680',
    'hydration': '17.2',
    'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'],
                    ['spelt1', '66.2']]}],
  ['generated control 3',
   [[['levain', 150, 'starter'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat0', 500, 'flour'], ['egg', 50, 'egg']]],
   {'flour_total': '575',
    'hydration': '76.1',
    'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'],
                    ['egg', '8.7']]}]],
 [['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 water share',
   [[['rye2', 450, 'flour'], ['rye0', 100, 'flour'], ['levain', 100, 'starter'], ['water', 325, 'water'],
     ['spelt1', 450, 'flour'], ['salt', 10, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '1050',
    'hydration': '39.3',
    'percentages': [['rye2', '42.9'], ['rye0', '9.5'], ['levain', '9.5'], ['water', '31.0'],
                    ['spelt1', '42.9'], ['salt', '1.0'], ['egg', '4.8']]}],
  ['repair check: starter water share',
   [[['levain', 150, 'starter'], ['rye0', 450, 'flour'], ['salt', 9, 'other'], ['rye1', 500, 'flour'],
     ['water', 325, 'water']]],
   {'flour_total': '1025',
    'hydration': '39.0',
    'percentages': [['levain', '14.6'], ['rye0', '43.9'], ['salt', '0.9'], ['rye1', '48.8'],
                    ['water', '31.7']]}],
  ['generated control 1',
   [[['rye0', 333, 'flour'], ['milk', 100, 'milk'], ['water', 150, 'water'], ['salt', 10, 'other'],
     ['levain', 60, 'starter']]],
   {'flour_total': '363',
    'hydration': '73.6',
    'percentages': [['rye0', '91.7'], ['milk', '27.5'], ['water', '41.3'], ['salt', '2.8'],
                    ['levain', '16.5']]}],
  ['generated control 2',
   [[['rye0', 300, 'flour'], ['salt', 9, 'other'], ['bread flour1', 333, 'flour'], ['milk', 100, 'milk'],
     ['egg', 100, 'egg']]],
   {'flour_total': '633',
    'hydration': '25.6',
    'percentages': [['rye0', '47.4'], ['salt', '1.4'], ['bread flour1', '52.6'], ['milk', '15.8'],
                    ['egg', '15.8']]}],
  ['generated control 3',
   [[['salt', 10, 'other'], ['spelt0', 300, 'flour'], ['egg', 100, 'egg'], ['water', 350, 'water']]],
   {'flour_total': '300',
    'hydration': '141.7',
    'percentages': [['salt', '3.3'], ['spelt0', '100.0'], ['egg', '33.3'], ['water', '116.7']]}]],
 [['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 water share',
   [[['bread flour2', 300, 'flour'], ['milk', 120, 'milk'], ['levain', 150, 'starter'],
     ['rye1', 200, 'flour'], ['salt', 11, 'other'], ['bread flour0', 100, 'flour'],
     ['water', 325, 'water']]],
   {'flour_total': '675',
    'hydration': '74.7',
    'percentages': [['bread flour2', '44.4'], ['milk', '17.8'], ['levain', '22.2'], ['rye1', '29.6'],
                    ['salt', '1.6'], ['bread flour0', '14.8'], ['water', '48.1']]}],
  ['repair check: starter water share',
   [[['whole wheat2', 300, 'flour'], ['rye1', 450, 'flour'], ['whole wheat0', 200, 'flour'],
     ['levain', 150, 'starter'], ['salt', 9, 'other']]],
   {'flour_total': '1025',
    'hydration': '7.3',
    'percentages': [['whole wheat2', '29.3'], ['rye1', '43.9'], ['whole wheat0', '19.5'], ['levain', '14.6'],
                    ['salt', '0.9']]}],
  ['generated control 1',
   [[['spelt1', 100, 'flour'], ['water', 200, 'water'], ['spelt0', 100, 'flour'], ['salt', 10, 'other'],
     ['egg', 50, 'egg']]],
   {'flour_total': '200',
    'hydration': '118.8',
    'percentages': [['spelt1', '50.0'], ['water', '100.0'], ['spelt0', '50.0'], ['salt', '5.0'],
                    ['egg', '25.0']]}],
  ['generated control 2',
   [[['levain', 60, 'starter'], ['water', 325, 'water'], ['salt', 11, 'other'],
     ['bread flour1', 200, 'flour'], ['bread flour0', 500, 'flour'], ['milk', 100, 'milk'],
     ['egg', 100, 'egg']]],
   {'flour_total': '730',
    'hydration': '70.8',
    'percentages': [['levain', '8.2'], ['water', '44.5'], ['salt', '1.5'], ['bread flour1', '27.4'],
                    ['bread flour0', '68.5'], ['milk', '13.7'], ['egg', '13.7']]}],
  ['generated control 3',
   [[['egg', 100, 'egg'], ['whole wheat0', 100, 'flour'], ['salt', 11, 'other'], ['water', 325, 'water'],
     ['levain', 60, 'starter'], ['spelt1', 333, 'flour']]],
   {'flour_total': '463',
    'hydration': '92.9',
    'percentages': [['egg', '21.6'], ['whole wheat0', '21.6'], ['salt', '2.4'], ['water', '70.2'],
                    ['levain', '13.0'], ['spelt1', '71.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 water share',
   [[['spelt0', 250, 'flour'], ['levain', 100, 'starter'], ['bread flour1', 333, 'flour'],
     ['water', 350, 'water'], ['spelt2', 333, 'flour'], ['egg', 50, 'egg'], ['milk', 120, 'milk'],
     ['salt', 10, 'other']]],
   {'flour_total': '966',
    'hydration': '56.1',
    'percentages': [['spelt0', '25.9'], ['levain', '10.4'], ['bread flour1', '34.5'], ['water', '36.2'],
                    ['spelt2', '34.5'], ['egg', '5.2'], ['milk', '12.4'], ['salt', '1.0']]}],
  ['repair check: starter water share',
   [[['levain', 100, 'starter'], ['bread flour0', 100, 'flour'], ['salt', 11, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '150',
    'hydration': '250.0',
    'percentages': [['levain', '66.7'], ['bread flour0', '66.7'], ['salt', '7.3'], ['water', '216.7']]}],
  ['generated control 1',
   [[['salt', 11, 'other'], ['milk', 50, 'milk'], ['rye0', 200, 'flour'], ['water', 150, 'water']]],
   {'flour_total': '200',
    'hydration': '96.8',
    'percentages': [['salt', '5.5'], ['milk', '25.0'], ['rye0', '100.0'], ['water', '75.0']]}],
  ['generated control 2',
   [[['whole wheat1', 500, 'flour'], ['whole wheat0', 250, 'flour'], ['egg', 50, 'egg'],
     ['milk', 120, 'milk'], ['salt', 11, 'other'], ['water', 200, 'water']]],
   {'flour_total': '750',
    'hydration': '45.6',
    'percentages': [['whole wheat1', '66.7'], ['whole wheat0', '33.3'], ['egg', '6.7'], ['milk', '16.0'],
                    ['salt', '1.5'], ['water', '26.7']]}],
  ['generated control 3',
   [[['egg', 100, 'egg'], ['milk', 50, 'milk'], ['whole wheat0', 450, 'flour'], ['salt', 9, 'other'],
     ['water', 325, 'water']]],
   {'flour_total': '450',
    'hydration': '98.6',
    'percentages': [['egg', '22.2'], ['milk', '11.1'], ['whole wheat0', '100.0'], ['salt', '2.0'],
                    ['water', '72.2']]}]],
 [['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 water share',
   [[['water', 377, 'water'], ['rye0', 100, 'flour'], ['salt', 9, 'other'], ['milk', 100, 'milk'],
     ['bread flour1', 250, 'flour'], ['levain', 60, 'starter']]],
   {'flour_total': '380',
    'hydration': '130.0',
    'percentages': [['water', '99.2'], ['rye0', '26.3'], ['salt', '2.4'], ['milk', '26.3'],
                    ['bread flour1', '65.8'], ['levain', '15.8']]}],
  ['repair check: starter water share',
   [[['rye1', 450, 'flour'], ['whole wheat2', 333, 'flour'], ['egg', 50, 'egg'], ['salt', 11, 'other'],
     ['water', 325, 'water'], ['levain', 60, 'starter'], ['rye0', 333, 'flour']]],
   {'flour_total': '1146',
    'hydration': '34.2',
    'percentages': [['rye1', '39.3'], ['whole wheat2', '29.1'], ['egg', '4.4'], ['salt', '1.0'],
                    ['water', '28.4'], ['levain', '5.2'], ['rye0', '29.1']]}],
  ['generated control 1',
   [[['rye2', 200, 'flour'], ['whole wheat1', 450, 'flour'], ['water', 150, 'water'], ['salt', 9, 'other'],
     ['milk', 50, 'milk'], ['egg', 50, 'egg'], ['levain', 100, 'starter'], ['rye0', 100, 'flour']]],
   {'flour_total': '800',
    'hydration': '35.1',
    'percentages': [['rye2', '25.0'], ['whole wheat1', '56.3'], ['water', '18.8'], ['salt', '1.1'],
                    ['milk', '6.3'], ['egg', '6.3'], ['levain', '12.5'], ['rye0', '12.5']]}],
  ['generated control 2',
   [[['spelt1', 200, 'flour'], ['whole wheat2', 250, 'flour'], ['rye0', 300, 'flour'],
     ['salt', 11, 'other']]],
   {'flour_total': '750',
    'hydration': '0.0',
    'percentages': [['spelt1', '26.7'], ['whole wheat2', '33.3'], ['rye0', '40.0'], ['salt', '1.5']]}],
  ['generated control 3',
   [[['water', 325, 'water'], ['levain', 150, 'starter'], ['salt', 9, 'other'], ['rye0', 250, 'flour']]],
   {'flour_total': '325',
    'hydration': '123.1',
    'percentages': [['water', '100.0'], ['levain', '46.2'], ['salt', '2.8'], ['rye0', '76.9']]}]]]
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: starter water share{'flour_total': '625', 'hydration': '79.3', 'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'], ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}{'flour_total': '625', 'hydration': '79.3', 'percentages': [['whole wheat2', '40.0'], ['salt', '1.4'], ['levain', '24.0'], ['spelt1', '32.0'], ['water', '60.3'], ['spelt0', '16.0'], ['milk', '8.0']]}Passed
repair check: starter water share{'flour_total': '680', 'hydration': '76.8', 'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'], ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}{'flour_total': '680', 'hydration': '76.8', 'percentages': [['salt', '1.3'], ['levain', '8.8'], ['bread flour1', '29.4'], ['water', '51.5'], ['rye0', '66.2'], ['milk', '17.6'], ['egg', '7.4']]}Passed
generated control 1{'flour_total': '650', 'hydration': '59.6', 'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'], ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}{'flour_total': '650', 'hydration': '59.6', 'percentages': [['egg', '7.7'], ['bread flour1', '38.5'], ['water', '53.8'], ['salt', '1.5'], ['whole wheat0', '15.4'], ['whole wheat2', '46.2']]}Passed
generated control 2{'flour_total': '680', 'hydration': '17.2', 'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'], ['spelt1', '66.2']]}{'flour_total': '680', 'hydration': '17.2', 'percentages': [['levain', '8.8'], ['salt', '1.5'], ['rye0', '29.4'], ['milk', '14.7'], ['spelt1', '66.2']]}Passed
generated control 3{'flour_total': '575', 'hydration': '76.1', 'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'], ['egg', '8.7']]}{'flour_total': '575', 'hydration': '76.1', 'percentages': [['levain', '26.1'], ['salt', '1.6'], ['water', '56.5'], ['whole wheat0', '87.0'], ['egg', '8.7']]}Passed

SHA-256 / 4c75cd5f2bb6ffacd39f7e7527c90e763845055ebdf4fa3e3319cb01e7dd7224

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

Case digest / f0282157c5cc6dff16a006a987f097a2bf98b534db6eb289c318d1b92a8605e0