Status: done (2026-11-10)
Priority: 2
Size: M
Arch: year
Phase: implement
Design ref: Goods and the farming year (Food, Meals), design.md section 8; Kim, 10 November
Goal: “Ration” does two jobs: it is the unit (one adult’s food for one day; grain, milk and debts are counted in it) and it is a good a household stores (hh.rations, cooked from grain by cook, src/sim/stores.js). Kim, 10 November: a ration is only the unit. What a household stores are foods, each worth so many rations, and meals, which the cook makes from them. Make that the shape of the stores before fish, gathered food and mixed meals arrive (VB-117 to VB-119), with nothing else changed.
Acceptance criteria:
hh.meals, counted in rations; the good’s name in sim/stores is 'meals', in every operation, reason and ledger line, in src/sim/ and src/page/, and in the tools and tests that name it (grep -rn "rations" src tools tests then finds only the unit). The page says “meals” for the cooked store and keeps “rations” as the unit (“12 rations of grain”, “Owes 34 rations”).FOODS in src/sim/rules.js: for each food its worth in rations a unit, its shelf life in days (none for grain), its source for a meal’s variety (grain and flour are one source) and whether it is eaten uncooked. Rows today: grain (1, none, grain). Every place that puts food into a household’s store under another reason (milk, butter, salted and fresh meat: src/sim/byre.js, src/sim/herds.js) is listed in the PR with what it puts and where; these keep going where they go today, and each gets its row, so the table names every food the game has. No food moves differently.cook takes foods and makes meals through one function that reads the table (today: grain only, 1 to 1).tests/saves.js). @state lines, src/owners.json and the invariants follow the name.node tools/sim.js --scenario populous --seed 7 --map small --years 3 is the same before and after. tests/golden.json is re-recorded only for the field’s name; the PR lists the changed entries and shows they differ in nothing else. Counters unchanged. npm run verify’s hard checks pass, its targets reported with their residuals (the page changes).src/sim/stores.js, src/sim/hunger.js and the page’s words, none of them slice 3’s plan files, so it may run beside VB-258; not beside VB-237 or VB-239 (stores and saves).FOODS row with today’s worth; a cell the code
does not give carries design.md’s value, or null where design.md gives none; “behaviour unchanged” is the sim run below printing the same
numbers, and the golden file changing only by the field’s name.hh.rations becomes hh.meals (owner sim/stores, src/owners.json); its writers are sim/stores (put, take,
cook, start), called from sim/hunger (the day’s meal), sim/kinds (the cook job), sim/farmclaims (provisions), sim/scenarios and
sim/records (the start); readers sim/lifecycle (the marriage store), the page (play.js food days, words.js Supplies) and
tools/balance.js. The stores’ good 'rations' is 'meals' in every operation, ledger entry and yearly total. New: FOODS in
src/sim/rules.js (a constant, not state), read by sim/stores (mealsFrom, the one place a food becomes meals, and cook(st, hh, food, n))
and sim/byre (milk’s shelf life, which was a literal 1 there). No new coupling between systems: sim/stores already read sim/rules.
Save format 3 (src/sim/saves.js): READS is [3], so a format-1 or 2 save (with hh.rations) is refused with “load: format 2, this build reads
3”; the page refuses it already by its build id (VB-214). tests/saves.js checks the refusal.grain, false); meat, fresh (1,
HERD.freshDays 3, meat, true); salt meat (1, HERD.saltDays 48, meat, true); milk (1, 1, milk, true); butter (1, HERD.butterDays 48,
null, true). Worth and keeps are today’s code values; sources of grain, meat and milk are design.md’s (Mixed meals: “grain or flour, fish and
gathered food are sources now, milk and meat with the animals”); butter’s source is null: design.md does not say whether butter counts as
milk. Nothing reads source or raw yet (the pot is VB-119), but tests/lib/invariants.js now checks every larder lot is a raw food of the table.hh.larder, by sim/hunger addFood, with a
Stores.record ledger line; unchanged): src/sim/byre.js slaughterDone puts fresh meat (HERD.meat[kind] rations, halved when lean;
reason meat); milkDone puts milk (kept a day) and butter (HERD.butter of it, kept butterDays; reasons milk, butter); saltDone
turns the fresh meat into salt meat (kept saltDays; no ledger line, as before). src/sim/herds.js puts nothing: it reads the larder and
the yearly milk and butter totals for its report.'rations' good, which was both the unit and the cooked store (field, setFood, cook, start, the ledger’s
goods); cook no longer hard-codes grain into the cooked store 1 to 1 (it reads the food’s worth); milk’s shelf life is no longer a bare
literal in byre.js; the comments that said “cooked rations” or “short of rations” for the store. Code: 30 files, +134 -97 before notes.docs/img/vb-259-supplies-meals.png, founders 7
tiny at the start: “Grain 219 rations; … Meals 6 rations, cooked.”). “rations” stays the unit everywhere else.node tools/sim.js --scenario populous --seed 7 --map small --years 3, before (756c693) and after: the same numbers every year
(pop 323/337/351, births 3/17/19, hungry days 18/12/9, mean grain 267.1/305.2/331.8, demand 19/6/3; ms/day aside); the households, hunger
and herds reports (--json) are byte-identical, and founders 7 small’s herds report too. Households are neither better nor worse off.
Golden: tests/golden.json re-recorded; changed entries: households only, in founders/7, heirs/7, founders/42 and heirs/42, at seed and
years 1 to 3 (16 entries). node tests/golden.js --dump of both, with .rations = and good = "rations" normalised to meals and each file’s
lines sorted, is identical (9,587,479 lines). Counters: node tests/counters.js 0 out against the baseline, none re-recorded.
npm test: 88 scripts pass; 2 targets out, as at the base and not moved (scaling.routeRefresh +0.1147, scaling.roundPairs +0.85).
npm run verify (337 s): every script passes but three, all for one reason: the published fixtures (fetched, made at 498a87a, save format 1)
are refused by this build, which reads format 3 only (“small-y5: save format 1, expected 3; remake the fixtures”): tests/fixtures.js,
tests/record.js (its fixture part, after its own checks passed) and tests/history.js (so the year-40 over year-5 cost target was not
measured). Expected: the field is renamed and the save format raised; the nightly workflow remakes the fixtures. Not remade here
(orchestrator). The page’s jsdom and Chromium tests pass. Targets out: the 2 of npm test above, as at the base; no target moved.milk: dairy is one source, as grain and flour are one. FOODS.butter.source set; nothing reads it yet (VB-119).