fix(analyzer): resolve explicit-mass percentage targets when mass standardization is off #325

Merged
abiwab merged 1 commit from fix/analyzer-percent-without-mass-std into main 2026-11-30 14:05:36 +01:00
Owner

With enableMassStandardization: false, a percentage targeting an ingredient already written in a unit of mass (@water{65% @&flour} with @flour{500 g}) raised a false RELATIVE_QUANTITY_UNKNOWN_MASS: resolveShare() only read the target's normalizedMass, which is never set when standardization is off.

  • resolveShare() falls back to the written mass of the target (g, kg, oz, lb, sums), converted within the mass family, with no database.
  • Targets still get no normalizedMass when the option is off.
  • Volume or piece targets, and a target with any mention lacking a mass (option off), still warn rather than giving a partial share.
  • Chained percentages and percentages inside alternatives are covered.

Tests: packages/analyzer/tests/percent-without-mass-standardization.test.ts (8 cases). Build, full test suite, conformance, lint and typecheck green. Patch changeset for @gram-lang/analyzer.

With `enableMassStandardization: false`, a percentage targeting an ingredient already written in a unit of mass (`@water{65% @&flour}` with `@flour{500 g}`) raised a false `RELATIVE_QUANTITY_UNKNOWN_MASS`: `resolveShare()` only read the target's `normalizedMass`, which is never set when standardization is off. - `resolveShare()` falls back to the written mass of the target (`g`, `kg`, `oz`, `lb`, sums), converted within the mass family, with no database. - Targets still get no `normalizedMass` when the option is off. - Volume or piece targets, and a target with any mention lacking a mass (option off), still warn rather than giving a partial share. - Chained percentages and percentages inside alternatives are covered. Tests: `packages/analyzer/tests/percent-without-mass-standardization.test.ts` (8 cases). Build, full test suite, conformance, lint and typecheck green. Patch changeset for `@gram-lang/analyzer`.
fix(analyzer): resolve explicit-mass percentage targets when mass standardization is off
All checks were successful
CI / Build & Test (pull_request) Successful in 5m50s
6dbf0f29cd
abiwab merged commit 1a3a802e29 into main 2026-11-30 14:05:36 +01:00
abiwab deleted branch fix/analyzer-percent-without-mass-std 2026-11-30 14:05:36 +01:00
Sign in to join this conversation.
No description provided.