Repository navigation
test(file-viewer): activate chat links in place once the chat has settled - #2492
Conversation
…tled The docked contents-page step (line 632) and the transition rows from #2459 timed out when a transcript link opened nothing. Event logs from looped runs show the click's pointerdown on the link and its pointerup on another row (or a key press landing on body): the chat was still scrolling to its end after a load, and a link far above the end raced a follow to the end when Playwright scrolled it into view. Wait for .chat-frame[data-pane-content] (the chat presented at its end), then dispatch the click on the link where it is. These steps check history and presentation, not pointer targeting.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Merging 180c96a: fixes the file-viewer-regression flake seen on main at b81e604 (both failures were the test racing the chat's scroll to its end, not a product race: a click's pointer down and up landing on different rows, and a key press after the focus moved). Review by the merge pass: test-only; the four affected steps wait for |
…patched (#2496) Follow-up to #2492 (merged as ef6832e before this landed): the long-task bound, and why the transcript steps dispatch their click instead of a real one. Test-only. ### Why `dispatchEvent("click")` and not a real click I tried to keep the real pointer path first: 1. Waiting for the chat to be presented at its end (`.chat-frame[data-pane-content]`, set by ChatView only then) and then clicking: the transition section still failed 5/12. Presentation at the end is not "stopped following". 2. Reading back to the link as a reader does (a real `mouse.wheel` over the chat, then waiting for its Jump to latest button, then a real click): in 2 of 6 loaded runs the chat was back at its end after a ~2000px wheel up (`scrollTop == scrollHeight - clientHeight`, no Jump to latest), so the helper itself flaked. The chat exposes no state after which a far-above link is guaranteed to stay put under a pointer in these steps, so they now wait for the chat to be presented and dispatch the click on the link where it is. These steps check history and presentation, not pointer targeting; real clicks and Enter on transcript links stay covered by the script's other steps. Can a real user hit it? Not shown. A reader's own scroll is input the chat honors, unlike Playwright's. The one hint is the wheel case above, which I saw only under Playwright with 6 runs at once, never by hand, so no issue is filed. ### The long-task bound (1s -> 2s) `no task held the page for a second` also fails on CI, not only under my contention: run 40863627510 (2026-10-29) failed it at 1065ms, and it failed my loaded runs at 1045-1182ms, while passing runs stay under ~550ms. That is the app's ordinary work stretched by a starved runner. The freeze this guards is many seconds: with the slow Markdown file highlighted on the page's own thread (a temporary mutation of `highlightKnown`, reverted), the page stayed frozen past a 10s click timeout. 2s keeps a wide margin on both sides; the reason is in a comment above `frozen`. ## Validation - `bun run check fast`: pass. `bun run typecheck`: pass. - Looped under CI-shaped contention (6 copies at once, one check session, pinned to 6 cores), whole script, 6 x 4: **9/24 failed before #2492 -> 0/24 with #2492 + this** (on ef6832e's tree; rebased onto 6797a8b since, with `bun run check fast` rerun there). Transition section alone, 6 x 2 x 5 rounds: 9/12 -> 0/12. - omo code reviewer on #2492: APPROVE, LOW notes only (one: `dispatchEvent` skips Playwright's actionability checks; the panel-beside-pane layout is still asserted elsewhere). - Not run: the full browser lane (`bun run check full`); only this script was looped.
Change
scripts/file-viewer-regression.tsfailed twice in one main CI run on b81e604 (re-run passed):waiting for locator('.web-panel, .web-panel-popup').first()in the transition rows (fix(web-panel): keep same-host mobile links in the app #2459)contents pageframe never ran (then line 632)Both are the same test-timing flake, not a product race. Event logs recorded in looped runs
(pointer/key events captured in the page before each failure) show:
pointerdownhits the link and whosepointeruphitsanother chat row at the same point, so
clickgoes to their common ancestor and nothing opens(the link ends ~2700px above the view: the chat moved to its end in between);
press("Enter")on a file link whosekeydownlands onbody(the focus was gone).A loaded or reloaded chat scrolls to its end once its conversation is measured, and keeps
following it; a link far above the end races that follow when Playwright scrolls it into view
(Playwright's scroll is no reader input, so the chat treats it as layout and goes back to its end).
The frame, history and file-open paths were fine: the docked frame step alone passed 1,280/1,280
under the same contention.
Why
dispatchEvent("click")and not a real clickI tried to keep the real pointer path first:
.chat-frame[data-pane-content], set byChatView only then) and then clicking: the transition section still failed 5/12. Presentation
at the end is not "stopped following".
mouse.wheelover the chat, then waiting forits Jump to latest button, then a real click): in 2 of 6 loaded runs the chat was back at its end
after a ~2000px wheel up (
scrollTop == scrollHeight - clientHeight, no Jump to latest), so thehelper itself flaked.
The chat exposes no state after which a far-above link is guaranteed to stay put under a pointer
in these steps, so they now wait for the chat to be presented and dispatch the click on the link
where it is. These steps check history and presentation, not pointer targeting; real clicks and
Enter on transcript links stay covered by the script's other steps.
Can a real user hit it? Not shown. A reader's own scroll is input the chat honors, unlike
Playwright's. The one hint is the wheel case above, which I saw only under Playwright with 6
runs at once, never by hand, so no issue is filed.
The long-task bound (1s -> 2s)
no task held the page for a secondalso fails on CI, not only under my contention: run40863627510 (2026-10-29) failed it at 1065ms, and it failed my loaded runs at 1045-1182ms, while
passing runs stay under ~550ms. That is the app's ordinary work stretched by a starved runner.
The freeze this guards is many seconds: with the slow Markdown file highlighted on the page's own
thread (a temporary mutation of
highlightKnown, reverted), the page stayed frozen past a 10sclick timeout. 2s keeps a wide margin on both sides; the reason is in a comment above
frozen.Validation
bun run check fast: pass.bun run typecheck: pass.whole script, 6 x 4: 9/24 failed before -> 0/24 after (the exact tree pushed).
Transition section alone, 6 x 2 x 5 rounds: 9/12 -> 0/12.
dispatchEventskipsPlaywright's actionability checks (the panel-beside-pane layout is still asserted elsewhere), and
the line in the first commit message is out of date.
bun run check full); only this script was looped.