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

open1
main
GitHub fork: fix/web-browser-test-port-windows
opened9d agobyZZacharon
View on GitHubTwo-way sync enabledPR last imported 9d ago

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

Checks

8 successful Ā· 2 skipped
All checks passed
3f5dad7

Added 1 commit

  • fix(web): browser tests no longer pick a port Windows has reserved3f5dad7
Synced from GitHub

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.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review. šŸŽ‰

ā„¹ļø Recent review info
āš™ļø Run configuration
šŸ“„ Commits

Reviewing files that changed from the base of the PR and between 807319c276c6831b2c219640e9da5b38019a8f1d and 3f5dad74ed2c9a1039be09db3df5a15c78d8b8f4.

šŸ“’ 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; 7 remain after this 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 checkout-path hash calculation remains unchanged.

Priority: āž– Normal

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 3f5da

No actionable merge-blocking risk remains in this dev-only configuration change.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title is concise, specific, and uses the required conventional commit format. It accurately describes the Windows browser-test port fix.
Description checkPassedThe description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the Windows failure, the port-range change, scope justification, focused before-and-a…
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: Description check

Explanation

The description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the Windows failure, the port-range change, scope justification, focused before-and-after verification, related test status, unverified platforms, and the agent 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.