fix: recipe card and chat card 'N to buy' keys add grocery lines with amounts (#868) #882
All Vouch review confidence checks passed
Residual risk 0.37 = Change Risk (0.52) × (1 − Review Confidence (0.29)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 48% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #882"
general
weight: 0.35
claude[bot]
Summary
The recipe card's own "Add to grocery list" key (the dish card on a saved meal's page, and the recipe card in chat) used to put bare names on the grocery list: every line read "Add amount" and landed under "Other". They now add what the meal page's to-buy line has added since PR #860: amount, unit and, for a saved meal, category. An amount already on a list line is never overwritten (the same
addMissingToGroceryListrule).What changes
fetchMealToBuyDetail); it now also builds each dish's list entries from it (toBuyEntriesByDish) and passes them to the card astoBuyEntries. Same entries, same order as the names the card shows./v1/grocery/meal-to-buyabout. The card adds each missing food (from the pantry grading,ingredient_availability) with the amount and unit from the card's own ingredient list (toBuyEntriesFromRecipe).ToBuyLinetakes an optionalentries(what the key adds) next toitems(what it displays);addItemsToMyGroceryListaccepts amounts. No change to what the line displays.Verify
Production build of this branch (
stack.sh up, commitf34f155ecode; the later commit only adds screenshots) against main built fromgit archive origin/main. Playwright as the e2e test user, 390 px wide. Walk: click the card's "Add to grocery list", open/grocery, read the rows back.| Flow | Main | This PR |
|---|---|---|
| Dish card, saved meal (feta 200 g, parsley, 2 lemon) | Feta / Parsley / Lemon: "Add amount", all under Other | Feta 200 g (Dairy), Lemon 2 (Produce), Parsley "Add amount" (recipe gives none; Produce) |
| Chat recipe card (50 g parmesan, 2 lemon missing) | Parmesan / Lemon: "Add amount" | Parmesan 50 g, Lemon 2 |
| | Dish card | Chat card |
|---|---|---|
| Main |  |  |
| This PR |  |  |
Smoke suite (minus "AI round trip") passed: 4/4. Neighbours walked: the card's confirmation ("N on your grocery list") and the
/grocerypage.Mocked: every AI-service
/v1/call was blocked in the browser (no model calls); the saved meal (GET /api/meals/:id),POST /api/ai/grocery/meal-to-buyand the chat stream were stubbed with fixed payloads. Not verified: the real meal-to-buy endpoint on a real saved meal, and a real chat recipe turn (no live Gemini). The grocery list is localStorage, so nothing was written to the hosted DB.Tests
New
card-to-buy-amounts.test.tsx(10 tests): entry builders, the dish card handing entries on, and both cards writing amounts to the real list through the real store, including "a typed amount is kept". Red on main: 9 of 10 failed (the "never overwrites" case passes there trivially because a bare name carries no amount). Green here. One existing assertion inrecipe-card-chat-and-compact-row.test.tsxexpected the bare name['Lemon']; it now expects the entry with the recipe's amount. Full jest 3736 passed,tsc --noEmitclean,eslint src0 errors.Decisions
/v1/grocery/meal-to-buytakes a meal id,/api/ai/pantry/match-ingredientsreturns have/low/missing without a buy amount. A food graded "missing" has nothing usable on hand, so its recipe amount is the amount to buy (the service's own rule for the meal line). Rejected: saving the recipe as a meal just to ask the endpoint (a write the user didn't ask for).estimate-category, which this must not call. Rejected: a client-side guess table.Linked
Fixes #868
Out of scope
🤖 Generated with Claude Code