Merge pull request #239 from fiddlerwoaroof/collapse-fu/wm20

improvise-wm20: a column total is its cell as if every drawn row were one fold
This commit is contained in:
Ed Langley
2026-09-23 22:38:33 -07:00
committed by GitHub
10 changed files with 881 additions and 81 deletions
+64
View File
@@ -4542,6 +4542,8 @@ Two faults injected:
assertion (`left: Some("0.50") right: Some("0.5000")`).
- Dropping only the `col_formats` write in `viewport::grid_body`, leaving the
cells correct, fails the totals assertion (`left: "1.50" right: "1.5000"`).
Those numbers predate improvise-wm20. The total is now the formula over the
pooled rows, `0.5000`, and the same rival reads `0.50`.
The second is the one that earns the test its length: without it, the totals
strip could round every formula column to the view's format and no assertion in
@@ -6164,6 +6166,45 @@ flag. This test fails alone. Every other test stays green, which was the gap.
Once improvise-fy9o re-seeds the reopened editor, a stale `touched` would make
every untouched Tab or Enter write its seed.
## `ui/project.rs` — the totals strip (improvise-wm20)
### a_ratio_columns_total_is_the_ratio_of_the_totalled_inputs
improvise-wm20. `Margin = (Revenue - Cost) / Revenue` over North (10, 5) and
South (30, 3). The rows read 0.50 and 0.90, so the three candidate rules give
three different answers: summed **1.40**, averaged 0.70, and pooled
(40 − 8) / 40 = **0.80**. A fixture whose rows share a ratio cannot tell them
apart; the old `a_formulas_format_reaches_its_own_column_and_no_other` is one
such fixture. **Red at `60179150`** with 1.40. Rival: the red commit itself,
where the walk sums.
### an_average_measures_total_is_the_mean_over_its_records
improvise-wm20. `Price` under Avg, with `Product` on None, so North's row is the
mean of two records (10, 20) and South's of one (30). Summing the rows gives
**45**, the mean of the rows' means 22.5, and the mean of the records **20**.
The ruling is the last. **Red at `60179150`** with 45.
### a_hidden_rows_values_stay_out_of_the_total
improvise-wm20. `East` (100, 100) is hidden, so both the Revenue total (40) and
the pooled Margin (0.80) must leave it out. Pooled in, the Margin would read
32/140. This test earns its place through two rivals, each injected into a full
workspace run where each fails this test and nothing else:
- The span ignores `covers`, so hidden rows are pooled in.
- A formula's references are read **unspanned**. The ratio test cannot see this
one: an unspanned reference reads the column key over every record, which is
the right answer whenever nothing is hidden. Only a hidden row separates
"every drawn row" from "every record".
### a_max_measures_total_does_not_move_when_a_row_group_collapses
improvise-wm20, from the #203 re-review's comment on the bead. `Revenue` under
Max, with Region on None and Month's Jan and Feb in Q1. Expanded, the rows are
5 and 7, which a summing strip reads as **12**. Collapsed, the fold reads 7. The
total must be 7 both ways. **Red at `60179150`** with 12.
#### improvise-i3o5: four declines that `set_status` hid from every sweep
`every_refusal_site_refuses_its_failure_and_only_its_failure` gained four cases.
@@ -6193,6 +6234,29 @@ runs `cargo test --workspace --no-fail-fast`. Four of four fail this test, and
nothing else fails. None of the four needs an abort: each is the only effect its
command emits, and `p`/`i` are single bindings, not sequences.
### a_formula_rows_error_does_not_poison_the_pooled_total
improvise-b5dp, the user's ruling on the conflict between wm20's rulings (1) and
(2): a formula column's total is the **pooled ratio**. A row's formula error
does not poison it, and a stored error still does
(`an_error_in_any_row_makes_the_total_an_error`). Rows North 25/30, South 27/30
and East -4/0 draw 0.83, 0.90 and `div/0`. The total must read **0.80**
(48/60), not an error. The test asserts that East's row really draws the error,
so a fixture where no row errors cannot pass it.
It was **green at `9948aaf5`**, because #239 already implemented the choice the
user then ratified. It is a pin, not a reproduction. Rival: in `grid_body`'s
walk, a drawn cell's `Error` overwrote its column's total. That is ruling (2)
applied to every row. This test and its Share sibling fail on the total
assertion. The other seven `column_totals` tests pass.
### a_share_columns_total_pools_past_a_rows_div_zero
improvise-b5dp, the second case the bead named. `Share = Revenue /
SUM(Revenue)`: East's own `SUM` is 0, so its row draws `div/0`. The pooled
total is 60/60 = **1.00**. It was green at `9948aaf5` and fails under the same
rival as the test above.
### a_frame_that_reframes_and_then_places_the_cursor_leaves_the_asker_placed
improvise-wdmp. A browser frame that reframes the grid and then places the cursor,