SYM-206: fix Vitest mock API port collisions#1271
Draft
jwalin-shah wants to merge 1 commit intotinyhumansai:mainfrom
Draft
SYM-206: fix Vitest mock API port collisions#1271jwalin-shah wants to merge 1 commit intotinyhumansai:mainfrom
jwalin-shah wants to merge 1 commit intotinyhumansai:mainfrom
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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