Repository navigation
Conversation
After the manifest is loaded, a spec that still has no name and whose manifest name is missing or empty throws EMISSINAME, carrying the raw spec, before that dependency is recorded. Explicit-request collection adds an edge only when edgesOut returns one. In reify's updateNodes, a missing outgoing edge is skipped, the same way an edge with no target already is. New tests cover a versionless named file: add, a nameless manifest, and a mixed add that leaves no "undefined" dependency key. Fixes npm#4819
2 tasks done
jeffkl
reviewed
Oct 22, 2026
| for (const spec of this[_resolvedAdd]) { | ||
| if (spec.tree === tree) { | ||
| this.#explicitRequests.add(tree.edgesOut.get(spec.name)) | ||
| const edge = tree.edgesOut.get(spec.name) |
There was a problem hiding this comment.
With nameless additions now rejected inside #add, these guards don’t appear necessary. Is there another scenario where an edge can legitimately be missing here? If so, could you add a regression test demonstrating why skipping it is correct.
The EMISSINAME check rejects nameless specs before these lookups run, so the guards were never reached and broke the coverage gate.
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.
Adding a package whose package.json has no name makes install crash with TypeError: Cannot read properties of undefined (reading 'spec'). The failure comes after fetch and unpack, the command exits 1, and the log shows a node_modules/undefined path. Save can also record a dependency under the key "undefined".
An add spec that arrives without a name is meant to take that name from the fetched manifest. When the manifest name is missing or an empty string, the dependency is stored under the key "undefined" and no outgoing edge is created. Explicit-request tracking and the save path then call edgesOut.get and read edge.spec on that missing edge, which throws.
Changes:
npm test --workspace @npmcli/arboristpasses locally, including the 100% coverage check.References
Closes #4819