FAILURE MAP
← Case archive

FA-97216 / Recipe scaling and nutrition / Open access

Recipe cost per serving: bulk proportional price · case 01

Buying 30 g of bulk herbs costs the price of 30 packs.

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

ROOT CAUSE

Bulk cost multiplies quantity by the pack price as if it were a unit price.

THE FAILURE

Bulk cost multiplies quantity by the pack price as if it were a unit price.

Unsuccessful approach: Dividing by 100 converts cents to dollars inside a cents total.

Case contract

Rows [name, ep_qty, pack_price_cents, pack_size, yield_pct, mode]. Edible portion needs as-purchased ap = ep/(yield/100). mode "whole" buys ceil(ap/pack_size) packs at full price; "bulk" pays ap/pack_size*price. total_cents = half-up integer of the exact total; per_serving_cents = ceiling of exact total/servings; packs lists whole-pack counts by name.

Why this case matters

Menu costing converts trimmed edible quantities to purchase quantities and rounds purchases to packs.

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(items, servings):
    total = Fraction(0)
    packs = {}
    for name, ep, price, size, y, mode in items:
        ap = Fraction(ep) / Fraction(y, 100)
        if mode == 'whole':
            n = math.ceil(ap / size)
            packs[name] = n
            total += n * price
        else:
            total += ap * price
    return {'total_cents': math.floor(total + Fraction(1, 2)), 'per_serving_cents': math.ceil(total / servings),
            'packs': packs}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['regression: bulk proportional price',
   [[['lemon', 50, 450, 500, 100, 'bulk'], ['herbs', 50, 450, 100, 90, 'whole']], 4],
   {'packs': {'herbs': 1}, 'per_serving_cents': 124, 'total_cents': 495}],
  ['repair check: bulk proportional price',
   [[['cream', 100, 450, 12, 80, 'bulk'], ['eggs', 300, 1200, 1000, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 1723, 'total_cents': 5168}],
  ['generated control 1', [[['lemon', 6, 1200, 6, 75, 'bulk'], ['herbs', 900, 450, 12, 100, 'bulk']], 8],
   {'packs': {}, 'per_serving_cents': 4419, 'total_cents': 35350}],
  ['generated control 2', [[['lemon', 3, 99, 500, 80, 'whole']], 3],
   {'packs': {'lemon': 1}, 'per_serving_cents': 33, 'total_cents': 99}],
  ['generated control 3',
   [[['herbs', 300, 1200, 250, 80, 'whole'], ['cream', 100, 99, 1000, 75, 'whole'],
     ['onion', 250, 99, 500, 80, 'bulk'], ['lemon', 6, 249, 12, 80, 'whole']],
    3],
   {'packs': {'cream': 1, 'herbs': 2, 'lemon': 1}, 'per_serving_cents': 937, 'total_cents': 2810}]],
 [['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['regression: bulk proportional price', [[['beef', 6, 99, 12, 80, 'bulk']], 6],
   {'packs': {}, 'per_serving_cents': 11, 'total_cents': 62}],
  ['repair check: bulk proportional price',
   [[['eggs', 100, 1200, 250, 90, 'whole'], ['herbs', 300, 1200, 12, 90, 'bulk']], 5],
   {'packs': {'eggs': 1}, 'per_serving_cents': 6907, 'total_cents': 34533}],
  ['generated control 1',
   [[['beef', 300, 1200, 100, 100, 'bulk'], ['cream', 400, 450, 250, 100, 'bulk'],
     ['herbs', 100, 249, 6, 50, 'bulk'], ['lemon', 100, 1200, 500, 50, 'bulk']],
    5],
   {'packs': {}, 'per_serving_cents': 2620, 'total_cents': 13100}],
  ['generated control 2',
   [[['cream', 300, 249, 100, 80, 'whole'], ['eggs', 900, 1200, 1000, 85, 'bulk'],
     ['herbs', 250, 249, 250, 90, 'whole'], ['beef', 250, 450, 6, 85, 'whole']],
    6],
   {'packs': {'beef': 50, 'cream': 4, 'herbs': 2}, 'per_serving_cents': 4211, 'total_cents': 25265}],
  ['generated control 3',
   [[['cream', 50, 450, 1000, 50, 'whole'], ['lemon', 100, 450, 12, 80, 'bulk'],
     ['eggs', 3, 249, 250, 100, 'whole'], ['herbs', 250, 450, 1000, 85, 'whole']],
    1],
   {'packs': {'cream': 1, 'eggs': 1, 'herbs': 1}, 'per_serving_cents': 5837, 'total_cents': 5837}]],
 [['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['regression: bulk proportional price',
   [[['beef', 900, 249, 12, 100, 'bulk'], ['cream', 400, 249, 250, 100, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 6358, 'total_cents': 19073}],
  ['repair check: bulk proportional price',
   [[['lemon', 250, 99, 1000, 50, 'bulk'], ['herbs', 6, 99, 250, 75, 'whole'],
     ['onion', 3, 450, 100, 80, 'bulk'], ['cream', 3, 249, 6, 50, 'whole']],
    2],
   {'packs': {'cream': 1, 'herbs': 1}, 'per_serving_cents': 208, 'total_cents': 414}],
  ['generated control 1',
   [[['onion', 3, 249, 6, 75, 'whole'], ['lemon', 900, 249, 12, 85, 'whole'],
     ['cream', 250, 1200, 12, 50, 'whole']],
    4],
   {'packs': {'cream': 42, 'lemon': 89, 'onion': 1}, 'per_serving_cents': 18203, 'total_cents': 72810}],
  ['generated control 2', [[['beef', 3, 249, 250, 80, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 63, 'total_cents': 249}],
  ['generated control 3',
   [[['onion', 300, 1200, 6, 80, 'whole'], ['eggs', 3, 99, 1000, 75, 'bulk'],
     ['lemon', 3, 249, 6, 100, 'whole'], ['beef', 900, 99, 1000, 75, 'bulk']],
    8],
   {'packs': {'lemon': 1, 'onion': 63}, 'per_serving_cents': 9497, 'total_cents': 75968}]],
 [['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['regression: bulk proportional price', [[['beef', 250, 99, 6, 90, 'bulk']], 2],
   {'packs': {}, 'per_serving_cents': 2292, 'total_cents': 4583}],
  ['repair check: bulk proportional price',
   [[['eggs', 6, 99, 100, 75, 'bulk'], ['lemon', 3, 1200, 100, 90, 'whole'],
     ['cream', 900, 1200, 6, 100, 'bulk'], ['onion', 400, 450, 100, 85, 'whole']],
    1],
   {'packs': {'lemon': 1, 'onion': 5}, 'per_serving_cents': 183458, 'total_cents': 183458}],
  ['generated control 1', [[['onion', 900, 99, 6, 100, 'whole']], 5],
   {'packs': {'onion': 150}, 'per_serving_cents': 2970, 'total_cents': 14850}],
  ['generated control 2',
   [[['cream', 250, 450, 250, 75, 'bulk'], ['beef', 250, 99, 250, 75, 'whole'],
     ['eggs', 3, 450, 250, 50, 'whole'], ['onion', 6, 249, 12, 50, 'whole']],
    4],
   {'packs': {'beef': 2, 'eggs': 1, 'onion': 1}, 'per_serving_cents': 375, 'total_cents': 1497}],
  ['generated control 3', [[['herbs', 6, 1200, 100, 100, 'whole']], 3],
   {'packs': {'herbs': 1}, 'per_serving_cents': 400, 'total_cents': 1200}]],
 [['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['regression: bulk proportional price',
   [[['herbs', 3, 1200, 500, 75, 'bulk'], ['eggs', 300, 1200, 100, 50, 'bulk'],
     ['lemon', 400, 249, 1000, 90, 'bulk'], ['onion', 900, 1200, 250, 100, 'whole']],
    7],
   {'packs': {'onion': 4}, 'per_serving_cents': 1732, 'total_cents': 12120}],
  ['repair check: bulk proportional price',
   [[['lemon', 50, 249, 6, 90, 'whole'], ['onion', 3, 450, 12, 75, 'bulk'],
     ['eggs', 400, 450, 6, 75, 'whole'], ['beef', 50, 99, 100, 100, 'bulk']],
    5],
   {'packs': {'eggs': 89, 'lemon': 10}, 'per_serving_cents': 8548, 'total_cents': 42740}],
  ['generated control 1', [[['lemon', 250, 450, 1000, 85, 'whole']], 6],
   {'packs': {'lemon': 1}, 'per_serving_cents': 75, 'total_cents': 450}],
  ['generated control 2', [[['herbs', 3, 1200, 12, 75, 'bulk'], ['cream', 900, 1200, 12, 100, 'bulk']], 7],
   {'packs': {}, 'per_serving_cents': 12915, 'total_cents': 90400}],
  ['generated control 3',
   [[['beef', 100, 450, 250, 100, 'whole'], ['eggs', 300, 1200, 12, 85, 'bulk'],
     ['onion', 50, 450, 100, 85, 'bulk']],
    8],
   {'packs': {'beef': 1}, 'per_serving_cents': 4502, 'total_cents': 36009}]]]
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
exact whole pack{'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}{'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}Passed
trim loss{'packs': {}, 'per_serving_cents': 9900, 'total_cents': 9900}{'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}Failed
bulk herbs{'packs': {}, 'per_serving_cents': 6000, 'total_cents': 18000}{'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}Failed
regression: bulk proportional price{'packs': {'herbs': 1}, 'per_serving_cents': 5738, 'total_cents': 22950}{'packs': {'herbs': 1}, 'per_serving_cents': 124, 'total_cents': 495}Failed
repair check: bulk proportional price{'packs': {}, 'per_serving_cents': 178750, 'total_cents': 536250}{'packs': {}, 'per_serving_cents': 1723, 'total_cents': 5168}Failed
generated control 1{'packs': {}, 'per_serving_cents': 51825, 'total_cents': 414600}{'packs': {}, 'per_serving_cents': 4419, 'total_cents': 35350}Failed
generated control 2{'packs': {'lemon': 1}, 'per_serving_cents': 33, 'total_cents': 99}{'packs': {'lemon': 1}, 'per_serving_cents': 33, 'total_cents': 99}Passed
generated control 3{'packs': {'cream': 1, 'herbs': 2, 'lemon': 1}, 'per_serving_cents': 11229, 'total_cents': 33686}{'packs': {'cream': 1, 'herbs': 2, 'lemon': 1}, 'per_serving_cents': 937, 'total_cents': 2810}Failed

SHA-256 / 7c32c6846c1b26f94f77a04433f4f83895e102eb4de841daea00b89c9a2c3dc7

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(items, servings):
    total = Fraction(0)
    packs = {}
    for name, ep, price, size, y, mode in items:
        ap = Fraction(ep) / Fraction(y, 100)
        if mode == 'whole':
            n = math.ceil(ap / size)
            packs[name] = n
            total += n * price
        else:
            total += ap / size * price / 100
    return {'total_cents': math.floor(total + Fraction(1, 2)), 'per_serving_cents': math.ceil(total / servings),
            'packs': packs}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['regression: bulk proportional price',
   [[['lemon', 50, 450, 500, 100, 'bulk'], ['herbs', 50, 450, 100, 90, 'whole']], 4],
   {'packs': {'herbs': 1}, 'per_serving_cents': 124, 'total_cents': 495}],
  ['repair check: bulk proportional price',
   [[['cream', 100, 450, 12, 80, 'bulk'], ['eggs', 300, 1200, 1000, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 1723, 'total_cents': 5168}],
  ['generated control 1', [[['lemon', 6, 1200, 6, 75, 'bulk'], ['herbs', 900, 450, 12, 100, 'bulk']], 8],
   {'packs': {}, 'per_serving_cents': 4419, 'total_cents': 35350}],
  ['generated control 2', [[['lemon', 3, 99, 500, 80, 'whole']], 3],
   {'packs': {'lemon': 1}, 'per_serving_cents': 33, 'total_cents': 99}],
  ['generated control 3',
   [[['herbs', 300, 1200, 250, 80, 'whole'], ['cream', 100, 99, 1000, 75, 'whole'],
     ['onion', 250, 99, 500, 80, 'bulk'], ['lemon', 6, 249, 12, 80, 'whole']],
    3],
   {'packs': {'cream': 1, 'herbs': 2, 'lemon': 1}, 'per_serving_cents': 937, 'total_cents': 2810}]],
 [['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['regression: bulk proportional price', [[['beef', 6, 99, 12, 80, 'bulk']], 6],
   {'packs': {}, 'per_serving_cents': 11, 'total_cents': 62}],
  ['repair check: bulk proportional price',
   [[['eggs', 100, 1200, 250, 90, 'whole'], ['herbs', 300, 1200, 12, 90, 'bulk']], 5],
   {'packs': {'eggs': 1}, 'per_serving_cents': 6907, 'total_cents': 34533}],
  ['generated control 1',
   [[['beef', 300, 1200, 100, 100, 'bulk'], ['cream', 400, 450, 250, 100, 'bulk'],
     ['herbs', 100, 249, 6, 50, 'bulk'], ['lemon', 100, 1200, 500, 50, 'bulk']],
    5],
   {'packs': {}, 'per_serving_cents': 2620, 'total_cents': 13100}],
  ['generated control 2',
   [[['cream', 300, 249, 100, 80, 'whole'], ['eggs', 900, 1200, 1000, 85, 'bulk'],
     ['herbs', 250, 249, 250, 90, 'whole'], ['beef', 250, 450, 6, 85, 'whole']],
    6],
   {'packs': {'beef': 50, 'cream': 4, 'herbs': 2}, 'per_serving_cents': 4211, 'total_cents': 25265}],
  ['generated control 3',
   [[['cream', 50, 450, 1000, 50, 'whole'], ['lemon', 100, 450, 12, 80, 'bulk'],
     ['eggs', 3, 249, 250, 100, 'whole'], ['herbs', 250, 450, 1000, 85, 'whole']],
    1],
   {'packs': {'cream': 1, 'eggs': 1, 'herbs': 1}, 'per_serving_cents': 5837, 'total_cents': 5837}]],
 [['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['regression: bulk proportional price',
   [[['beef', 900, 249, 12, 100, 'bulk'], ['cream', 400, 249, 250, 100, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 6358, 'total_cents': 19073}],
  ['repair check: bulk proportional price',
   [[['lemon', 250, 99, 1000, 50, 'bulk'], ['herbs', 6, 99, 250, 75, 'whole'],
     ['onion', 3, 450, 100, 80, 'bulk'], ['cream', 3, 249, 6, 50, 'whole']],
    2],
   {'packs': {'cream': 1, 'herbs': 1}, 'per_serving_cents': 208, 'total_cents': 414}],
  ['generated control 1',
   [[['onion', 3, 249, 6, 75, 'whole'], ['lemon', 900, 249, 12, 85, 'whole'],
     ['cream', 250, 1200, 12, 50, 'whole']],
    4],
   {'packs': {'cream': 42, 'lemon': 89, 'onion': 1}, 'per_serving_cents': 18203, 'total_cents': 72810}],
  ['generated control 2', [[['beef', 3, 249, 250, 80, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 63, 'total_cents': 249}],
  ['generated control 3',
   [[['onion', 300, 1200, 6, 80, 'whole'], ['eggs', 3, 99, 1000, 75, 'bulk'],
     ['lemon', 3, 249, 6, 100, 'whole'], ['beef', 900, 99, 1000, 75, 'bulk']],
    8],
   {'packs': {'lemon': 1, 'onion': 63}, 'per_serving_cents': 9497, 'total_cents': 75968}]],
 [['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['regression: bulk proportional price', [[['beef', 250, 99, 6, 90, 'bulk']], 2],
   {'packs': {}, 'per_serving_cents': 2292, 'total_cents': 4583}],
  ['repair check: bulk proportional price',
   [[['eggs', 6, 99, 100, 75, 'bulk'], ['lemon', 3, 1200, 100, 90, 'whole'],
     ['cream', 900, 1200, 6, 100, 'bulk'], ['onion', 400, 450, 100, 85, 'whole']],
    1],
   {'packs': {'lemon': 1, 'onion': 5}, 'per_serving_cents': 183458, 'total_cents': 183458}],
  ['generated control 1', [[['onion', 900, 99, 6, 100, 'whole']], 5],
   {'packs': {'onion': 150}, 'per_serving_cents': 2970, 'total_cents': 14850}],
  ['generated control 2',
   [[['cream', 250, 450, 250, 75, 'bulk'], ['beef', 250, 99, 250, 75, 'whole'],
     ['eggs', 3, 450, 250, 50, 'whole'], ['onion', 6, 249, 12, 50, 'whole']],
    4],
   {'packs': {'beef': 2, 'eggs': 1, 'onion': 1}, 'per_serving_cents': 375, 'total_cents': 1497}],
  ['generated control 3', [[['herbs', 6, 1200, 100, 100, 'whole']], 3],
   {'packs': {'herbs': 1}, 'per_serving_cents': 400, 'total_cents': 1200}]],
 [['trim loss', [[['onion', 90, 99, 100, 90, 'bulk']], 1],
   {'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}],
  ['bulk herbs', [[['herbs', 30, 450, 100, 75, 'bulk']], 3],
   {'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}],
  ['exact whole pack', [[['beef', 500, 1200, 500, 100, 'whole']], 4],
   {'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}],
  ['regression: bulk proportional price',
   [[['herbs', 3, 1200, 500, 75, 'bulk'], ['eggs', 300, 1200, 100, 50, 'bulk'],
     ['lemon', 400, 249, 1000, 90, 'bulk'], ['onion', 900, 1200, 250, 100, 'whole']],
    7],
   {'packs': {'onion': 4}, 'per_serving_cents': 1732, 'total_cents': 12120}],
  ['repair check: bulk proportional price',
   [[['lemon', 50, 249, 6, 90, 'whole'], ['onion', 3, 450, 12, 75, 'bulk'],
     ['eggs', 400, 450, 6, 75, 'whole'], ['beef', 50, 99, 100, 100, 'bulk']],
    5],
   {'packs': {'eggs': 89, 'lemon': 10}, 'per_serving_cents': 8548, 'total_cents': 42740}],
  ['generated control 1', [[['lemon', 250, 450, 1000, 85, 'whole']], 6],
   {'packs': {'lemon': 1}, 'per_serving_cents': 75, 'total_cents': 450}],
  ['generated control 2', [[['herbs', 3, 1200, 12, 75, 'bulk'], ['cream', 900, 1200, 12, 100, 'bulk']], 7],
   {'packs': {}, 'per_serving_cents': 12915, 'total_cents': 90400}],
  ['generated control 3',
   [[['beef', 100, 450, 250, 100, 'whole'], ['eggs', 300, 1200, 12, 85, 'bulk'],
     ['onion', 50, 450, 100, 85, 'bulk']],
    8],
   {'packs': {'beef': 1}, 'per_serving_cents': 4502, 'total_cents': 36009}]]]
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
exact whole pack{'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}{'packs': {'beef': 1}, 'per_serving_cents': 300, 'total_cents': 1200}Passed
trim loss{'packs': {}, 'per_serving_cents': 1, 'total_cents': 1}{'packs': {}, 'per_serving_cents': 99, 'total_cents': 99}Failed
bulk herbs{'packs': {}, 'per_serving_cents': 1, 'total_cents': 2}{'packs': {}, 'per_serving_cents': 60, 'total_cents': 180}Failed
regression: bulk proportional price{'packs': {'herbs': 1}, 'per_serving_cents': 113, 'total_cents': 450}{'packs': {'herbs': 1}, 'per_serving_cents': 124, 'total_cents': 495}Failed
repair check: bulk proportional price{'packs': {}, 'per_serving_cents': 18, 'total_cents': 52}{'packs': {}, 'per_serving_cents': 1723, 'total_cents': 5168}Failed
generated control 1{'packs': {}, 'per_serving_cents': 45, 'total_cents': 354}{'packs': {}, 'per_serving_cents': 4419, 'total_cents': 35350}Failed
generated control 2{'packs': {'lemon': 1}, 'per_serving_cents': 33, 'total_cents': 99}{'packs': {'lemon': 1}, 'per_serving_cents': 33, 'total_cents': 99}Passed
generated control 3{'packs': {'cream': 1, 'herbs': 2, 'lemon': 1}, 'per_serving_cents': 917, 'total_cents': 2749}{'packs': {'cream': 1, 'herbs': 2, 'lemon': 1}, 'per_serving_cents': 937, 'total_cents': 2810}Failed

SHA-256 / 0c0bf75d3ef3c6b50f72c08d0f6d9472f6e27fd68e9ebbee04b3cf440e103cd0

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 26206364f8ab0b90f72b31c1ae052db8b2ddb972f3447813f6b95fee3b960e51