FAILURE MAP
← Case archive

FA-96931 / Recipe scaling and nutrition / Open access

Baker's percentage calculator: multiple flour basis · case 01

A 400 g bread flour + 100 g rye formula reports 87.5% hydration for 350 g water instead of 70%.

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

ROOT CAUSE

Only the first flour row forms the 100% basis instead of the sum of all flours.

VERIFIED REPAIR

Sum every flour row into the basis.

Unsuccessful approach: Using the largest flour row still drops the secondary flours from the basis.

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 = next((Fraction(str(g)) for n, g, r in ingredients if r == 'flour'), Fraction(0)) + 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: multiple flour basis',
   [[['bread flour1', 300, 'flour'], ['water', 350, 'water'], ['spelt2', 450, 'flour'],
     ['bread flour0', 450, 'flour'], ['milk', 100, 'milk'], ['salt', 11, 'other']]],
   {'flour_total': '1200',
    'hydration': '36.4',
    'percentages': [['bread flour1', '25.0'], ['water', '29.2'], ['spelt2', '37.5'], ['bread flour0', '37.5'],
                    ['milk', '8.3'], ['salt', '0.9']]}],
  ['repair check: multiple flour basis',
   [[['spelt1', 100, 'flour'], ['bread flour0', 500, 'flour'], ['levain', 150, 'starter'],
     ['milk', 50, 'milk'], ['water', 325, 'water'], ['salt', 10, 'other'], ['bread flour2', 333, 'flour']]],
   {'flour_total': '1008',
    'hydration': '44.0',
    'percentages': [['spelt1', '9.9'], ['bread flour0', '49.6'], ['levain', '14.9'], ['milk', '5.0'],
                    ['water', '32.2'], ['salt', '1.0'], ['bread flour2', '33.0']]}],
  ['generated control 1',
   [[['milk', 100, 'milk'], ['bread flour0', 500, 'flour'], ['salt', 11, 'other'],
     ['bread flour1', 100, 'flour']]],
   {'flour_total': '600',
    'hydration': '14.5',
    'percentages': [['milk', '16.7'], ['bread flour0', '83.3'], ['salt', '1.8'], ['bread flour1', '16.7']]}],
  ['generated control 2',
   [[['bread flour0', 250, 'flour'], ['egg', 50, 'egg'], ['whole wheat2', 450, 'flour'],
     ['milk', 100, 'milk'], ['bread flour1', 300, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '1000',
    'hydration': '12.5',
    'percentages': [['bread flour0', '25.0'], ['egg', '5.0'], ['whole wheat2', '45.0'], ['milk', '10.0'],
                    ['bread flour1', '30.0'], ['salt', '1.1']]}],
  ['generated control 3',
   [[['water', 200, 'water'], ['salt', 9, 'other'], ['bread flour0', 250, 'flour'], ['egg', 50, 'egg']]],
   {'flour_total': '250',
    'hydration': '95.0',
    'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}]],
 [['no flour', [[['water', 100, 'water']]], 'error: no flour'],
  ['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
   {'flour_total': '400',
    'hydration': '62.3',
    'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
  ['two flours with levain',
   [[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
   {'flour_total': '550',
    'hydration': '69.1',
    'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
  ['regression: multiple flour basis',
   [[['spelt2', 200, 'flour'], ['bread flour1', 450, 'flour'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat0', 500, 'flour'], ['milk', 120, 'milk']]],
   {'flour_total': '1150',
    'hydration': '37.3',
    'percentages': [['spelt2', '17.4'], ['bread flour1', '39.1'], ['salt', '0.8'], ['water', '28.3'],
                    ['whole wheat0', '43.5'], ['milk', '10.4']]}],
  ['repair check: multiple flour basis',
   [[['levain', 100, 'starter'], ['bread flour0', 100, 'flour'], ['salt', 10, 'other'],
     ['rye1', 300, 'flour']]],
   {'flour_total': '450',
    'hydration': '11.1',
    'percentages': [['levain', '22.2'], ['bread flour0', '22.2'], ['salt', '2.2'], ['rye1', '66.7']]}],
  ['generated control 1',
   [[['water', 325, 'water'], ['egg', 100, 'egg'], ['salt', 10, 'other'], ['whole wheat0', 250, 'flour'],
     ['whole wheat1', 250, 'flour']]],
   {'flour_total': '500',
    'hydration': '80.0',
    'percentages': [['water', '65.0'], ['egg', '20.0'], ['salt', '2.0'], ['whole wheat0', '50.0'],
                    ['whole wheat1', '50.0']]}],
  ['generated control 2',
   [[['whole wheat0', 450, 'flour'], ['whole wheat2', 100, 'flour'], ['water', 325, 'water'],
     ['bread flour1', 450, 'flour'], ['salt', 10, 'other']]],
   {'flour_total': '1000',
    'hydration': '32.5',
    'percentages': [['whole wheat0', '45.0'], ['whole wheat2', '10.0'], ['water', '32.5'],
                    ['bread flour1', '45.0'], ['salt', '1.0']]}],
  ['generated control 3',
   [[['levain', 60, 'starter'], ['egg', 100, 'egg'], ['rye2', 100, 'flour'], ['milk', 50, 'milk'],
     ['spelt0', 200, 'flour'], ['bread flour1', 100, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '430',
    'hydration': '34.5',
    'percentages': [['levain', '14.0'], ['egg', '23.3'], ['rye2', '23.3'], ['milk', '11.6'],
                    ['spelt0', '46.5'], ['bread flour1', '23.3'], ['salt', '2.6']]}]],
 [['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: multiple flour basis',
   [[['whole wheat1', 300, 'flour'], ['bread flour0', 333, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '633',
    'hydration': '0.0',
    'percentages': [['whole wheat1', '47.4'], ['bread flour0', '52.6'], ['salt', '1.7']]}],
  ['repair check: multiple flour basis',
   [[['bread flour1', 450, 'flour'], ['salt', 9, 'other'], ['whole wheat2', 100, 'flour'],
     ['bread flour0', 450, 'flour'], ['milk', 120, 'milk']]],
   {'flour_total': '1000',
    'hydration': '10.4',
    'percentages': [['bread flour1', '45.0'], ['salt', '0.9'], ['whole wheat2', '10.0'],
                    ['bread flour0', '45.0'], ['milk', '12.0']]}],
  ['generated control 1',
   [[['spelt0', 100, 'flour'], ['spelt1', 450, 'flour'], ['rye2', 450, 'flour'], ['levain', 100, 'starter'],
     ['egg', 100, 'egg'], ['salt', 10, 'other'], ['water', 350, 'water'], ['milk', 100, 'milk']]],
   {'flour_total': '1050',
    'hydration': '53.5',
    'percentages': [['spelt0', '9.5'], ['spelt1', '42.9'], ['rye2', '42.9'], ['levain', '9.5'],
                    ['egg', '9.5'], ['salt', '1.0'], ['water', '33.3'], ['milk', '9.5']]}],
  ['generated control 2',
   [[['spelt1', 300, 'flour'], ['water', 200, 'water'], ['rye0', 450, 'flour'], ['egg', 50, 'egg'],
     ['salt', 9, 'other']]],
   {'flour_total': '750',
    'hydration': '31.7',
    'percentages': [['spelt1', '40.0'], ['water', '26.7'], ['rye0', '60.0'], ['egg', '6.7'],
                    ['salt', '1.2']]}],
  ['generated control 3',
   [[['spelt2', 333, 'flour'], ['rye0', 200, 'flour'], ['water', 377, 'water'],
     ['whole wheat1', 250, 'flour'], ['levain', 100, 'starter'], ['milk', 100, 'milk'],
     ['salt', 11, 'other']]],
   {'flour_total': '833',
    'hydration': '61.7',
    'percentages': [['spelt2', '40.0'], ['rye0', '24.0'], ['water', '45.3'], ['whole wheat1', '30.0'],
                    ['levain', '12.0'], ['milk', '12.0'], ['salt', '1.3']]}]],
 [['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: multiple flour basis',
   [[['whole wheat2', 250, 'flour'], ['whole wheat0', 250, 'flour'], ['salt', 9, 'other'],
     ['spelt1', 250, 'flour'], ['water', 325, 'water'], ['levain', 150, 'starter']]],
   {'flour_total': '825',
    'hydration': '48.5',
    'percentages': [['whole wheat2', '30.3'], ['whole wheat0', '30.3'], ['salt', '1.1'], ['spelt1', '30.3'],
                    ['water', '39.4'], ['levain', '18.2']]}],
  ['repair check: multiple flour basis',
   [[['rye0', 450, 'flour'], ['salt', 10, 'other'], ['water', 325, 'water'], ['rye2', 200, 'flour'],
     ['spelt1', 200, 'flour']]],
   {'flour_total': '850',
    'hydration': '38.2',
    'percentages': [['rye0', '52.9'], ['salt', '1.2'], ['water', '38.2'], ['rye2', '23.5'],
                    ['spelt1', '23.5']]}],
  ['generated control 1',
   [[['whole wheat2', 300, 'flour'], ['water', 350, 'water'], ['whole wheat1', 500, 'flour'],
     ['salt', 10, 'other'], ['milk', 50, 'milk'], ['whole wheat0', 300, 'flour']]],
   {'flour_total': '1100',
    'hydration': '35.8',
    'percentages': [['whole wheat2', '27.3'], ['water', '31.8'], ['whole wheat1', '45.5'], ['salt', '0.9'],
                    ['milk', '4.5'], ['whole wheat0', '27.3']]}],
  ['generated control 2',
   [[['egg', 50, 'egg'], ['spelt0', 200, 'flour'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat1', 500, 'flour'], ['levain', 150, 'starter']]],
   {'flour_total': '775',
    'hydration': '56.5',
    'percentages': [['egg', '6.5'], ['spelt0', '25.8'], ['salt', '1.2'], ['water', '41.9'],
                    ['whole wheat1', '64.5'], ['levain', '19.4']]}],
  ['generated control 3',
   [[['levain', 60, 'starter'], ['bread flour1', 333, 'flour'], ['whole wheat0', 100, 'flour'],
     ['salt', 9, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '463',
    'hydration': '14.6',
    'percentages': [['levain', '13.0'], ['bread flour1', '71.9'], ['whole wheat0', '21.6'], ['salt', '1.9'],
                    ['egg', '10.8']]}]],
 [['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: multiple flour basis',
   [[['egg', 100, 'egg'], ['salt', 11, 'other'], ['rye1', 333, 'flour'], ['levain', 60, 'starter'],
     ['whole wheat0', 100, 'flour']]],
   {'flour_total': '463',
    'hydration': '22.7',
    'percentages': [['egg', '21.6'], ['salt', '2.4'], ['rye1', '71.9'], ['levain', '13.0'],
                    ['whole wheat0', '21.6']]}],
  ['repair check: multiple flour basis',
   [[['whole wheat1', 200, 'flour'], ['rye0', 200, 'flour'], ['salt', 11, 'other'], ['milk', 100, 'milk']]],
   {'flour_total': '400',
    'hydration': '21.8',
    'percentages': [['whole wheat1', '50.0'], ['rye0', '50.0'], ['salt', '2.8'], ['milk', '25.0']]}],
  ['generated control 1', [[['salt', 11, 'other'], ['bread flour0', 500, 'flour'], ['water', 350, 'water']]],
   {'flour_total': '500',
    'hydration': '70.0',
    'percentages': [['salt', '2.2'], ['bread flour0', '100.0'], ['water', '70.0']]}],
  ['generated control 2', [[['spelt0', 300, 'flour'], ['salt', 9, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '300',
    'hydration': '12.5',
    'percentages': [['spelt0', '100.0'], ['salt', '3.0'], ['egg', '16.7']]}],
  ['generated control 3',
   [[['whole wheat1', 300, 'flour'], ['salt', 9, 'other'], ['rye2', 450, 'flour'], ['levain', 100, 'starter'],
     ['whole wheat0', 333, 'flour']]],
   {'flour_total': '1133',
    'hydration': '4.4',
    'percentages': [['whole wheat1', '26.5'], ['salt', '0.8'], ['rye2', '39.7'], ['levain', '8.8'],
                    ['whole wheat0', '29.4']]}]]]
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: multiple flour basis{'flour_total': '300', 'hydration': '145.7', 'percentages': [['bread flour1', '100.0'], ['water', '116.7'], ['spelt2', '150.0'], ['bread flour0', '150.0'], ['milk', '33.3'], ['salt', '3.7']]}{'flour_total': '1200', 'hydration': '36.4', 'percentages': [['bread flour1', '25.0'], ['water', '29.2'], ['spelt2', '37.5'], ['bread flour0', '37.5'], ['milk', '8.3'], ['salt', '0.9']]}Failed
repair check: multiple flour basis{'flour_total': '175', 'hydration': '253.4', 'percentages': [['spelt1', '57.1'], ['bread flour0', '285.7'], ['levain', '85.7'], ['milk', '28.6'], ['water', '185.7'], ['salt', '5.7'], ['bread flour2', '190.3']]}{'flour_total': '1008', 'hydration': '44.0', 'percentages': [['spelt1', '9.9'], ['bread flour0', '49.6'], ['levain', '14.9'], ['milk', '5.0'], ['water', '32.2'], ['salt', '1.0'], ['bread flour2', '33.0']]}Failed
generated control 1{'flour_total': '500', 'hydration': '17.4', 'percentages': [['milk', '20.0'], ['bread flour0', '100.0'], ['salt', '2.2'], ['bread flour1', '20.0']]}{'flour_total': '600', 'hydration': '14.5', 'percentages': [['milk', '16.7'], ['bread flour0', '83.3'], ['salt', '1.8'], ['bread flour1', '16.7']]}Failed
generated control 2{'flour_total': '250', 'hydration': '49.8', 'percentages': [['bread flour0', '100.0'], ['egg', '20.0'], ['whole wheat2', '180.0'], ['milk', '40.0'], ['bread flour1', '120.0'], ['salt', '4.4']]}{'flour_total': '1000', 'hydration': '12.5', 'percentages': [['bread flour0', '25.0'], ['egg', '5.0'], ['whole wheat2', '45.0'], ['milk', '10.0'], ['bread flour1', '30.0'], ['salt', '1.1']]}Failed
generated control 3{'flour_total': '250', 'hydration': '95.0', 'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}{'flour_total': '250', 'hydration': '95.0', 'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}Passed

SHA-256 / 25c84a113561100c8a82496eb37b0f036c8e17f3a34c7b15217ff21f9f805934

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 = max((Fraction(str(g)) for n, g, r in ingredients if r == 'flour'), default=Fraction(0)) + 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: multiple flour basis',
   [[['bread flour1', 300, 'flour'], ['water', 350, 'water'], ['spelt2', 450, 'flour'],
     ['bread flour0', 450, 'flour'], ['milk', 100, 'milk'], ['salt', 11, 'other']]],
   {'flour_total': '1200',
    'hydration': '36.4',
    'percentages': [['bread flour1', '25.0'], ['water', '29.2'], ['spelt2', '37.5'], ['bread flour0', '37.5'],
                    ['milk', '8.3'], ['salt', '0.9']]}],
  ['repair check: multiple flour basis',
   [[['spelt1', 100, 'flour'], ['bread flour0', 500, 'flour'], ['levain', 150, 'starter'],
     ['milk', 50, 'milk'], ['water', 325, 'water'], ['salt', 10, 'other'], ['bread flour2', 333, 'flour']]],
   {'flour_total': '1008',
    'hydration': '44.0',
    'percentages': [['spelt1', '9.9'], ['bread flour0', '49.6'], ['levain', '14.9'], ['milk', '5.0'],
                    ['water', '32.2'], ['salt', '1.0'], ['bread flour2', '33.0']]}],
  ['generated control 1',
   [[['milk', 100, 'milk'], ['bread flour0', 500, 'flour'], ['salt', 11, 'other'],
     ['bread flour1', 100, 'flour']]],
   {'flour_total': '600',
    'hydration': '14.5',
    'percentages': [['milk', '16.7'], ['bread flour0', '83.3'], ['salt', '1.8'], ['bread flour1', '16.7']]}],
  ['generated control 2',
   [[['bread flour0', 250, 'flour'], ['egg', 50, 'egg'], ['whole wheat2', 450, 'flour'],
     ['milk', 100, 'milk'], ['bread flour1', 300, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '1000',
    'hydration': '12.5',
    'percentages': [['bread flour0', '25.0'], ['egg', '5.0'], ['whole wheat2', '45.0'], ['milk', '10.0'],
                    ['bread flour1', '30.0'], ['salt', '1.1']]}],
  ['generated control 3',
   [[['water', 200, 'water'], ['salt', 9, 'other'], ['bread flour0', 250, 'flour'], ['egg', 50, 'egg']]],
   {'flour_total': '250',
    'hydration': '95.0',
    'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}]],
 [['no flour', [[['water', 100, 'water']]], 'error: no flour'],
  ['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
   {'flour_total': '400',
    'hydration': '62.3',
    'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
  ['two flours with levain',
   [[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
   {'flour_total': '550',
    'hydration': '69.1',
    'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
  ['regression: multiple flour basis',
   [[['spelt2', 200, 'flour'], ['bread flour1', 450, 'flour'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat0', 500, 'flour'], ['milk', 120, 'milk']]],
   {'flour_total': '1150',
    'hydration': '37.3',
    'percentages': [['spelt2', '17.4'], ['bread flour1', '39.1'], ['salt', '0.8'], ['water', '28.3'],
                    ['whole wheat0', '43.5'], ['milk', '10.4']]}],
  ['repair check: multiple flour basis',
   [[['levain', 100, 'starter'], ['bread flour0', 100, 'flour'], ['salt', 10, 'other'],
     ['rye1', 300, 'flour']]],
   {'flour_total': '450',
    'hydration': '11.1',
    'percentages': [['levain', '22.2'], ['bread flour0', '22.2'], ['salt', '2.2'], ['rye1', '66.7']]}],
  ['generated control 1',
   [[['water', 325, 'water'], ['egg', 100, 'egg'], ['salt', 10, 'other'], ['whole wheat0', 250, 'flour'],
     ['whole wheat1', 250, 'flour']]],
   {'flour_total': '500',
    'hydration': '80.0',
    'percentages': [['water', '65.0'], ['egg', '20.0'], ['salt', '2.0'], ['whole wheat0', '50.0'],
                    ['whole wheat1', '50.0']]}],
  ['generated control 2',
   [[['whole wheat0', 450, 'flour'], ['whole wheat2', 100, 'flour'], ['water', 325, 'water'],
     ['bread flour1', 450, 'flour'], ['salt', 10, 'other']]],
   {'flour_total': '1000',
    'hydration': '32.5',
    'percentages': [['whole wheat0', '45.0'], ['whole wheat2', '10.0'], ['water', '32.5'],
                    ['bread flour1', '45.0'], ['salt', '1.0']]}],
  ['generated control 3',
   [[['levain', 60, 'starter'], ['egg', 100, 'egg'], ['rye2', 100, 'flour'], ['milk', 50, 'milk'],
     ['spelt0', 200, 'flour'], ['bread flour1', 100, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '430',
    'hydration': '34.5',
    'percentages': [['levain', '14.0'], ['egg', '23.3'], ['rye2', '23.3'], ['milk', '11.6'],
                    ['spelt0', '46.5'], ['bread flour1', '23.3'], ['salt', '2.6']]}]],
 [['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: multiple flour basis',
   [[['whole wheat1', 300, 'flour'], ['bread flour0', 333, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '633',
    'hydration': '0.0',
    'percentages': [['whole wheat1', '47.4'], ['bread flour0', '52.6'], ['salt', '1.7']]}],
  ['repair check: multiple flour basis',
   [[['bread flour1', 450, 'flour'], ['salt', 9, 'other'], ['whole wheat2', 100, 'flour'],
     ['bread flour0', 450, 'flour'], ['milk', 120, 'milk']]],
   {'flour_total': '1000',
    'hydration': '10.4',
    'percentages': [['bread flour1', '45.0'], ['salt', '0.9'], ['whole wheat2', '10.0'],
                    ['bread flour0', '45.0'], ['milk', '12.0']]}],
  ['generated control 1',
   [[['spelt0', 100, 'flour'], ['spelt1', 450, 'flour'], ['rye2', 450, 'flour'], ['levain', 100, 'starter'],
     ['egg', 100, 'egg'], ['salt', 10, 'other'], ['water', 350, 'water'], ['milk', 100, 'milk']]],
   {'flour_total': '1050',
    'hydration': '53.5',
    'percentages': [['spelt0', '9.5'], ['spelt1', '42.9'], ['rye2', '42.9'], ['levain', '9.5'],
                    ['egg', '9.5'], ['salt', '1.0'], ['water', '33.3'], ['milk', '9.5']]}],
  ['generated control 2',
   [[['spelt1', 300, 'flour'], ['water', 200, 'water'], ['rye0', 450, 'flour'], ['egg', 50, 'egg'],
     ['salt', 9, 'other']]],
   {'flour_total': '750',
    'hydration': '31.7',
    'percentages': [['spelt1', '40.0'], ['water', '26.7'], ['rye0', '60.0'], ['egg', '6.7'],
                    ['salt', '1.2']]}],
  ['generated control 3',
   [[['spelt2', 333, 'flour'], ['rye0', 200, 'flour'], ['water', 377, 'water'],
     ['whole wheat1', 250, 'flour'], ['levain', 100, 'starter'], ['milk', 100, 'milk'],
     ['salt', 11, 'other']]],
   {'flour_total': '833',
    'hydration': '61.7',
    'percentages': [['spelt2', '40.0'], ['rye0', '24.0'], ['water', '45.3'], ['whole wheat1', '30.0'],
                    ['levain', '12.0'], ['milk', '12.0'], ['salt', '1.3']]}]],
 [['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: multiple flour basis',
   [[['whole wheat2', 250, 'flour'], ['whole wheat0', 250, 'flour'], ['salt', 9, 'other'],
     ['spelt1', 250, 'flour'], ['water', 325, 'water'], ['levain', 150, 'starter']]],
   {'flour_total': '825',
    'hydration': '48.5',
    'percentages': [['whole wheat2', '30.3'], ['whole wheat0', '30.3'], ['salt', '1.1'], ['spelt1', '30.3'],
                    ['water', '39.4'], ['levain', '18.2']]}],
  ['repair check: multiple flour basis',
   [[['rye0', 450, 'flour'], ['salt', 10, 'other'], ['water', 325, 'water'], ['rye2', 200, 'flour'],
     ['spelt1', 200, 'flour']]],
   {'flour_total': '850',
    'hydration': '38.2',
    'percentages': [['rye0', '52.9'], ['salt', '1.2'], ['water', '38.2'], ['rye2', '23.5'],
                    ['spelt1', '23.5']]}],
  ['generated control 1',
   [[['whole wheat2', 300, 'flour'], ['water', 350, 'water'], ['whole wheat1', 500, 'flour'],
     ['salt', 10, 'other'], ['milk', 50, 'milk'], ['whole wheat0', 300, 'flour']]],
   {'flour_total': '1100',
    'hydration': '35.8',
    'percentages': [['whole wheat2', '27.3'], ['water', '31.8'], ['whole wheat1', '45.5'], ['salt', '0.9'],
                    ['milk', '4.5'], ['whole wheat0', '27.3']]}],
  ['generated control 2',
   [[['egg', 50, 'egg'], ['spelt0', 200, 'flour'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat1', 500, 'flour'], ['levain', 150, 'starter']]],
   {'flour_total': '775',
    'hydration': '56.5',
    'percentages': [['egg', '6.5'], ['spelt0', '25.8'], ['salt', '1.2'], ['water', '41.9'],
                    ['whole wheat1', '64.5'], ['levain', '19.4']]}],
  ['generated control 3',
   [[['levain', 60, 'starter'], ['bread flour1', 333, 'flour'], ['whole wheat0', 100, 'flour'],
     ['salt', 9, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '463',
    'hydration': '14.6',
    'percentages': [['levain', '13.0'], ['bread flour1', '71.9'], ['whole wheat0', '21.6'], ['salt', '1.9'],
                    ['egg', '10.8']]}]],
 [['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: multiple flour basis',
   [[['egg', 100, 'egg'], ['salt', 11, 'other'], ['rye1', 333, 'flour'], ['levain', 60, 'starter'],
     ['whole wheat0', 100, 'flour']]],
   {'flour_total': '463',
    'hydration': '22.7',
    'percentages': [['egg', '21.6'], ['salt', '2.4'], ['rye1', '71.9'], ['levain', '13.0'],
                    ['whole wheat0', '21.6']]}],
  ['repair check: multiple flour basis',
   [[['whole wheat1', 200, 'flour'], ['rye0', 200, 'flour'], ['salt', 11, 'other'], ['milk', 100, 'milk']]],
   {'flour_total': '400',
    'hydration': '21.8',
    'percentages': [['whole wheat1', '50.0'], ['rye0', '50.0'], ['salt', '2.8'], ['milk', '25.0']]}],
  ['generated control 1', [[['salt', 11, 'other'], ['bread flour0', 500, 'flour'], ['water', 350, 'water']]],
   {'flour_total': '500',
    'hydration': '70.0',
    'percentages': [['salt', '2.2'], ['bread flour0', '100.0'], ['water', '70.0']]}],
  ['generated control 2', [[['spelt0', 300, 'flour'], ['salt', 9, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '300',
    'hydration': '12.5',
    'percentages': [['spelt0', '100.0'], ['salt', '3.0'], ['egg', '16.7']]}],
  ['generated control 3',
   [[['whole wheat1', 300, 'flour'], ['salt', 9, 'other'], ['rye2', 450, 'flour'], ['levain', 100, 'starter'],
     ['whole wheat0', 333, 'flour']]],
   {'flour_total': '1133',
    'hydration': '4.4',
    'percentages': [['whole wheat1', '26.5'], ['salt', '0.8'], ['rye2', '39.7'], ['levain', '8.8'],
                    ['whole wheat0', '29.4']]}]]]
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: multiple flour basis{'flour_total': '450', 'hydration': '97.1', 'percentages': [['bread flour1', '66.7'], ['water', '77.8'], ['spelt2', '100.0'], ['bread flour0', '100.0'], ['milk', '22.2'], ['salt', '2.4']]}{'flour_total': '1200', 'hydration': '36.4', 'percentages': [['bread flour1', '25.0'], ['water', '29.2'], ['spelt2', '37.5'], ['bread flour0', '37.5'], ['milk', '8.3'], ['salt', '0.9']]}Failed
repair check: multiple flour basis{'flour_total': '575', 'hydration': '77.1', 'percentages': [['spelt1', '17.4'], ['bread flour0', '87.0'], ['levain', '26.1'], ['milk', '8.7'], ['water', '56.5'], ['salt', '1.7'], ['bread flour2', '57.9']]}{'flour_total': '1008', 'hydration': '44.0', 'percentages': [['spelt1', '9.9'], ['bread flour0', '49.6'], ['levain', '14.9'], ['milk', '5.0'], ['water', '32.2'], ['salt', '1.0'], ['bread flour2', '33.0']]}Failed
generated control 1{'flour_total': '500', 'hydration': '17.4', 'percentages': [['milk', '20.0'], ['bread flour0', '100.0'], ['salt', '2.2'], ['bread flour1', '20.0']]}{'flour_total': '600', 'hydration': '14.5', 'percentages': [['milk', '16.7'], ['bread flour0', '83.3'], ['salt', '1.8'], ['bread flour1', '16.7']]}Failed
generated control 2{'flour_total': '450', 'hydration': '27.7', 'percentages': [['bread flour0', '55.6'], ['egg', '11.1'], ['whole wheat2', '100.0'], ['milk', '22.2'], ['bread flour1', '66.7'], ['salt', '2.4']]}{'flour_total': '1000', 'hydration': '12.5', 'percentages': [['bread flour0', '25.0'], ['egg', '5.0'], ['whole wheat2', '45.0'], ['milk', '10.0'], ['bread flour1', '30.0'], ['salt', '1.1']]}Failed
generated control 3{'flour_total': '250', 'hydration': '95.0', 'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}{'flour_total': '250', 'hydration': '95.0', 'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}Passed

SHA-256 / f7206a0b7c0dc3024c7451ebaa7de9f7c4d87f2866c197518ac54d2759353f62

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: multiple flour basis',
   [[['bread flour1', 300, 'flour'], ['water', 350, 'water'], ['spelt2', 450, 'flour'],
     ['bread flour0', 450, 'flour'], ['milk', 100, 'milk'], ['salt', 11, 'other']]],
   {'flour_total': '1200',
    'hydration': '36.4',
    'percentages': [['bread flour1', '25.0'], ['water', '29.2'], ['spelt2', '37.5'], ['bread flour0', '37.5'],
                    ['milk', '8.3'], ['salt', '0.9']]}],
  ['repair check: multiple flour basis',
   [[['spelt1', 100, 'flour'], ['bread flour0', 500, 'flour'], ['levain', 150, 'starter'],
     ['milk', 50, 'milk'], ['water', 325, 'water'], ['salt', 10, 'other'], ['bread flour2', 333, 'flour']]],
   {'flour_total': '1008',
    'hydration': '44.0',
    'percentages': [['spelt1', '9.9'], ['bread flour0', '49.6'], ['levain', '14.9'], ['milk', '5.0'],
                    ['water', '32.2'], ['salt', '1.0'], ['bread flour2', '33.0']]}],
  ['generated control 1',
   [[['milk', 100, 'milk'], ['bread flour0', 500, 'flour'], ['salt', 11, 'other'],
     ['bread flour1', 100, 'flour']]],
   {'flour_total': '600',
    'hydration': '14.5',
    'percentages': [['milk', '16.7'], ['bread flour0', '83.3'], ['salt', '1.8'], ['bread flour1', '16.7']]}],
  ['generated control 2',
   [[['bread flour0', 250, 'flour'], ['egg', 50, 'egg'], ['whole wheat2', 450, 'flour'],
     ['milk', 100, 'milk'], ['bread flour1', 300, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '1000',
    'hydration': '12.5',
    'percentages': [['bread flour0', '25.0'], ['egg', '5.0'], ['whole wheat2', '45.0'], ['milk', '10.0'],
                    ['bread flour1', '30.0'], ['salt', '1.1']]}],
  ['generated control 3',
   [[['water', 200, 'water'], ['salt', 9, 'other'], ['bread flour0', 250, 'flour'], ['egg', 50, 'egg']]],
   {'flour_total': '250',
    'hydration': '95.0',
    'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}]],
 [['no flour', [[['water', 100, 'water']]], 'error: no flour'],
  ['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
   {'flour_total': '400',
    'hydration': '62.3',
    'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
  ['two flours with levain',
   [[['bread', 400, 'flour'], ['rye', 100, 'flour'], ['levain', 100, 'starter'], ['water', 330, 'water']]],
   {'flour_total': '550',
    'hydration': '69.1',
    'percentages': [['bread', '72.7'], ['rye', '18.2'], ['levain', '18.2'], ['water', '60.0']]}],
  ['regression: multiple flour basis',
   [[['spelt2', 200, 'flour'], ['bread flour1', 450, 'flour'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat0', 500, 'flour'], ['milk', 120, 'milk']]],
   {'flour_total': '1150',
    'hydration': '37.3',
    'percentages': [['spelt2', '17.4'], ['bread flour1', '39.1'], ['salt', '0.8'], ['water', '28.3'],
                    ['whole wheat0', '43.5'], ['milk', '10.4']]}],
  ['repair check: multiple flour basis',
   [[['levain', 100, 'starter'], ['bread flour0', 100, 'flour'], ['salt', 10, 'other'],
     ['rye1', 300, 'flour']]],
   {'flour_total': '450',
    'hydration': '11.1',
    'percentages': [['levain', '22.2'], ['bread flour0', '22.2'], ['salt', '2.2'], ['rye1', '66.7']]}],
  ['generated control 1',
   [[['water', 325, 'water'], ['egg', 100, 'egg'], ['salt', 10, 'other'], ['whole wheat0', 250, 'flour'],
     ['whole wheat1', 250, 'flour']]],
   {'flour_total': '500',
    'hydration': '80.0',
    'percentages': [['water', '65.0'], ['egg', '20.0'], ['salt', '2.0'], ['whole wheat0', '50.0'],
                    ['whole wheat1', '50.0']]}],
  ['generated control 2',
   [[['whole wheat0', 450, 'flour'], ['whole wheat2', 100, 'flour'], ['water', 325, 'water'],
     ['bread flour1', 450, 'flour'], ['salt', 10, 'other']]],
   {'flour_total': '1000',
    'hydration': '32.5',
    'percentages': [['whole wheat0', '45.0'], ['whole wheat2', '10.0'], ['water', '32.5'],
                    ['bread flour1', '45.0'], ['salt', '1.0']]}],
  ['generated control 3',
   [[['levain', 60, 'starter'], ['egg', 100, 'egg'], ['rye2', 100, 'flour'], ['milk', 50, 'milk'],
     ['spelt0', 200, 'flour'], ['bread flour1', 100, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '430',
    'hydration': '34.5',
    'percentages': [['levain', '14.0'], ['egg', '23.3'], ['rye2', '23.3'], ['milk', '11.6'],
                    ['spelt0', '46.5'], ['bread flour1', '23.3'], ['salt', '2.6']]}]],
 [['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: multiple flour basis',
   [[['whole wheat1', 300, 'flour'], ['bread flour0', 333, 'flour'], ['salt', 11, 'other']]],
   {'flour_total': '633',
    'hydration': '0.0',
    'percentages': [['whole wheat1', '47.4'], ['bread flour0', '52.6'], ['salt', '1.7']]}],
  ['repair check: multiple flour basis',
   [[['bread flour1', 450, 'flour'], ['salt', 9, 'other'], ['whole wheat2', 100, 'flour'],
     ['bread flour0', 450, 'flour'], ['milk', 120, 'milk']]],
   {'flour_total': '1000',
    'hydration': '10.4',
    'percentages': [['bread flour1', '45.0'], ['salt', '0.9'], ['whole wheat2', '10.0'],
                    ['bread flour0', '45.0'], ['milk', '12.0']]}],
  ['generated control 1',
   [[['spelt0', 100, 'flour'], ['spelt1', 450, 'flour'], ['rye2', 450, 'flour'], ['levain', 100, 'starter'],
     ['egg', 100, 'egg'], ['salt', 10, 'other'], ['water', 350, 'water'], ['milk', 100, 'milk']]],
   {'flour_total': '1050',
    'hydration': '53.5',
    'percentages': [['spelt0', '9.5'], ['spelt1', '42.9'], ['rye2', '42.9'], ['levain', '9.5'],
                    ['egg', '9.5'], ['salt', '1.0'], ['water', '33.3'], ['milk', '9.5']]}],
  ['generated control 2',
   [[['spelt1', 300, 'flour'], ['water', 200, 'water'], ['rye0', 450, 'flour'], ['egg', 50, 'egg'],
     ['salt', 9, 'other']]],
   {'flour_total': '750',
    'hydration': '31.7',
    'percentages': [['spelt1', '40.0'], ['water', '26.7'], ['rye0', '60.0'], ['egg', '6.7'],
                    ['salt', '1.2']]}],
  ['generated control 3',
   [[['spelt2', 333, 'flour'], ['rye0', 200, 'flour'], ['water', 377, 'water'],
     ['whole wheat1', 250, 'flour'], ['levain', 100, 'starter'], ['milk', 100, 'milk'],
     ['salt', 11, 'other']]],
   {'flour_total': '833',
    'hydration': '61.7',
    'percentages': [['spelt2', '40.0'], ['rye0', '24.0'], ['water', '45.3'], ['whole wheat1', '30.0'],
                    ['levain', '12.0'], ['milk', '12.0'], ['salt', '1.3']]}]],
 [['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: multiple flour basis',
   [[['whole wheat2', 250, 'flour'], ['whole wheat0', 250, 'flour'], ['salt', 9, 'other'],
     ['spelt1', 250, 'flour'], ['water', 325, 'water'], ['levain', 150, 'starter']]],
   {'flour_total': '825',
    'hydration': '48.5',
    'percentages': [['whole wheat2', '30.3'], ['whole wheat0', '30.3'], ['salt', '1.1'], ['spelt1', '30.3'],
                    ['water', '39.4'], ['levain', '18.2']]}],
  ['repair check: multiple flour basis',
   [[['rye0', 450, 'flour'], ['salt', 10, 'other'], ['water', 325, 'water'], ['rye2', 200, 'flour'],
     ['spelt1', 200, 'flour']]],
   {'flour_total': '850',
    'hydration': '38.2',
    'percentages': [['rye0', '52.9'], ['salt', '1.2'], ['water', '38.2'], ['rye2', '23.5'],
                    ['spelt1', '23.5']]}],
  ['generated control 1',
   [[['whole wheat2', 300, 'flour'], ['water', 350, 'water'], ['whole wheat1', 500, 'flour'],
     ['salt', 10, 'other'], ['milk', 50, 'milk'], ['whole wheat0', 300, 'flour']]],
   {'flour_total': '1100',
    'hydration': '35.8',
    'percentages': [['whole wheat2', '27.3'], ['water', '31.8'], ['whole wheat1', '45.5'], ['salt', '0.9'],
                    ['milk', '4.5'], ['whole wheat0', '27.3']]}],
  ['generated control 2',
   [[['egg', 50, 'egg'], ['spelt0', 200, 'flour'], ['salt', 9, 'other'], ['water', 325, 'water'],
     ['whole wheat1', 500, 'flour'], ['levain', 150, 'starter']]],
   {'flour_total': '775',
    'hydration': '56.5',
    'percentages': [['egg', '6.5'], ['spelt0', '25.8'], ['salt', '1.2'], ['water', '41.9'],
                    ['whole wheat1', '64.5'], ['levain', '19.4']]}],
  ['generated control 3',
   [[['levain', 60, 'starter'], ['bread flour1', 333, 'flour'], ['whole wheat0', 100, 'flour'],
     ['salt', 9, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '463',
    'hydration': '14.6',
    'percentages': [['levain', '13.0'], ['bread flour1', '71.9'], ['whole wheat0', '21.6'], ['salt', '1.9'],
                    ['egg', '10.8']]}]],
 [['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: multiple flour basis',
   [[['egg', 100, 'egg'], ['salt', 11, 'other'], ['rye1', 333, 'flour'], ['levain', 60, 'starter'],
     ['whole wheat0', 100, 'flour']]],
   {'flour_total': '463',
    'hydration': '22.7',
    'percentages': [['egg', '21.6'], ['salt', '2.4'], ['rye1', '71.9'], ['levain', '13.0'],
                    ['whole wheat0', '21.6']]}],
  ['repair check: multiple flour basis',
   [[['whole wheat1', 200, 'flour'], ['rye0', 200, 'flour'], ['salt', 11, 'other'], ['milk', 100, 'milk']]],
   {'flour_total': '400',
    'hydration': '21.8',
    'percentages': [['whole wheat1', '50.0'], ['rye0', '50.0'], ['salt', '2.8'], ['milk', '25.0']]}],
  ['generated control 1', [[['salt', 11, 'other'], ['bread flour0', 500, 'flour'], ['water', 350, 'water']]],
   {'flour_total': '500',
    'hydration': '70.0',
    'percentages': [['salt', '2.2'], ['bread flour0', '100.0'], ['water', '70.0']]}],
  ['generated control 2', [[['spelt0', 300, 'flour'], ['salt', 9, 'other'], ['egg', 50, 'egg']]],
   {'flour_total': '300',
    'hydration': '12.5',
    'percentages': [['spelt0', '100.0'], ['salt', '3.0'], ['egg', '16.7']]}],
  ['generated control 3',
   [[['whole wheat1', 300, 'flour'], ['salt', 9, 'other'], ['rye2', 450, 'flour'], ['levain', 100, 'starter'],
     ['whole wheat0', 333, 'flour']]],
   {'flour_total': '1133',
    'hydration': '4.4',
    'percentages': [['whole wheat1', '26.5'], ['salt', '0.8'], ['rye2', '39.7'], ['levain', '8.8'],
                    ['whole wheat0', '29.4']]}]]]
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: multiple flour basis{'flour_total': '1200', 'hydration': '36.4', 'percentages': [['bread flour1', '25.0'], ['water', '29.2'], ['spelt2', '37.5'], ['bread flour0', '37.5'], ['milk', '8.3'], ['salt', '0.9']]}{'flour_total': '1200', 'hydration': '36.4', 'percentages': [['bread flour1', '25.0'], ['water', '29.2'], ['spelt2', '37.5'], ['bread flour0', '37.5'], ['milk', '8.3'], ['salt', '0.9']]}Passed
repair check: multiple flour basis{'flour_total': '1008', 'hydration': '44.0', 'percentages': [['spelt1', '9.9'], ['bread flour0', '49.6'], ['levain', '14.9'], ['milk', '5.0'], ['water', '32.2'], ['salt', '1.0'], ['bread flour2', '33.0']]}{'flour_total': '1008', 'hydration': '44.0', 'percentages': [['spelt1', '9.9'], ['bread flour0', '49.6'], ['levain', '14.9'], ['milk', '5.0'], ['water', '32.2'], ['salt', '1.0'], ['bread flour2', '33.0']]}Passed
generated control 1{'flour_total': '600', 'hydration': '14.5', 'percentages': [['milk', '16.7'], ['bread flour0', '83.3'], ['salt', '1.8'], ['bread flour1', '16.7']]}{'flour_total': '600', 'hydration': '14.5', 'percentages': [['milk', '16.7'], ['bread flour0', '83.3'], ['salt', '1.8'], ['bread flour1', '16.7']]}Passed
generated control 2{'flour_total': '1000', 'hydration': '12.5', 'percentages': [['bread flour0', '25.0'], ['egg', '5.0'], ['whole wheat2', '45.0'], ['milk', '10.0'], ['bread flour1', '30.0'], ['salt', '1.1']]}{'flour_total': '1000', 'hydration': '12.5', 'percentages': [['bread flour0', '25.0'], ['egg', '5.0'], ['whole wheat2', '45.0'], ['milk', '10.0'], ['bread flour1', '30.0'], ['salt', '1.1']]}Passed
generated control 3{'flour_total': '250', 'hydration': '95.0', 'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}{'flour_total': '250', 'hydration': '95.0', 'percentages': [['water', '80.0'], ['salt', '3.6'], ['bread flour0', '100.0'], ['egg', '20.0']]}Passed

SHA-256 / 951be74e3e8e46ae7aa3afd969ed36374a99f4dc9b1452d21db8c30eae0dda6b

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

Case digest / 956cab74f01855ab87b517638683442c92f852cc399c328ce51d7427d8145251