FAILURE MAP
← Case archive

FA-96951 / Recipe scaling and nutrition / Open access

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

Enriched doughs with eggs show too low a hydration.

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

ROOT CAUSE

Eggs contribute nothing to hydration although they are 75% water.

VERIFIED REPAIR

Add 75% of egg weight to hydration water.

Unsuccessful approach: Counting eggs as pure 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':
            pass
        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: egg water content',
   [[['spelt1', 450, 'flour'], ['egg', 100, 'egg'], ['salt', 10, 'other'], ['spelt0', 333, 'flour']]],
   {'flour_total': '783',
    'hydration': '9.6',
    'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}],
  ['repair check: egg water content',
   [[['salt', 10, 'other'], ['bread flour2', 450, 'flour'], ['rye1', 500, 'flour'],
     ['bread flour0', 300, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '1250',
    'hydration': '6.0',
    'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'],
                    ['egg', '8.0']]}],
  ['generated control 1',
   [[['whole wheat1', 500, 'flour'], ['bread flour0', 500, 'flour'], ['levain', 100, 'starter'],
     ['whole wheat2', 100, 'flour'], ['salt', 9, 'other'], ['water', 200, 'water']]],
   {'flour_total': '1150',
    'hydration': '21.7',
    'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'],
                    ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}],
  ['generated control 2',
   [[['levain', 100, 'starter'], ['water', 350, 'water'], ['salt', 11, 'other'],
     ['whole wheat0', 500, 'flour']]],
   {'flour_total': '550',
    'hydration': '72.7',
    'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}],
  ['generated control 3',
   [[['whole wheat0', 300, 'flour'], ['milk', 50, 'milk'], ['rye2', 450, 'flour'],
     ['whole wheat1', 333, 'flour'], ['salt', 9, 'other']]],
   {'flour_total': '1083',
    'hydration': '4.0',
    'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'],
                    ['salt', '0.8']]}]],
 [['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: egg water content',
   [[['rye0', 200, 'flour'], ['salt', 10, 'other'], ['levain', 90, 'starter'], ['egg', 50, 'egg'],
     ['whole wheat1', 250, 'flour']]],
   {'flour_total': '495',
    'hydration': '16.7',
    'percentages': [['rye0', '40.4'], ['salt', '2.0'], ['levain', '18.2'], ['egg', '10.1'],
                    ['whole wheat1', '50.5']]}],
  ['repair check: egg water content',
   [[['levain', 100, 'starter'], ['water', 377, 'water'], ['egg', 50, 'egg'], ['salt', 10, 'other'],
     ['whole wheat0', 450, 'flour']]],
   {'flour_total': '500',
    'hydration': '92.9',
    'percentages': [['levain', '20.0'], ['water', '75.4'], ['egg', '10.0'], ['salt', '2.0'],
                    ['whole wheat0', '90.0']]}],
  ['generated control 1',
   [[['water', 325, 'water'], ['spelt0', 100, 'flour'], ['salt', 11, 'other'], ['milk', 100, 'milk'],
     ['levain', 90, 'starter']]],
   {'flour_total': '145',
    'hydration': '315.2',
    'percentages': [['water', '224.1'], ['spelt0', '69.0'], ['salt', '7.6'], ['milk', '69.0'],
                    ['levain', '62.1']]}],
  ['generated control 2',
   [[['salt', 10, 'other'], ['spelt1', 300, 'flour'], ['bread flour0', 100, 'flour'],
     ['levain', 60, 'starter']]],
   {'flour_total': '430',
    'hydration': '7.0',
    'percentages': [['salt', '2.3'], ['spelt1', '69.8'], ['bread flour0', '23.3'], ['levain', '14.0']]}],
  ['generated control 3',
   [[['whole wheat0', 200, 'flour'], ['salt', 9, 'other'], ['levain', 150, 'starter'],
     ['water', 377, 'water']]],
   {'flour_total': '275',
    'hydration': '164.4',
    'percentages': [['whole wheat0', '72.7'], ['salt', '3.3'], ['levain', '54.5'], ['water', '137.1']]}]],
 [['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: egg water content',
   [[['rye0', 250, 'flour'], ['whole wheat1', 200, 'flour'], ['egg', 100, 'egg'],
     ['bread flour2', 100, 'flour'], ['salt', 11, 'other'], ['water', 377, 'water'],
     ['levain', 150, 'starter'], ['milk', 50, 'milk']]],
   {'flour_total': '625',
    'hydration': '91.3',
    'percentages': [['rye0', '40.0'], ['whole wheat1', '32.0'], ['egg', '16.0'], ['bread flour2', '16.0'],
                    ['salt', '1.8'], ['water', '60.3'], ['levain', '24.0'], ['milk', '8.0']]}],
  ['repair check: egg water content',
   [[['egg', 100, 'egg'], ['milk', 50, 'milk'], ['water', 150, 'water'], ['rye2', 300, 'flour'],
     ['bread flour1', 450, 'flour'], ['bread flour0', 300, 'flour'], ['salt', 9, 'other']]],
   {'flour_total': '1050',
    'hydration': '25.6',
    'percentages': [['egg', '9.5'], ['milk', '4.8'], ['water', '14.3'], ['rye2', '28.6'],
                    ['bread flour1', '42.9'], ['bread flour0', '28.6'], ['salt', '0.9']]}],
  ['generated control 1',
   [[['salt', 11, 'other'], ['spelt0', 500, 'flour'], ['spelt1', 333, 'flour'], ['water', 325, 'water'],
     ['levain', 60, 'starter']]],
   {'flour_total': '863',
    'hydration': '41.1',
    'percentages': [['salt', '1.3'], ['spelt0', '57.9'], ['spelt1', '38.6'], ['water', '37.7'],
                    ['levain', '7.0']]}],
  ['generated control 2',
   [[['water', 200, 'water'], ['milk', 100, 'milk'], ['salt', 10, 'other'], ['spelt0', 200, 'flour']]],
   {'flour_total': '200',
    'hydration': '143.5',
    'percentages': [['water', '100.0'], ['milk', '50.0'], ['salt', '5.0'], ['spelt0', '100.0']]}],
  ['generated control 3',
   [[['salt', 9, 'other'], ['whole wheat1', 100, 'flour'], ['milk', 50, 'milk'],
     ['bread flour0', 500, 'flour'], ['water', 200, 'water']]],
   {'flour_total': '600',
    'hydration': '40.6',
    'percentages': [['salt', '1.5'], ['whole wheat1', '16.7'], ['milk', '8.3'], ['bread flour0', '83.3'],
                    ['water', '33.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: egg water content',
   [[['water', 377, 'water'], ['levain', 90, 'starter'], ['rye0', 500, 'flour'], ['salt', 10, 'other'],
     ['egg', 50, 'egg']]],
   {'flour_total': '545',
    'hydration': '84.3',
    'percentages': [['water', '69.2'], ['levain', '16.5'], ['rye0', '91.7'], ['salt', '1.8'],
                    ['egg', '9.2']]}],
  ['repair check: egg water content',
   [[['milk', 120, 'milk'], ['spelt0', 333, 'flour'], ['egg', 100, 'egg'], ['water', 350, 'water'],
     ['salt', 10, 'other']]],
   {'flour_total': '333',
    'hydration': '159.0',
    'percentages': [['milk', '36.0'], ['spelt0', '100.0'], ['egg', '30.0'], ['water', '105.1'],
                    ['salt', '3.0']]}],
  ['generated control 1', [[['rye1', 500, 'flour'], ['salt', 11, 'other'], ['spelt0', 333, 'flour']]],
   {'flour_total': '833',
    'hydration': '0.0',
    'percentages': [['rye1', '60.0'], ['salt', '1.3'], ['spelt0', '40.0']]}],
  ['generated control 2',
   [[['water', 150, 'water'], ['salt', 11, 'other'], ['spelt1', 200, 'flour'], ['milk', 100, 'milk'],
     ['rye0', 100, 'flour']]],
   {'flour_total': '300',
    'hydration': '79.0',
    'percentages': [['water', '50.0'], ['salt', '3.7'], ['spelt1', '66.7'], ['milk', '33.3'],
                    ['rye0', '33.3']]}],
  ['generated control 3',
   [[['water', 350, 'water'], ['whole wheat0', 200, 'flour'], ['salt', 10, 'other'],
     ['bread flour1', 200, 'flour'], ['levain', 60, 'starter']]],
   {'flour_total': '430',
    'hydration': '88.4',
    'percentages': [['water', '81.4'], ['whole wheat0', '46.5'], ['salt', '2.3'], ['bread flour1', '46.5'],
                    ['levain', '14.0']]}]],
 [['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
   {'flour_total': '500',
    'hydration': '70.0',
    'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
  ['no flour', [[['water', 100, 'water']]], 'error: no flour'],
  ['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
   {'flour_total': '400',
    'hydration': '62.3',
    'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
  ['regression: egg water content',
   [[['bread flour0', 300, 'flour'], ['whole wheat1', 100, 'flour'], ['levain', 60, 'starter'],
     ['egg', 50, 'egg'], ['salt', 10, 'other']]],
   {'flour_total': '430',
    'hydration': '15.7',
    'percentages': [['bread flour0', '69.8'], ['whole wheat1', '23.3'], ['levain', '14.0'], ['egg', '11.6'],
                    ['salt', '2.3']]}],
  ['repair check: egg water content',
   [[['spelt0', 333, 'flour'], ['salt', 11, 'other'], ['egg', 50, 'egg'], ['water', 150, 'water']]],
   {'flour_total': '333',
    'hydration': '56.3',
    'percentages': [['spelt0', '100.0'], ['salt', '3.3'], ['egg', '15.0'], ['water', '45.0']]}],
  ['generated control 1',
   [[['bread flour1', 500, 'flour'], ['salt', 10, 'other'], ['spelt0', 500, 'flour'],
     ['water', 350, 'water']]],
   {'flour_total': '1000',
    'hydration': '35.0',
    'percentages': [['bread flour1', '50.0'], ['salt', '1.0'], ['spelt0', '50.0'], ['water', '35.0']]}],
  ['generated control 2',
   [[['spelt0', 333, 'flour'], ['salt', 9, 'other'], ['egg', 100, 'egg'], ['water', 200, 'water']]],
   {'flour_total': '333',
    'hydration': '82.6',
    'percentages': [['spelt0', '100.0'], ['salt', '2.7'], ['egg', '30.0'], ['water', '60.1']]}],
  ['generated control 3',
   [[['salt', 10, 'other'], ['rye2', 450, 'flour'], ['whole wheat1', 200, 'flour'],
     ['spelt0', 200, 'flour']]],
   {'flour_total': '850',
    'hydration': '0.0',
    'percentages': [['salt', '1.2'], ['rye2', '52.9'], ['whole wheat1', '23.5'], ['spelt0', '23.5']]}]]]
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': '43.5', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}{'flour_total': '400', 'hydration': '62.3', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}Failed
regression: egg water content{'flour_total': '783', 'hydration': '0.0', 'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}{'flour_total': '783', 'hydration': '9.6', 'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}Failed
repair check: egg water content{'flour_total': '1250', 'hydration': '0.0', 'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'], ['egg', '8.0']]}{'flour_total': '1250', 'hydration': '6.0', 'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'], ['egg', '8.0']]}Failed
generated control 1{'flour_total': '1150', 'hydration': '21.7', 'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'], ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}{'flour_total': '1150', 'hydration': '21.7', 'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'], ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}Passed
generated control 2{'flour_total': '550', 'hydration': '72.7', 'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}{'flour_total': '550', 'hydration': '72.7', 'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}Passed
generated control 3{'flour_total': '1083', 'hydration': '4.0', 'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'], ['salt', '0.8']]}{'flour_total': '1083', 'hydration': '4.0', 'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'], ['salt', '0.8']]}Passed

