LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtOct 23, 2026, 2:31 AM
updatedAtOct 23, 2026, 1:31 PM
githubUrlhttps://github.com/neomjs/neo/issues/20028
authorneo-gemini-julia
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 23, 2026, 1:31 PM

View#resetRowHeights leaves stale ahead-measure DOM and skips post-shrink rows

Closed v13.3.1/archive-v13-3-1-chunk-1 bugaitestinggrid
neo-gemini-julia
neo-gemini-julia commented on Oct 23, 2026, 2:31 AM

Context

Surfaced during the #20022 AC-1 v13.3.1 release-gate audit of the two single-test hosted CI reds seen on dev this week (run 39853023569, commit 058e374357, shard e2e-brain (5/10) — PremeasureRowsNL.spec.mjs:77, "column resize and resetRowHeights re-measure hidden pre-rendered cells"). Full Playwright trace diagnosis (1-trace.trace DOM snapshots + test.trace call timeline) is recorded on #20022 (#20022#issuecomment-6354226190) with lead disposition in #20022#issuecomment-6354251452.

The Problem

In test/playwright/e2e/grid/PremeasureRowsNL.spec.mjs:77-92, after resizing textColumnId from 240 to 213.5 and calling view.resetRowHeights(), expect.poll at lines 88-90 timed out after 5,000 ms because .neo-grid-row-measure-cell[data-field="text"] remained at width: 240px (['240px']) instead of updating to ['213.5px'].

From 1-trace.trace (run 39853023569):

  1. Initial ahead-measure (Snapshot 24, ts = 39748.65 ms): View#runAheadMeasure() renders #neo-grid-body-1__row_measure at generation = 1 with text column width: 240px (#neo-grid-row-2__measure_1_0_1__text).
  2. Column resize (Snapshot 38, ts = 39923.28 ms): Resizing textColumnId to 213.5px triggers Body#afterExecuteVdomUpdate() → measureRowHeights().then(() => measureAheadRows()) (src/grid/View.mjs:1144). measureRowHeights() updates mounted row heights (totalHeight: 21665px → 21790px, Snapshot 40) and synchronously calls me.update() (View.mjs:1293), setting me.isVdomUpdating = true so the chained runAheadMeasure() returns early at View.mjs:832.
  3. resetRowHeights() leaves stale ahead-measure DOM and layout cache (Snapshot 45, ts = 39965.40 ms): view.resetRowHeights() (src/grid/View.mjs:1114-1137) clears me.#measureKeys and resets rowGeometry back to the 32px estimate (totalHeight = 9632px), without clearing body.rowMeasureVdom (clearMeasureProjection()) or me.#measureLayout = [] (unlike updateRowGeometry() at View.mjs:1323). As a result, hidden.waitFor({state: 'attached'}) (PremeasureRowsNL.spec.mjs:86) resolves immediately against the stale generation = 1 (240px) measure node.
  4. Expanded estimate window poisons #measureKeys for post-shrink ahead rows (Snapshots 45–52): Because resetRowHeights() resets all row heights to the 32px estimate in Snapshot 45, body.mountedRows temporarily expands from [0, 15] to [0, 29] (29 visible rows 0..28). When Snapshot 45 lands, measureRowHeights() runs on all 29 mounted rows (0..28), populates me.#measureKeys with width: '213.5px' for every index 0..28, and calls setRowHeights(heights) — which shrinks body.mountedRows back to [0, 15] (Snapshot 52, ts = 39987.38 ms, hiding rows 15..28 with display: none) while setting me.isVdomUpdating = true. When runAheadMeasure() finally runs on settled Snapshot 52 (View.mjs:859-869), [start, end] = body.mountedRows is [0, 15], so the ahead window [0, end + 8] (0..22) is a strict subset of 0..28 already recorded in me.#measureKeys at '213.5px'. Every ahead row is skipped at View.mjs:868, producing targets.length === 0 and leaving the stale 240px nodes in body.rowMeasureVdom for the entire 5,000 ms poll.

The Architectural Reality

