Repository navigation
fix(setup): preserve overridden runner variables and test isolation on Windows - #3639
Closed
Swatantra-66 wants to merge 0 commit into
Closed
Swatantra-66 wants to merge 0 commit into
Swatantra-66 wants to merge 0 commit into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Contributor
[Medium impact] The PR appears safe to merge; the previous Windows override issue is fixed. SummaryThe PR preserves caller overrides when Windows environment keys differ only in case.
Reviews (2) · Last reviewed commit: "fix(process): preserve Windows environme..." · Reviewed by Greptile |
Closed
2 tasks done
Swatantra-66
force-pushed
the
fix/windows-runner-env-isolation
branch
from
October 14, 2026 20:28
a4a5639 to
fffb074
Compare
Owner
|
Thanks @Swatantra-66 for investigating Windows runner-variable overrides and ConPTY output in the setup tests. Main includes the setup and test-isolation corrections, with the environment normalization refined in a follow-up. |
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 package runner identity resolution when ambient uppercase environment variables exist on Windows, isolates
USERPROFILEin CLI setup tests, and hardens PTY JSON extraction against Windows ConPTY escape sequences.Fixes #3635
Problem and expected behavior
{ ...process.env, npm_command: "exec" }on Windows, npm's ambientNPM_COMMAND="run"precedes the lowercase entry inObject.keys().environmentValuepicked the first match, ignoring the override.tests/boundary/cli/cliSetup.test.ts,runJourneyonly setHOME: isolatedHome, leavingUSERPROFILEpointed at the host home directory.\x1b[?25h) trailing stdout lines, breaking.split(/\r?\n/u, 1)[0]JSON parsing.Change and scope
src/application/ClientRegistrationIdentity.ts, updatedenvironmentValueon Windows to usefindLast()with case-normalized target comparison (candidate.toLowerCase() === target).src/setupEnvironment.test.ts, added unit regression coverage for Windows ambient case collisions.tests/boundary/cli/cliSetup.test.ts, setUSERPROFILE: isolatedHome, bounded JSON parsing between{and}, sequenced multiselect prompt steps deterministically, and filtered ambient runner variables case-insensitively.Contract and boundary impact
Semantic owner and earliest changed stage:
src/application/ClientRegistrationIdentity.ts(invokingPackageRunner)Contribution scope fit and linked maintainer decision: not applicable (bug fix within existing contracts)
CLI and MCP/tool-catalog contract: none
Provider, bridge, target-format, or platform compatibility: Windows
win32Evidence, artifact, provenance, or reconstruction contract: none
Target selection, authority, upstream behavior, and cleanup details: none
Generated metadata: none
Read existing files or captured data.
Launch or attach to a process.
Inject instrumentation or run scripts/code.
Change process memory, registers, files, or configuration.
Contact network services.
Recover protected code or work around protections.
Documentation or usability only; no target interaction.
Not sure yet; investigation or maintainer guidance needed.
Evidence and regression coverage
Tests added or updated:
src/setupEnvironment.test.ts("prioritizes overridden package runner environment variables over ambient keys with differing case on Windows")tests/boundary/cli/cliSetup.test.ts(14 tests passed on Windows ConPTY)Base reproduction or other evidence: On Windows,
invokingPackageRunner({ NPM_COMMAND: "run", npm_command: "exec", NPM_CONFIG_USER_AGENT: "npm/..." }, "win32")returnedundefined.Remaining proof gaps: none for Windows environment variable resolution and ConPTY journey parsing.
Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
npm run test:local -- src/setupEnvironment.test.ts— 7 tests passednpm run test:focused -- tests/boundary/cli/cliSetup.test.ts— 14 tests passednpm run check:fast— passed (turbo typecheck and lint)npm run docs:check— passed (documentation and product catalog consistency)Compatibility, safety, and release
USERPROFILE.Author readiness
Human owner: @Swatantra-66