test(web): fix the workflow script test that times out on busy CI runners #21699
main fromrefs/pull/21699/head·merged by shivamhwp(GitHub profile, opens in a new tab) View on GitHubProblem#
WorkflowOpeningBlock.browser.test.tsx > "shows a short script as highlighted code with nothing to open" (added in #20857) flakes on CI. It waits with vi.waitFor's 1s default for .chat-markdown-shiki, which only appears once the real Shiki WASM engine and the JavaScript grammar finish loading. On a busy runner that takes longer than 1s and the test fails with expected null not to be null.
It isn't tied to any PR's code:
- #18548 (MCP full-screen only) failed it in attempts 1, 2 and 3 of run 39230751931, "Test Web" job. Attempt 3 had it as the only failure out of 8,048 tests. Attempts 1 and 2 also failed
AttachmentFilePreview.browser.test.tsx. A fourth attempt passed. - #19570 failed it the same way in run 39183209914.
- main's own run 39207785797 on 1451e7cb passed it.
The WorkerPoolManager: worker initialization timed out after 10000ms line in the #18548 log comes from StyledDiffCodeView.browser.test.tsx, 3 minutes earlier. Chat code blocks highlight through getSharedHighlighter on the page, not that worker pool, so the slow part here is loading the engine.
Change#
Test only. The test now mocks getSyntaxHighlighterPromise with a highlighter whose codeToHtml wraps the code in a <pre>, the same approach AttachmentFilePreview.browser.test.tsx takes with its source preview. The real ChatMarkdown code-block path still runs, so the test still checks that the short script renders as a javascript code block, gets a .chat-markdown-shiki block, and has no "Show full script" button. Shiki output itself is covered in ChatMarkdown.browser.test.tsx.
Scope and approval#
A small test-only fix for a flaky test on main. No app code changes.
Verification#
Ran the file repeatedly on a 16-core machine. "Under load" means 32 busy-loop processes running alongside it.
| idle | under load | |
|---|---|---|
| main (1451e7cb) | 25/25 pass | 20/25 pass, 5 failed with expected null not to be null |
| this branch | 25/25 pass | 39/40 pass, 0 failures of this test |
The one loaded failure on this branch happened before any test ran: Vite failed to serve packages/contracts/src/index.ts to the browser and the file collected 0 tests. That's load on the dev server, not this test.
I also checked that the test still catches a broken component: rendering the script as a plain <pre> instead of through ChatMarkdown makes it fail.
vp test run --project browserforapps/web: 137 files, 1,020 tests passvp linton the file andtsc-rs --noEmitforapps/webpass
Claude Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
a043859Macroscope's review found this PR approvable — The PR is a small, test-only fix confined to ignored paths, with no production runtime, default, schema, deployment, or static-analysis suppression impact. Its blast radius is limited to CI test execution.
Notes:
- No code objects were reviewed. Approvability was decided on eligibility alone.
Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5a6ac943-2a38-4b3a-90c1-759ea10163d4
📥 Commits
-
Reviewing files that changed from the base of the PR and between a043859cc157111610685dd9e0d273af2f80a227 and aefc729c04c0b2d142e6fd7796bf90367d2358f7.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
12ef7593-4975-4dcf-94bb-e511b40c6cd2
📥 Commits
-
Reviewing files that changed from the base of the PR and between 1451e7cb23034d29774338608368a15d8845df36 and a043859cc157111610685dd9e0d273af2f80a227.
📒 Files selected for processing: 1
-
apps/web/src/components/chat/WorkflowOpeningBlock.browser.test.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
The browser test mocks syntax highlighting to return the input code in a
<pre>element. The mock retains the module’s other exports and avoids loading the real Shiki WASM and grammar.Changes: Browser test setup
Layer / File(s) Summary Mock syntax highlighting
apps/web/src/components/chat/WorkflowOpeningBlock.browser.test.tsxThe test mock returns the input code in a <pre>element and retains the module’s other exports.Priority: ⬇️ Low
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Other
Suggested reviewers:
juliusmarmingeMerge Risk: ⚪ Minimal · up to
a0438The browser test keeps checking workflow script rendering, folding, and find reveal while avoiding real Shiki loading. No actionable merge risk is indicated.
Pre-merge checks:
4Check name Status Explanation Title check The title clearly and concisely describes the test-only fix for a workflow script test that times out on busy CI runners. Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Description check The description covers all required sections. It explains the flaky-test problem, the mock-based test change, the limited scope, approval rationale, detailed verification results, and the model and ha… Full details: Description check
Explanation
The description covers all required sections. It explains the flaky-test problem, the mock-based test change, the limited scope, approval rationale, detailed verification results, and the model and harness used.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
shivamhwp(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
@shivamsdot