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): drop self-link materialization for undeclared workspaces by manzoorwanijk · Pull Request #9399 · npm/cli

Conversation

@manzoorwanijk

@manzoorwanijk manzoorwanijk commented May 24, 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.

Summary

In install-strategy=linked, every workspace not listed in the root package.json's deps was getting a self-symlink inside its own node_modules/ (e.g. packages/test/node_modules/@namespace/test -> ..).
The workspace did not declare itself as a dependency; the link was a side effect of #9076 parking the workspace IsolatedLink off-root.
pnpm does not create such a self-link — packages that need to self-resolve by name are expected to use Node's exports-based self-referencing.

Fix

Keep the workspace IsolatedLink in the tree (so --workspace filters resolve undeclared workspaces and install scripts still run via the diff's unchanged-link path), but mark it isUndeclaredWorkspaceLink = true and treat it as tree-only:

  • #extractOrLink returns early for these links, so no symlink is materialized on disk.
  • #cleanOrphanedStoreEntries excludes them from the valid set, so any stale self-link from an older npm version is swept on the next install.
  • The link is no longer added to workspace.children.

The only behavior change is that require('<self-name>') from inside an undeclared workspace without an exports field no longer resolves.
This matches pnpm and the strict-isolation intent of #9076.
Cross-workspace dep links, declared-workspace root symlinks, and workspace postinstall execution are unaffected.

References

Fixes #9398
Related to #9076

Sorry, something went wrong.

Uh oh!

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

All reactions
@manzoorwanijk
manzoorwanijk force-pushed the fix/linked-strategy-undeclared-workspace-self-link branch from a1934f3 to 4059d99 Compare May 24, 2026 00:37
@manzoorwanijk
fix(arborist): do not materialize self-link for undeclared workspaces
53ef290
In install-strategy=linked, every workspace not listed in root's deps
got a self-symlink at <ws>/node_modules/<wsName> as a side effect of
parking its IsolatedLink off-root. Keep the Link in the tree so install
scripts and --workspace filters still work, but mark it as tree-only
so the reifier skips materialization and the orphan sweep removes any
stale self-link left over from an older npm version.

Fixes npm#9398
@manzoorwanijk
manzoorwanijk force-pushed the fix/linked-strategy-undeclared-workspace-self-link branch from 4059d99 to 53ef290 Compare May 24, 2026 00:46
@manzoorwanijk
manzoorwanijk marked this pull request as ready for review May 24, 2026 02:39
@manzoorwanijk
manzoorwanijk requested review from a team as code owners May 24, 2026 02:39
owlstronaut
owlstronaut approved these changes May 27, 2026
View reviewed changes
@owlstronaut owlstronaut added the backport:v11 label May 27, 2026
@owlstronaut
owlstronaut merged commit dac7ff6 into npm:latest May 27, 2026
17 checks passed

Uh oh!

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

@github-actions github-actions Bot mentioned this pull request May 27, 2026
fix(arborist): drop self-link materialization for undeclared workspaces #9418
Merged
@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

🎉 Backport to release/v11 created: #9418

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 May 27, 2026
chore: release 12.0.0-pre.1 #9387
Merged
owlstronaut pushed a commit that referenced this pull request May 27, 2026
@github-actions @manzoorwanijk
fix(arborist): drop self-link materialization for undeclared workspac…
d8a7803
…es (#9418)

Backport of #9399 to `release/v11`.

Co-authored-by: Manzoor Wani <[email protected]>
@manzoorwanijk
manzoorwanijk deleted the fix/linked-strategy-undeclared-workspace-self-link branch June 19, 2026 04:53
@coderabbitai coderabbitai Bot mentioned this pull request Jul 2, 2026
Dev zlovtnik/schema-migrator#8
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

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

Uh oh!

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

Assignees

No one assigned

Labels

backport:v11

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[BUG] install-strategy=linked creates an unnecessary self-link inside every undeclared workspace's node_modules/

Uh oh!

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

2 participants

@manzoorwanijk @owlstronaut
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.