A new Recipes page at /recipes lets a cook paste a plain-text… #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "osf/69-172-comparison-arm-groups-scale-recipes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was done
/recipeslets a cook paste a plain-text recipe, choose the number of servings and Metric or US, and get the recipe back scaled and converted./recipesas a person would — a fresh page, a recipe with an unread line, add-to-list, and an invalid-servings entry.How to review
compare/groups.npm testafternpm install; every suite passes, including the new reader, scaling, conversion, shopping-list, page and route tests.npx playwright install chromiumonce, thennpm run test:e2e— which starts the server and drives/recipes, asserting14 oz flour,4 eggs, theLine 3unread report, and the6 eggs/14 oz flourlist (both this andnpm startwant the Postgres the README's Run section describes, set onDATABASE_URL).npm startand open http://localhost:3000/recipes: pasteServes 2,200 g flour,a pinch of salt,2 eggs, enter 4, choose US and press Show recipe to see14 oz flour,4 eggsandLine 3: a pinch of salt (no quantity), then press Add to list to see the list.src/recipe.tsfirst (the shared types and the reader), then the/recipesroutes insrc/server.ts, which sit before the/<code>branch so the page is not answered as a short link.CHANGELOG.mdentry under## Unreleased.Code review
Reviewed the four new modules (reading, scaling, converting, shopping list), the /recipes page and routes, and all their tests against the change's five spec deltas. The implementation matches every pinned scenario: all 47 scenarios are covered by unit, page, server and e2e tests; 86 narrowed vitest tests (including the pre-existing server route tests), tsc --noEmit, openspec validate --strict, scripts/ci/release-notes.sh and playwright test --list all pass. No generated, secret or scratch files are carried by the commit (node_modules/, test-results/ and playwright-report/ are already ignored). I fixed two minor CSS issues in the new page (a dead .problem rule and radio inputs inheriting the text-input border/padding) and recorded one edge case left as designed: a quantity below 5e-7 is written to a hidden list field as 0 and its line is dropped on the next round trip, which is the literal result of design.md's six-decimals rule and is not pinned by any spec scenario.
Left for you
src/server.ts:32: ingredientLine writes the quantity to six decimals with trailing zeros dropped; a positive quantity below 5e-7 (e.g. a pasted 0.0000001 ml, which displays as 0.1) becomes 0.000000 and thus 0 in the hidden list field, so parseIngredientLine drops the line (no quantity) on the next submission and the ingredient silently leaves the shopping list. This is the literal result of design.md's six-decimals rule and no spec scenario pins it, so left as designed.Fixed before the commit
src/pages.ts:41: Dead CSS rule.problem { color: #b00020; }added by this change: the lines-that-did-not-read list uses class="problems" (and messages use class="error"), so the rule never matched. Removed it.src/pages.ts:39: The Metric/US radio inputs inherited the genericinputrule (1px border, padding), rendering each radio inside a small bordered box. Extended the change's own.choice inputrule toflex: none; padding: 0; border: 0;.Tests
All 47 scenarios of
scale-recipes-and-shopping-listhave a tagged test.The test lint found, in the run's tests on the last check:
Recorded, not decided
e2e/recipes.spec.ts:1B7: no relative import: this file asserts on things it constructed itself, which is the measured 'asserted on my own mock' failuretest/recipes-page.test.ts:1B7: nothing imported here looks like the module under test ('recipes-page')test/recipes-server.test.ts:1B7: nothing imported here looks like the module under test ('recipes-server')Braid run
scale-recipes-and-shopping-list(23 steps)602203c039Opened by Braid.
Scale a recipe, convert its units, and build a shopping listto A new Recipes page at/recipeslets a cook paste a plain-text…602203c0394f0f5de55f