Skip to content

test(scripts): settle four flaky browser checks on what they test - #2632

Merged
devswha merged 1 commit into
mainfrom
test/browser-ci-flakes
Nov 3, 2026
Merged

devswha merged 1 commit into
mainfrom
test/browser-ci-flakes

Conversation

@devswha

@devswha devswha commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Change

Four browser scripts failed now and then in "Browser regression (other scripts)" on main (run 41558343287 on c0cdc8e, and later runs). The take-over failure was a product race, fixed in #2630. This PR fixes the other three, plus the relay-media failure seen on bef2be1. Test-only: no product code changes.

chat-local-send-follow-demo-regression.ts:95: "the reader moves away"

wheelUp waited for each wheel notch to lower scrollTop by more than 20 px. A write trace on the page showed every notch moving the view 120 px. Then, as a row above the view was measured, LegendList's ScrollAdjust called scrollBy(+103) to keep the reader's rows in place, with scrollHeight growing by the same 103 px. That undid the notch in scrollTop, but the distance from the end stayed exactly 600 px before and after. The reader had moved away; the wait could not see it. The wait now measures the distance from the end, which that adjustment leaves alone.

Not a #2624 regression. An A/B of the unmodified script, alternating commits under dori heavy, gave passes/runs of: 05c9133 (before #2624) 5/7, 9ef34f8 (#2624) 5/6, main 2/6. The step fails before #2624 too; #2624 changes when rows get measured, so it lands more often. No scrollToEnd or follow write appears in the trace.

file-viewer-regression.ts: "video not visible"

The CI failure came right after setFileOpen("panel") reloads the page: videoLink.click() was a pointer click on a transcript link while the reloaded chat followed to its end, so the click landed on nothing and no popup opened (0 "locator resolved" lines on CI and locally). The script's own header comment describes this trap, and its other steps already use activateInTranscript. Under load, three more steps hit the same trap: after a goto (big code), after the panel closes (the extensionless and unknown-text loop, which keeps the link focused so the focus-return assertion still holds), and after a reload and Back at 390 px. The click on the framed page's table-of-contents link is dispatched to the link: the frame's own navigation is under test, not where the panel lays the frame out.

files-prompt-regression.ts:71: Escape left Files open after a pane switch

Not reproduced in about 435 local attempts (15 per run, fresh pages, 6x CPU throttle, load up to 92), and nothing found by reading the code. The Escape check stays: it is the only place a script checks Escape closing Files. When it fails now, the script writes what decided it to the log and to files-<page>-escape-diagnostics.json in the browser-evidence artifact: whether a window keydown probe saw the key, the focused element, the modal and dialog stack, whether FilesDialog stood down (file or diff over it, native modal), and any open picker. Tracked as #2631.

relay-media-browser-qa.ts:44: "Timed out: copied-link clipboard event"

Seen inside relay-e2e-regression.ts on bef2be1 (run 41568570526). The stubbed writeText always resolves, so the click never reached Copy link. copy.click({ force: true }) is aimed at where the button was, under a frozen browser clock, while the viewer may still move it. The click is now dispatched to the button itself; the clipboard listener is still subscribed before it.

Validation

All runs went through dori heavy; host load ranged from about 4 to 92 (70 CPU hogs for part of it).

  • chat-local-send-follow: 22/22 consecutive.
  • file-viewer: 20 consecutive and counting on the final script (bun run check run, isolated herdr session). Earlier rounds under load caught the other lost-click steps fixed here.
  • files-prompt: 22/22 consecutive. A forced failure (key withheld) wrote the diagnostics JSON and screenshot. The review's try/catch, which keeps the original timeout as the reported error, came after those runs; it runs only when the check fails.
  • relay-media (fixed): 22/22 consecutive; the unmodified script passed 10/10 locally, so CI is the only evidence for that one.
  • bun run check fast: success on 6069b0a. An earlier run caught a regression in this branch: ci-browser.test.ts forbids ?? on evidence dirs (The browser lane loses its evidence folder before omo-plan-browser-regression in bun run check full #1554). Fixed with ||.
  • omo code reviewer: APPROVE, LOW notes only. Applied: the diagnostics never replace the original error. Not changed: browser-other uploads PNGs only on failure; the 390 px reopen dispatches directly because activateInTranscript waits for a frame that section lacks; the wheelUp callers assert the distance afterwards.
  • Skipped: full check, Windows VM.

No changelog fragment: test-only.

- chat-local-send-follow: a wheel notch away from the end is measured as the distance from the end.
  LegendList keeps the reader's rows in place as rows above the view are measured, which can undo
  a notch's move in scrollTop (traced: scrollBy(+103) with scrollHeight +103, the distance from the
  end unchanged).
