test: use filesystem-safe temp dir names in sync runner tests - #468
Merged
Conversation
The sync runner tests named their temp directory with `{:?}` of an
`Instant`, which renders as `Instant { tv_sec: 131419, tv_nsec: ... }`.
That component contains `:`, spaces and braces - legal in a Unix path,
illegal on Windows - so `create_dir_all` failed there with OS error 267
(NotADirectory) and four tests failed on windows-latest only.
Use a pid plus a per-process atomic counter for the unique suffix
instead: safe on every filesystem, still collision-free across parallel
test threads and concurrent test binaries.
`file_age_secs_reports_recent_write_as_near_zero` had its own inline
copy of the same snippet, so it now shares the `temp_session_path`
helper rather than carrying a second one.
Claude-Session: https://claude.ai/code/session_01V5XkBXdf8QdEho9QWQdFC8
ReviewSmall, well-scoped fix — replacing Code quality
Bugs / correctness
Potential nit (non-blocking)
Test coverage
Security / performance
Overall: a minimal, correct, well-justified fix. LGTM. |
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.
Problem
Four
sync::runnertests fail onwindows-latestonly, blocking CI onmain(run 33329650752):auth_rejected_clears_the_session_and_deletes_the_filefile_age_secs_reports_recent_write_as_near_zerosuccessful_renewal_replaces_the_session_and_records_the_timetransient_failure_keeps_the_session_and_the_fileCause
Both test helpers named their temp directory with
{:?}of anInstant:That path component contains
:, spaces and braces. Legal on Unix, illegal on Windows — socreate_dir_allcould never succeed there. Test fixtures only; nothing in the production code path was wrong.Fix
Build the unique suffix from the pid plus a per-process
AtomicUsizecounter — filesystem-safe everywhere, and still collision-free across parallel test threads and concurrent test binaries.file_age_secs_reports_recent_write_as_near_zerohad duplicated the same bad snippet inline, so it now shares thetemp_session_pathhelper instead of carrying its own copy.Verification
cargo fmt,cargo clippy --all-targetsclean, fullcargo testsuite green locally. Local runs are macOS, where these tests already passed — the Windows job on this PR is the real confirmation.https://claude.ai/code/session_01V5XkBXdf8QdEho9QWQdFC8