Skip to content

fix(bench): wait for grouping to paint before opening the group-expand window - #483

Merged
blove merged 1 commit into
mainfrom
blove/bench-group-expand-wait-for-paint
Aug 23, 2026
Merged

fix(bench): wait for grouping to paint before opening the group-expand window#483
blove merged 1 commit into
mainfrom
blove/bench-group-expand-wait-for-paint

Conversation

@blove

@blove blove commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Why

test has been failing on main since Aug 17, which skips Deploy → Vercel (production) and the preview smoke — grey checks, no red X — so production has been serving 5f59f86 while main is a438efb. Tracked by #482. A CI re-run failed identically, so it is not a transient flake.

The failing test is groups the grid BEFORE the group-expand measurement window opens.

The bug

waitForGroupedRowModel gated on the row model, but the invariant it exists to hold is about the screen. If the group rows render inside the measurement window, that render is what gets measured instead of the toggle. Under CI load the model settles several frames before React commits the paint, so the window opened early and silently folded grouping cost into the group-expand number.

Worth naming: the pre-existing countGroupRows also reads the model — nothing in the app consulted the DOM before this change.

The fix

  • Gate on group rows actually committed to the DOM (countPaintedGroupRows).
  • If the frame budget is exhausted without a painted grouping, report partial instead of measuring. A run that says it fell short beats a completed run that quietly measured the wrong thing.

Verification

Every number below is from this branch, not a cache.

  • Whole file against unpatched app code: Tests 1 failed | 17 passed (18) — only the new test fails, so the teardown change breaks nothing.
  • Against patched code: Tests 18 passed (18).
  • Full package suite: Test Files 15 passed (15) / Tests 159 passed (159).
  • typecheck clean, prettier --check clean.

The new test withholds paint forever and asserts the run declines to measure. An earlier version of it was vacuous — it mocked the DOM query, but the old code never queries the DOM at all, so the mock changed nothing and it passed on broken code. This version discriminates.

A second, separate defect found on the way

The new test passed alone and failed in the suite. window[__PRETABLE_BENCH_RESULT__] is a global that nothing reset between tests, so a test waiting for a published result could match the previous test's result and assert against a run that never happened — it failed in 200 ms, before anything could have run. Cleared in the suite teardown, which closes the class for every test in the file.

Note this only makes the measurement honest; it does not by itself prove the group-expand number was wrong in past runs.

🤖 Generated with Claude Code

…d window

`waitForGroupedRowModel` gated on the row model, but the invariant it exists
to hold is about the screen: if the group rows render inside the measurement
window, that render is what gets measured instead of the toggle. Under CI load
the model settles several frames before React commits, so the window opened
early and silently folded grouping cost into the group-expand number — which
is what made `groups the grid BEFORE the group-expand measurement window
opens` fail on main, skipping the production deploy (#482).

Gate on group rows actually committed to the DOM. When the frame budget is
exhausted without a painted grouping, report `partial` rather than measuring
the wrong thing — a run that says it fell short beats a completed run that
quietly measured something else. Note the pre-existing `countGroupRows` reads
the model too; nothing in the app consulted the DOM before this.

The new regression test withholds paint forever and asserts the run declines
to measure. Proven red against unpatched code, green against patched.

Also clear `window[__PRETABLE_BENCH_RESULT__]` in the suite's teardown: it is
a global that nothing reset, so a test waiting for a published result could
match the PREVIOUS test's and assert against a run that never happened. That
is exactly how the new test passed alone and failed in the suite.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pretable Ignored Ignored Aug 23, 2026 12:16am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Vercel preview ready

Preview: https://pretable-b93mjaxah-cacheplane.vercel.app
Commit: a14a8b99a1780793945ae91e697b9a97e1043d7c

Updated automatically by the deploy-preview job.

@blove
blove merged commit e77cd85 into main Aug 23, 2026
20 checks passed
@blove
blove deleted the blove/bench-group-expand-wait-for-paint branch August 23, 2026 00:32
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.

1 participant