Skip to content

Calc: SUBTOTAL 109 recalculates when Row Height, AutoFit or Ungroup reveal rows - #796

Merged
h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
vangel76:fix/subtotal-hidden-recalc
Oct 13, 2026
Merged

h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
vangel76:fix/subtotal-hidden-recalc

Conversation

@vangel76

Copy link
Copy Markdown
Contributor

Root cause: home.rowHeight (non-zero height unhides, zero hides), home.autofitRowHeight (clears hidden) and data.ungroup (unhides rows of removed groups) change row hidden state without setting cx.structural, so SUBTOTAL(101-111) cells stay stale in memory (incremental recalc) and differ from a full recalc. Found by the command-sequence fuzz (seed 3); minimal repro: selection.set E8:F13, home.hideRows 9:11, home.rowHeight 60 with =SUBTOTAL(109,Sales[Q1]). Pre-existing on main (the new regression test fails there), not caused by WordArt (#789), whose changed command mix only exposed it.

Change: mark these three commands structural, like home.hideRows already does.

Tests: tests::subtotal_109_recalculates_when_row_height_or_autofit_reveals_rows (fails before, passes after). cargo test -p gridcraft-engine --lib (230 ok), --test command_sequence_fuzz (default seeds and GRIDCRAFT_FUZZ_SEEDS=40 all green), clippy -D warnings, fmt on gridcraft-engine.

Not done: no regression test for the ungroup path specifically; other hide paths (filter apply, outline) already set structural.

🤖 Generated with Claude Code

…or Ungroup reveal rows

home.rowHeight, home.autofitRowHeight and data.ungroup change row hidden
state without marking the edit structural, so SUBTOTAL(101-111) kept a stale
value. Found by the command-sequence fuzz (seed 3).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts:
#	ROADMAP.md
#	crates/engine/src/tests.rs
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 599fc0f into storytold:main Oct 13, 2026
1 check failed
@echelon

echelon commented Oct 13, 2026

Copy link
Copy Markdown
Member

Merged — thank you @vangel76 for the contribution!

I merged main into your branch to resolve conflicts with other PRs that landed first.

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.

3 participants