Skip to content

test(file-viewer): activate chat links in place once the chat has settled - #2492

Merged
devswha merged 1 commit into
mainfrom
fix/file-viewer-docked-frame-flake
Oct 31, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/file-viewer-docked-frame-flake

Conversation

@devswha

@devswha devswha commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Change

scripts/file-viewer-regression.ts failed twice in one main CI run on b81e604 (re-run passed):

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:

  • a click on a transcript link whose pointerdown hits the link and whose pointerup hits
    another chat row at the same point, so click goes to their common ancestor and nothing opens
    (the link ends ~2700px above the view: the chat moved to its end in between);
  • a press("Enter") on a file link whose keydown lands on body (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 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 -> 0/24 after (the exact tree pushed).
    Transition section alone, 6 x 2 x 5 rounds: 9/12 -> 0/12.
  • omo code reviewer on the first commit: APPROVE, three LOW notes. It said dispatchEvent skips
    Playwright's actionability checks (the panel-beside-pane layout is still asserted elsewhere), and
    the line in the first commit message is out of date.
  • Not run: the full browser lane (bun run check full); only this script was looped.

…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.
@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 29f1cf8 and 180c96a.

Files selected for processing: 1
  • scripts/file-viewer-regression.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@devswha

devswha commented Oct 31, 2026

Copy link
Copy Markdown
Owner Author

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 .chat-frame[data-pane-content] (set once the chat is presented at its end; other scripts wait on it) instead of a timer, then dispatch the click on the link where it is. These steps check history and presentation, not pointer targeting, which other steps keep covering. No changelog fragment (test-only).

@devswha
devswha merged commit ef6832e into main Oct 31, 2026
12 checks passed
@devswha
devswha deleted the fix/file-viewer-docked-frame-flake branch October 31, 2026 11:47
devswha added a commit that referenced this pull request Oct 31, 2026
…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.
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