SHA-256 / cfd7e20f8dfe5a76de1c68f4ba4ab084ae2be242e61cbc1a01c03d1207a06a1d

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))
        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: egg water content',
   [[['spelt1', 450, 'flour'], ['egg', 100, 'egg'], ['salt', 10, 'other'], ['spelt0', 333, 'flour']]],
   {'flour_total': '783',
    'hydration': '9.6',
    'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}],
  ['repair check: egg water content',
   [[['salt', 10, 'other'], ['bread flour2', 450, 'flour'], ['rye1', 500, 'flour'],
     ['bread flour0', 300, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '1250',
    'hydration': '6.0',
    'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'],
                    ['egg', '8.0']]}],
  ['generated control 1',
   [[['whole wheat1', 500, 'flour'], ['bread flour0', 500, 'flour'], ['levain', 100, 'starter'],
     ['whole wheat2', 100, 'flour'], ['salt', 9, 'other'], ['water', 200, 'water']]],
   {'flour_total': '1150',
    'hydration': '21.7',
    'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'],
                    ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}],
  ['generated control 2',
   [[['levain', 100, 'starter'], ['water', 350, 'water'], ['salt', 11, 'other'],
     ['whole wheat0', 500, 'flour']]],
   {'flour_total': '550',
    'hydration': '72.7',
    'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}],
  ['generated control 3',
   [[['whole wheat0', 300, 'flour'], ['milk', 50, 'milk'], ['rye2', 450, 'flour'],
     ['whole wheat1', 333, 'flour'], ['salt', 9, 'other']]],
   {'flour_total': '1083',
    'hydration': '4.0',
    'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'],
                    ['salt', '0.8']]}]],
 [['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: egg water content',
   [[['rye0', 200, 'flour'], ['salt', 10, 'other'], ['levain', 90, 'starter'], ['egg', 50, 'egg'],
     ['whole wheat1', 250, 'flour']]],
   {'flour_total': '495',
    'hydration': '16.7',
    'percentages': [['rye0', '40.4'], ['salt', '2.0'], ['levain', '18.2'], ['egg', '10.1'],
                    ['whole wheat1', '50.5']]}],
  ['repair check: egg water content',
   [[['levain', 100, 'starter'], ['water', 377, 'water'], ['egg', 50, 'egg'], ['salt', 10, 'other'],
     ['whole wheat0', 450, 'flour']]],
   {'flour_total': '500',
    'hydration': '92.9',
    'percentages': [['levain', '20.0'], ['water', '75.4'], ['egg', '10.0'], ['salt', '2.0'],
                    ['whole wheat0', '90.0']]}],
  ['generated control 1',
   [[['water', 325, 'water'], ['spelt0', 100, 'flour'], ['salt', 11, 'other'], ['milk', 100, 'milk'],
     ['levain', 90, 'starter']]],
   {'flour_total': '145',
    'hydration': '315.2',
    'percentages': [['water', '224.1'], ['spelt0', '69.0'], ['salt', '7.6'], ['milk', '69.0'],
                    ['levain', '62.1']]}],
  ['generated control 2',
   [[['salt', 10, 'other'], ['spelt1', 300, 'flour'], ['bread flour0', 100, 'flour'],
     ['levain', 60, 'starter']]],
   {'flour_total': '430',
    'hydration': '7.0',
    'percentages': [['salt', '2.3'], ['spelt1', '69.8'], ['bread flour0', '23.3'], ['levain', '14.0']]}],
  ['generated control 3',
   [[['whole wheat0', 200, 'flour'], ['salt', 9, 'other'], ['levain', 150, 'starter'],
     ['water', 377, 'water']]],
   {'flour_total': '275',
    'hydration': '164.4',
    'percentages': [['whole wheat0', '72.7'], ['salt', '3.3'], ['levain', '54.5'], ['water', '137.1']]}]],
 [['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: egg water content',
   [[['rye0', 250, 'flour'], ['whole wheat1', 200, 'flour'], ['egg', 100, 'egg'],
     ['bread flour2', 100, 'flour'], ['salt', 11, 'other'], ['water', 377, 'water'],
     ['levain', 150, 'starter'], ['milk', 50, 'milk']]],
   {'flour_total': '625',
    'hydration': '91.3',
    'percentages': [['rye0', '40.0'], ['whole wheat1', '32.0'], ['egg', '16.0'], ['bread flour2', '16.0'],
                    ['salt', '1.8'], ['water', '60.3'], ['levain', '24.0'], ['milk', '8.0']]}],
  ['repair check: egg water content',
   [[['egg', 100, 'egg'], ['milk', 50, 'milk'], ['water', 150, 'water'], ['rye2', 300, 'flour'],
     ['bread flour1', 450, 'flour'], ['bread flour0', 300, 'flour'], ['salt', 9, 'other']]],
   {'flour_total': '1050',
    'hydration': '25.6',
    'percentages': [['egg', '9.5'], ['milk', '4.8'], ['water', '14.3'], ['rye2', '28.6'],
                    ['bread flour1', '42.9'], ['bread flour0', '28.6'], ['salt', '0.9']]}],
  ['generated control 1',
   [[['salt', 11, 'other'], ['spelt0', 500, 'flour'], ['spelt1', 333, 'flour'], ['water', 325, 'water'],
     ['levain', 60, 'starter']]],
   {'flour_total': '863',
    'hydration': '41.1',
    'percentages': [['salt', '1.3'], ['spelt0', '57.9'], ['spelt1', '38.6'], ['water', '37.7'],
                    ['levain', '7.0']]}],
  ['generated control 2',
   [[['water', 200, 'water'], ['milk', 100, 'milk'], ['salt', 10, 'other'], ['spelt0', 200, 'flour']]],
   {'flour_total': '200',
    'hydration': '143.5',
    'percentages': [['water', '100.0'], ['milk', '50.0'], ['salt', '5.0'], ['spelt0', '100.0']]}],
  ['generated control 3',
   [[['salt', 9, 'other'], ['whole wheat1', 100, 'flour'], ['milk', 50, 'milk'],
     ['bread flour0', 500, 'flour'], ['water', 200, 'water']]],
   {'flour_total': '600',
    'hydration': '40.6',
    'percentages': [['salt', '1.5'], ['whole wheat1', '16.7'], ['milk', '8.3'], ['bread flour0', '83.3'],
                    ['water', '33.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: egg water content',
   [[['water', 377, 'water'], ['levain', 90, 'starter'], ['rye0', 500, 'flour'], ['salt', 10, 'other'],
     ['egg', 50, 'egg']]],
   {'flour_total': '545',
    'hydration': '84.3',
    'percentages': [['water', '69.2'], ['levain', '16.5'], ['rye0', '91.7'], ['salt', '1.8'],
                    ['egg', '9.2']]}],
  ['repair check: egg water content',
   [[['milk', 120, 'milk'], ['spelt0', 333, 'flour'], ['egg', 100, 'egg'], ['water', 350, 'water'],
     ['salt', 10, 'other']]],
   {'flour_total': '333',
    'hydration': '159.0',
    'percentages': [['milk', '36.0'], ['spelt0', '100.0'], ['egg', '30.0'], ['water', '105.1'],
                    ['salt', '3.0']]}],
  ['generated control 1', [[['rye1', 500, 'flour'], ['salt', 11, 'other'], ['spelt0', 333, 'flour']]],
   {'flour_total': '833',
    'hydration': '0.0',
    'percentages': [['rye1', '60.0'], ['salt', '1.3'], ['spelt0', '40.0']]}],
  ['generated control 2',
   [[['water', 150, 'water'], ['salt', 11, 'other'], ['spelt1', 200, 'flour'], ['milk', 100, 'milk'],
     ['rye0', 100, 'flour']]],
   {'flour_total': '300',
    'hydration': '79.0',
    'percentages': [['water', '50.0'], ['salt', '3.7'], ['spelt1', '66.7'], ['milk', '33.3'],
                    ['rye0', '33.3']]}],
  ['generated control 3',
   [[['water', 350, 'water'], ['whole wheat0', 200, 'flour'], ['salt', 10, 'other'],
     ['bread flour1', 200, 'flour'], ['levain', 60, 'starter']]],
   {'flour_total': '430',
    'hydration': '88.4',
    'percentages': [['water', '81.4'], ['whole wheat0', '46.5'], ['salt', '2.3'], ['bread flour1', '46.5'],
                    ['levain', '14.0']]}]],
 [['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
   {'flour_total': '500',
    'hydration': '70.0',
    'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
  ['no flour', [[['water', 100, 'water']]], 'error: no flour'],
  ['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
   {'flour_total': '400',
    'hydration': '62.3',
    'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
  ['regression: egg water content',
   [[['bread flour0', 300, 'flour'], ['whole wheat1', 100, 'flour'], ['levain', 60, 'starter'],
     ['egg', 50, 'egg'], ['salt', 10, 'other']]],
   {'flour_total': '430',
    'hydration': '15.7',
    'percentages': [['bread flour0', '69.8'], ['whole wheat1', '23.3'], ['levain', '14.0'], ['egg', '11.6'],
                    ['salt', '2.3']]}],
  ['repair check: egg water content',
   [[['spelt0', 333, 'flour'], ['salt', 11, 'other'], ['egg', 50, 'egg'], ['water', 150, 'water']]],
   {'flour_total': '333',
    'hydration': '56.3',
    'percentages': [['spelt0', '100.0'], ['salt', '3.3'], ['egg', '15.0'], ['water', '45.0']]}],
  ['generated control 1',
   [[['bread flour1', 500, 'flour'], ['salt', 10, 'other'], ['spelt0', 500, 'flour'],
     ['water', 350, 'water']]],
   {'flour_total': '1000',
    'hydration': '35.0',
    'percentages': [['bread flour1', '50.0'], ['salt', '1.0'], ['spelt0', '50.0'], ['water', '35.0']]}],
  ['generated control 2',
   [[['spelt0', 333, 'flour'], ['salt', 9, 'other'], ['egg', 100, 'egg'], ['water', 200, 'water']]],
   {'flour_total': '333',
    'hydration': '82.6',
    'percentages': [['spelt0', '100.0'], ['salt', '2.7'], ['egg', '30.0'], ['water', '60.1']]}],
  ['generated control 3',
   [[['salt', 10, 'other'], ['rye2', 450, 'flour'], ['whole wheat1', 200, 'flour'],
     ['spelt0', 200, 'flour']]],
   {'flour_total': '850',
    'hydration': '0.0',
    'percentages': [['salt', '1.2'], ['rye2', '52.9'], ['whole wheat1', '23.5'], ['spelt0', '23.5']]}]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
lean dough control{'flour_total': '500', 'hydration': '70.0', 'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}{'flour_total': '500', 'hydration': '70.0', 'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}Passed
no flourerror: no flourerror: no flourPassed
enriched dough{'flour_total': '400', 'hydration': '68.5', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}{'flour_total': '400', 'hydration': '62.3', 'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}Failed
regression: egg water content{'flour_total': '783', 'hydration': '12.8', 'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}{'flour_total': '783', 'hydration': '9.6', 'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}Failed
repair check: egg water content{'flour_total': '1250', 'hydration': '8.0', 'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'], ['egg', '8.0']]}{'flour_total': '1250', 'hydration': '6.0', 'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'], ['egg', '8.0']]}Failed
generated control 1{'flour_total': '1150', 'hydration': '21.7', 'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'], ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}{'flour_total': '1150', 'hydration': '21.7', 'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'], ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}Passed
generated control 2{'flour_total': '550', 'hydration': '72.7', 'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}{'flour_total': '550', 'hydration': '72.7', 'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}Passed
generated control 3{'flour_total': '1083', 'hydration': '4.0', 'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'], ['salt', '0.8']]}{'flour_total': '1083', 'hydration': '4.0', 'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'], ['salt', '0.8']]}Passed

