GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(arborist): propagate overrides through Link nodes to targets by manzoorwanijk · Pull Request #9198 · npm/cli

Conversation

@manzoorwanijk

@manzoorwanijk manzoorwanijk commented Apr 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

In continuation of our exploration of using install-strategy=linked in the Gutenberg monorepo, which powers the WordPress Block Editor.

When using install-strategy=linked, npm overrides for transitive dependencies were ignored.
The overridden version was installed but reported as invalid instead of overridden, and with strict-peer-deps the install failed entirely with ERESOLVE.

The root cause is that override propagation stops at Link nodes and never reaches their targets.
Overrides propagate through the tree via addEdgeIn -> updateOverridesEdgeInAdded -> recalculateOutEdgesOverrides.
When a Link node receives overrides, recalculateOutEdgesOverrides iterates over this.edgesOut — but Links have no edgesOut (their targets do).
So overrides never reach the target node's dependency edges, and those edges use rawSpec instead of the overridden spec.

In the linked strategy, all packages in node_modules/ are Links pointing to targets in .store/.
This meant no overrides propagated past the first level of the dependency tree.

The fix overrides recalculateOutEdgesOverrides in the Link class to forward overrides to the target node.
When buildIdealTree creates a root Link (e.g. on macOS where /tmp -> /private/tmp), the target Node is now created with loadOverrides: true so it loads override rules from package.json.

The #applyRootOverridesToWorkspaces workaround method is removed — it was compensating for this exact bug by detaching workspace edges whose specs didn't match. With proper propagation, workspace edges already have the correct overridden spec, making the workaround dead code.

References

Fixes #9197

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@manzoorwanijk
manzoorwanijk marked this pull request as ready for review April 7, 2026 02:47
@manzoorwanijk
manzoorwanijk requested a review from a team as a code owner April 7, 2026 02:47
wraithgar
wraithgar reviewed Apr 7, 2026
View reviewed changes
Comment thread workspaces/arborist/lib/link.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@wraithgar

wraithgar commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

We are waiting to land any PRs until node ships with a newer version of the cli. CI should be green when that happens.

manzoorwanijk reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wraithgar wraithgar self-assigned this Apr 7, 2026
manzoorwanijk added 2 commits April 17, 2026 14:35
@manzoorwanijk
fix(arborist): propagate overrides through Link nodes to targets
1eca3bc
@manzoorwanijk
fix(arborist): remove dead applyRootOverridesToWorkspaces workaround
19c94cc
This method was a workaround for overrides not propagating through Link
nodes to their targets. Now that Link.recalculateOutEdgesOverrides
properly forwards overrides, workspace edges already have the correct
overridden spec, making this detach logic unreachable dead code.
@manzoorwanijk
manzoorwanijk force-pushed the fix/linked-overrides-not-propagated branch from 8310f5a to b923926 Compare April 17, 2026 09:05
@manzoorwanijk
test(arborist): add regression test for Link override propagation
5db25b6
Verifies that when a Link node receives overrides via edgesIn, they are
forwarded to its target node. The target's outgoing edges should use the
overridden spec. Also covers the no-op case when target is null.
@manzoorwanijk
manzoorwanijk force-pushed the fix/linked-overrides-not-propagated branch from b923926 to 5db25b6 Compare April 17, 2026 09:10
@manzoorwanijk

manzoorwanijk commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

CI is now green.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

wraithgar
wraithgar reviewed Apr 17, 2026
View reviewed changes
Comment thread workspaces/arborist/lib/arborist/build-ideal-tree.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@wraithgar wraithgar added the backport:v11 label Apr 17, 2026
wraithgar
wraithgar approved these changes Apr 17, 2026
View reviewed changes
@wraithgar
wraithgar merged commit bc32d94 into npm:latest Apr 17, 2026
18 checks passed

Uh oh!

There was an error while loading. Please reload this page.

