Repository navigation
fix(config): clear loadedEnvValues in resetDotenv and verify live process.env in getLoadedEnvValue - #417
Open
Pybsama wants to merge 1 commit into
Open
fix(config): clear loadedEnvValues in resetDotenv and verify live process.env in getLoadedEnvValue#417Pybsama wants to merge 1 commit into
Pybsama wants to merge 1 commit into
Conversation
…cess.env in getLoadedEnvValue
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.
Summary
Fixes two state-tracking bugs in
src/config/dotenv-loader.ts:resetDotenv()leftloadedEnvValuespopulated: WhileresetDotenv()deleted injectedprocess.envkeys and clearedinjectedKeys,loadedEnvFiles, andloadedEnvKeys, it did not callloadedEnvValues.clear(). After a reset (for example on dashboard config reload or project switching),getLoadedEnvValue(key)could still return stale values from a previous.envload, causingresolveDashboardKeySource()to misattribute a process environment variable to.env.getLoadedEnvValue(key)did not verifyprocess.env[key]: Its JSDoc states "Get the value injected by .env, if the current process still has that value." Previously it returned the cached map entry unconditionally even ifprocess.env[key]was subsequently deleted or overwritten. It now checksprocess.env[key] === loadedbefore returning the value.Added regression tests in
tests/config/dotenv-loader.test.ts.Verification
Run locally on macOS (M1 Max):
npm cinpm run build:workspaces— passednpm run lint(tsc --noEmit) — passednpm run build— passednpx vitest run tests/config/—10 passed (10)test files,92 passed (92)testsAI Disclosure
Prepared with AI assistance; all changes and tests were reviewed and verified locally.