Repository navigation
Share test port allocations across suites - #2838
Merged
Merged
Conversation
tylerkaraszewski
marked this pull request as ready for review
October 7, 2026 18:53
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
deetergp
approved these changes
Oct 8, 2026
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.
Hold for https://github.com/Expensify/Auth/pull/25217Hold for https://github.com/Expensify/FuzzyBot/pull/372Hold for https://github.com/Expensify/ExpensifyBackupManager/pull/189Merge these backward-compatible preparation changes first, then this PR.
Details
PortMaponly tracks allocations within one process, so separate test suites (i.e., running in different worktrees) can select the same port before either Bedrock instance binds it. This adds a small port server shared by all test suites and worktrees running under the same Unix user.Each client registers its PID and owns its port reservations. Multiple clients can share a PID, and ports are released when they're returned, when the client disconnects, or when its PID exits. The server starts lazily, holds a singleton lock throughout its lifetime, and exits when its last client disappears. PID monitoring uses Linux pidfds or macOS kqueue, so inherited sockets and unreaped processes don't prevent cleanup.
The existing
getPort(),returnPort(), andwaitForPort()calls stay in place. Most of the implementation is in new files;PortMap.cppremains a forwarding file for consumers such as Auth that explicitly list it in their builds. The helper is built alongside Bedrock and the test binaries.This change is basically 100% AI written, and only affects how the test suite operates. I wouldn't worry a ton about reviewing every detail for perfection, so long as it generally seems to function OK. We can always improve it later.
Fixed Issues
For https://github.com/Expensify/Expensify/issues/689406
Tests
There are new tests added for this. Also, all PRs above have been tested using the new PortServer
Internal Testing Reminder: when changing bedrock, please compile auth against your new changes