Skip to content

Fix: unit-suite headroom and mixed-sign row height race (#76, #87) - #94

Merged
DavidVFitzGerald merged 10 commits into
mainfrom
fix/76-87-unit-headroom
Nov 16, 2026
Merged

DavidVFitzGerald merged 10 commits into
mainfrom
fix/76-87-unit-headroom

Conversation

@DavidVFitzGerald

@DavidVFitzGerald DavidVFitzGerald commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Refs #76
Refs #87
Refs #93

Unit-suite headroom (#76), the intermittent mixed-sign row/cell height mismatch (#87) and the deep-focus window race (#93), in one PR. The maintainer decided #76/#87; the coordinator added #93 after QA's AC4 FAIL. Evidence is in docs/engineering/unit-headroom-verification.md.

#87: geometry defect (class B), fixed in product code

  • Probes. In jsdom, every run committed 2 mutation batches with 53px value cells inside 52px rows. Each survived a microtask but not a macrotask. In Chromium, 1 of 396 sampled rAF frames painted the mismatch; Firefox showed 0 of 396.
  • Cause. A cell took its height from the summary at render time. The row took the virtualizer's row.size, which resizeItem updates one commit later, from a microtask after the layout effect.
  • Fix. ComparisonGrid passes each cell renderer the row's height in that commit. FlowsGrid draws the summary geometry only once the row has that height; until then the cell stays pending at the row's height. View anchoring ([Task] F4 — Virtualize comparison rows and columns with sticky alignment #23 D2–D4) is unchanged, and the Intermittent mixed-sign grid row/cell height assertion in frontend CI #87 fix itself adds no flushSync (the Bug: deep-scroll focus test loses row 1310 under load (flows-grid D1/D2) #93 fix below adds one, outside lifecycle methods).
  • Regression. The mixed-sign test now checks every mutation batch during the scroll, then checks a settled grid. It failed 3 of 3 on the pre-fix code (96 mismatches) and passes after.
  • After the fix. The probes show 0 mismatches (jsdom, Chromium, Firefox). The test failed 0 of 50 isolated runs and 0 of 10 src/services/mock/ runs.

#93: window committed above the view (class B), fixed in product code

  • Cause. Rows above resize when their summaries arrive. pin() then scrolls by how far the anchor flow moved (+695 px in D1/D2). The virtualizer learns the new offset only from the asynchronous scroll event, so the render already scheduled by resizeItem commits the window at the old offset: rows 1282–1305, above the view at 68,315. That unmounts row 1310, which is loaded and in view.
  • Classification.
    • jsdom showed the wrong window in 10 of 10 runs.
    • Before the fix, Chromium (2 batches) and Firefox (1 batch) committed the same uncovered window after resize > pin > render, across 2,880 rAF frames over 72 deep jumps. No painted frame failed.
    • A sequence that real browsers also follow makes this class B.
  • Fix (ComparisonGrid.tsx).
  • Regression. A new flows-grid.test.tsx test checks every mutation batch after the deep jump: the mounted rows must cover the viewport, and loaded rows that were in view must stay mounted.

#76: cheaper tests, no raised limits

  • The comparison mock.
    • freezeComparisonCatalog lets a mock read a deep-frozen catalog without its ~2 s defensive copy.
    • flowRows builds a selection's row set once per instance, instead of ~150 ms of work per 100-row page. Outputs, tokens, latency, cancellation and errors are unchanged.
  • The 300-selection test fills its list with one branch selection instead of 300 tree clicks (~10 s of setup).
  • maxWorkers: "50%". Two concurrent suites at the default workers failed 4 + 3 tests; with this setting they pass and finish faster (76 s against 105 s).
  • Results.
    • Full suite: 105–107 s → 43–44 s.
    • Deep-scroll internal wait: 107–114 % (timed out 3 of 3) → 15–17 %.
    • 300-selection test: 92–95 % → 1 %.

Modified tests (AC5)

Test Before → after Fixture
flows-grid.test.tsx › sizes mixed-sign rows… Same equality, stripe and contiguity checks, now on a settled grid, plus every mutation batch during the scroll checked (#87) 220 × 2,000+
selection.test.tsx › bounds mounted list items for 300 selections Same list assertions; filled by one branch selection instead of 300 clicks 300 leaves
comparison.test.ts › serves a frozen catalog… (new) Frozen and copied catalogs serve the same pages; writes are rejected; responses are copies; instances do not share tokens 30 × 250
flows-grid-hold.test.tsx › hold Comment only 220 / 12 / 23
flows-grid.test.tsx › keeps the rows in view mounted in every commit… (#93, new) Every mutation batch after the D1/D2 deep jump: the mounted rows cover the viewport, and loaded rows that were in view stay mounted 220 × 2,000+

No limit or budget changed (AC6). The one config change is maxWorkers, with before/after numbers (AC7).

Checks at decb56a, in the container (before #93)

  • AC3. Quiet host, start loads 1.77, 1.80, 1.82: 3 × 411 tests, 0 failures. The highest figures: 31 % of a ≥ 20 s limit, 31 % of a ≥ 5 s budget, 34 % of a flows-grid 1 s wait.
  • AC4. 2 of 5 two-suite pairs (my attempt 4 and QA pair 3 B) failed the Bug: deep-scroll focus test loses row 1310 under load (flows-grid D1/D2) #93 D1/D2 race. QA measured flows-grid-anchoring.test.tsx:183 (1 s default wait) at 92.3 % in pair 3 B. My earlier "61 %, nothing above 90 %" was wrong for decb56a as a whole.

Checks at 9374bde (final code), in the container

Limitations

  • Mock evidence only.
  • Residual risk: flows-grid-anchoring.test.tsx:183, a 1 s default wait, reached 92.3 % once under two suites at decb56a (41–66 % at 9374bde). Its budget is not raised.
  • Hosted quality and the workflow_dispatch full run are recorded in the issue handoff.

🤖 Generated with Claude Code

DavidVFitzGerald and others added 7 commits November 15, 2026 23:05
A summary's height reached the row one commit after its cells drew the
summary geometry (the virtualizer applies it via resizeItem in a
microtask after commit), so a 53px cell could be committed - and in
Chromium painted - inside a 52px row. Cells now draw the summary
geometry only once their row has that height, and stay pending at the
row's current height until then. The mixed-sign grid test checks every
mutation batch and runs its geometry checks on a settled grid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n mock (Refs #76)

Each large-workload test paid ~2 s (more under load) for the mock's
defensive copy of the 220 x 2,000+ catalog, and every 100-row page
rebuilt the whole selection's represented-row union (~150 ms per page
for 220 processes). freezeComparisonCatalog deep-freezes a catalog so
mocks read it without copying; flowRows builds the sorted row set once
per snapshot and process set, per mock instance, bounded like tokens.
Responses are still copied, and outputs, ordering, tokens, latency,
cancellation and errors are unchanged. The grid harness freezes its
catalog; a new mock test checks frozen and copied catalogs serve the
same pages and that instances do not share tokens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…76)

The selected-list test clicked 300 tree rows one by one, re-rendering
every mounted tree row each time (~10 s alone, 27-29 s of its 30 s
limit under parallel load). One branch selection adds the same 300
leaves in the same name order; every list assertion is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment only; the hold budget and assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This host allows two container suites at once. On 8 cores, two
concurrent full runs with the default workers failed 4 + 3 tests
(104-106 s each, load 13); with maxWorkers 50% both passed with no
failure in 76 s each. Measurements are recorded in
docs/engineering/unit-headroom-verification.md; every test file still
runs in npm run test:unit and CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
, #93)

Baseline at af5317d, the #87 probes and classification (geometry
defect), the remedies with before/after numbers, the AC3 runs and every
AC4 two-suite attempt at decb56a, the #93 probe, gates and residual
risk. f4-verification.md points to the new document.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DavidVFitzGerald and others added 3 commits November 16, 2026 02:10
…Refs #93)

pin() scrolled with element.scrollTo, but the virtualizer learns the new
offset only from the asynchronous scroll event, so the render scheduled by
resizeItem committed the window at the old offset, above the view, and
unmounted loaded rows in view (the D1/D2 focus race). Hand the virtualizer
the read-back offset and re-render before paint (flushSync from the resize
microtask, a normal update from the layout effect), after the pins are
updated so the render does not move the view again.

Adds a regression test that checks every mutation batch after the deep
jump for rows covering the viewport and loaded rows kept mounted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds the #93 section (probe sequence, classification B, fix, regression,
stability), the two-suite attempts and AC3 runs at 9374bde, and corrects
the residual risk: anchoring :183 reached 92.3 % in QA's pair 3 B.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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