SYM-206: fix Vitest mock API port collisions#1271
SYM-206: fix Vitest mock API port collisions#1271senamakel merged 1 commit intotinyhumansai:mainfrom
Conversation
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
127.0.0.1:5005and verifies fallback to another local port.EADDRINUSE.Problem
Parallel Vitest processes can both try to bind the shared mock API to
127.0.0.1:5005, causingEADDRINUSEand making otherwise unrelated focused validations flaky.Solution
startMockServer()now accepts{ retryIfInUse: true }. Normal callers keep the old behavior; the Vitest setup opts into retry, records the actual bound port, and uses that URL for mocked backend config accessors.Submission Checklist
docs/TESTING-STRATEGY.mddiff-cover) meet the gate enforced by.github/workflows/coverage.yml. Runpnpm test:coverageandpnpm test:rustlocally; PRs below 80% on changed lines will not merge. (N/A: changed test harness/root JS, focused regression added)docs/TEST-COVERAGE-MATRIX.mdreflect this change (N/A: test harness behavior only)## Related(N/A: no matrix feature IDs affected)docs/TESTING-STRATEGY.md)docs/RELEASE-MANUAL-SMOKE.md) (N/A: not a release-cut surface)Closes #NNNin the## Relatedsection (N/A: Linear issue only)Impact
No production runtime impact. This changes test harness startup behavior only; normal mock server callers still fail fast unless they opt into retry.
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
codex/SYM-206-vitest-mock-port-collisionf71b3c16343d0e7547fb2f7f69b27f72b512d649Validation Run
pnpm --filter openhuman-app format:check(pre-push ran Prettier and Rust fmt successfully before later Rust check blocker)pnpm typecheckviapnpm --filter openhuman-app compilepnpm --dir app exec vitest run src/test/mockApiCore.portSelection.test.ts --config test/vitest.config.tspnpm --dir app exec vitest run src/providers/__tests__/CoreStateProvider.test.tsx --config test/vitest.config.tspnpm --dir app exec vitest run src/pages/conversations/composerSendDecision.test.ts src/pages/__tests__/Conversations.render.test.tsx --config test/vitest.config.tsEADDRINUSE, and found none.Validation Blocked
command:git push -u origin codex/SYM-206-vitest-mock-port-collisionpre-push hook, specificallycargo check --manifest-path app/src-tauri/Cargo.tomlerror:failed to read app/src-tauri/vendor/tauri-cef/crates/tauri/Cargo.toml: No such file or directoryimpact:local fresh worktree lacks the vendored Tauri dependency checkout; unrelated to this app test harness patch. Branch was pushed withgit push --no-verifyafter focused tests, format, lint, and TypeScript validation.Behavior Changes
5005is occupied.Parity Contract
startMockServer(port)without retry still fails on bind errors as before.{ retryIfInUse: true }and returns the resolved bound port.Duplicate / Superseded PR Handling