fix(arborist): don't load store packages' devDependencies as required edges#9626
Open
manzoorwanijk wants to merge 1 commit into
Open
fix(arborist): don't load store packages' devDependencies as required edges#9626manzoorwanijk wants to merge 1 commit into
manzoorwanijk wants to merge 1 commit into
Conversation
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.
In continuation of our exploration of using
install-strategy=linkedin the Gutenberg monorepo, whichUnder
install-strategy=linked,npm sbomexited non-zero withESBOMPROBLEMS, reporting the devDependencies of transitive packages (e.g.matcha,tape) asmissing: ... required by .... Those dev dependencies are correctly not installed (the same is true under hoisted), yet only the linked strategy treated them as missing-and-required. Hoisted produced a clean SBOM for the same dependency set.Why
A package in the linked strategy's store lives at
node_modules/.store/<key>/node_modules/<pkg>, which makes it a structural tree top (isTop, no parent).Node._loadDepsloads devDependencies for every top node, so each store package — a transitive dependency whose devDependencies are never installed — gained requireddevedges.npm sbomreads the filesystem tree vialoadActual, queries it, and flags every non-optional missing edge, so those spurious dev edges surfaced asESBOMPROBLEMS. Standalonenpm auditwas unaffected because it audits the virtual tree from the lockfile. Hoisted was unaffected because its transitive packages have a real parent, so they are not tops and never load devDependencies.How
load-actual.jsnow flags a node asisInStorewhen its realpath sits inside anode_modules/.store/directory, matching the flag the isolated reifier already sets on ideal-tree store nodes.Node._loadDepsexcludes store nodes from the devDependency load (isTop && !globalTop && path && !this.isInStore), so a store package — a transitive dependency by definition — never gains required dev edges. This makes the linked actual tree's edge semantics match hoisted.References
Fixes #9610
Part of #9608