fix(cli): scope install-scripts warning to packages touched by this reify#9799
Open
Sanjays2402 wants to merge 1 commit into
Open
fix(cli): scope install-scripts warning to packages touched by this reify#9799Sanjays2402 wants to merge 1 commit into
Sanjays2402 wants to merge 1 commit into
Conversation
…eify npm reify's post-install "install scripts blocked" warning walked the whole actual tree, so `npm update -g <pkg>` (or any partial install) warned about pre-existing, untouched global packages whose install scripts were never going to run this session. Filter the unreviewed list against arb.diff so only packages actually added or changed in this run are reported. Fixes npm#9797
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.
Description
npm update -g <pkg>(and other partial installs) warns about install scripts that are "blocked" on pre-existing global packages that this run never touched. Example from the issue:yarnis already installed, already sitting on disk, andnpm update -g opencode-aiis not going to run its scripts this session. It gets flagged only becausecheckAllowScriptswalks the entireactualTreeafter reify.The strict-allow-scripts preflight is intentionally whole-tree (it hard-fails installs), so I left that alone. This change only tightens the advisory warning shown after a successful reify.
Fix
In
lib/utils/reify-finish.js, after collecting unreviewed nodes, filter them against the set of locations that appear asADDorCHANGEinarb.diff. Untouched packages don't run install scripts this reify, so we don't flag them. When there is no diff (defensive fallback), behavior is unchanged.Existing Issue
Fixes #9797
Screenshots
Not applicable, terminal warning output change only.
Test Coverage
Added three new subtests to
test/lib/utils/reify-finish.js:arb.diffis absent, behavior falls back to the previous whole-tree listCHANGEactions, nested children, and tolerates nullish diff entriesI verified both directions: the new tests fail on
main(untouched packages still leak through) and pass with this patch.reify-finish.jsstays at 100% line / branch / function / statement coverage. Only changed files were linted (eslint clean).AI disclosure
This change was written with the assistance of Claude. I have reviewed the diff and the tests and take responsibility for the code.