Repository navigation
Build and test on Windows in CI - #119
Merged
Merged
Conversation
fylorn
force-pushed
the
feat/windows-ci
branch
5 times, most recently
from
September 23, 2026 05:52
54d34a6 to
75db2bd
Compare
fylorn
added a commit
that referenced
this pull request
Sep 23, 2026
…ling `std::fs::rename` refuses when the destination exists on Windows. Every call to `write_atomic` has an existing destination -- it rewrites the client configuration the user already has -- so adoption did not merely degrade on that platform, it failed at the first step, reporting "the file exists" about a file whose existence is the entire point. `MoveFileExW` with `MOVEFILE_REPLACE_EXISTING` is the same-volume atomic replace that `rename(2)` already is on unix. Not "delete the destination, then move". That leaves a window in which the user's configuration file does not exist, and a process that dies inside it takes the original with it -- before we have told them where the backup went. `MOVEFILE_WRITE_THROUGH` so the move is on disk before the call returns. This writes other people's configuration files, and "we said it was saved and it was not there after a power cut" is far harder to track down than a write that failed outright. The new test reads as a no-op on unix, where rename has always overwritten. It is a stake driven in for the other platform. Found by the Windows CI job in #119, which is stacked on this and is what confirms the fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 23, 2026
…ling (#122) `std::fs::rename` refuses when the destination exists on Windows. Every call to `write_atomic` has an existing destination -- it rewrites the client configuration the user already has -- so adoption did not merely degrade on that platform, it failed at the first step, reporting "the file exists" about a file whose existence is the entire point. `MoveFileExW` with `MOVEFILE_REPLACE_EXISTING` is the same-volume atomic replace that `rename(2)` already is on unix. Not "delete the destination, then move". That leaves a window in which the user's configuration file does not exist, and a process that dies inside it takes the original with it -- before we have told them where the backup went. `MOVEFILE_WRITE_THROUGH` so the move is on disk before the call returns. This writes other people's configuration files, and "we said it was saved and it was not there after a power cut" is far harder to track down than a write that failed outright. The new test reads as a no-op on unix, where rename has always overwritten. It is a stake driven in for the other platform. Found by the Windows CI job in #119, which is stacked on this and is what confirms the fix. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
fylorn
force-pushed
the
feat/windows-ci
branch
from
September 23, 2026 06:19
75db2bd to
3884e5c
Compare
fylorn
added a commit
that referenced
this pull request
Sep 23, 2026
The source path is squashed into one file name so a backup says whose it is. It only replaced `/`. On Windows the separator is `\`, so the name kept its backslashes -- and `Path::join` given an absolute path discards the base entirely. The "file inside the backup directory" quietly became the user's own configuration file. What happened next was `create_new`, reporting that the file already exists. That complaint is the thing that saved us: without it the backup step would have written backup text over the user's configuration, and not damaging other people's files is the entire reason this module exists. The colon goes too. The one in `C:` is not legal in a Windows file name. The test runs on macOS and fails against the old implementation, which is the part worth keeping: a `\` separator survives string replacement of `/` on any platform, so this never needed a Windows machine to be caught. It was caught by one only because nothing had asked. Found by the Windows CI job in #119. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 23, 2026
The source path is squashed into one file name so a backup says whose it is. It only replaced `/`. On Windows the separator is `\`, so the name kept its backslashes -- and `Path::join` given an absolute path discards the base entirely. The "file inside the backup directory" quietly became the user's own configuration file. What happened next was `create_new`, reporting that the file already exists. That complaint is the thing that saved us: without it the backup step would have written backup text over the user's configuration, and not damaging other people's files is the entire reason this module exists. The colon goes too. The one in `C:` is not legal in a Windows file name. The test runs on macOS and fails against the old implementation, which is the part worth keeping: a `\` separator survives string replacement of `/` on any platform, so this never needed a Windows machine to be caught. It was caught by one only because nothing had asked. Found by the Windows CI job in #119. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
fylorn
force-pushed
the
feat/windows-ci
branch
6 times, most recently
from
September 23, 2026 07:28
7679937 to
7f5c539
Compare
Core has a platform half for the things Windows does differently -- a loopback port where unix has a socket, a handle wait where unix has a signal -- and until now none of it had ever been compiled. A `#[cfg(windows)]` module that "passes" looks exactly like one nobody has ever looked at. `cargo fmt` is not repeated: formatting does not depend on the platform, and running it twice only takes twice as long. The macOS smoke script does not run here -- `stat -f`, `curl --unix-socket`, BSD spellings throughout -- and porting it is its own piece of work. What this does instead is prove the two things that are genuinely different on this platform: that the binary starts, and that the control plane answers on a loopback port, refusing a request without the token and serving one with it. Without that, the Windows failure mode is a fully green CI and an interface that sits on the connection screen forever. The port file is what the wait is on, because core writes it only after the bind succeeds -- its existence is exactly "it is listening". The job found something on its first run, which is the point of it: a cast to the type the value already had. `IF_OPER_STATUS` is an `i32`, and `-D warnings` is not relaxed here for the same reason it is not relaxed anywhere else. The cross-check that should have caught it ran `cargo check` rather than clippy -- a lint is not a compile error, and the method now runs clippy with the flags CI uses. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fylorn
force-pushed
the
feat/windows-ci
branch
from
September 23, 2026 07:48
7f5c539 to
9ea8921
Compare
Closed
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.
Stacked on #118 — it needs that PR's loopback transport to compile at all. Review #118 first; this one is what actually proves it.
Core has a platform half for the things Windows does differently — a loopback port where unix has a socket, a handle wait where unix has a signal — and until now none of it had ever been compiled. A
#[cfg(windows)]module that "passes" looks exactly like one nobody has ever looked at.What the job does
clippy, tests and a release build of twcore on
windows-latest.cargo fmtis not repeated — formatting does not depend on the platform, and running it twice only takes twice as long.The macOS smoke script does not run here (
stat -f,curl --unix-socket, BSD spellings throughout) and porting it is its own piece of work. What this does instead is prove the two things that are genuinely different on this platform:Without that, the Windows failure mode is a fully green CI and an interface that sits on the connection screen forever.
The wait is on the port file, because core writes it only after the bind succeeds — its existence is exactly "it is listening". If core exits first, the step prints its stderr rather than waiting out the timeout.
Two things to decide
1. This job is not a required check. Branch protection requires the context
check, sowindowswill show up in the PR checks list but will not block a merge. Convertingcheckinto a matrix would rename the context and break the existing requirement, so that is not a silent change to make. To make it required:That is a repository setting, so it is yours to run rather than mine.
2. x64 only for now. arm64 Windows would need the
windows-11-armrunner; adding it is worth doing before release artifacts exist, not before this job has ever run once. Release targets for both are a separate piece.🤖 Generated with Claude Code