SHA-256 / a732dcd7f7fd8e31312543c94f1ba8c42813fd17c17c4fa75859d52423243eab

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: egg water content',
   [[['spelt1', 450, 'flour'], ['egg', 100, 'egg'], ['salt', 10, 'other'], ['spelt0', 333, 'flour']]],
   {'flour_total': '783',
    'hydration': '9.6',
    'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}],
  ['repair check: egg water content',
   [[['salt', 10, 'other'], ['bread flour2', 450, 'flour'], ['rye1', 500, 'flour'],
     ['bread flour0', 300, 'flour'], ['egg', 100, 'egg']]],
   {'flour_total': '1250',
    'hydration': '6.0',
    'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'],
                    ['egg', '8.0']]}],
  ['generated control 1',
   [[['whole wheat1', 500, 'flour'], ['bread flour0', 500, 'flour'], ['levain', 100, 'starter'],
     ['whole wheat2', 100, 'flour'], ['salt', 9, 'other'], ['water', 200, 'water']]],
   {'flour_total': '1150',
    'hydration': '21.7',
    'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'],
                    ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}],
  ['generated control 2',
   [[['levain', 100, 'starter'], ['water', 350, 'water'], ['salt', 11, 'other'],
     ['whole wheat0', 500, 'flour']]],
   {'flour_total': '550',
    'hydration': '72.7',
    'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}],
  ['generated control 3',
   [[['whole wheat0', 300, 'flour'], ['milk', 50, 'milk'], ['rye2', 450, 'flour'],
     ['whole wheat1', 333, 'flour'], ['salt', 9, 'other']]],
   {'flour_total': '1083',
    'hydration': '4.0',
    'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'],
                    ['salt', '0.8']]}]],
 [['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: egg water content',
   [[['rye0', 200, 'flour'], ['salt', 10, 'other'], ['levain', 90, 'starter'], ['egg', 50, 'egg'],
     ['whole wheat1', 250, 'flour']]],
   {'flour_total': '495',
    'hydration': '16.7',
    'percentages': [['rye0', '40.4'], ['salt', '2.0'], ['levain', '18.2'], ['egg', '10.1'],
                    ['whole wheat1', '50.5']]}],
  ['repair check: egg water content',
   [[['levain', 100, 'starter'], ['water', 377, 'water'], ['egg', 50, 'egg'], ['salt', 10, 'other'],
     ['whole wheat0', 450, 'flour']]],
   {'flour_total': '500',
    'hydration': '92.9',
    'percentages': [['levain', '20.0'], ['water', '75.4'], ['egg', '10.0'], ['salt', '2.0'],
                    ['whole wheat0', '90.0']]}],
  ['generated control 1',
   [[['water', 325, 'water'], ['spelt0', 100, 'flour'], ['salt', 11, 'other'], ['milk', 100, 'milk'],
     ['levain', 90, 'starter']]],
   {'flour_total': '145',
    'hydration': '315.2',
    'percentages': [['water', '224.1'], ['spelt0', '69.0'], ['salt', '7.6'], ['milk', '69.0'],
                    ['levain', '62.1']]}],
  ['generated control 2',
   [[['salt', 10, 'other'], ['spelt1', 300, 'flour'], ['bread flour0', 100, 'flour'],
     ['levain', 60, 'starter']]],
   {'flour_total': '430',
    'hydration': '7.0',
    'percentages': [['salt', '2.3'], ['spelt1', '69.8'], ['bread flour0', '23.3'], ['levain', '14.0']]}],
  ['generated control 3',
   [[['whole wheat0', 200, 'flour'], ['salt', 9, 'other'], ['levain', 150, 'starter'],
     ['water', 377, 'water']]],
   {'flour_total': '275',
    'hydration': '164.4',
    'percentages': [['whole wheat0', '72.7'], ['salt', '3.3'], ['levain', '54.5'], ['water', '137.1']]}]],
 [['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: egg water content',
   [[['rye0', 250, 'flour'], ['whole wheat1', 200, 'flour'], ['egg', 100, 'egg'],
     ['bread flour2', 100, 'flour'], ['salt', 11, 'other'], ['water', 377, 'water'],
     ['levain', 150, 'starter'], ['milk', 50, 'milk']]],
   {'flour_total': '625',
    'hydration': '91.3',
    'percentages': [['rye0', '40.0'], ['whole wheat1', '32.0'], ['egg', '16.0'], ['bread flour2', '16.0'],
                    ['salt', '1.8'], ['water', '60.3'], ['levain', '24.0'], ['milk', '8.0']]}],
  ['repair check: egg water content',
   [[['egg', 100, 'egg'], ['milk', 50, 'milk'], ['water', 150, 'water'], ['rye2', 300, 'flour'],
     ['bread flour1', 450, 'flour'], ['bread flour0', 300, 'flour'], ['salt', 9, 'other']]],
   {'flour_total': '1050',
    'hydration': '25.6',
    'percentages': [['egg', '9.5'], ['milk', '4.8'], ['water', '14.3'], ['rye2', '28.6'],
                    ['bread flour1', '42.9'], ['bread flour0', '28.6'], ['salt', '0.9']]}],
  ['generated control 1',
   [[['salt', 11, 'other'], ['spelt0', 500, 'flour'], ['spelt1', 333, 'flour'], ['water', 325, 'water'],
     ['levain', 60, 'starter']]],
   {'flour_total': '863',
    'hydration': '41.1',
    'percentages': [['salt', '1.3'], ['spelt0', '57.9'], ['spelt1', '38.6'], ['water', '37.7'],
                    ['levain', '7.0']]}],
  ['generated control 2',
   [[['water', 200, 'water'], ['milk', 100, 'milk'], ['salt', 10, 'other'], ['spelt0', 200, 'flour']]],
   {'flour_total': '200',
    'hydration': '143.5',
    'percentages': [['water', '100.0'], ['milk', '50.0'], ['salt', '5.0'], ['spelt0', '100.0']]}],
  ['generated control 3',
   [[['salt', 9, 'other'], ['whole wheat1', 100, 'flour'], ['milk', 50, 'milk'],
     ['bread flour0', 500, 'flour'], ['water', 200, 'water']]],
   {'flour_total': '600',
    'hydration': '40.6',
    'percentages': [['salt', '1.5'], ['whole wheat1', '16.7'], ['milk', '8.3'], ['bread flour0', '83.3'],
                    ['water', '33.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: egg water content',
   [[['water', 377, 'water'], ['levain', 90, 'starter'], ['rye0', 500, 'flour'], ['salt', 10, 'other'],
     ['egg', 50, 'egg']]],
   {'flour_total': '545',
    'hydration': '84.3',
    'percentages': [['water', '69.2'], ['levain', '16.5'], ['rye0', '91.7'], ['salt', '1.8'],
                    ['egg', '9.2']]}],
  ['repair check: egg water content',
   [[['milk', 120, 'milk'], ['spelt0', 333, 'flour'], ['egg', 100, 'egg'], ['water', 350, 'water'],
     ['salt', 10, 'other']]],
   {'flour_total': '333',
    'hydration': '159.0',
    'percentages': [['milk', '36.0'], ['spelt0', '100.0'], ['egg', '30.0'], ['water', '105.1'],
                    ['salt', '3.0']]}],
  ['generated control 1', [[['rye1', 500, 'flour'], ['salt', 11, 'other'], ['spelt0', 333, 'flour']]],
   {'flour_total': '833',
    'hydration': '0.0',
    'percentages': [['rye1', '60.0'], ['salt', '1.3'], ['spelt0', '40.0']]}],
  ['generated control 2',
   [[['water', 150, 'water'], ['salt', 11, 'other'], ['spelt1', 200, 'flour'], ['milk', 100, 'milk'],
     ['rye0', 100, 'flour']]],
   {'flour_total': '300',
    'hydration': '79.0',
    'percentages': [['water', '50.0'], ['salt', '3.7'], ['spelt1', '66.7'], ['milk', '33.3'],
                    ['rye0', '33.3']]}],
  ['generated control 3',
   [[['water', 350, 'water'], ['whole wheat0', 200, 'flour'], ['salt', 10, 'other'],
     ['bread flour1', 200, 'flour'], ['levain', 60, 'starter']]],
   {'flour_total': '430',
    'hydration': '88.4',
    'percentages': [['water', '81.4'], ['whole wheat0', '46.5'], ['salt', '2.3'], ['bread flour1', '46.5'],
                    ['levain', '14.0']]}]],
 [['lean dough control', [[['flour', 500, 'flour'], ['water', 350, 'water'], ['salt', 10, 'other']]],
   {'flour_total': '500',
    'hydration': '70.0',
    'percentages': [['flour', '100.0'], ['water', '70.0'], ['salt', '2.0']]}],
  ['no flour', [[['water', 100, 'water']]], 'error: no flour'],
  ['enriched dough', [[['flour', 400, 'flour'], ['milk', 200, 'milk'], ['egg', 100, 'egg']]],
   {'flour_total': '400',
    'hydration': '62.3',
    'percentages': [['flour', '100.0'], ['milk', '50.0'], ['egg', '25.0']]}],
  ['regression: egg water content',
   [[['bread flour0', 300, 'flour'], ['whole wheat1', 100, 'flour'], ['levain', 60, 'starter'],
     ['egg', 50, 'egg'], ['salt', 10, 'other']]],
   {'flour_total': '430',
    'hydration': '15.7',
    'percentages': [['bread flour0', '69.8'], ['whole wheat1', '23.3'], ['levain', '14.0'], ['egg', '11.6'],
                    ['salt', '2.3']]}],
  ['repair check: egg water content',
   [[['spelt0', 333, 'flour'], ['salt', 11, 'other'], ['egg', 50, 'egg'], ['water', 150, 'water']]],
   {'flour_total': '333',
    'hydration': '56.3',
    'percentages': [['spelt0', '100.0'], ['salt', '3.3'], ['egg', '15.0'], ['water', '45.0']]}],
  ['generated control 1',
   [[['bread flour1', 500, 'flour'], ['salt', 10, 'other'], ['spelt0', 500, 'flour'],
     ['water', 350, 'water']]],
   {'flour_total': '1000',
    'hydration': '35.0',
    'percentages': [['bread flour1', '50.0'], ['salt', '1.0'], ['spelt0', '50.0'], ['water', '35.0']]}],
  ['generated control 2',
   [[['spelt0', 333, 'flour'], ['salt', 9, 'other'], ['egg', 100, 'egg'], ['water', 200, 'water']]],
   {'flour_total': '333',
    'hydration': '82.6',
    'percentages': [['spelt0', '100.0'], ['salt', '2.7'], ['egg', '30.0'], ['water', '60.1']]}],
  ['generated control 3',
   [[['salt', 10, 'other'], ['rye2', 450, 'flour'], ['whole wheat1', 200, 'flour'],
     ['spelt0', 200, 'flour']]],
   {'flour_total': '850',
    'hydration': '0.0',
    'percentages': [['salt', '1.2'], ['rye2', '52.9'], ['whole wheat1', '23.5'], ['spelt0', '23.5']]}]]]
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: egg water content{'flour_total': '783', 'hydration': '9.6', 'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}{'flour_total': '783', 'hydration': '9.6', 'percentages': [['spelt1', '57.5'], ['egg', '12.8'], ['salt', '1.3'], ['spelt0', '42.5']]}Passed
repair check: egg water content{'flour_total': '1250', 'hydration': '6.0', 'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'], ['egg', '8.0']]}{'flour_total': '1250', 'hydration': '6.0', 'percentages': [['salt', '0.8'], ['bread flour2', '36.0'], ['rye1', '40.0'], ['bread flour0', '24.0'], ['egg', '8.0']]}Passed
generated control 1{'flour_total': '1150', 'hydration': '21.7', 'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'], ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}{'flour_total': '1150', 'hydration': '21.7', 'percentages': [['whole wheat1', '43.5'], ['bread flour0', '43.5'], ['levain', '8.7'], ['whole wheat2', '8.7'], ['salt', '0.8'], ['water', '17.4']]}Passed
generated control 2{'flour_total': '550', 'hydration': '72.7', 'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}{'flour_total': '550', 'hydration': '72.7', 'percentages': [['levain', '18.2'], ['water', '63.6'], ['salt', '2.0'], ['whole wheat0', '90.9']]}Passed
generated control 3{'flour_total': '1083', 'hydration': '4.0', 'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'], ['salt', '0.8']]}{'flour_total': '1083', 'hydration': '4.0', 'percentages': [['whole wheat0', '27.7'], ['milk', '4.6'], ['rye2', '41.6'], ['whole wheat1', '30.7'], ['salt', '0.8']]}Passed

SHA-256 / 0b3a43682f140657b0e48577c2a29595c4ae670b9b1b340cf133e6d546a75b9a

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

Case digest / 2df44ffee7160e5cae7ebac8d692816fa4fd6834d13aedbf7afaab7b506020f2