Skip to content

[pull] main from pnpm:main - #495

Merged
pull[bot] merged 6 commits into
dwongdev:mainfrom
pnpm:main
Aug 11, 2026
Merged

pull[bot] merged 6 commits into
dwongdev:mainfrom
pnpm:main

Conversation

@pull

@pull pull Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

zkochan and others added 6 commits August 11, 2026 00:48
…13789)

The peer-suffix guard asked whether any surviving suffix mentions a
dropped alias, by substring-matching `<alias>@`. The question it means to
ask is narrower: does a surviving suffix name the `name@version` the
removal or range move severed? A dependent that resolves the same alias
at another version needs no rekeying, and neither does one whose peer
merely ends with the alias's name.

Both stacks now record what each severed edge pointed at, written the way
a peer suffix names a package — `name@version`, or a bare `name@` when
the reference pins no version to compare against, such as a link or a
tarball — and reject only a suffix that names one of those. Suffix
segments are read at every nesting depth, so the peers a `dedupePeers`-off
dep path pins are checked too, and the hashed-suffix bail stays: a
shortened suffix names nothing that can be ruled out.

A version the prune leaves behind is no proof the suffix is safe: a peer
stays reachable through the very dependent whose key names it, so the
check is against what the severed edge pointed at, not against what the
lockfile still holds.

Closes #13781.
…13791)

A missing peer declared by several dependents reaches merge_ranges once
per dependent. Only the length check consulted the unique set, so the
intersection folded every duplicate in again. node-semver intersects two
unions as their Cartesian product and keeps an alternative another one
already covers, so each pass multiplied the alternative count. The
reproduction reports the react peer 35 times across three distinct
ranges, which projects to billions of alternatives and exhausts memory
within seconds of starting resolution.

The intersection now runs over the unique ranges in report order and
collapses the covered alternatives after each step. The merged range is
unchanged as a set of versions, only bounded: at 10 duplicates it carries
2 alternatives instead of 1025, and four differently spelled variants of
the react range stay at 4 alternatives however often they repeat instead
of growing from 5 to 36.

semver-range-intersect collapses equivalent alternatives, so the
TypeScript CLI never had this behaviour and needs no counterpart change.

Fixes #13786.

---------

Co-authored-by: Zoltan Kochan <[email protected]>
…e main thread (#13646)

Closes #13627.

`hardLinkDir()` runs on a worker thread but is handed destinations relative to lockfileDir ([during-install#L327-L329](https://github.com/pnpm/pnpm/blob/main/pnpm11/building/during-install/src/index.ts#L327-L329)). `applyPatchToDir()` — called for every `patchedDependencies` entry — wraps patch application in a synchronous `process.chdir()` ([apply-patch#L18-L32](https://github.com/pnpm/pnpm/blob/main/pnpm11/patching/apply-patch/src/index.ts#L18-L32)). The cwd is process-wide and shared with worker threads, so a worker resolving a relative destination inside that window resolves it against the patched package instead of the project root, and the rename fails with `ERR_PNPM_ENOENT` — or `ERR_PNPM_ENOTEMPTY`, depending on what happens to be at the wrong path.

Resolving the destinations on the main thread is safe because the cwd is only switched inside a synchronous block, so no other main-thread code can observe it, and `hoistedLocations` values are always relative (they come from `path.relative`).

The rebuild path ([after-install#L405](https://github.com/pnpm/pnpm/blob/main/pnpm11/building/after-install/src/index.ts#L405)) already maps hoisted locations through `path.join(opts.lockfileDir, hoistedLocation)` before calling `hardLinkDir()`, so this makes install consistent with rebuild rather than introducing a new convention.

---------

Co-authored-by: Zoltan Kochan <[email protected]>
#13792)

An overrides entry whose value is a range bailed to the resolver in
both stacks. Resolution settles such a range on whichever version the
graph already holds — preferredVersions beats picking the highest
published, measured the same way item 4 of the roadmap was — so the
rewrite can name that version itself: the highest already-locked one
satisfying the range. A range nothing locked satisfies still bails,
since only the resolver can fetch a version that is not there.

Everything downstream is unchanged: the plan still carries a concrete
version, and the existing guards decide whether the rewrite can be
expressed — including the pair that refuse to merge onto a key whose
recorded snapshot or metadata would not match what the rewrite
rebuilds.

Parent-scoped overrides stay on the resolver. Those move one edge
rather than every edge to a package, so the lockfile would have to
hold both versions at once, which this rewrite cannot express.

Item 6 of #13696.
…er (#13714)

`record_children` now returns a `ChildrenRecording` instead of a bool, computing
under the same lock as the write whether the published edges differ from the
standing recording. A walk that re-records different edges flips the package's
other occurrence nodes to lazy, so their realized children stop pointing at what
an earlier, worse-ranked occurrence resolved. `children_context_unchanged` only
compares the claim's `peer_shadowed` set, which cannot see that the walk it waved
through landed on different edges.

A recording the prior lockfile pinned is exempt: a fresh walk's different answer
must not unpin the subtree the reusing occurrences realized, which is the churn
`unchanged_shadow_ownership_handover_keeps_reused_subtree` guards.

Related to #13685 — the `recorded_children_match` early return, which is
the arrival-order dependence that issue describes, is untouched.

---------

Co-authored-by: Zoltan Kochan <[email protected]>
…13797)

A parent-scoped override (parent>child) bailed to the resolver in both
stacks unless it was a removal. Measured what a full resolution does
with one: only the named parent's edge moves, the other dependents keep
the version they had, and the version left behind is pruned when
nothing reaches it any more.

That is expressible. The plan already inserts the new version alongside
the old and leaves reachability to the shared prune, so the old key
survives on its own whenever another dependent still points at it. What
was missing is that the repoint ignored the selector's parent and moved
every edge; it now consults the same predicate parent-scoped removals
already use, extracted so both share it. Importer edges keep the exit
removals take there, since a parent selector never names an importer.

Closes #13795.
@pull pull Bot locked and limited conversation to collaborators Aug 11, 2026
@pull pull Bot added the ⤵️ pull label Aug 11, 2026
@pull
pull Bot merged commit ac97bc1 into dwongdev:main Aug 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants