fix: formula evaluation and management bugs

Three bugs fixed, each with a failing regression test added first:

1. WHERE filter fallthrough: when the filter's category was absent from the
   cell key, the formula was applied unconditionally. Now returns the raw
   stored value (no formula applied) when the category is missing.

2. Agg inner/filter ignored: SUM(Revenue) was summing ALL cells in the
   partial slice rather than constraining to the Revenue item. Now resolves
   the inner Ref to its category and pins that coordinate before scanning.

3. Formula dedup by target only: add_formula and remove_formula keyed on
   target name alone, so two formulas with the same item name in different
   categories would collide. Both now key on (target, target_category).

RemoveFormula command updated to carry target_category.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ed L
2026-03-24 00:11:33 -07:00
parent 09caf815d3
commit 9ef0a72894
3 changed files with 302 additions and 16 deletions

View File

@ -31,8 +31,8 @@ pub enum Command {
/// `target_category` names the category that owns the formula target.
AddFormula { raw: String, target_category: String },
/// Remove a formula by its target name.
RemoveFormula { target: String },
/// Remove a formula by its target name and category.
RemoveFormula { target: String, target_category: String },
/// Create a new view.
CreateView { name: String },