test(ci): fix Windows json-parity test failures (sandbox home isolation)#43
Merged
Merged
Conversation
os.homedir() ignores HOME on Windows and reads USERPROFILE, so each withSandbox call leaked into the real home dir. Accounts added by one test (account1+account2) bled into the next, so 'parallel install writes Fish functions' saw 2 stale profiles and asserted 1. Set USERPROFILE alongside HOME to keep the sandbox isolated on every platform.
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.
What
Windows CI failed on
parallel install writes Fish functions with direct login refresh path(expected: 1, actual: 2) across node 18/20/22.Root cause
src/commands/parallel.tsresolves~/.claude-accountsviaos.homedir(). On Windows,os.homedir()readsUSERPROFILEand ignores theHOMEthatwithSandboxsets. So every sandbox shared the runner's real home dir, and accounts leaked across tests:parallel aliases…addsaccount1+account2parallel install…addsaccount1, then enumerates 2 stale profiles → writes 2 Fish files → asserts 1 → failLinux/macOS pass because
os.homedir()honorsHOMEthere.Fix
Set
USERPROFILE: tempHomealongsideHOMEinwithSandbox. Node'sos.homedir()honorsUSERPROFILEon Windows, restoring per-test isolation on every platform. Test-only change; no production behavior touched.Verify
Real proof is the Windows CI matrix on this PR.