Repository navigation
test: temp-path guard cannot match on Windows - 3 deterministic cross-process test deaths - #88
Merged
Conversation
requireTempPath compared realpathSync(path) against realpathSync(tmpdir()) + "/". On Windows realpathSync yields BACKSLASH paths, so the comparison can never match: every guarded child (writer.ts, lock-holder.ts) exited 2 against its own perfectly temporary store path, and the cross-process tests that spawn them die deterministically on Windows: "four writers: nothing is lost...", "a reader process always parses a complete file" and "a second process waits for the first to finish publishing" fail on any tree containing abogartz#86 (measured: child stderr "writer: refusing to run against a non-temporary store path: C:\...\osi-race-XXXX\memory"). On POSIX sep is "/" and behavior is bit-identical. Adds a guard test in both directions: a fresh mkdtemp path must pass in-process (the shipped bug's shape is loud there - process.exit(2) takes the test runner down, verified against the pre-fix helper), and writer.ts must refuse a non-temp path with exit 2. The refuse probe uses homedir rather than the repo because checkouts can themselves live under the temp dir - where they do on the reference machine - and a repo-root probe there would pass the guard and let the writer actually write.
Contributor
Author
|
Bummer, on it. |
|
🎉 This PR is included in version 0.9.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
The bug #86 shipped
test/helpers/temp-root.tsdecides "is this path inside the temp dir?" withrealpathSyncreturns backslash paths on Windows, so+ "/"never matches and no temp path on Windows can pass the guard. Every guarded child (writer.ts,lock-holder.ts) exits 2 against its own perfectly temporary store:Three cross-process tests therefore die deterministically on Windows on any tree containing #86, on both Bun lines:
two processes sharing one store > four writers: nothing is lost, every supersede lands, no lock is strandedtwo processes sharing one store > a reader process always parses a complete filewithStoreLock > a second process waits for the first to finish publishing(Verified by running current
mainon Windows ×2 Buns — and it's the guard's stderr in the failure output, not a filesystem race. On Linuxsepis/, so CI saw none of this.)The fix
One token:
+ sep. Bit-identical POSIX behavior.Plus
test/temp-root.test.ts, pinning the guard in both directions — the accept-path test is loud on the shipped bug all by itself, because a wrong comparison meansprocess.exit(2)inside the test process (measured: the whole test file dies with raw exit 2). The refuse-path test spawnswriter.tsagainsthomedir()— deliberately not the repo path, because checkouts themselves can live under the temp dir (they do on the reference machine) and a repo probe there would pass the guard and let the writer write.Verification (Windows ×2 Bun + Linux logic-unchanged)
tsc --noEmit/ lintIndependent of #80/#81/#85/#87. Any Windows test leg — a job like the one in the forthcoming Windows-semantics PR, or anyone's local
bun test— cannot go green on currentmainuntil this lands.assisted by Qwen3-flash-next