Skip to content

fix(reify): report added count for fresh linked installs#9661

Merged
owlstronaut merged 1 commit into
npm:latestfrom
manzoorwanijk:fix/linked-reify-output-added-count
Jun 25, 2026
Merged

fix(reify): report added count for fresh linked installs#9661
owlstronaut merged 1 commit into
npm:latestfrom
manzoorwanijk:fix/linked-reify-output-added-count

Conversation

@manzoorwanijk

Copy link
Copy Markdown
Contributor

Under install-strategy=linked, a fresh npm install that actually creates .store entries and symlinks printed up to date, audited N packages instead of added N packages, misleading users and CI into thinking nothing changed.

reify-output counts adds with actualTree.inventory.has(d.ideal). Under the linked strategy the diff's ideal nodes belong to the isolated store tree (locations under node_modules/.store/<key>/node_modules/<name>), while the actualTree returned after reify is the logical hoisted-layout tree. The two never share node identity, so the lookup always failed and added stayed 0.

The ADD branch now also counts a node when it is a real store package node (isInStore && !isLink), which maps 1:1 to a hoisted package add. This excludes the internal store symlinks and the top-level consumer symlink, so the count matches hoisted for registry dependencies (verified: minimatch 4/4, rimraf 12/12, express 69/69). Omitted/incompatible optional deps have no store entry and are still not counted, and hoisted behavior is unchanged.

Known limitations (tracked separately): workspace and file:/npm link additions are represented as links rather than store nodes under linked, so they are not yet counted here — counting them is entangled with the self-link bug (#9398) and the undeclared-workspaces bug (#9618). The --json add[].path for a counted store package points to its .store realpath rather than a logical node_modules/<name> path.

References

Fixes #9623

@manzoorwanijk manzoorwanijk marked this pull request as ready for review June 25, 2026 14:33
@manzoorwanijk manzoorwanijk requested review from a team as code owners June 25, 2026 14:33
@owlstronaut owlstronaut merged commit 0c33947 into npm:latest Jun 25, 2026
28 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Backport to release/v11 created: #9667

@manzoorwanijk manzoorwanijk deleted the fix/linked-reify-output-added-count branch June 25, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] install-strategy=linked: a fresh install reports "up to date" instead of "added N"

2 participants