Skip to content

feat(pantry): don't count missing optional ingredients - #594

Merged
dubadub merged 1 commit into
mainfrom
feat/pantry-optional
Oct 7, 2026
Merged

dubadub merged 1 commit into
mainfrom
feat/pantry-optional

Conversation

@dubadub

@dubadub dubadub commented Sep 30, 2026

Copy link
Copy Markdown
Member

Part 3 of the CookCLI side of spec proposal 0018 — independent of #592/#593.

Features that match recipes against available ingredients should not count a missing optional ingredient as missing. A recipe whose only absent ingredients are optional is a full match.

  • cook pantry recipes: wanted ingredients are the recipe's required ones, so a missing @?chives no longer demotes a recipe to a partial match, and partial percentages / missing lists are over required ingredients.
  • cook pantry plan: optional ingredients are never planned.
  • An ingredient used both ways (@parmesan{100%g} … @?parmesan{50%g}) is required.
  • cook doctor aisle still checks every ingredient, optional included — they still need an aisle.

Core: new find::required_ingredients, used by pantry::recipes and pantry::plan. Tests for full/partial matches, mixed use, and the plan. docs/pantry.md notes the behaviour. cargo test --all-features --workspace passes.

Following spec proposal 0018, `pantry recipes` treats a recipe whose
only absent ingredients are optional (`@?chives`) as a full match, and
works out partial-match percentages over required ingredients only.
`pantry plan` never plans optional ingredients. An ingredient used both
ways is required. `doctor`'s aisle check still sees every ingredient.
@dubadub
dubadub merged commit e5b6272 into main Oct 7, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant