Skip to content
Source
Sign inSign up
pingdotgg/t3code

test(web): fix flaky startup and Tailwind tests #9558

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/9558/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Two web tests failed on unrelated changes to main.

  • Wait for Vite's ready message before fetching the Tailwind test bundle. The build hook runs before Vite can serve its output.
  • Register one main-module mock per startup test. Queued mocks can resolve out of order.

Both files passed 50 consecutive runs, with 350 test executions. Focused tests, web typecheck, lint, and formatting also pass after rebasing onto main. No retries or longer timeouts were added.

Created with GPT-6 Astra (preview) in Codex.


Note

Low Risk Test-only changes with no production code paths; risk is limited to CI signal quality.

Overview Stabilizes two web integration tests that were failing intermittently on unrelated main changes.

Bootstrap startup tests: The shared beforeEach no longer mocks ./main with a synchronous throw. That mock is registered only in the test that asserts preamble/import failures, and afterEach calls vi.doUnmock("./main") so Vitest’s queued mocks cannot leak into the async startup rejection case.

Tailwind HMR test: Instead of treating generateBundle as “built,” the test waits for the HMR client to connect and for Vite’s full-reload message with ifFallback: true before fetching /assets/index.js. The observe plugin’s generateBundle stays pending until the socket is connected, matching the real ordering where bundle generation finishes before assets are served over HTTP.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 20355791d60f59cef2699544c7510b92e337e3b3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Fix flaky bootstrap startup and bundledDev Tailwind tests

  • Removes the default throwing ./main mock from the beforeEach hook so it no longer affects every test in the startup-failure suite; the throwing import is moved into the single test that verifies the pre-main error path.
  • Adds ./main mock cleanup in the afterEach hook to prevent mock reuse across tests.
  • Reworks the bundled-dev test synchronization: delays generateBundle completion until the WebSocket connects, treats Vite's fallback full-reload as the readiness signal, and waits for it before requesting the generated entry; source changes are still validated through the bundled-dev-update message.
  • Risk: test-only changes; no runtime behavior affected.
Macroscope summarized 2035579.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.6 KiB13.6 KiB−39 B (−0.3%)15.1 KiB✅
      CodexThread snapshot wire7.0 KiB7.0 KiB−7 B (−0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.6 KiB6.5 KiB−32 B (−0.5%)7.8 KiB✅
      CodexLive turn WebSocket decoded57.1 KiB57.0 KiB−44 B (−0.1%)66.4 KiB✅
      CodexLive turn messages109−1 (−10.0%)21✅
      ClaudeTotal thread wire13.5 KiB13.6 KiB+48 B (+0.3%)15.1 KiB✅
      ClaudeThread snapshot wire7.0 KiB7.0 KiB−2 B (−0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.5 KiB6.6 KiB+50 B (+0.8%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded57.8 KiB57.9 KiB+88 B (+0.1%)66.4 KiB✅
      ClaudeLive turn messages810+2 (+25.0%)21✅

      Baseline: 9e1bc36 · PR result: 2035579 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 113.8 KiB
      • Claude decoded thread snapshot: 114.5 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. Approvability

      Verdict: Approved at 2035579

      Macroscope's review found this PR approvable — The PR changes only test harness synchronization and module-mock isolation in two web test files. It introduces no production-path behavior, product-default changes, or broadened static-analysis suppressions.

      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).

Sign in to join this conversation.