Skip to content
Source
Sign inSign up
pingdotgg/t3code

test(web): fix the workflow script test that times out on busy CI runners #21699

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/21699/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Problem

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.

idleunder load
main (1451e7cb)25/25 pass20/25 pass, 5 failed with expected null not to be null
this branch25/25 pass39/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 browser for apps/web: 137 files, 1,020 tests pass
  • vp lint on the file and tsc-rs --noEmit for apps/web pass

Claude Opus 5.5 in Claude Code, running in T3 Code.

🤖 Generated with Claude Code

    1. Approvability

      Verdict: Approved at a043859

      Macroscope'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.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      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_status to false in 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.tsx
      The 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: juliusmarminge

      Merge Risk: ⚪ Minimal · up to a0438

      The 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: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the test-only fix for a workflow script test that times out on busy CI runners.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Description checkPassedThe 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
      Comment `@coderabbitai help` to get the list of available commands.

Sign in to join this conversation.