Skip to content

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

Merged
juliusmarminge merged 3 commits into
windows-tests/media-realpathfrom
windows-tests/server-paths
Sep 4, 2026
Merged

test(server): make Windows path and async fixtures deterministic#9576
juliusmarminge merged 3 commits into
windows-tests/media-realpathfrom
windows-tests/server-paths

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 4, 2026

Copy link
Copy Markdown
Member

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 3bcea0a. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

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

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.8 KiB 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.7 KiB 7.8 KiB
Codex Live turn WebSocket decoded 58.5 KiB 66.4 KiB
Codex Live turn messages 10 21
Claude Total thread wire 13.6 KiB 15.1 KiB
Claude Thread snapshot wire 7.0 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.5 KiB 7.8 KiB
Claude Live turn WebSocket decoded 57.8 KiB 66.4 KiB
Claude Live 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.

@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from 4262108 to e5cd793 Compare September 4, 2026 03:20
@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch 2 times, most recently from e8bf6ff to 1c663fb Compare September 4, 2026 04:23
@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from 1c663fb to 74ad05b Compare September 4, 2026 04:54
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Sep 4, 2026
@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from ab8d9fe to 91ee36b Compare September 4, 2026 07:20
@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch 2 times, most recently from 419699d to d9d9d0b Compare September 4, 2026 07:28
@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from d9d9d0b to d0aff95 Compare September 4, 2026 07:32
@juliusmarminge
juliusmarminge marked this pull request as ready for review September 4, 2026 07:35
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Sep 4, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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.

@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from d0aff95 to edff38e Compare September 4, 2026 17:42
@macroscopeapp
macroscopeapp Bot dismissed their stale review September 4, 2026 17:43

Dismissing prior approval to re-evaluate edff38e

@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from edff38e to 678154a Compare September 4, 2026 17:48
@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from 678154a to 101a360 Compare September 4, 2026 17:50
@juliusmarminge juliusmarminge changed the title test(server): build path expectations from the Path the code resolves with test(server): make Windows path and async fixtures deterministic Sep 4, 2026
@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from 101a360 to 84fdeb5 Compare September 4, 2026 18:07
juliusmarminge and others added 3 commits September 4, 2026 13:26
… with

ProviderInstanceRegistryLive, AntigravityAdapter, and
SourceControlRepositoryService asserted literal posix paths against values
the code under test had run through Path.resolve or Path.join, so on Windows
the received side carried a drive letter and backslashes. Resolve the
expectation with the same Path. cli/config tolerates the bootstrap fd
already being closed where the reader has no /proc path and consumes the fd
itself, and WorkspaceFileSystem skips its FIFO case on Windows.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…on the cache file

Two ProviderRegistry tests polled the status-cache file up to 50 times after publishing a change, which lost the race on a loaded Windows runner and read the previous snapshot. The registry writes the cache and only then publishes, so subscribe to its change stream before publishing and join on the matching checkedAt; the file is on disk by then.

On Windows, readBootstrapEnvelope consumes the inherited descriptor through an auto-closing stream. The successful-read tests now leave that descriptor to the stream instead of racing it with a scoped second close; failure-path tests still close descriptors they retain.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the windows-tests/server-paths branch from 84fdeb5 to 3bcea0a Compare September 4, 2026 20:26
@juliusmarminge
juliusmarminge merged commit b123cbb into main Sep 4, 2026
34 of 43 checks passed
@juliusmarminge
juliusmarminge deleted the windows-tests/server-paths branch September 4, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant