Repository navigation
Stop locate and server-move tests from flaking on Windows - #8070
Merged
Merged
Conversation
locate.test.ts: PATH_CLAIM_SETTLE_TIMEOUT_MS was read at module top level from environment-hooks, which sits on an import cycle back through path-admission. When a worker first loads modules in another order (e.g. after host-shared-ports.test.ts), the value is undefined, the settle deadline is NaN, and a thread waiting behind another thread's path claim fails at once. The hook timeout now lives in an import-free module. server-move tests: their polls wait across a real archive export, target RPCs, and 200-300 ms activation retry windows on the default 1 s poll budget. They now share a 10 s budget. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/fix-server-test-flakes-thr_xrm9brynmp
branch
from
November 24, 2026 00:36
0a9f756 to
3f95952
Compare
ymichael
marked this pull request as ready for review
November 24, 2026 00:37
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.
Human comments
What was wrong
These are the still-active group D server flakes from the past week.
test/environments/locate.test.ts: "lets two Local threads share one row" and "holds a second branch switch behind the first one's claim…". This failed 3 times on Windows server-2, including mainde0b6f1ccfand today onf9134e1c49. Both tests always fail together, and attempt 2 passed on the same SHA.path-admission.tssetPATH_CLAIM_SETTLE_TIMEOUT_MS = ENVIRONMENT_HOOK_TIMEOUT_MSat module top level, importing the value fromenvironment-hooks.ts.environment-hookssits on an import cycle that leads back topath-admission(throughhosts/online-rpc→ws/hub→ … →threads/thread-command-environment).isolate: false). When a file such astest/app/host-shared-ports.test.tsloads that graph from a different entry,path-admissionis evaluated beforeenvironment-hooksfinishes, and the constant isundefined.admitAfterPathClaimsSettleandpathClaimDeadlineinthread-provisioning.ts) then compute aNaNdeadline. A thread that should wait behind another thread's settling path claim either fails immediately ('error'instead of'starting') or never wakes ([id, null]).vars safely today, but it would get the same silentNaNif the bundle order changed.test/server-move/coordinator.test.ts(3 tests) andtest/server-move/routes.test.ts(1 test) failed once on Windows server-3 (run 44836680494). Attempt 2 passed on the same SHA, and that branch only touchedinstall-machine.sh.expect.pollused vitest's default 1 s budget while waiting for the coordinator to get through real work: a real export of the harness DB (SQLite backup, tar.gz, sha256), target RPCs, and the 200–300 ms activation retry windows the tests configure.Checked and left out:
127.0.0.1:<port>, and Windows rejects a colon in a path. This is deterministic and only on unmerged Fetch managed plugin snapshots before cloning repository history #7914.bb-vt-sandbox, which pushes git object paths past Windows MAX_PATH. This is deterministic and only on that branch.What changed
apps/server/src/services/environments/environment-hook-timeout.ts(new, no imports) ownsENVIRONMENT_HOOK_TIMEOUT_MS.environment-hooks.tsandpath-admission.tsimport it from there. A module with no imports always finishes evaluating before its importers, so the settle deadline no longer depends on module load order. Behavior is otherwise unchanged (still 15 minutes).apps/server/test/helpers/server-move.tsexportsSERVER_MOVE_STEP_POLL = { timeout: 10_000 }.expect.pollincoordinator.test.tsandroutes.test.tsuses it, since each one waits on the move pipeline.How you verified
test/app/host-shared-ports.test.ts. Its imports alone are enough (-t KT2, with all its tests skipped).PATH_CLAIM_SETTLE_TIMEOUT_MSinside locate printedundefinedin that order.settlingPathClaim()to return null reproduces exactly these two failures and no others.pnpm exec turbo run typecheck --filter=@bb/serverpasses.test/environments,test/server-moveandtest/threads/thread-environment-restore.test.ts: 23 files, 175 tests, all pass.🤖 Generated with Claude Code