test(server): make Windows path and async fixtures deterministic#9576

merged3
windows-tests/media-realpath
windows-tests/server-paths
openedSep 4, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 5d ago

Several server tests compared POSIX literals with values resolved by the host Path service. Two ProviderRegistry cases also polled the cache file after publishing, racing the asynchronous persistence path on loaded runners. A static-file race fixture relied on POSIX rename-over-open behavior that Windows rejects. Finally, Windows bootstrap reads own and auto-close the inherited descriptor because there is no /proc descriptor path.

Build path expectations through the same Path service as the implementation, subscribe to the registry change stream before publishing and wait for the matching persisted update, and make bootstrap descriptor cleanup follow the reader's platform-specific ownership. On Windows, model the static replacement race with a pre-replacement snapshot handle so its metadata-and-bytes invariant remains covered. FIFO-only fixtures remain POSIX-only.

Part of the Windows test-suite stack rooted at #9564; the manual Windows lane comes from #9538.

Originally prepared with Claude Fable 5 in Claude Code; finalized with GPT-5.6 Sol in T3 Code.

Note

Make server test fixtures deterministic on Windows paths and async cleanup

  • Adds closeIfOpen and openBootstrapInputFd helpers in bootstrap.test.ts so descriptor cleanup tolerates EBADF when the reader has already closed the fd, with Windows leaving the fd open for the reader.
  • Switches path assertions across bootstrap, CLI config, boot service, adapter, provider registry, source control, and workspace tests to the host Path service instead of hard-coded separators or string concatenation.
  • Replaces cache-file polling in ProviderRegistry.test.ts with a scoped awaitPersistedProvider subscriber that waits for the matching registry change notification.
  • Adds Windows-specific setup in server.test.ts so the atomic-replacement test models Windows open-file constraints.
  • Skips the FIFO rejection test in WorkspaceFileSystem.test.ts on Windows where FIFO creation is unavailable.

Macroscope summarized 3bcea0a.


Note

Low Risk Test-only changes with no runtime behavior; low risk aside from possible gaps if new platforms diverge from the Path/fd assumptions encoded in the fixtures.

Overview Hardens the server test suite for Windows and flaky CI by aligning fixtures with host path resolution and platform-specific file-descriptor behavior—no production code changes.

Bootstrap and CLI config tests add closeIfOpen / openBootstrapInputFd so teardown tolerates fds the reader already closed on Windows (no /proc reopen path). Bootstrap t3Home expectations use Path.resolve so absolutised homes match on drive-letter hosts.

Path assertions across boot service, Antigravity adapter, provider instance registry, source control, and Claude status tests compare against effect/Path (join / resolve) instead of POSIX literals or "/parent/child" concatenation.

ProviderRegistry tests replace cache-file polling after PubSub.publish with awaitPersistedProvider, which subscribes to streamChanges and waits for the matching checkedAt before reading disk—avoiding races on slow runners.

Static file and workspace tests: on Windows, the atomic-replacement case opens a pre-replacement snapshot because rename-over-open fails; the FIFO rejection case is skipIf(win32) where mkfifo does not exist.

Reviewed by Cursor Bugbot for commit 3bcea0a97064d223537fb84e50f6f67a7c7b8869. Bugbot is set up for automated code reviews on this repo. Configure here.

Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire—13.8 KiB—15.1 KiB✅
CodexThread snapshot wire—7.0 KiB—7.3 KiB✅
CodexLive turn WebSocket wire—6.7 KiB—7.8 KiB✅
CodexLive turn WebSocket decoded—58.5 KiB—66.4 KiB✅
CodexLive turn messages—10—21✅
ClaudeTotal thread wire—13.6 KiB—15.1 KiB✅
ClaudeThread snapshot wire—7.0 KiB—7.3 KiB✅
ClaudeLive turn WebSocket wire—6.5 KiB—7.8 KiB✅
ClaudeLive turn WebSocket decoded—57.8 KiB—66.4 KiB✅
ClaudeLive turn messages—9—21✅

Baseline: unavailable · PR result: 3bcea0a · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.8 KiB
  • Claude decoded thread snapshot: 114.5 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Synced from GitHub

Approvability

Verdict: Approved at 84fdeb5

Macroscope's review found this PR approvable — All changes are confined to existing test files and improve Windows path, file-descriptor, filesystem-race, and unsupported-FIFO handling. No production behavior, product defaults, static-analysis configuration, or customer request path is changed.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

No code changes detected at 3bcea0a. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

Added 3 commits

  • test(server): model atomic replacement on Windows3bcea0a
  • test(server): wait on the registry change stream instead of spinning on the cache filec27b2dc
  • test(server): build path expectations from the Path the code resolves withde8410c