Skip to content

shopping-list silently drops ingredients more than two references deep #509

Closed

Description

@jsadowyj

cook shopping-list expands recipe references two levels down and stops. Anything deeper is left out of the list, with no warning and exit code 0.

Reproduction

mkdir -p config
printf 'Make @./b{} and add @salt{1%%tsp}.\n' > a.cook
printf 'Make @./c{} and add @pepper{1%%tsp}.\n' > b.cook
printf 'Make @./d{} and add @cumin{1%%tsp}.\n' > c.cook
printf 'Add @paprika{1%%tsp}.\n' > d.cook
printf '[spices]\nsalt\npepper\ncumin\npaprika\n' > config/aisle.conf

cook shopping-list a.cook
[spices]
salt   1 tsp
pepper 1 tsp
cumin  1 tsp

paprika is missing. It is declared in d.cook, three references below a.cook. The same command on b.cook — the same chain, one level shorter — lists pepper, cumin and paprika, so the file and the reference path are fine.

cook doctor reports "All recipe references are valid" for the same collection.

Why

Expansion is two hand-rolled levels rather than recursion: a recipe's references are expanded, then one further loop covers "References inside the referenced recipe, one level further down" (src: https://github.com/cooklang/cookcli/blame/main/crates/core/src/shopping_list/mod.rs#L618-L625). The third level is never visited.

Recursing would not reintroduce #424: the ancestors chain added for cycle detection already bounds it.

The mobile app

The Cook mobile app appears to stop a level earlier still. Ex: adding a main dish lists the 4 cloves of garlic declared in the prep recipe it references directly, but not the clove reached through the sauce it also references; but the CLI lists 5. Rewriting that same garlic as a plain ingredient inside the sauce made the app find it. Adding the menu above the main dish lists no garlic at all.

Context

Noticed with a weekly menu that references dinners, which reference sauces, which reference an aromatic prep recipe: garlic came out at 7 cloves instead of 11.

Activity

  1. jsadowyj commented on Sep 18, 2026

    @jsadowyj
    Author

    @dubadub Is this fixed in the mobile app too?

  2. dubadub commented on Sep 18, 2026

    @dubadub
    Member

    @dubadub Is this fixed in the mobile app too?

    Not yet, working on it

  3. added a commit that references this issue on Nov 16, 2026
    a69b461
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions