Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): browser tests no longer pick a port Windows has reserved #24007

MergedZacharon(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/24007/headmerged by juliusmarminge View on GitHub

Problem

apps/web/vite.config.ts hashes the checkout path into a browser-test API port between 61000 and 64999. On Windows that band sits inside the dynamic port range, where Hyper-V, WSL and Docker reserve blocks of ports (netsh interface ipv4 show excludedportrange protocol=tcp). If a checkout's path hashes into one of those blocks, no browser test can run there. Vitest exits at startup with listen EACCES: permission denied ::1:64580. strictPort: false doesn't help, because Vite only tries the next port on EADDRINUSE.

Change

Move the band to 20000-23999. It sits below the Linux (32768+) and Windows/macOS (49152+) ephemeral ranges and clear of dev-runner's ports. Same hash, same width. If something already listens on the chosen port, strictPort: false still moves on as before.

Scope and approval

Small, focused fix for an obvious bug: one constant in a dev-only config. Users and shipped code are unaffected.

Verification

Windows 10 (19045), Node 26.12.1, Vite+ 1.3.0. One of my checkouts hashes to 64580, which falls in a reserved block (64537-64636) on this machine.

  • Before, from apps/web in that checkout: vp test run --project browser src/components/ChatMarkdown.browser.test.tsx fails at startup with EACCES ::1:64580. No tests run.
  • After, same checkout and command: the port is 23580, the browser starts and all 6 tests run. Five pass. The sixth is an unrelated Windows-only failure, fixed separately in #24006.
  • vp run check:changed: format, lint, knip and typecheck (2 packages) pass. On Windows this needed a local workaround for check:changed spawning vp.cmd, which isn't part of this PR.

Not checked on Linux or macOS. The new band is outside their ephemeral ranges, and a port already in use is handled the same way as before.

Fix written by Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Approvability

      Verdict: Approved at 3f5dad7

      Macroscope's review found this PR approvable — This is a small, isolated browser-test configuration fix that moves the hashed test API port below OS ephemeral and reserved-port ranges. It affects only local test execution and does not change shipped product behavior or product defaults.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The browser-test API port range changes to 20,000–23,999. Port selection continues to use the checkout-path hash.

      Changes: Browser test API port selection

      Layer / File(s)Summary
      Update the browser test API port range
      apps/web/vite.config.ts
      The configured range changes from 61,000–64,999 to 20,000–23,999. The comments describe Windows Hyper-V/WSL reservations and EACCES failures.

      Estimated code review effort: 1 (Trivial) | ~5 minutes

      Change: Bug fix

      Suggested reviewers: juliusmarminge

      Merge Risk: Minimal · up to 503b2

      This changes the port range that browser tests use, so they should start on Windows machines whose reserved ports overlapped the old range. No concrete defect was found, and the change is low risk to merge.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the main change: browser tests in apps/web no longer pick a port that Windows has reserved. The PR moves the browser-test API port band from 61000–64999 to 20000–23999, which matches t…
      Description checkPassedThe description follows the repository template. It has Problem, Change, Scope and approval, and Verification sections, and each section has concrete content. The Problem section gives the cause and t…
      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.
      Full details: Title check

      Explanation

      The title names the main change: browser tests in apps/web no longer pick a port that Windows has reserved. The PR moves the browser-test API port band from 61000–64999 to 20000–23999, which matches the title. The title follows the conventional commit format and is specific to the change.

      Full details: Description check

      Explanation

      The description follows the repository template. It has Problem, Change, Scope and approval, and Verification sections, and each section has concrete content. The Problem section gives the cause and the error text. The Change section explains the new port band and the reason for it. The Scope section explains why no issue is linked and calls the fix small and focused. The Verification section gives the Windows environment, the before and after results, and the checks that were not run on Linux or macOS. The template asks for a linked issue or a reason for none, and the author gives a reason. The template also asks for the model and harness used, and the author includes that at the end. The description does not include a screenshot, but the change is a dev-only config fix and has no UI change, so none is required.

      Finishing Touches

      Generate unit tests (beta)

      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 45cd80eb23cb8efd45b48d697adff30b1ed7fc5b and 503b274e1027e01599d90d62a6b21f291fb7dd2f.

      Files selected for processing: 1

      • apps/web/vite.config.ts

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

    4. tanstack-source added labelsbug

    5. This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.

      See the conflict window.

    6. Additional comments: 1

      apps/web/vite.config.ts-100-100: 1

      100-100: Major · Stability & Availability · Heavy lift

      **Unverified finding** Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

      Handle excluded ports in the new range.

      Windows exclusions are not limited to the default ephemeral range. (learn.microsoft.com) If a checkout hashes to an excluded port such as 22000, this change selects that port instead of 63000. The browser test server can then fail with EACCES; strictPort: false does not skip that error. Select a port based on availability or handle EACCES with a fallback.

      Review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 3f5dad74ed2c9a1039be09db3df5a15c78d8b8f4 and 45cd80eb23cb8efd45b48d697adff30b1ed7fc5b.

      Files selected for processing: 1

      • apps/web/vite.config.ts

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

    7. juliusmarminge added labelstakeover:in-progress

    8. Evidence

      On Windows Server 2025 with real WSL/HNS dynamic exclusions covering 61001–61300, used separate checkouts with the same hash bucket (78), installed dependencies, and ran vp test run --project browser src/components/ChatMarkdown.browser.test.tsx from each apps/web. Bare Node binds to reserved port 61078 returned EACCES on both commits.

      BeforeAfter
      Before: startup fails on reserved port 61078After: port 20078 listens and browser tests execute
      b2259d3c6c: Startup Error / EACCES, no tests run.503b274e10: listener observed on ::1:20078; all 28 tests execute, 27 pass.

      Head still exits 1 because of the unrelated d:alert markdown assertion reported during triage. The reserved-port startup failure is gone.

      Reproduction driver · Hash and bind probe · Capture display script · Complete CLI transcripts · Full artifacts and reproduction notes

      Not shown:

      • An all-green browser suite was not demonstrated: head executes all 28 tests but retains the unrelated d:alert markdown assertion failure. This proof verifies reserved-port startup.
    9. juliusmarminge added labelstakeover:ready

    10. juliusmarminge removed labelstakeover:in-progress

    11. juliusmarminge merged this2b6145b

    12. juliusmarminge closed this

    13. juliusmarminge removed labelstakeover:ready

Sign in to join this conversation.