Skip to content

Shopping list: an optional linked recipe accepted with ? ./path is not bought #866

Backlog

Description

@dubadub

What happens

A .shopping-list can say that someone accepted a recipe's optional linked recipe (@?./Sauces/Aioli{1}) with a ? ./path selection line under the recipe's entry. CookCLI's store skips that line when it reads the list, so none of the linked recipe's ingredients are bought. The Cook apps for Android and iOS write this line and buy the linked recipe, so the same synced file gives a shorter list in CookCLI than on the phone.

Accepted optional ingredients (? chives{2}) are fine: CookCLI reads and writes those the same way the apps do.

Steps to reproduce

Dinner/Baked potato.cook

Bake @potato{2}. Top with @?chives{2} and @?./Sauces/Aioli{1}.

Sauces/Aioli.cook

Crush @garlic{1%clove} into @mayonnaise{100%g}.

.shopping-list

./Dinner/Baked potato
  ? chives{2}
  ? ./Sauces/Aioli

Run cook server in that folder and open the shopping list (or GET /api/shopping_list/items, then POST /api/shopping_list with what it returns).

Expected: potato 2, chives 2, garlic 1 clove, mayonnaise 100 g.

Actual: potato 2 and chives 2. The stored entry comes back with "included_references": [] and no trace of Aioli.

Checked on a local build of main (0.41.1 plus later commits).

Where

crates/core/src/shopping_list/store.rs: child_paths keeps only recipe children with optional == false, and its comment says a ? ./path line is one "this store does not write". StoredEntry has optional_ingredients for ? name{qty} lines but nothing for an accepted optional recipe, so the selection is lost between the file and the generated list.

The line itself survives: add and remove edit the parsed list and write it back, so CookCLI does not delete a selection another tool wrote. It only ignores it.

What the line means

From cooklang-rs src/shopping_list.rs, and what the apps do:

  • ? ./path{n} under a recipe entry: the optional linked recipe was accepted. n is the portion the recipe asks for, unscaled, left out when it is 1. It is read like any other child recipe, at the entry's scale × n.
  • The accepted recipe's own required linked recipes are stored as plain children under it. Its own optional items are not offered.

Suggested change

  • Read side: treat a ? ./path{n} child as an included reference when generating the list, at entry scale × n.
  • Write side (can follow later): let the Add to list dialog offer a recipe's optional linked recipes, unticked, and store a ticked one as a ? ./path{n} line, the way it already does for optional ingredients.

Activity

  1. added
    bug
    area: shopping-list
    on Nov 29, 2026
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

    area: shopping-listbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions