Skip to content

chore(deps): cooklang 0.22.0; keep free-hand names starting with #, ~ or @ - #861

Merged
dubadub merged 2 commits into
mainfrom
chore/cooklang-0.22
Nov 28, 2026
Merged

dubadub merged 2 commits into
mainfrom
chore/cooklang-0.22

Conversation

@dubadub

@dubadub dubadub commented Nov 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Dependencies. cooklang 0.21.0 → 0.22.0, cooklang-ingredient-parser 0.21.0 → 0.22.0, cooklang-reports 0.9.0 → 0.10.0, cooklang-language-server 0.5.0 → 0.6.0. The tree keeps a single cooklang.
  • Adapting to cooklang 0.22 (feat!: shopping list quantities are Cooklang quantities cooklang-rs#165). IngredientItem.quantity is now a Quantity. CookCLI's FreeHandItem keeps its string quantity, so the web API's JSON is unchanged, and converts at the store boundary. The typed-item code uses the parser crate's Quantity API.
  • Fix: names starting with #, ~ or @. Free-hand items used to be merged into the list by re-parsing @{name}{q} as a one-line recipe. That turned #1 flour into cookware, ~ramen into a timer and @milk into milk, so they never reached the aisle list. They now go through IngredientList::add_shopping_item and keep their names. This covers items typed on the web list, lines written by the apps or added from a menu's days, and the CLI's --extra.

Behaviour notes

  • A rewrite of .shopping-list stores cooklang's normalised spelling (0.50%kg → 0.5%kg). Removing or editing an item matches its quantity by value, so a client holding the old spelling still finds the line.
  • CLI --extra still accepts one leading @, then reads the value as a one-line shopping list. Recipe-only syntax (|alias, ?) is no longer read. ./x, text after the closing brace, and a value spanning several lines are errors.

Test Plan

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings
  • cargo test --workspace --no-fail-fast: 1969 passed. New core, server and CLI tests cover #1 flour{2}, ~ramen and @milk{1%l} being listed under those exact names, ticks surviving compaction, and unticking on add. They fail before the fix.
  • cargo build --no-default-features --features server,lsp
  • Playwright, shopping-list specs, chromium, --workers=1: 16 passed, 2 skipped (both skips already in the specs)

https://claude.ai/code/session_01B7jPFN3aqqHBFR4HAZyuqW

…klang-language-server to 0.6.0

Also cooklang-ingredient-parser to 0.22.0. cooklang 0.22 reads a shopping
list item's quantity as a `Quantity` instead of a string. CookCLI's
`FreeHandItem` and `OptionalSelection` keep the stored string form
(`2%l`) as their JSON shape and convert at the store boundary: written
back with `Quantity::to_cooklang`, read with the shopping list format's
own quantity grammar. Lines are matched by the quantity they read as, so
a rewrite stores the format's spelling (`0.50%kg` becomes `0.5%kg`).

Claude-Session: https://claude.ai/code/session_01B7jPFN3aqqHBFR4HAZyuqW
A free-hand item went onto the generated list by being written as a
one-ingredient recipe (`@{name}{{q}}`) and parsed, so a name such as
`#1 flour`, `~ramen` or `@milk` came out as cookware, a timer or a
stripped name, and its tick was dropped on the next compaction.

Free-hand items now join the list through cooklang 0.22's
`IngredientList::add_shopping_item`, under their own name, both on the
page (`POST /api/shopping_list`, which still refuses a blank name with
400) and when the server works out which ticks to keep. The CLI's
`--extra` reads its value as a one-line shopping list, dropping one
leading `@` as before; a value that is not one named item (empty,
unclosed braces, a recipe line, several lines) is still a parse error
naming it.

Claude-Session: https://claude.ai/code/session_01B7jPFN3aqqHBFR4HAZyuqW
@claude

claude Bot commented Nov 27, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@dubadub
dubadub merged commit 4eae19f into main Nov 28, 2026
6 checks passed
@dubadub
dubadub deleted the chore/cooklang-0.22 branch November 28, 2026 08:42
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