perf(messages): virtualize top-level thread replies - #514
Draft
kalvinnchau wants to merge 3 commits into
Draft
kalvinnchau wants to merge 3 commits into
kalvinnchau wants to merge 3 commits into
Conversation
added 3 commits
October 1, 2026 12:53
Thread history mounted every loaded reply (up to 460 strict / 500 legacy). Top-level replies now render through the same Virtua Virtualizer as the channel timeline; a nested branch stays whole inside its top-level item. Virtua mounts and measures rows over later frames, so initial positioning, exact-target reveal and follow-latest hold their place until the mounted range is measured instead of positioning once in a single layout effect. The exact target, an own pending send, the focused row and rows with an open report stay mounted. Jump to latest is now immediate rather than a smooth scroll. Browser specs that counted mounted rows now assert on visible content, scroll range or relay reads instead. Co-authored-by: peon <9ac6794b000690b7e814eb1805ad32405d0bec7d52838de3a86cf967565dacc0@buzz.block.builderlab.xyz> Signed-off-by: peon <9ac6794b000690b7e814eb1805ad32405d0bec7d52838de3a86cf967565dacc0@buzz.block.builderlab.xyz>
The exact-target anchor is viewport-relative while history is incomplete. A scroll that bypassed the wheel, touch, key and pointer handlers left it stale, so the next row update pulled the reader back to the target. Refresh the anchor on scroll outside positioning. Cover it in the existing live-update case, and restore the 305 unique reply check as a walk over the virtualized range. Co-authored-by: peon <9ac6794b000690b7e814eb1805ad32405d0bec7d52838de3a86cf967565dacc0@buzz.block.builderlab.xyz> Signed-off-by: peon <9ac6794b000690b7e814eb1805ad32405d0bec7d52838de3a86cf967565dacc0@buzz.block.builderlab.xyz>
The 305-reply walk advanced on a 50 ms poll inside a 10 s expectation. Hosted Linux runners timed out partway (237 and 262 of 305). Step one viewport at a time, wait for geometry to settle before each sample, and stop at the end of the scroll range. Co-authored-by: peon <9ac6794b000690b7e814eb1805ad32405d0bec7d52838de3a86cf967565dacc0@buzz.block.builderlab.xyz> Signed-off-by: peon <9ac6794b000690b7e814eb1805ad32405d0bec7d52838de3a86cf967565dacc0@buzz.block.builderlab.xyz>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Thread history mounted every loaded reply (up to 460 strict / 500 legacy). Top-level thread replies now render through the same Virtua
Virtualizeras the channel timeline (virtua@0.51.0+ existing patch). A nested branch stays whole inside its top-level item.How
ThreadPanel.tsx: top-level replies are virtual items. The exact target, an own pending send, the focused row and rows that request it stay mounted.Messages.module.css:overflow-anchor: noneon the thread scroller; a focused or exact-target item stays visible while Virtua re-measures it.Behavior changes
Browser test changes
Row-count assertions cannot hold once offscreen replies unmount. Each was replaced, not dropped:
thread-window.spec.mjs(legacy continuation)thread-window.spec.mjs(scrollback)navigation-thread-history.spec.mjsmessages.spec.mjschannel-opening.spec.mjsAdded:
message-navigation.spec.mjs"live updates do not snap it back to the target" now scrolls the reader away programmatically before the live edit. Browser-only because it asserts real scroll geometry under virtualization.Fail-then-pass:
4fe221a7) it failed at 63 of 305 with the scroll step disabled (chromium). That form ran out of time on hosted runners (237 and 262 of 305), so the third commit replaced it with a loop that settles, samples and steps one viewport until the bottom. The fail-first check was not repeated on the loop form.Vitest: thread suites mock
virtuawith a mount-everything stand-in (virtua.testing.tsx), since jsdom has no layout. That stand-in does not exercise eviction; eviction is covered by the browser specs.Evidence
Hosted CI at the PR head
d97719a9(run 36920559245, executed on merge759c0a56withmain69a9af23)thread-window7/7,message-navigation21/21,messages7/7,navigation-thread-history3/3,nested-replies8/8 per engine; the large-threadchannel-openingcase this PR changes (:240) passes in both measurement projects. No retries.CI requiredis red for two reasons, both also present onmain's own run at69a9af23(run 36919997681):channel-tabs.spec.mjs:281fails in both engines (tab count expected 2, received 5). Also fails onmainate697aa7a. This PR does not touch it.JavaScriptjob was cancelled by its 10-minute timeout after Vitest finished green (561 s).main's run was cancelled at the same step. This PR does not touch it.Local, macOS, headless
At
d97719a9(test-only delta from4fe221a7,thread-window.spec.mjsonly):thread-window.spec.mjsin chromium and webkit, 42 passed including repeated runs of the walk;biomeclean.At
4fe221a7(rebased one697aa7a):tsc --noEmit,biome check --error-on-warnings .,vitest run(489 files / 6504 tests): pass.thread-window,navigation-thread-history,nested-replies,message-navigation,messages,thread-opening,thread-unread,thread-video,image-scroll): 122 passed, 0 failed.At the pre-rebase head
4af30376oncc0c47c7(identical patches pergit range-diff):profiles:524both engines,reactions-polish:6both engines,channel-completion:7webkit) fail identically in a full run on cleancc0c47c7and pass when run alone on either side.d97719a9with no actionable findings; its runtime evidence is the hosted merge-tree run above, verified by the reviewers from the downloaded reports, not a standalone-head run.The full browser suite has not been rerun locally at the rebased head.
300-reply thread, one full-suite run per side:
cc0c47c74af30376"Traversal painted" ends on a different condition after this change (see table above); "first visible row" is the same measurement.
Deferred