fix(arborist): surface undeclared workspaces under the linked strategy#9657
Merged
owlstronaut merged 1 commit intoJun 25, 2026
Merged
Conversation
1d08ee8 to
5ab259a
Compare
Contributor
Author
|
@owlstronaut let us wrap this up. It may also need a manual backport. EDIT: I am done for the day, please feel free to create a manual backport if needed, otherwise I will do it tomorrow. |
owlstronaut
approved these changes
Jun 25, 2026
Contributor
|
This usually means the cherry-pick had conflicts. Please create a manual backport: git fetch origin release/v11
git checkout -b backport/v11/9657 origin/release/v11
git cherry-pick -x ae6dbeb12a6f4b313a28c99068e34ba834ae91d1
# resolve any conflicts, then:
git push origin backport/v11/9657Error details |
Contributor
|
@manzoorwanijk I'll let you do it so my approval lets me merge it as well 😆 |
Contributor
Author
|
Here is it is #9669 |
owlstronaut
pushed a commit
that referenced
this pull request
Jun 26, 2026
…y (backport release/v11) (#9669) Backport of #9657 to `release/v11`. Under `install-strategy=linked`, a workspace the root does not depend on is installed on disk but was invisible to `npm ls --all`, `npm ls --workspaces`, and `npm query ':root > *'`, all of which reported an empty tree. The hoisted strategy lists every workspace. `loadActual` now synthesizes the missing root-to-workspace links for undeclared workspaces in both the filesystem-scan and hidden-lockfile paths (via a shared `#linkActualWorkspaces()` helper), so the root's workspace edges resolve. A declared workspace whose root link is genuinely missing is left unsynthesized so it still reports `UNMET`, and a name already present as a root child is never replaced. With the edges resolving, the workspace-skip branch `npm ls` used to suppress them is removed. Backport notes: the `.npm-extension` calls from the original commit are omitted (that feature is not on `release/v11`), and the `filterLinkedStrategyEdges` dev-edge guard keeps the v11 `istanbul ignore` since v11 has no test exercising it. ## References Fixes #9618 Backport of #9657
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, which powers the WordPress Block Editor.Under
install-strategy=linked, a declared workspace that the root does not depend on is installed on disk but was invisible tonpm ls --all,npm ls --workspaces, andnpm query ':root > *', all of which reported an empty tree. The hoisted strategy lists every workspace.Undeclared workspaces are intentionally not symlinked into the root
node_modulesunder the linked strategy, so whenloadActualrebuilds the actual tree (from the filesystem scan or the hidden lockfile, neither of which records anode_modules/<ws>entry) the root'sworkspaceedges resolve to nothing and the workspaces drop out of the tree thatlsandquerytraverse.npm lsthen hid those missing edges entirely to avoid a falseUNMET DEPENDENCY.The fix adds
loadActualpost-processing that, for the linked strategy, synthesizes an in-memoryLinkatnode_modules/<ws>for each undeclared workspace so its root edge resolves, matching the logical layout the regularpackage-lock.jsonalready records. This is introspection-only and writes nothing to disk. A declared workspace whose root link is genuinely missing is left alone so it still reportsUNMET, an existing root child of the same name is never replaced, and a workspace that was not loaded is skipped. With the edges now resolving, the workspace-skip branch thatnpm lsused to suppress them is removed.References
Fixes #9618