- file-viewer: transcript links right after a reload, a goto or a panel closing are activated where
  they are, as the script's own header asks; the framed page's table-of-contents click is
  dispatched to its link.
- files-prompt: the Escape after a pane switch stays, and its failure now writes what decided it
  (keydown probe, focus, modal stack, FilesDialog's stand-down state) to the log and evidence (#2631).
- relay-media: Copy link is clicked on the button, not at where a forced click aims.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Updated automated checks for chat scrolling, file links, and media link copying to use more consistent interaction steps.
    • Added diagnostic capture when a Files dialog check times out, including a screenshot and relevant interface state, to make failures easier to investigate.

The regression scripts update wheel-scroll checks and transcript-link activation. The Files dialog test adds timeout diagnostics and a screenshot-directory fallback. The media-browser QA test dispatches the Copy link click and continues to verify the copied URL.

Changes: Chat scroll regression

Layer / File(s) Summary
Measure wheel-up movement
scripts/chat-local-send-follow-demo-regression.ts
The wheel-up check now waits for the distance from the chat’s end to grow by more than 20 pixels. It no longer compares scrollTop.

File viewer regression

Layer / File(s) Summary
Activate transcript links
scripts/file-viewer-regression.ts
Several link activations now wait for transcript readiness or dispatch click events. The existing history-entry assertion remains.

Files dialog regression

Layer / File(s) Summary
Capture Escape-close timeout evidence
scripts/files-prompt-regression.ts
The screenshot directory falls back to UI_EVIDENCE_DIR when FILES_PROMPT_SHOTS is unset or empty. On timeout, the test logs UI and keyboard diagnostics, saves JSON and a screenshot, and rethrows the original timeout.

Media browser QA

Layer / File(s) Summary
Dispatch Copy link click
scripts/relay-media-browser-qa.ts
The test dispatches a click event instead of using a forced click. It still verifies the copied URL.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: anndii

Merge Risk: Minimal · up to 6069b

The changes stabilize browser-test activation and improve failure diagnostics without changing product behavior. No actionable issue remains that should block merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the test-only change and the four flaky browser checks it settles. It matches the scope in the raw summary and objectives. It is concise and specific, and it does not list files, so it…
Description check Passed The description covers the problem, the fix for each of the four scripts, and the validation runs with results. It follows the template's Change and Validation sections. It names the skipped checks (f…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the test-only change and the four flaky browser checks it settles. It matches the scope in the raw summary and objectives. It is concise and specific, and it does not list files, so it passes.

Full details: Description check

Explanation

The description covers the problem, the fix for each of the four scripts, and the validation runs with results. It follows the template's Change and Validation sections. It names the skipped checks (full check, Windows VM). The changelog note is stated as not needed. The template's CONTRIBUTING.md reference is not repeated, but the required content is present, so the check passes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 4 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between bef2be1 and 6069b0a.

Files selected for processing: 4
  • scripts/chat-local-send-follow-demo-regression.ts
  • scripts/file-viewer-regression.ts
  • scripts/files-prompt-regression.ts
  • scripts/relay-media-browser-qa.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@devswha

devswha commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Test-only fix for four browser scripts that rotated failures across main's CI runs (lane browser-flakes; no product code). Merge-pass read of the whole diff:

  • chat-local-send-follow-demo-regression.ts: each wheel notch is measured as the distance from the end rather than scrollTop, because LegendList raises scrollTop by the growth of rows measured above the view to keep the reader's rows in place; the assertion (the reader moved up by more than 20 px per notch) is unchanged. The lane's A/B in the PR shows it isn't a fix(chat): follow measured rows without a competing glide #2624 regression.
  • file-viewer-regression.ts: links in a chat that is still following its end after a reload, go-back or a panel closing are activated where they are (activateInTranscript / dispatchEvent), since the pointer could miss a link that moved; what each step asserts afterwards (popup vs panel, history entries, focus return) is unchanged.
  • files-prompt-regression.ts: keeps its Escape check and, on failure, records the key's path and the modal state before rethrowing (for Files: Escape may be ignored right after a pane switch (seen once on CI, not reproduced) #2631).
  • relay-media-browser-qa.ts: the Copy link click is dispatched to the button instead of a forced click at its old position.

Each script ran 20+ times in a row under load on the lane's side; omo approved (LOW only). A test-only change gets no CodeRabbit round; it merges on its checks.

@devswha
devswha merged commit 3e51902 into main Nov 3, 2026
12 checks passed
@devswha
devswha deleted the test/browser-ci-flakes branch November 3, 2026 04:25
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