Added a /recipes page to the existing Shortcut app that reads a… #10

Merged
cmoriarty merged 3 commits from osf/74-172-comparison-arm-verify-186-scale into compare/verify-186 2026-10-17 17:30:28 -04:00
Owner

What was done

  • Added a /recipes page to the existing Shortcut app that reads a pasted recipe — a Serves N line and one ingredient per line, each a quantity, an optional unit, and a name.
  • Show recipe rewrites the recipe at the servings entered (an empty field keeps the recipe's own count) in Metric or US units, one ingredient per line, so a cook can scale and convert without doing the math.
  • Every ingredient line that could not be read is shown beside its line number with the reason, so a bad line is never silently dropped.
  • Add to list keeps the recipe in a shopping list of at most five recipes, whose ingredients merge by name and unit, sum their quantities, and sort by name.
  • The reading, scaling, conversion, and list rules each have their own unit tests, and the page has browser tests that drive it end to end.
  • The unit and browser tests ran and passed, and the page was opened in a real browser and confirmed to read correctly in every state.
  • The user-facing documentation and the changelog both cover the new page.
  • Not done: The shopping list is not stored in the database; it is carried in the page between submissions and starts empty on a fresh visit.

How to review

  1. Check out the change: git checkout osf/74-172-comparison-arm-verify-186-scale — it adds a /recipes page to the existing app, with new source modules and their tests.
  2. Install and run the unit checks: npm install then npm test — all suites should pass, including the new ones for reading, scaling, converting, the shopping list, and the page routes.
  3. Run the browser checks: npx playwright install chromium then npm run test:e2e — these drive the live page end to end (paste a recipe, show it doubled in US units, and add it to the list).
  4. Use it by hand: npm start (embedded Postgres per the README's Run section) and open http://localhost:3000/recipes — you should see the form with Metric selected and "The shopping list is empty."; paste a recipe, enter servings, choose US, and press Show recipe and Add to list to watch it scale, convert, and merge.
  5. Read src/recipe.ts (the recipe parsing) and src/server.ts (the /recipes routes) first; the other modules hang off them.

Code review

Reviewed the new recipes feature (scale-recipes-and-shopping-list): src/recipe.ts, src/scale.ts, src/convert.ts, src/shopping.ts, the recipesPage in src/pages.ts, the /recipes routes in src/server.ts, and all seven test files plus e2e/recipes.spec.ts. Every spec scenario is covered by a tagged test, and the hand-verified math (scaling, quarter/third rounding, the unit ladder, shopping-list name keys and sort order) matches the spec. All 78 tests pass, tsc --noEmit is clean, the Playwright suite lists 26 tests including the two recipes scenarios, release-notes.sh passes, and README documents /recipes. One very minor, unrealistic edge was recorded but not fixed: a scaled quantity below about 5e-7 formats to '0' and that line is silently dropped from the hidden list field.

Left for you

  • minor, src/server.ts:28: qtyText formats the quantity with toFixed(6); a scaled quantity below about 5e-7 (e.g. a 20 g ingredient in a 'Serves 1000000000' recipe scaled 2x) yields '0.000000' -> '0', which parseQuantity then rejects, so the line is silently dropped from the hidden list field. Only reachable with absurdly small quantities; no spec scenario or realistic recipe triggers it, so it is recorded but not fixed.

Tests

All 47 scenarios of scale-recipes-and-shopping-list have a tagged test.

The test lint found, in the run's tests on the last check:

Recorded, not decided

  • e2e/recipes.spec.ts:1 B7: no relative import: this file asserts on things it constructed itself, which is the measured 'asserted on my own mock' failure
  • test/recipes-page.test.ts:1 B7: nothing imported here looks like the module under test ('recipes-page')
  • test/recipes-server.test.ts:1 B7: nothing imported here looks like the module under test ('recipes-server')

Braid run

  • Workflow: Braid's OpenSpec flow, change scale-recipes-and-shopping-list (19 steps)
  • Issue: cmoriarty/braid-combined-test#4
  • Model: vLLM · qwen3.8-27b
  • Time: 1 h 18 m from start to this pull request, 1 h 10 m of it in the model
  • Tokens: 5.7M input, 43k output, 156k reasoning, over 187 model calls
  • Pre-flight estimate: fits-flagged, p50 198k / p80 278k tokens against a 86k-token step allowance
  • CI: passed its 6 jobs on 0b7c0b5b48
  • Run: run_01M55QVQNF9ZCAA1SX9231V8RZ

Opened by Braid.

## What was done - Added a `/recipes` page to the existing Shortcut app that reads a pasted recipe — a `Serves N` line and one ingredient per line, each a quantity, an optional unit, and a name. - `Show recipe` rewrites the recipe at the servings entered (an empty field keeps the recipe's own count) in Metric or US units, one ingredient per line, so a cook can scale and convert without doing the math. - Every ingredient line that could not be read is shown beside its line number with the reason, so a bad line is never silently dropped. - `Add to list` keeps the recipe in a shopping list of at most five recipes, whose ingredients merge by name and unit, sum their quantities, and sort by name. - The reading, scaling, conversion, and list rules each have their own unit tests, and the page has browser tests that drive it end to end. - The unit and browser tests ran and passed, and the page was opened in a real browser and confirmed to read correctly in every state. - The user-facing documentation and the changelog both cover the new page. - **Not done:** The shopping list is not stored in the database; it is carried in the page between submissions and starts empty on a fresh visit. ## How to review 1. Check out the change: `git checkout osf/74-172-comparison-arm-verify-186-scale` — it adds a `/recipes` page to the existing app, with new source modules and their tests. 2. Install and run the unit checks: `npm install` then `npm test` — all suites should pass, including the new ones for reading, scaling, converting, the shopping list, and the page routes. 3. Run the browser checks: `npx playwright install chromium` then `npm run test:e2e` — these drive the live page end to end (paste a recipe, show it doubled in US units, and add it to the list). 4. Use it by hand: `npm start` (embedded Postgres per the README's Run section) and open http://localhost:3000/recipes — you should see the form with Metric selected and "The shopping list is empty."; paste a recipe, enter servings, choose US, and press Show recipe and Add to list to watch it scale, convert, and merge. 5. Read `src/recipe.ts` (the recipe parsing) and `src/server.ts` (the `/recipes` routes) first; the other modules hang off them. ## Code review Reviewed the new recipes feature (scale-recipes-and-shopping-list): src/recipe.ts, src/scale.ts, src/convert.ts, src/shopping.ts, the recipesPage in src/pages.ts, the /recipes routes in src/server.ts, and all seven test files plus e2e/recipes.spec.ts. Every spec scenario is covered by a tagged test, and the hand-verified math (scaling, quarter/third rounding, the unit ladder, shopping-list name keys and sort order) matches the spec. All 78 tests pass, tsc --noEmit is clean, the Playwright suite lists 26 tests including the two recipes scenarios, release-notes.sh passes, and README documents /recipes. One very minor, unrealistic edge was recorded but not fixed: a scaled quantity below about 5e-7 formats to '0' and that line is silently dropped from the hidden list field. **Left for you** - minor, `src/server.ts:28`: qtyText formats the quantity with toFixed(6); a scaled quantity below about 5e-7 (e.g. a 20 g ingredient in a 'Serves 1000000000' recipe scaled 2x) yields '0.000000' -> '0', which parseQuantity then rejects, so the line is silently dropped from the hidden list field. Only reachable with absurdly small quantities; no spec scenario or realistic recipe triggers it, so it is recorded but not fixed. ## Tests All 47 scenarios of `scale-recipes-and-shopping-list` have a tagged test. The test lint found, in the run's tests on the last check: **Recorded, not decided** - `e2e/recipes.spec.ts:1` B7: no relative import: this file asserts on things it constructed itself, which is the measured 'asserted on my own mock' failure - `test/recipes-page.test.ts:1` B7: nothing imported here looks like the module under test ('recipes-page') - `test/recipes-server.test.ts:1` B7: nothing imported here looks like the module under test ('recipes-server') ## Braid run - **Workflow:** Braid's OpenSpec flow, change `scale-recipes-and-shopping-list` (19 steps) - **Issue:** cmoriarty/braid-combined-test#4 - **Model:** vLLM · qwen3.8-27b - **Time:** 1 h 18 m from start to this pull request, 1 h 10 m of it in the model - **Tokens:** 5.7M input, 43k output, 156k reasoning, over 187 model calls - **Pre-flight estimate:** fits-flagged, p50 198k / p80 278k tokens against a 86k-token step allowance - **CI:** passed its 6 jobs on `0b7c0b5b48` - **Run:** [run_01M55QVQNF9ZCAA1SX9231V8RZ](http://openspecflow.internal.underthere.xyz/run/run_01M55QVQNF9ZCAA1SX9231V8RZ) _Opened by Braid._
check: the code of fix-loop round 1, for the project's CI
All checks were successful
CI / Release notes (pull_request) Successful in 10s
CI / Browser tests (pull_request) Successful in 59s
CI / Unit tests (pull_request) Successful in 1m4s
CI / Unit tests (push) Successful in 58s
CI / Release notes (push) Successful in 10s
CI / Browser tests (push) Successful in 1m34s
0b7c0b5b48
cmoriarty changed title from Scale a recipe, convert its units, and build a shopping list to Added a /recipes page to the existing Shortcut app that reads a… 2026-10-17 17:30:13 -04:00
cmoriarty force-pushed osf/74-172-comparison-arm-verify-186-scale from 0b7c0b5b48
All checks were successful
CI / Release notes (pull_request) Successful in 10s
CI / Browser tests (pull_request) Successful in 59s
CI / Unit tests (pull_request) Successful in 1m4s
CI / Unit tests (push) Successful in 58s
CI / Release notes (push) Successful in 10s
CI / Browser tests (push) Successful in 1m34s
to 34e909f421
All checks were successful
CI / Release notes (push) Successful in 11s
CI / Unit tests (pull_request) Successful in 53s
CI / Unit tests (push) Successful in 59s
CI / Browser tests (push) Successful in 1m0s
CI / Release notes (pull_request) Successful in 8s
CI / Browser tests (pull_request) Successful in 1m27s
2026-10-17 17:30:14 -04:00
Compare
cmoriarty merged commit f768326c1d into compare/verify-186 2026-10-17 17:30:28 -04:00
cmoriarty deleted branch osf/74-172-comparison-arm-verify-186-scale 2026-10-17 17:30:28 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cmoriarty/braid-combined-test!10
No description provided.