Repository navigation
[rush] Respect repository npm configuration in install-run bootstrap scripts - #6216
MingYang Lu (2836048681) wants to merge 1 commit into
Conversation
|
MingYang Lu (@2836048681) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
3 similar comments
|
MingYang Lu (@2836048681) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
MingYang Lu (@2836048681) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
MingYang Lu (@2836048681) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Summary
Fixes #2817.
When an npm script invokes an
install-runbootstrap script, inherited npm configuration can override the repository's synced.npmrc. This can send bootstrap package lookups and installations to the wrong registry even though invoking Rush directly succeeds.Create a filtered environment for bootstrap npm subprocesses, removing
INIT_CWDandnpm_config_*keys case-insensitively. Apply it tonpm view,npm install, andnpm ci, including captured installation output.Details
The filter copies the environment before removing inherited npm settings. It preserves other environment variables, including variables referenced by
.npmrccredentials. The parent environment and the environment passed to the installed command remain intact.Add five regression cases covering package-version resolution and installation with both lockfile modes and both output-capture modes. Include a Rush patch changefile. No runtime dependencies or generated bootstrap bundles are changed in the patch.
Changed files:
libraries/rush-lib/src/scripts/install-run.tslibraries/rush-lib/src/scripts/test/InstallRunEnvironment.test.tscommon/changes/@microsoft/rush/fix-2817-bootstrap-npm-environment_2026-11-21-15-00.jsonHow it was tested
Linux, Node.js 24.22.1, TypeScript 5.8.3, Webpack 5.105.2, Jest 30.2.0 and npm 11.6.2.
npm ci. All three fixture commands ran successfully with caller environment and spaced arguments preserved. Credential/cache variables in the repository.npmrcalso remained usable. The original source fails the smoke test duringnpm viewwith the conflicting parent registry.git diff --checkpassed.The full Rush Stack monorepo build, full rush-lib suite, and repository-wide lint were not run. The scoped standalone build and validation scripts are handoff assets outside the upstream checkout. Windows and macOS were not run.
An intermediate run hit an ordering assertion in the existing stdout/stderr capture test. That test and
NPM_OUTPUT_CAPTURE_SCRIPTare byte-identical to the base revision; the isolated baseline capture suite passed all six tests, and the final fixed focused run passed all 156 tests. Seelogs/observed-capture-timing-failure.logandlogs/unchanged-capture-evidence.log. No capture timing code or tests were changed.Reproduce validation from the round directory
For baseline evidence, run
node tooling/validate-bootstrap.cjs --baseline, then run the new regression suite or smoke test; they are expected to fail. Rebuild without--baselineafterward. The baseline flag pins the original commit, so it works after the fix commit.Screening and handoff
shortlist.mdrecords ten new bug candidates and rejection/defer reasons.screening/contains unauthenticated GitHub API responses, prior-work exclusions, selected-issue timeline, PR overlap searches, and an owner PR search showing zero open PRs in this repository at screening.The requested
../ready-w03-r105.mdand../LEDGER-w03.mddestinations returned[Errno 30] Read-only file system. This local draft and the localLEDGER-w03.mdpreserve the handoff for the supervisor to copy. No permission bypass was attempted.AI assistance: Codex assisted with issue screening, implementation, and local regression validation.