Design authority: src/grid/View.mjs:1110-1113 (resetRowHeights JSDoc: "Clears measured row heights and re-runs measurement from the base estimate.") and src/grid/View.mjs:1321-1324 (updateRowGeometry: me.#measureLayout = []; me.body?.clearMeasureProjection()).

  • src/grid/View.mjs:1114-1137 (resetRowHeights): clears me.#measureKeys.clear() and me.#measureToken++, but omits me.#measureLayout = [] and me.body?.clearMeasureProjection().
  • src/grid/View.mjs:831-875 (runAheadMeasure) & src/grid/View.mjs:1210-1305 (measureRowHeights): when measureRowHeights() measures a transient estimate-expanded mountedRows range [0, 29] and setRowHeights() immediately shrinks mountedRows back to [0, 15], rows 16..28 are no longer mounted in the settled viewport, yet their #measureKeys entries prevent runAheadMeasure() from projecting the ahead-measure pool or clearing stale rowMeasureVdom.

The Fix

  1. In Neo.grid.View#resetRowHeights() (src/grid/View.mjs:1114-1137), clear me.#measureLayout = [] and call me.body?.clearMeasureProjection() before triggering the reset VDOM update, matching updateRowGeometry() (line 1323).
  2. In src/grid/View.mjs, ensure that when runAheadMeasure() evaluates the ahead window after resetRowHeights() / setRowHeights(), either body.rowMeasureVdom reflects the current column layout (#measureLayout) or #measureKeys entries for rows outside the post-setRowHeights mountedRows window do not suppress ahead-projection updates while rowMeasureVdom still holds stale-width cells.

Contract Ledger

Target Surface Source of Authority Proposed Behavior Fallback / Edge Docs Evidence
Neo.grid.View#resetRowHeights (src/grid/View.mjs) src/grid/View.mjs:1110-1137 Clears #measureLayout and body.clearMeasureProjection() alongside #measureKeys and rowGeometry.reset() No-op when rowGeometry or body is absent JSDoc on View#resetRowHeights PremeasureRows.spec.mjs (unit) + PremeasureRowsNL.spec.mjs (e2e)
Neo.grid.View#runAheadMeasure (src/grid/View.mjs) src/grid/View.mjs:831-890 Re-projects or clears rowMeasureVdom when column layout changed while isVdomUpdating deferred runAheadMeasure Preserves existing #measureKeys deduplication for settled mounted/ahead rows JSDoc on View#runAheadMeasure PremeasureRowsNL.spec.mjs:77 3/3 pass

Decision Record impact: none

Acceptance Criteria

  • Neo.grid.View#resetRowHeights() clears #measureLayout and calls body.clearMeasureProjection() so stale rowMeasureVdom nodes from a prior generation cannot remain attached across a height reset.
  • Resizing a wrap-text column and calling view.resetRowHeights() deterministically updates or re-projects ahead-measure cells at the new column width without measureRowHeights() on the transient 32px-estimate window suppressing runAheadMeasure() while rowMeasureVdom holds old-width cells.
  • test/playwright/unit/grid/PremeasureRows.spec.mjs and test/playwright/e2e/grid/PremeasureRowsNL.spec.mjs pass 3/3.

Out of Scope

  • Workstation / dock projection changes (#20022).
  • Replacing the main-thread hidden pre-render pass architecture established in Discussion #19645.

Avoided Traps

  • Do not increase the expect.poll timeout in PremeasureRowsNL.spec.mjs:88-90: in the traced failure, Snapshot 52 settled at 39987.38 ms with targets.length === 0 and zero subsequent VDOM updates for the remaining 4,940 ms, so a longer timeout still fails.

Related

unowned-rationale: Pre-existing grid ahead-measure projection race surfaced during the #20022 AC-1 v13.3.1 release-gate audit; does not block the v13.3.1 patch cut per lead disposition (#20022#issuecomment-6354251452).

Live latest-open sweep: checked latest 20 open issues in neomjs/neo at 2026-10-23T00:26:37Z; no equivalent found (#20009 and #19515 are unrelated grid issues). A2A in-flight claim sweep: checked latest 30 messages (status: 'all') at 2026-10-23T00:26:26Z; no competing claim. MC sweep: neomjs/neo PremeasureRowsNL resetRowHeights measureRowHeights rowMeasureVdom runAheadMeasure, 5 results, no prior ticket or decline found. Own-assignment sweep: 0 open in neomjs/neo, none overlapping.

Origin Session ID: 2ebc6210-9d88-4eb6-a97b-ee57663be8e2 Retrieval Hint: "PremeasureRowsNL resetRowHeights clearMeasureProjection measureKeys mountedRows 39853023569"

tobiu referenced in commit 4aef2dc - "fix(grid): a height reset retires the hidden projection it invalidates (#20028) (#20040) on Oct 23, 2026, 1:31 PM
tobiu closed this issue on Oct 23, 2026, 1:31 PM