fix(config): honor $HOME for OpenWiki home dir resolution on Windows - #705
Open
XiaoChen (c020627) wants to merge 1 commit into
Open
fix(config): honor $HOME for OpenWiki home dir resolution on Windows#705XiaoChen (c020627) wants to merge 1 commit into
XiaoChen (c020627) wants to merge 1 commit into
Conversation
On Windows `os.homedir()` reads `USERPROFILE` and silently ignores `process.env.HOME`, so pointing `$HOME` at a throwaway directory (the isolation strategy used by the test suite and local dev tooling) had no effect on Windows. `resolveOpenWikiHomeDir` now resolves the user home via `resolveUserHomeDir`, which honors `$HOME` when set and falls back to `os.homedir()` otherwise. POSIX behavior is unchanged. Fixes langchain-ai#695 Co-Authored-By: WorkBuddy <noreply@workbuddy.ai>
🦋 Changeset detectedLatest commit: 5260635 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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
On Windows,
os.homedir()readsUSERPROFILEand silently ignoresprocess.env.HOME. The test suite and local dev tooling isolate state by pointing$HOMEat a throwaway directory, but that isolation was a no-op on Windows — onboarding/config tests wrote into the real~/.openwikiinstead of the isolated path (see #695).Solution
src/config/openwiki-home.tsnow resolves the user home through a newresolveUserHomeDir()helper that honorsprocess.env.HOMEwhen set and falls back toos.homedir()otherwise.resolveOpenWikiHomeDir()uses it at every call site. POSIX behavior is unchanged (os.homedir already returns$HOMEthere), so this only affects Windows isolation.Testing
test/config/openwiki-home-home-env.test.tswith 5 cases covering:$HOMEhonored when set,os.homedir()fallback when unset, andOPENWIKI_CONFIG_DIR/~/~/subexpansion against$HOME.npx vitest run test/config/openwiki-home-home-env.test.ts→ 5 passed.npx tsc --noEmit -p tsconfig.json→ clean.patchchangeset (.changeset/fix-home-env-isolation.md).Fixes #695