feat(kitchen): warn when an alias written after a blank loses its quantity #320

Merged
abiwab merged 5 commits from fix/alias-after-blank into dev/1.6 2026-11-29 21:09:27 +01:00
Owner

Summary

Since #303 an alias is glued to the colon, so @salt: fine{2 g} reads as the bare salt then text, and the quantity silently drops out of the shopping list and nutrition (pre-release audit 1.6, finding H1). Option kept: a warning with a fix, no grammar change, so nothing to carry over to tree-sitter-gram.

  • Kitchen: new ALIAS_AFTER_BLANK warning (data: { name, alias, suggestion }) on a bare ingredient or cookware followed by : alias{…}, multi-word names included (@dry white wine: wine{10 ml}). It is raised only when the glued form parses as that ingredient with that alias, so its fix is always safe: the fuzzer found braces that are a parse error once glued (regression in fuzz/regressions/).
  • Modules (lint): a preferred fix removes the blanks around the colon (Glue the alias to the colon: @salt:fine{2 g}), so the LSP Quick Fix and gram check --fix apply it; a second pass changes nothing.
  • TextMate: the braced ingredient and cookware rules no longer colour an alias after a blank (([\w][\w\s]*)); plist regenerated; new textmate-alias.test.ts.
  • Conformance: new warn-029-alias-after-blank; conformance:update changed nothing else.
  • Docs: ALIAS_AFTER_BLANK section in warnings.mdx, #303 paragraphs of ingredients.mdx and cookware.mdx (en + fr), llms-full.txt, and the importer's prompt. Changeset parser-alias-no-leading-blank completed (kitchen and modules minor).

Guard rails: bun run fuzz --iterations 50000 found one signature, format-preserves-meaning on CR-only line endings (@Flour vs @&flour). The same input fails on main and on dev/1.6, so it is not this PR's; it will be fixed on its own branch from main. bun run --cwd audit audit: 128 flags and 10 infos, as before.

Type of change

  • New feature (non-breaking change adding functionality)

Quality checklist

  • Code formatted with Biome (bun run lint:fix)
  • TypeScript types validated (bun run typecheck)
  • Package tests passing (bun test)
  • Golden conformance suite passing (bun run conformance)
  • If changing a published package, a changeset is included (bun run change)
  • Rebuilt packages before testing downstream packages (bun run build)
## Summary Since #303 an alias is glued to the colon, so `@salt: fine{2 g}` reads as the bare `salt` then text, and the quantity silently drops out of the shopping list and nutrition (pre-release audit 1.6, finding H1). Option kept: a warning with a fix, no grammar change, so nothing to carry over to `tree-sitter-gram`. - **Kitchen**: new `ALIAS_AFTER_BLANK` warning (`data: { name, alias, suggestion }`) on a bare ingredient or cookware followed by `: alias{…}`, multi-word names included (`@dry white wine: wine{10 ml}`). It is raised only when the glued form parses as that ingredient with that alias, so its fix is always safe: the fuzzer found braces that are a parse error once glued (regression in `fuzz/regressions/`). - **Modules (lint)**: a preferred fix removes the blanks around the colon (`Glue the alias to the colon: @salt:fine{2 g}`), so the LSP Quick Fix and `gram check --fix` apply it; a second pass changes nothing. - **TextMate**: the braced ingredient and cookware rules no longer colour an alias after a blank (`([\w][\w\s]*)`); plist regenerated; new `textmate-alias.test.ts`. - **Conformance**: new `warn-029-alias-after-blank`; `conformance:update` changed nothing else. - **Docs**: `ALIAS_AFTER_BLANK` section in `warnings.mdx`, #303 paragraphs of `ingredients.mdx` and `cookware.mdx` (en + fr), `llms-full.txt`, and the importer's prompt. Changeset `parser-alias-no-leading-blank` completed (kitchen and modules minor). Guard rails: `bun run fuzz --iterations 50000` found one signature, `format-preserves-meaning` on CR-only line endings (`@Flour` vs `@&flour`). The same input fails on `main` and on `dev/1.6`, so it is not this PR's; it will be fixed on its own branch from `main`. `bun run --cwd audit audit`: 128 flags and 10 infos, as before. ## Type of change - [x] New feature (non-breaking change adding functionality) ## Quality checklist - [x] Code formatted with Biome (`bun run lint:fix`) - [x] TypeScript types validated (`bun run typecheck`) - [x] Package tests passing (`bun test`) - [x] Golden conformance suite passing (`bun run conformance`) - [x] If changing a published package, a changeset is included (`bun run change`) - [x] Rebuilt packages before testing downstream packages (`bun run build`)
abiwab merged commit 7542eb3c59 into dev/1.6 2026-11-29 21:09:27 +01:00
Sign in to join this conversation.
No description provided.