github-actions Bot pushed a commit that referenced this pull request Apr 17, 2026
@manzoorwanijk @npm-cli-bot
fix(arborist): propagate overrides through Link nodes to targets (#9198)
7998720
In continuation of our exploration of using `install-strategy=linked` in
the [Gutenberg
monorepo](WordPress/gutenberg#75814), which
powers the WordPress Block Editor.

When using `install-strategy=linked`, npm overrides for transitive
dependencies were ignored.
The overridden version was installed but reported as `invalid` instead
of `overridden`, and with `strict-peer-deps` the install failed entirely
with `ERESOLVE`.

The root cause is that override propagation stops at Link nodes and
never reaches their targets.
Overrides propagate through the tree via `addEdgeIn` ->
`updateOverridesEdgeInAdded` -> `recalculateOutEdgesOverrides`.
When a Link node receives overrides, `recalculateOutEdgesOverrides`
iterates over `this.edgesOut` — but Links have no `edgesOut` (their
targets do).
So overrides never reach the target node's dependency edges, and those
edges use `rawSpec` instead of the overridden spec.

In the linked strategy, all packages in `node_modules/` are Links
pointing to targets in `.store/`.
This meant no overrides propagated past the first level of the
dependency tree.

The fix overrides `recalculateOutEdgesOverrides` in the `Link` class to
forward overrides to the target node.
When `buildIdealTree` creates a root Link (e.g. on macOS where `/tmp` ->
`/private/tmp`), the target Node is now created with `loadOverrides:
true` so it loads override rules from `package.json`.

The `#applyRootOverridesToWorkspaces` workaround method is removed — it
was compensating for this exact bug by detaching workspace edges whose
specs didn't match. With proper propagation, workspace edges already
have the correct overridden spec, making the workaround dead code.

## References

Fixes #9197

(cherry picked from commit bc32d94)
@github-actions github-actions Bot mentioned this pull request Apr 17, 2026
fix(arborist): propagate overrides through Link nodes to targets #9254
Merged
@github-actions

github-actions Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

🎉 Backport to release/v11 created: #9254

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Apr 17, 2026
chore: release 12.0.0-pre.0.0 #9229
Merged
reggi pushed a commit that referenced this pull request Apr 21, 2026
@manzoorwanijk @reggi
fix(arborist): propagate overrides through Link nodes to targets (#9198)
81802d2
In continuation of our exploration of using `install-strategy=linked` in
the [Gutenberg
monorepo](WordPress/gutenberg#75814), which
powers the WordPress Block Editor.

When using `install-strategy=linked`, npm overrides for transitive
dependencies were ignored.
The overridden version was installed but reported as `invalid` instead
of `overridden`, and with `strict-peer-deps` the install failed entirely
with `ERESOLVE`.

The root cause is that override propagation stops at Link nodes and
never reaches their targets.
Overrides propagate through the tree via `addEdgeIn` ->
`updateOverridesEdgeInAdded` -> `recalculateOutEdgesOverrides`.
When a Link node receives overrides, `recalculateOutEdgesOverrides`
iterates over `this.edgesOut` — but Links have no `edgesOut` (their
targets do).
So overrides never reach the target node's dependency edges, and those
edges use `rawSpec` instead of the overridden spec.

In the linked strategy, all packages in `node_modules/` are Links
pointing to targets in `.store/`.
This meant no overrides propagated past the first level of the
dependency tree.

The fix overrides `recalculateOutEdgesOverrides` in the `Link` class to
forward overrides to the target node.
When `buildIdealTree` creates a root Link (e.g. on macOS where `/tmp` ->
`/private/tmp`), the target Node is now created with `loadOverrides:
true` so it loads override rules from `package.json`.

The `#applyRootOverridesToWorkspaces` workaround method is removed — it
was compensating for this exact bug by detaching workspace edges whose
specs didn't match. With proper propagation, workspace edges already
have the correct overridden spec, making the workaround dead code.


## References

Fixes #9197
owlstronaut pushed a commit that referenced this pull request Apr 22, 2026
@manzoorwanijk Michael Smith
fix(arborist): propagate overrides through Link nodes to targets (#9198)
e7805c3
In continuation of our exploration of using `install-strategy=linked` in
the [Gutenberg
monorepo](WordPress/gutenberg#75814), which
powers the WordPress Block Editor.

When using `install-strategy=linked`, npm overrides for transitive
dependencies were ignored.
The overridden version was installed but reported as `invalid` instead
of `overridden`, and with `strict-peer-deps` the install failed entirely
with `ERESOLVE`.

The root cause is that override propagation stops at Link nodes and
never reaches their targets.
Overrides propagate through the tree via `addEdgeIn` ->
`updateOverridesEdgeInAdded` -> `recalculateOutEdgesOverrides`.
When a Link node receives overrides, `recalculateOutEdgesOverrides`
iterates over `this.edgesOut` — but Links have no `edgesOut` (their
targets do).
So overrides never reach the target node's dependency edges, and those
edges use `rawSpec` instead of the overridden spec.

In the linked strategy, all packages in `node_modules/` are Links
pointing to targets in `.store/`.
This meant no overrides propagated past the first level of the
dependency tree.

The fix overrides `recalculateOutEdgesOverrides` in the `Link` class to
forward overrides to the target node.
When `buildIdealTree` creates a root Link (e.g. on macOS where `/tmp` ->
`/private/tmp`), the target Node is now created with `loadOverrides:
true` so it loads override rules from `package.json`.

The `#applyRootOverridesToWorkspaces` workaround method is removed — it
was compensating for this exact bug by detaching workspace edges whose
specs didn't match. With proper propagation, workspace edges already
have the correct overridden spec, making the workaround dead code.

## References

Fixes #9197

(cherry picked from commit bc32d94)
@github-actions github-actions Bot mentioned this pull request Apr 22, 2026
chore: release 11.14.0 #9273
Merged
@manzoorwanijk
manzoorwanijk deleted the fix/linked-overrides-not-propagated branch May 14, 2026 16:50
This was referenced May 14, 2026
[BUG] npm ci re-resolves workspace deps from the registry in v11.14.x, fails on lockfiles v11.13.x accepts #9357
Closed
fix(arborist): only forward Link overrides when a rule names a target dep #9359
Merged
@github-actions github-actions Bot mentioned this pull request May 27, 2026
chore: release 12.0.0-pre.1 #9387
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@wraithgar wraithgar wraithgar approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@wraithgar wraithgar

Labels

backport:v11

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[BUG] Overrides ignored for transitive dependencies with install-strategy=linked

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@manzoorwanijk @wraithgar
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.