Repository navigation
Description
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.nis 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