Skip to content

refactor(package-manager): bring the fresh install's submodules under the bindings cap - #14748

Merged
zkochan merged 4 commits into
mainfrom
perfectionist-fresh-submodules
Sep 9, 2026
Merged

zkochan merged 4 commits into
mainfrom
perfectionist-fresh-submodules

Conversation

@zkochan

@zkochan zkochan commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Rebased onto main after #14746 merged; the four commits are this PR. Fourth installment of adopting perfectionist::too_many_local_bindings at max_bindings = 12. Related to #14562.

Brings the fresh install's submodules under the cap — resolver_setup.rs (build_resolver_chain, 44 names), resolve.rs (run_resolve_pass 38, lockfile_reuse_seed 25) and manifest_transforms.rs (build_manifest_transforms, 25) — so install_with_fresh_lockfile/ has no site left:

  • The resolve pass's inputs are two halves, named by who reads them. WorkspaceWalk is what resolve_workspace consumes whole (the hooks it takes ownership of, the reuse policy, the registries); ImporterInputs is what every importer's resolve reads alongside. Each builds its own options (WorkspaceWalk::into_options, ImporterInputs::resolve_importer_options), where one struct was taken apart into twenty-seven names and rebuilt into two.
  • The reuse seed reads its inputs in place and builds its two RewriteContexts from one method instead of two identical literals.
  • ImporterTransforms owns what it applies (the extenders, the overrider, the ignored-optionals matcher), drops an empty overrider at construction where two sinks each filtered it, applies itself to every importer, and turns into the three read-package hooks the resolver runs, carried as one ManifestHooks value.
  • Each resolver of the chain is built from the chain inputs by a method of its own, sharing one retry-options and packument-caches source; chain() is the order, prefetch_context() the wrapper's inputs, and loading the pnpmfile with its custom resolvers and fetchers is a step of its own (load_pnpmfile).

No user-visible behavior changes; no changeset. Nothing is cloned or allocated that was not before: the split inputs are the same borrows and moves, the hooks clone the same Arcs, and the chain's Vec is sized for its ten built-in resolvers (it was sized for nine).

Squash Commit Body

Bring the fresh install's submodules under the twelve-name cap.

Split the resolve pass's inputs into the WorkspaceWalk the walk
consumes whole and the ImporterInputs every importer reads, each
building its own options. Read the reuse seed's inputs in place and
build its rewrite contexts from one method. Let ImporterTransforms own
the extenders, the overrider and the matcher it applies, drop an empty
overrider at construction, and produce the read-package hooks as one
ManifestHooks value. Build each resolver of the chain from the chain
inputs by a method of its own, and load the pnpmfile with its custom
resolvers and fetchers as a step of its own.

Related to pnpm/pnpm#14562.

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • Added or updated tests.

Written by an agent (Claude Code, claude-fable-5-1).

🤖 Generated with Claude Code

https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 669f1ce5-b069-4eac-bf3a-b96fcdc84dde

📥 Commits

Reviewing files that changed from the base of the PR and between da5a760 and 2f89b50.

📒 Files selected for processing (3)
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs
💤 Files with no reviewable changes (1)
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The fresh-lockfile installer now groups manifest hooks and resolve-pass inputs into dedicated structures. It centralizes rewrite-context and resolver-option construction. Dependency groups are passed by reference, and resolver lifetime declarations are adjusted.

Changes

Fresh-lockfile resolution refactor

Layer / File(s) Summary
Manifest transform ownership and hooks
pnpm/crates/package-manager/src/install_with_fresh_lockfile/manifest_transforms.rs
ImporterTransforms now owns transformation state, applies transformations to importers, and builds a bundled ManifestHooks value.
Resolve-pass input grouping
pnpm/crates/package-manager/src/install/materialize.rs, pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs
Resolve-pass options are grouped into WorkspaceWalk and ImporterInputs. Rewrite-context construction and catalog override detection use dedicated helpers. Dependency groups are passed by reference.
Resolver lifetime adjustments
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs
Resolver chain inputs use elided lifetimes, and prefetch_context declares an explicit method lifetime. An ordering comment is removed.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 2f89b

The fresh-install resolution path is reorganized while retaining its existing behavior; no concrete merge-blocking correctness, security, or runtime risk remains identified.

Suggested labels: product: pacquet

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perfectionist-fresh-submodules

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Refactor fresh installs into binding-capped phases

✨ Enhancement 🕐 40+ Minutes

Grey Divider

AI Description

• Splits fresh installation into typed resolver, resolution, lockfile, and materialization phases.
• Encapsulates manifest transforms, resolver construction, and per-importer options to enforce
 binding limits.
• Preserves installation behavior while replacing generic dependency groups with borrowed slices.
Diagram

graph TD
  A["Fresh install"] --> B["Resolver setup"] --> C["Manifest prep"] --> D["Workspace resolve"] --> E["Lockfile build"] --> F["Materialization plan"] --> G["On-disk phases"] --> H["Lockfile persist"]
Loading
High-Level Assessment

The phased, ownership-aware approach is appropriate for reducing local bindings without changing behavior. Smaller helper functions alone would still require broad argument threading, while unstructured context objects would obscure ownership; the introduced domain-specific inputs, outputs, and phase methods provide clearer boundaries.

Files changed (5) +2018 / -1584

Refactor (5) +2018 / -1584
materialize.rsBorrow dependency groups for fresh installation +1/-1

Borrow dependency groups for fresh installation

• Passes the existing dependency-group vector as a slice to match the simplified 'InstallWithFreshLockfile' API and avoid recollecting it.

pnpm/crates/package-manager/src/install/materialize.rs

install_with_fresh_lockfile.rsConvert the fresh-install driver into a phased pipeline +1461/-1117

Convert the fresh-install driver into a phased pipeline

• Splits borrowed and consumed inputs, then reorganizes resolver setup, graph resolution, lockfile construction, materialization planning, on-disk work, and persistence into typed phases. Adds focused context and result structures for hooks, patches, reuse scopes, lockfile views, materialization scope, and disk operations while preserving existing sequencing and behavior.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs

manifest_transforms.rsEncapsulate importer transforms and resolver hooks +127/-88

Encapsulate importer transforms and resolver hooks

• Makes 'ImporterTransforms' own its extenders, active overrider, and optional-dependency matcher, with methods for parallel importer transformation and hook construction. Groups the three resolver-facing hooks into 'ManifestHooks' and discards empty overriders during construction.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/manifest_transforms.rs

resolve.rsSeparate workspace and per-importer resolution inputs +180/-179

Separate workspace and per-importer resolution inputs

• Splits resolve-pass state into 'WorkspaceWalk' and 'ImporterInputs', each responsible for constructing its resolver options. Reuses a single rewrite-context builder for lockfile seed rewrites and reads seed inputs in place to reduce local bindings.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs

resolver_setup.rsBuild resolver-chain components through focused methods +249/-199

Build resolver-chain components through focused methods

• Moves individual resolver construction, shared packument caches, retry options, chain ordering, prefetch context, and pnpmfile loading behind dedicated methods and structures. Preserves custom resolver and fetcher behavior while explicitly sizing the chain for all ten built-in resolvers.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs

@qodo-code-review

qodo-code-review Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Fresh installs fail to compile ✓ Resolved 🐞 Bug ☼ Reliability ⭐ New
Description
ResolverChainInputs::prefetch_context requires custom_fetcher_session to live for the input
lifetime 'a, even though build_resolver_chain passes a reference into the shorter-lived local
pnpmfile value. Every fresh-install resolver-chain construction reaches this call, where Rust
rejects the local borrow despite PrefetchingResolver::new immediately cloning the session and only
needing a method-local lifetime.
Code

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[R420-423]

+    fn prefetch_context(
+        &self,
+        custom_fetcher_session: Option<&'a Arc<pnpm_deps_restorer::CustomFetcherSession>>,
+    ) -> PrefetchContext<'a> {
Relevance

●●● Strong

Concrete Rust lifetime mismatch prevents fresh-install compilation; shortening the method borrow is
a deterministic fix.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
build_resolver_chain creates pnpmfile locally and borrows its custom-fetcher session for
prefetch_context, while the added method signature requires that reference to last for the 'a
lifetime carried by ResolverChainInputs. PrefetchingResolver::new immediately consumes the
context and clones the session and other borrowed fields into owned storage, demonstrating that the
context can use an independent, shorter method-local lifetime.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[146-177]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[208-240]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[420-448]
pnpm/crates/package-manager/src/prefetching_resolver.rs[153-191]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[208-224]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[420-435]
pnpm/crates/package-manager/src/prefetching_resolver.rs[143-188]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`prefetch_context` ties `custom_fetcher_session` to `ResolverChainInputs`'s `'a` lifetime, but `build_resolver_chain` passes a reference to `PnpmfileLoad::custom_fetcher_session`, which is owned by the local `pnpmfile` variable and does not live for `'a`. This creates an invalid borrow even though `PrefetchingResolver::new` immediately clones the session and other borrowed context values.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[420-436]

## Recommended Fix
Give `prefetch_context` an independent, shorter lifetime tied to both `&self` and `custom_fetcher_session`, and return `PrefetchContext` with that method-local lifetime. The references stored in `ResolverChainInputs` can be shortened to this lifetime, allowing the reference into local `pnpmfile` to remain valid through the immediate `PrefetchingResolver::new` call, which clones the borrowed values into owned storage. Alternatively, construct `PrefetchContext` inline as before.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. A phase comment narrates its steps ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
prepare_resolution is preceded by a comment that enumerates the transforms, lockfile, patches,
hooks, reuse scopes, and pre-resolution-hook call performed directly in its body. The text adds no
invariant or rationale, so routine changes to the phase sequence require maintaining a second
implementation outline.
Code

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[R1587-1589]

+/// Settle everything the resolve pass reads: the manifest transforms,
+/// the lockfile to resolve against, the patches, the pnpmfile hooks and
+/// the update reuse scopes. Runs the pnpmfile's pre-resolution hook.
Relevance

●●● Strong

Recent same-rule precedent accepted removing redundant implementation-narrating rustdoc comments.

PR-#14593
PR-#14201

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 rejects comments that mirror control flow or directly inferable operations.
The added documentation lists the same preparation steps implemented immediately below it without
explaining why the ordering or grouping is required.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1587-1595]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The documentation above `prepare_resolution` restates the operations performed by the function instead of documenting rationale, constraints, or a contract.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[1587-1589]

## Recommended Fix
Remove the implementation outline, or replace it with a concise comment describing a non-obvious invariant or ownership guarantee that callers need to understand.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Two helper comments repeat their names ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
overrides_use_catalogs is documented as checking for catalog references, while chain is
documented as returning resolvers in chain order. Both comments merely paraphrase their helper names
and immediately visible expressions, so they add no rationale and can become stale when either
implementation changes.
Code

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs[R375-376]

+/// Whether any override's configured value is a `catalog:` reference.
+fn overrides_use_catalogs(config: &Config) -> bool {
Relevance

●●● Strong

Recent precedent accepted removing redundant helper comments under the same repository rule.

PR-#14593

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 rejects comments that merely restate an identifier or simple operation. The
cited comments paraphrase overrides_use_catalogs and chain without adding intent, constraints,
or rationale.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs[375-376]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[378-378]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Two newly added helper comments only restate their helper names and directly visible behavior without documenting rationale, constraints, or non-obvious semantics.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs[375-376]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[378-378]

## Recommended Fix
Remove these comments, or replace them only if there is a non-obvious invariant or ordering reason that callers and future maintainers need to preserve.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. One method comment repeats its purpose ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
included is preceded by Which dependency groups this install includes, which merely paraphrases
the method name and its direct field checks. Renaming or inlining this helper would make the comment
obsolete without losing any rationale, invariant, or edge-case information.
Code

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[718]

+    /// Which dependency groups this install includes.
Relevance

●●● Strong

Recent repository precedents accept removing redundant Rustdoc comments that merely narrate obvious
helper behavior.

PR-#14593
PR-#14201
PR-#14534

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 prohibits comments that only repeat a method name or directly inferable
operation. The added comment at line 718 paraphrases included without adding context beyond the
method and its simple dependency-group checks.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[718-724]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Rustdoc above `included` only restates the method's purpose and provides no rationale, invariant, constraint, or edge-case information.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[718-718]

## Recommended Fix
Remove the redundant Rustdoc comment, or replace it only if there is a non-obvious contract or rationale that callers need to know.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 37 rules
✅ Cross-repo context — repo relationships
Review mode: ⚖️ Balanced: Downgraded extended -> standard: change is below the extended eligibility bar (hunks 15/18, lines 1094/200; both must reach the floor). Router rationale: This is a broad, behavior-sensitive refactor across resolver construction, manifest hooks, lockfile reuse, and workspace resolution, with many independent logic paths and prior compile issues making redundant review materially valuable.

Grey Divider

Tip of the day
💡 Did you know, you can commit Qodo's fix in one click with committable suggestions (GitHub & GitLab)

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 7b97a73

Results up to commit c20c1f0 🧠 Deep


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. One method comment repeats its purpose ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
included is preceded by Which dependency groups this install includes, which merely paraphrases
the method name and its direct field checks. Renaming or inlining this helper would make the comment
obsolete without losing any rationale, invariant, or edge-case information.
Code

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[718]

+    /// Which dependency groups this install includes.
Relevance

●●● Strong

Recent repository precedents accept removing redundant Rustdoc comments that merely narrate obvious
helper behavior.

PR-#14593
PR-#14201
PR-#14534

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 prohibits comments that only repeat a method name or directly inferable
operation. The added comment at line 718 paraphrases included without adding context beyond the
method and its simple dependency-group checks.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[718-724]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Rustdoc above `included` only restates the method's purpose and provides no rationale, invariant, constraint, or edge-case information.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs[718-718]

## Recommended Fix
Remove the redundant Rustdoc comment, or replace it only if there is a non-obvious contract or rationale that callers need to know.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit 0f38f85 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. Two helper comments repeat their names ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
overrides_use_catalogs is documented as checking for catalog references, while chain is
documented as returning resolvers in chain order. Both comments merely paraphrase their helper names
and immediately visible expressions, so they add no rationale and can become stale when either
implementation changes.
Code

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs[R375-376]

+/// Whether any override's configured value is a `catalog:` reference.
+fn overrides_use_catalogs(config: &Config) -> bool {
Relevance

●●● Strong

Recent precedent accepted removing redundant helper comments under the same repository rule.

PR-#14593

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 713467 rejects comments that merely restate an identifier or simple operation. The
cited comments paraphrase overrides_use_catalogs and chain without adding intent, constraints,
or rationale.

Rule 713467: Avoid redundant comments that restate the code
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs[375-376]
pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[378-378]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Two newly added helper comments only restate their helper names and directly visible behavior without documenting rationale, constraints, or non-obvious semantics.

## Fix Focus Areas
- pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolve.rs[375-376]
- pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs[378-378]

## Recommended Fix
Remove these comments, or replace them only if there is a non-obvious invariant or ordering reason that callers and future maintainers need to preserve.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@zkochan
zkochan force-pushed the perfectionist-fresh-submodules branch from c20c1f0 to 0f38f85 Compare September 9, 2026 19:37
@qodo-code-review

qodo-code-review Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 510a76e

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve unchanged workspace manifests

Merge the transformed manifests with the original declared ones instead of
completely replacing them. This prevents dropping unchanged workspace importers
during resolution.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs [1242-1248]

 if self.effective.is_empty() {
     std::borrow::Cow::Borrowed(&self.declared)
 } else {
-    std::borrow::Cow::Owned(
-        self.effective.iter().map(|(id, manifest)| (id.clone(), manifest)).collect(),
-    )
+    let mut manifests = self.declared.clone();
+    manifests.extend(
+        self.effective.iter().map(|(id, manifest)| (id.clone(), manifest)),
+    );
+    std::borrow::Cow::Owned(manifests)
 }

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 10

__

Why: The suggestion identifies a critical logic bug introduced in the refactoring where unchanged manifests would be dropped, effectively restoring the necessary merge behavior of the old effective_manifests function.

High
  • Update

Previous suggestions

Suggestions up to commit 2f89b50
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve unchanged importer manifests

Merge unchanged manifests with effective ones when generating the view.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs [1242-1248]

 if self.effective.is_empty() {
     std::borrow::Cow::Borrowed(&self.declared)
 } else {
     std::borrow::Cow::Owned(
-        self.effective.iter().map(|(id, manifest)| (id.clone(), manifest)).collect(),
+        self.declared
+            .iter()
+            .map(|(id, declared)| {
+                (
+                    id.clone(),
+                    self.effective.get(id).map_or(*declared, |manifest| manifest),
+                )
+            })
+            .collect(),
     )
 }
Suggestion importance[1-10]: 10

__

Why: This catches a critical logic error introduced during the refactor where unaltered manifests would be incorrectly dropped if any other manifest was mutated, breaking workspace resolution.

High
✅ Suggestions up to commit da5a760
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve untransformed workspace importers

Include unmodified manifests in the ManifestsView instead of dropping them when
self.effective is not empty.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs [1241-1247]

 if self.effective.is_empty() {
     std::borrow::Cow::Borrowed(&self.declared)
 } else {
     std::borrow::Cow::Owned(
-        self.effective.iter().map(|(id, manifest)| (id.clone(), manifest)).collect(),
+        self.declared
+            .iter()
+            .map(|(id, declared)| {
+                (id.clone(), self.effective.get(id).unwrap_or(*declared))
+            })
+            .collect(),
     )
 }
Suggestion importance[1-10]: 10

__

Why: The suggestion catches a critical bug introduced by the refactoring where unmodified manifests are dropped if any manifest is transformed, successfully restoring the behavior of the removed effective_manifests function.

High
✅ Shorten the prefetch context lifetime
Suggestion Impact:The commit removed the lifetime-constrained prefetch_context method and constructed PrefetchContext inline, allowing custom_fetcher_session.as_ref() to use its local lifetime and resolving the same borrow-checking issue through a broader refactor.

code diff:

-    fn prefetch_context(
-        &self,
-        custom_fetcher_session: Option<&'a Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-    ) -> PrefetchContext<'a> {
-        PrefetchContext {
-            http_client: self.http_client_arc,
-            mem_cache: self.tarball_mem_cache,
-            store_index: self.store_index,
-            store_index_writer: Some(self.store_index_writer),
-            verified_files_cache: self.verified_files_cache,
-            config: self.config,
-            requester: self.requester,
-            supported_architectures: self.supported_architectures,
-            progress_reported: self.progress_reported,
-            prefetch_downloads: self.prefetch_downloads && custom_fetcher_session.is_none(),
-            custom_fetcher_session,
-        }
-    }
-}
-
-/// The pnpmfile the resolve runs, with its custom resolvers and fetchers.
-struct PnpmfileLoad {
-    hook: Option<Arc<dyn pnpm_hooks::PnpmfileHooks>>,
-    custom_resolvers: Vec<Arc<dyn pnpm_hooks::CustomResolver>>,
-    // Loaded alongside the custom resolvers (same worker, same fatality
-    // rule) and consumed by `CreateVirtualStore` — a custom resolver
-    // typically writes the custom-typed resolutions its sibling fetcher
-    // materializes.
-    custom_fetcher_session: Option<Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-}
-
-/// The override when an embedder supplied one, else the on-disk pnpmfiles
-/// unless `ignorePnpmfile` is set. A hook that fails to hand over its
-/// custom resolvers or fetchers fails the install.
-async fn load_pnpmfile(
-    config: &Config,
-    lockfile_dir: &Path,
-    hook_override: Option<Arc<dyn pnpm_hooks::PnpmfileHooks>>,
-) -> Result<PnpmfileLoad, InstallWithFreshLockfileError> {
-    let hook = match hook_override {
+    let tarball_resolver = TarballResolver {
+        http_client: Arc::clone(http_client_arc),
+        fetch_context: Some(TarballFetchContext {
+            store_dir,
+            store_index_writer: Some(Arc::clone(store_index_writer)),
+            mem_cache: Some(Arc::clone(tarball_mem_cache)),
+            auth_headers: Arc::clone(auth_headers),
+            retry_opts: crate::retry_config::retry_opts_from_config(config),
+            store_index: store_index.cloned(),
+            verify_store_integrity: config.verify_store_integrity,
+            verified_files_cache: Arc::clone(verified_files_cache),
+            prior_tarball_entries: Arc::new(prior_tarball_entries(wanted_lockfile)),
+        }),
+    };
+    // `preserveAbsolutePaths` is wired through `Config`; thread the
+    // current value into the local-resolver context so absolute `file:` /
+    // `link:` specs round-trip the right shape under the
+    // `--config.preserve-absolute-paths` setting. Pacquet doesn't expose
+    // `preserveAbsolutePaths` yet, so the context defaults to `false`.
+    let local_ctx = LocalResolverContext { preserve_absolute_paths: false };
+    let local_scheme_resolver = LocalSchemeResolver::new(local_ctx);
+    let local_path_resolver = LocalPathResolver::new(local_ctx);
+    let mut node_resolver =
+        NodeResolver::new_with_auth(Arc::clone(http_client_arc), Arc::clone(auth_headers));
+    node_resolver.node_download_mirrors.clone_from(&config.node_download_mirrors);
+    node_resolver.offline = config.offline;
+    node_resolver.cache_dir = Some(config.cache_dir.clone());
+    let deno_resolver = DenoResolver::new(Arc::clone(http_client_arc), Arc::clone(&npm_resolver));
+    let bun_resolver = BunResolver::new(Arc::clone(http_client_arc), Arc::clone(&npm_resolver));
+    let yarn_resolver =
+        YarnResolver::new(Arc::clone(http_client_arc), config.tls.strict_ssl.unwrap_or(true));
+    let named_registry_resolver = NamedRegistryResolver {
+        registries_by_prefix: registries_by_prefix.clone(),
+        registry_names: registries_by_prefix.keys().cloned().collect(),
+        http_client: Arc::clone(http_client_arc),
+        auth_headers: Arc::clone(auth_headers),
+        meta_cache: Arc::clone(meta_cache),
+        fetch_locker: Arc::clone(&fetch_locker),
+        picked_manifest_cache: Arc::clone(&picked_manifest_cache),
+        cache_dir: Some(config.cache_dir.clone()),
+        offline: config.offline,
+        prefer_offline: config.prefer_offline,
+        ignore_missing_time_field: config.minimum_release_age_ignore_missing_time,
+        // Same rationale as `NpmResolver.full_metadata` above.
+        full_metadata,
+        needs_full_metadata_for: Some(Arc::clone(&needs_full_metadata_for)),
+        filter_metadata: config.requires_filtered_full_metadata(),
+        retry_opts: crate::retry_config::retry_opts_from_config(config),
+    };
+
+    let pnpmfile_hook = match pnpmfile_hook_override {
         Some(hook) => Some(hook),
         None if config.ignore_pnpmfile => None,
         None => pnpm_hooks::finder::load_pnpmfiles(lockfile_dir, crate::pnpmfile_selection(config))
             .map_err(InstallWithFreshLockfileError::MissingPnpmfile)?,
     };
-    let Some(hook) = hook else {
-        return Ok(PnpmfileLoad {
-            hook: None,
-            custom_resolvers: vec![],
-            custom_fetcher_session: None,
-        });
+    let custom_resolvers: Vec<Arc<dyn pnpm_hooks::CustomResolver>> =
+        if let Some(ref hook) = pnpmfile_hook {
+            hook.get_custom_resolvers().await.map_err(|err| {
+                tracing::error!(
+                    target: "pacquet::install",
+                    "Failed to get custom resolvers from pnpmfile: {err}",
+                );
+                InstallWithFreshLockfileError::CustomResolverHook(err)
+            })?
+        } else {
+            vec![]
+        };
+    // Loaded alongside the custom resolvers (same worker, same fatality
+    // rule) and consumed by `CreateVirtualStore` — a custom resolver
+    // typically writes the custom-typed resolutions its sibling fetcher
+    // materializes.
+    let custom_fetcher_session = if let Some(ref hook) = pnpmfile_hook {
+        let fetchers = hook.get_custom_fetchers().await.map_err(|err| {
+            tracing::error!(
+                target: "pacquet::install",
+                "Failed to get custom fetchers from pnpmfile: {err}",
+            );
+            InstallWithFreshLockfileError::CustomFetcherHook(err)
+        })?;
+        (!fetchers.is_empty())
+            .then(|| Arc::new(pnpm_deps_restorer::CustomFetcherSession::new(fetchers)))
+    } else {
+        None
     };
-    let custom_resolvers = hook.get_custom_resolvers().await.map_err(|err| {
-        tracing::error!(
-            target: "pacquet::install",
-            "Failed to get custom resolvers from pnpmfile: {err}",
-        );
-        InstallWithFreshLockfileError::CustomResolverHook(err)
-    })?;
-    let fetchers = hook.get_custom_fetchers().await.map_err(|err| {
-        tracing::error!(
-            target: "pacquet::install",
-            "Failed to get custom fetchers from pnpmfile: {err}",
-        );
-        InstallWithFreshLockfileError::CustomFetcherHook(err)
-    })?;
-    Ok(PnpmfileLoad {
-        hook: Some(hook),
+
+    let mut chain: Vec<Box<dyn Resolver>> = Vec::with_capacity(custom_resolvers.len() + 9);
+    chain.extend(
+        custom_resolvers
+            .iter()
+            .filter(|custom| custom.has_can_resolve() && custom.has_resolve())
+            .map(|custom| {
+                Box::new(pnpm_hooks::custom_resolver_adapter::CustomResolverAdapter::new(
+                    Arc::clone(custom),
+                )) as Box<dyn Resolver>
+            }),
+    );
+    chain.extend([
+        Box::new(Arc::clone(&npm_resolver)) as Box<dyn Resolver>,
+        Box::new(git_resolver),
+        Box::new(tarball_resolver),
+        Box::new(local_scheme_resolver),
+        Box::new(node_resolver),
+        Box::new(deno_resolver),
+        Box::new(bun_resolver),
+        Box::new(yarn_resolver),
+        Box::new(named_registry_resolver),
+        Box::new(local_path_resolver),
+    ]);
+
+    // The install pass later calls `IngestTarballToStore::run_with_mem_cache`
+    // for the same URLs and either picks up `CacheValue::Available`
+    // immediately or briefly blocks on the per-URL `Notify`. See
+    // `prefetching_resolver.rs` for the full design rationale.
+    let resolver: Box<dyn Resolver> = Box::new(PrefetchingResolver::<Reporter>::new(
+        Box::new(DefaultResolver::new(chain)),
+        PrefetchContext {
+            http_client: http_client_arc,
+            mem_cache: tarball_mem_cache,
+            store_index,
+            store_index_writer: Some(store_index_writer),
+            verified_files_cache,
+            config,
+            requester,
+            supported_architectures,
+            progress_reported,
+            prefetch_downloads: prefetch_downloads && custom_fetcher_session.is_none(),
+            custom_fetcher_session: custom_fetcher_session.as_ref(),
+        },
+    ));

Use a method-local lifetime instead of the struct's lifetime 'a for the
custom_fetcher_session reference. This prevents borrow-checking failures when
passing locally loaded values.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs [420-423]

-fn prefetch_context(
-    &self,
-    custom_fetcher_session: Option<&'a Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-) -> PrefetchContext<'a> {
+fn prefetch_context<'context>(
+    &'context self,
+    custom_fetcher_session: Option<
+        &'context Arc<pnpm_deps_restorer::CustomFetcherSession>,
+    >,
+) -> PrefetchContext<'context> {
Suggestion importance[1-10]: 9

__

Why: This suggestion fixes a compilation error by appropriately decoupling the method's local reference custom_fetcher_session from the struct's wider lifetime 'a.

High
Suggestions up to commit 0f38f85
CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve unchanged workspace manifests

Merge transformed manifests with the declared ones instead of completely
replacing the view. This ensures unchanged workspace importers are not lost if
only some manifests are rewritten by hooks.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs [1242-1248]

 if self.effective.is_empty() {
     std::borrow::Cow::Borrowed(&self.declared)
 } else {
-    std::borrow::Cow::Owned(
-        self.effective.iter().map(|(id, manifest)| (id.clone(), manifest)).collect(),
-    )
+    let mut manifests: BTreeMap<String, &PackageManifest> = self
+        .declared
+        .iter()
+        .map(|(id, manifest)| (id.clone(), *manifest))
+        .collect();
+    manifests.extend(
+        self.effective
+            .iter()
+            .map(|(id, manifest)| (id.clone(), manifest)),
+    );
+    std::borrow::Cow::Owned(manifests)
 }
Suggestion importance[1-10]: 9

__

Why: The PR removes effective_manifests, which likely merged transformed manifests with the declared ones, and replacing it with self.effective could drop unchanged workspace projects if only a subset was rewritten.

High
✅ Shorten the prefetch context lifetime
Suggestion Impact:The commit removed the lifetime-constrained prefetch_context method and constructed PrefetchContext inline, allowing custom_fetcher_session.as_ref() to use its local lifetime and resolving the same borrow-checking issue through a broader refactor.

code diff:

-    fn prefetch_context(
-        &self,
-        custom_fetcher_session: Option<&'a Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-    ) -> PrefetchContext<'a> {
-        PrefetchContext {
-            http_client: self.http_client_arc,
-            mem_cache: self.tarball_mem_cache,
-            store_index: self.store_index,
-            store_index_writer: Some(self.store_index_writer),
-            verified_files_cache: self.verified_files_cache,
-            config: self.config,
-            requester: self.requester,
-            supported_architectures: self.supported_architectures,
-            progress_reported: self.progress_reported,
-            prefetch_downloads: self.prefetch_downloads && custom_fetcher_session.is_none(),
-            custom_fetcher_session,
-        }
-    }
-}
-
-/// The pnpmfile the resolve runs, with its custom resolvers and fetchers.
-struct PnpmfileLoad {
-    hook: Option<Arc<dyn pnpm_hooks::PnpmfileHooks>>,
-    custom_resolvers: Vec<Arc<dyn pnpm_hooks::CustomResolver>>,
-    // Loaded alongside the custom resolvers (same worker, same fatality
-    // rule) and consumed by `CreateVirtualStore` — a custom resolver
-    // typically writes the custom-typed resolutions its sibling fetcher
-    // materializes.
-    custom_fetcher_session: Option<Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-}
-
-/// The override when an embedder supplied one, else the on-disk pnpmfiles
-/// unless `ignorePnpmfile` is set. A hook that fails to hand over its
-/// custom resolvers or fetchers fails the install.
-async fn load_pnpmfile(
-    config: &Config,
-    lockfile_dir: &Path,
-    hook_override: Option<Arc<dyn pnpm_hooks::PnpmfileHooks>>,
-) -> Result<PnpmfileLoad, InstallWithFreshLockfileError> {
-    let hook = match hook_override {
+    let tarball_resolver = TarballResolver {
+        http_client: Arc::clone(http_client_arc),
+        fetch_context: Some(TarballFetchContext {
+            store_dir,
+            store_index_writer: Some(Arc::clone(store_index_writer)),
+            mem_cache: Some(Arc::clone(tarball_mem_cache)),
+            auth_headers: Arc::clone(auth_headers),
+            retry_opts: crate::retry_config::retry_opts_from_config(config),
+            store_index: store_index.cloned(),
+            verify_store_integrity: config.verify_store_integrity,
+            verified_files_cache: Arc::clone(verified_files_cache),
+            prior_tarball_entries: Arc::new(prior_tarball_entries(wanted_lockfile)),
+        }),
+    };
+    // `preserveAbsolutePaths` is wired through `Config`; thread the
+    // current value into the local-resolver context so absolute `file:` /
+    // `link:` specs round-trip the right shape under the
+    // `--config.preserve-absolute-paths` setting. Pacquet doesn't expose
+    // `preserveAbsolutePaths` yet, so the context defaults to `false`.
+    let local_ctx = LocalResolverContext { preserve_absolute_paths: false };
+    let local_scheme_resolver = LocalSchemeResolver::new(local_ctx);
+    let local_path_resolver = LocalPathResolver::new(local_ctx);
+    let mut node_resolver =
+        NodeResolver::new_with_auth(Arc::clone(http_client_arc), Arc::clone(auth_headers));
+    node_resolver.node_download_mirrors.clone_from(&config.node_download_mirrors);
+    node_resolver.offline = config.offline;
+    node_resolver.cache_dir = Some(config.cache_dir.clone());
+    let deno_resolver = DenoResolver::new(Arc::clone(http_client_arc), Arc::clone(&npm_resolver));
+    let bun_resolver = BunResolver::new(Arc::clone(http_client_arc), Arc::clone(&npm_resolver));
+    let yarn_resolver =
+        YarnResolver::new(Arc::clone(http_client_arc), config.tls.strict_ssl.unwrap_or(true));
+    let named_registry_resolver = NamedRegistryResolver {
+        registries_by_prefix: registries_by_prefix.clone(),
+        registry_names: registries_by_prefix.keys().cloned().collect(),
+        http_client: Arc::clone(http_client_arc),
+        auth_headers: Arc::clone(auth_headers),
+        meta_cache: Arc::clone(meta_cache),
+        fetch_locker: Arc::clone(&fetch_locker),
+        picked_manifest_cache: Arc::clone(&picked_manifest_cache),
+        cache_dir: Some(config.cache_dir.clone()),
+        offline: config.offline,
+        prefer_offline: config.prefer_offline,
+        ignore_missing_time_field: config.minimum_release_age_ignore_missing_time,
+        // Same rationale as `NpmResolver.full_metadata` above.
+        full_metadata,
+        needs_full_metadata_for: Some(Arc::clone(&needs_full_metadata_for)),
+        filter_metadata: config.requires_filtered_full_metadata(),
+        retry_opts: crate::retry_config::retry_opts_from_config(config),
+    };
+
+    let pnpmfile_hook = match pnpmfile_hook_override {
         Some(hook) => Some(hook),
         None if config.ignore_pnpmfile => None,
         None => pnpm_hooks::finder::load_pnpmfiles(lockfile_dir, crate::pnpmfile_selection(config))
             .map_err(InstallWithFreshLockfileError::MissingPnpmfile)?,
     };
-    let Some(hook) = hook else {
-        return Ok(PnpmfileLoad {
-            hook: None,
-            custom_resolvers: vec![],
-            custom_fetcher_session: None,
-        });
+    let custom_resolvers: Vec<Arc<dyn pnpm_hooks::CustomResolver>> =
+        if let Some(ref hook) = pnpmfile_hook {
+            hook.get_custom_resolvers().await.map_err(|err| {
+                tracing::error!(
+                    target: "pacquet::install",
+                    "Failed to get custom resolvers from pnpmfile: {err}",
+                );
+                InstallWithFreshLockfileError::CustomResolverHook(err)
+            })?
+        } else {
+            vec![]
+        };
+    // Loaded alongside the custom resolvers (same worker, same fatality
+    // rule) and consumed by `CreateVirtualStore` — a custom resolver
+    // typically writes the custom-typed resolutions its sibling fetcher
+    // materializes.
+    let custom_fetcher_session = if let Some(ref hook) = pnpmfile_hook {
+        let fetchers = hook.get_custom_fetchers().await.map_err(|err| {
+            tracing::error!(
+                target: "pacquet::install",
+                "Failed to get custom fetchers from pnpmfile: {err}",
+            );
+            InstallWithFreshLockfileError::CustomFetcherHook(err)
+        })?;
+        (!fetchers.is_empty())
+            .then(|| Arc::new(pnpm_deps_restorer::CustomFetcherSession::new(fetchers)))
+    } else {
+        None
     };
-    let custom_resolvers = hook.get_custom_resolvers().await.map_err(|err| {
-        tracing::error!(
-            target: "pacquet::install",
-            "Failed to get custom resolvers from pnpmfile: {err}",
-        );
-        InstallWithFreshLockfileError::CustomResolverHook(err)
-    })?;
-    let fetchers = hook.get_custom_fetchers().await.map_err(|err| {
-        tracing::error!(
-            target: "pacquet::install",
-            "Failed to get custom fetchers from pnpmfile: {err}",
-        );
-        InstallWithFreshLockfileError::CustomFetcherHook(err)
-    })?;
-    Ok(PnpmfileLoad {
-        hook: Some(hook),
+
+    let mut chain: Vec<Box<dyn Resolver>> = Vec::with_capacity(custom_resolvers.len() + 9);
+    chain.extend(
+        custom_resolvers
+            .iter()
+            .filter(|custom| custom.has_can_resolve() && custom.has_resolve())
+            .map(|custom| {
+                Box::new(pnpm_hooks::custom_resolver_adapter::CustomResolverAdapter::new(
+                    Arc::clone(custom),
+                )) as Box<dyn Resolver>
+            }),
+    );
+    chain.extend([
+        Box::new(Arc::clone(&npm_resolver)) as Box<dyn Resolver>,
+        Box::new(git_resolver),
+        Box::new(tarball_resolver),
+        Box::new(local_scheme_resolver),
+        Box::new(node_resolver),
+        Box::new(deno_resolver),
+        Box::new(bun_resolver),
+        Box::new(yarn_resolver),
+        Box::new(named_registry_resolver),
+        Box::new(local_path_resolver),
+    ]);
+
+    // The install pass later calls `IngestTarballToStore::run_with_mem_cache`
+    // for the same URLs and either picks up `CacheValue::Available`
+    // immediately or briefly blocks on the per-URL `Notify`. See
+    // `prefetching_resolver.rs` for the full design rationale.
+    let resolver: Box<dyn Resolver> = Box::new(PrefetchingResolver::<Reporter>::new(
+        Box::new(DefaultResolver::new(chain)),
+        PrefetchContext {
+            http_client: http_client_arc,
+            mem_cache: tarball_mem_cache,
+            store_index,
+            store_index_writer: Some(store_index_writer),
+            verified_files_cache,
+            config,
+            requester,
+            supported_architectures,
+            progress_reported,
+            prefetch_downloads: prefetch_downloads && custom_fetcher_session.is_none(),
+            custom_fetcher_session: custom_fetcher_session.as_ref(),
+        },
+    ));

Introduce a shorter lifetime 'context in prefetch_context to safely borrow the
local custom_fetcher_session.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs [420-423]

-fn prefetch_context(
-    &self,
-    custom_fetcher_session: Option<&'a Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-) -> PrefetchContext<'a> {
+fn prefetch_context<'context>(
+    &'context self,
+    custom_fetcher_session: Option<
+        &'context Arc<pnpm_deps_restorer::CustomFetcherSession>,
+    >,
+) -> PrefetchContext<'context>
+where
+    'a: 'context,
+{
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly resolves a Rust compilation error caused by borrowing a local variable (pnpmfile.custom_fetcher_session) for the struct's longer 'a lifetime.

Medium
✅ Suggestions up to commit c20c1f0
CategorySuggestion                                                                                                                                    Impact
Possible issue
✅ Use a local generic lifetime to fix a borrow checker error
Suggestion Impact:The commit addressed the lifetime issue through a broader refactor: it removed the lifetime-coupled `prefetch_context` method and constructs `PrefetchContext` inline, where `custom_fetcher_session.as_ref()` is borrowed with the appropriate local lifetime.

code diff:

-    fn prefetch_context(
-        &self,
-        custom_fetcher_session: Option<&'a Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-    ) -> PrefetchContext<'a> {
-        PrefetchContext {
-            http_client: self.http_client_arc,
-            mem_cache: self.tarball_mem_cache,
-            store_index: self.store_index,
-            store_index_writer: Some(self.store_index_writer),
-            verified_files_cache: self.verified_files_cache,
-            config: self.config,
-            requester: self.requester,
-            supported_architectures: self.supported_architectures,
-            progress_reported: self.progress_reported,
-            prefetch_downloads: self.prefetch_downloads && custom_fetcher_session.is_none(),
-            custom_fetcher_session,
-        }
-    }
-}
-
-/// The pnpmfile the resolve runs, with its custom resolvers and fetchers.
-struct PnpmfileLoad {
-    hook: Option<Arc<dyn pnpm_hooks::PnpmfileHooks>>,
-    custom_resolvers: Vec<Arc<dyn pnpm_hooks::CustomResolver>>,
-    // Loaded alongside the custom resolvers (same worker, same fatality
-    // rule) and consumed by `CreateVirtualStore` — a custom resolver
-    // typically writes the custom-typed resolutions its sibling fetcher
-    // materializes.
-    custom_fetcher_session: Option<Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-}
-
-/// The override when an embedder supplied one, else the on-disk pnpmfiles
-/// unless `ignorePnpmfile` is set. A hook that fails to hand over its
-/// custom resolvers or fetchers fails the install.
-async fn load_pnpmfile(
-    config: &Config,
-    lockfile_dir: &Path,
-    hook_override: Option<Arc<dyn pnpm_hooks::PnpmfileHooks>>,
-) -> Result<PnpmfileLoad, InstallWithFreshLockfileError> {
-    let hook = match hook_override {
+    let tarball_resolver = TarballResolver {
+        http_client: Arc::clone(http_client_arc),
+        fetch_context: Some(TarballFetchContext {
+            store_dir,
+            store_index_writer: Some(Arc::clone(store_index_writer)),
+            mem_cache: Some(Arc::clone(tarball_mem_cache)),
+            auth_headers: Arc::clone(auth_headers),
+            retry_opts: crate::retry_config::retry_opts_from_config(config),
+            store_index: store_index.cloned(),
+            verify_store_integrity: config.verify_store_integrity,
+            verified_files_cache: Arc::clone(verified_files_cache),
+            prior_tarball_entries: Arc::new(prior_tarball_entries(wanted_lockfile)),
+        }),
+    };
+    // `preserveAbsolutePaths` is wired through `Config`; thread the
+    // current value into the local-resolver context so absolute `file:` /
+    // `link:` specs round-trip the right shape under the
+    // `--config.preserve-absolute-paths` setting. Pacquet doesn't expose
+    // `preserveAbsolutePaths` yet, so the context defaults to `false`.
+    let local_ctx = LocalResolverContext { preserve_absolute_paths: false };
+    let local_scheme_resolver = LocalSchemeResolver::new(local_ctx);
+    let local_path_resolver = LocalPathResolver::new(local_ctx);
+    let mut node_resolver =
+        NodeResolver::new_with_auth(Arc::clone(http_client_arc), Arc::clone(auth_headers));
+    node_resolver.node_download_mirrors.clone_from(&config.node_download_mirrors);
+    node_resolver.offline = config.offline;
+    node_resolver.cache_dir = Some(config.cache_dir.clone());
+    let deno_resolver = DenoResolver::new(Arc::clone(http_client_arc), Arc::clone(&npm_resolver));
+    let bun_resolver = BunResolver::new(Arc::clone(http_client_arc), Arc::clone(&npm_resolver));
+    let yarn_resolver =
+        YarnResolver::new(Arc::clone(http_client_arc), config.tls.strict_ssl.unwrap_or(true));
+    let named_registry_resolver = NamedRegistryResolver {
+        registries_by_prefix: registries_by_prefix.clone(),
+        registry_names: registries_by_prefix.keys().cloned().collect(),
+        http_client: Arc::clone(http_client_arc),
+        auth_headers: Arc::clone(auth_headers),
+        meta_cache: Arc::clone(meta_cache),
+        fetch_locker: Arc::clone(&fetch_locker),
+        picked_manifest_cache: Arc::clone(&picked_manifest_cache),
+        cache_dir: Some(config.cache_dir.clone()),
+        offline: config.offline,
+        prefer_offline: config.prefer_offline,
+        ignore_missing_time_field: config.minimum_release_age_ignore_missing_time,
+        // Same rationale as `NpmResolver.full_metadata` above.
+        full_metadata,
+        needs_full_metadata_for: Some(Arc::clone(&needs_full_metadata_for)),
+        filter_metadata: config.requires_filtered_full_metadata(),
+        retry_opts: crate::retry_config::retry_opts_from_config(config),
+    };
+
+    let pnpmfile_hook = match pnpmfile_hook_override {
         Some(hook) => Some(hook),
         None if config.ignore_pnpmfile => None,
         None => pnpm_hooks::finder::load_pnpmfiles(lockfile_dir, crate::pnpmfile_selection(config))
             .map_err(InstallWithFreshLockfileError::MissingPnpmfile)?,
     };
-    let Some(hook) = hook else {
-        return Ok(PnpmfileLoad {
-            hook: None,
-            custom_resolvers: vec![],
-            custom_fetcher_session: None,
-        });
+    let custom_resolvers: Vec<Arc<dyn pnpm_hooks::CustomResolver>> =
+        if let Some(ref hook) = pnpmfile_hook {
+            hook.get_custom_resolvers().await.map_err(|err| {
+                tracing::error!(
+                    target: "pacquet::install",
+                    "Failed to get custom resolvers from pnpmfile: {err}",
+                );
+                InstallWithFreshLockfileError::CustomResolverHook(err)
+            })?
+        } else {
+            vec![]
+        };
+    // Loaded alongside the custom resolvers (same worker, same fatality
+    // rule) and consumed by `CreateVirtualStore` — a custom resolver
+    // typically writes the custom-typed resolutions its sibling fetcher
+    // materializes.
+    let custom_fetcher_session = if let Some(ref hook) = pnpmfile_hook {
+        let fetchers = hook.get_custom_fetchers().await.map_err(|err| {
+            tracing::error!(
+                target: "pacquet::install",
+                "Failed to get custom fetchers from pnpmfile: {err}",
+            );
+            InstallWithFreshLockfileError::CustomFetcherHook(err)
+        })?;
+        (!fetchers.is_empty())
+            .then(|| Arc::new(pnpm_deps_restorer::CustomFetcherSession::new(fetchers)))
+    } else {
+        None
     };
-    let custom_resolvers = hook.get_custom_resolvers().await.map_err(|err| {
-        tracing::error!(
-            target: "pacquet::install",
-            "Failed to get custom resolvers from pnpmfile: {err}",
-        );
-        InstallWithFreshLockfileError::CustomResolverHook(err)
-    })?;
-    let fetchers = hook.get_custom_fetchers().await.map_err(|err| {
-        tracing::error!(
-            target: "pacquet::install",
-            "Failed to get custom fetchers from pnpmfile: {err}",
-        );
-        InstallWithFreshLockfileError::CustomFetcherHook(err)
-    })?;
-    Ok(PnpmfileLoad {
-        hook: Some(hook),
+
+    let mut chain: Vec<Box<dyn Resolver>> = Vec::with_capacity(custom_resolvers.len() + 9);
+    chain.extend(
+        custom_resolvers
+            .iter()
+            .filter(|custom| custom.has_can_resolve() && custom.has_resolve())
+            .map(|custom| {
+                Box::new(pnpm_hooks::custom_resolver_adapter::CustomResolverAdapter::new(
+                    Arc::clone(custom),
+                )) as Box<dyn Resolver>
+            }),
+    );
+    chain.extend([
+        Box::new(Arc::clone(&npm_resolver)) as Box<dyn Resolver>,
+        Box::new(git_resolver),
+        Box::new(tarball_resolver),
+        Box::new(local_scheme_resolver),
+        Box::new(node_resolver),
+        Box::new(deno_resolver),
+        Box::new(bun_resolver),
+        Box::new(yarn_resolver),
+        Box::new(named_registry_resolver),
+        Box::new(local_path_resolver),
+    ]);
+
+    // The install pass later calls `IngestTarballToStore::run_with_mem_cache`
+    // for the same URLs and either picks up `CacheValue::Available`
+    // immediately or briefly blocks on the per-URL `Notify`. See
+    // `prefetching_resolver.rs` for the full design rationale.
+    let resolver: Box<dyn Resolver> = Box::new(PrefetchingResolver::<Reporter>::new(
+        Box::new(DefaultResolver::new(chain)),
+        PrefetchContext {
+            http_client: http_client_arc,
+            mem_cache: tarball_mem_cache,
+            store_index,
+            store_index_writer: Some(store_index_writer),
+            verified_files_cache,
+            config,
+            requester,
+            supported_architectures,
+            progress_reported,
+            prefetch_downloads: prefetch_downloads && custom_fetcher_session.is_none(),
+            custom_fetcher_session: custom_fetcher_session.as_ref(),
+        },
+    ));

Introduce a distinct lifetime 'b for the prefetch_context method to safely
borrow the custom_fetcher_session local variable. This decouples it from the
struct's longer 'a lifetime and satisfies the borrow checker.

pnpm/crates/package-manager/src/install_with_fresh_lockfile/resolver_setup.rs [420-423]

-fn prefetch_context(
-    &self,
-    custom_fetcher_session: Option<&'a Arc<pnpm_deps_restorer::CustomFetcherSession>>,
-) -> PrefetchContext<'a> {
+fn prefetch_context<'b>(
+    &'b self,
+    custom_fetcher_session: Option<&'b Arc<pnpm_deps_restorer::CustomFetcherSession>>,
+) -> PrefetchContext<'b> {
Suggestion importance[1-10]: 10

__

Why: This suggestion accurately identifies and provides an elegant fix for a guaranteed "borrowed value does not live long enough" compiler error, ensuring the Rust code builds successfully.

High
Prevent double-awaiting the lockfile verification gate

Update the condition to prevent double-awaiting the lockfile_verification_gate
when install.lockfile_only is true.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs [1704-1706]

-if verify_filtered_repair {
+if verify_filtered_repair && !install.lockfile_only {
     await_lockfile_gate(lockfile_verification_gate).await?;
 }
Suggestion importance[1-10]: 9

__

Why: It accurately identifies a logic flaw introduced during the refactoring where await_lockfile_gate could be incorrectly awaited twice if both install.lockfile_only and verify_filtered_repair are true.

High

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Sep 9, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 0f38f85

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.01     13.7±0.91ms    27.3 MB/sec    1.00     13.6±0.13ms    27.6 MB/sec
packument/parse                                  1.00     44.8±0.48µs  1482.0 MB/sec    1.02     45.6±0.84µs  1454.8 MB/sec
tarball/download_dependency                      1.00      4.6±0.21ms   948.0 KB/sec    1.01      4.6±0.29ms   938.5 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00    232.1±3.41ms 68.9 KElem/sec    1.01    234.3±4.98ms 68.3 KElem/sec
workspace_resolution/hoist_heavy                 1.00    276.6±4.82ms        ? ?/sec    1.00    276.7±6.15ms        ? ?/sec
workspace_sort/chained_projects                  1.00     17.5±0.74ms        ? ?/sec    1.06     18.5±1.00ms        ? ?/sec

@zkochan
zkochan force-pushed the perfectionist-fresh-submodules branch from 0f38f85 to da5a760 Compare September 9, 2026 19:47
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit da5a760

@codecov-commenter

codecov-commenter commented Sep 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.45815% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.28%. Comparing base (d6783e7) to head (7b97a73).

Files with missing lines Patch % Lines
.../src/install_with_fresh_lockfile/resolver_setup.rs 96.92% 6 Missing ⚠️
...install_with_fresh_lockfile/manifest_transforms.rs 98.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14748      +/-   ##
==========================================
- Coverage   90.29%   90.28%   -0.01%     
==========================================
  Files         795      795              
  Lines      153301   153333      +32     
==========================================
+ Hits       138423   138444      +21     
- Misses      14878    14889      +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zkochan

zkochan commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Qodo's three findings are addressed in 2f89b50.

  • The "fresh installs fail to compile" bug is not one: build_resolver_chain compiled and passed every check here and in CI with the 'a-tied signature, because ResolverChainInputs is covariant in 'a and the borrow of inputs shortens to fit. The suggested method-local lifetime is the signature one would write on purpose, though, so prefetch_context now borrows for the call (<'p>(&'p self, Option<&'p Arc<_>>) -> PrefetchContext<'p>).
  • The prepare_resolution doc no longer lists its steps; it states the ordering contract (after the resolvers, before the pass; the pre-resolution hook fires once the lockfile to resolve against is fixed; a custom resolver may still widen the reuse scopes).
  • The overrides_use_catalogs and chain comments are gone; the chain order stays documented once, on build_resolver_chain.

The red Rust CI / Clippy and Dylint checks are unused imports in pnpm/crates/cli/src/cargo_deps/git/tests.rs, which this PR does not touch: main's own last two Rust CI runs fail the same way, and the PR's merge ref inherits it.


Written by an agent (Claude Code, claude-fable-5-1).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2f89b50

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 510a76e

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 510a76e34965

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.494 ± 0.119 2.326 2.714 1.67 ± 0.13
pacquet@main 2.458 ± 0.062 2.343 2.565 1.64 ± 0.11
pnpr@HEAD 1.506 ± 0.083 1.395 1.674 1.01 ± 0.08
pnpr@main 1.497 ± 0.093 1.359 1.662 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4937462722800006,
      "stddev": 0.1193643436814172,
      "median": 2.49997278368,
      "user": 1.7296744599999996,
      "system": 1.8008345399999999,
      "min": 2.32609373018,
      "max": 2.71389987118
    },
    {
      "command": "pacquet@main",
      "mean": 2.45779815018,
      "stddev": 0.06207091885751189,
      "median": 2.44544549668,
      "user": 1.8949288599999996,
      "system": 1.86773504,
      "min": 2.34329620518,
      "max": 2.56549203318
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5062104199800002,
      "stddev": 0.08307908196071842,
      "median": 1.50888114918,
      "user": 1.8043126600000001,
      "system": 1.9406343399999997,
      "min": 1.39486111518,
      "max": 1.67381358618
    },
    {
      "command": "pnpr@main",
      "mean": 1.4971418342800002,
      "stddev": 0.0933396992332286,
      "median": 1.48965310018,
      "user": 1.42932256,
      "system": 1.5386674399999998,
      "min": 1.3587923721800002,
      "max": 1.6618128521800002
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 256.7 ± 34.8 218.1 319.7 1.00
pacquet@main 292.6 ± 32.5 237.1 324.4 1.14 ± 0.20
pnpr@HEAD 291.2 ± 27.8 260.9 342.1 1.13 ± 0.19
pnpr@main 274.8 ± 24.9 239.5 326.2 1.07 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25669607273999995,
      "stddev": 0.034788192893968686,
      "median": 0.25449904684,
      "user": 0.25011079999999997,
      "system": 0.56790038,
      "min": 0.21805582834000004,
      "max": 0.31970274434
    },
    {
      "command": "pacquet@main",
      "mean": 0.29258913974000006,
      "stddev": 0.032535298083327606,
      "median": 0.29853503584,
      "user": 0.2941412,
      "system": 0.6519463799999998,
      "min": 0.23712255834000004,
      "max": 0.32437560434
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29115580014,
      "stddev": 0.027794369644147575,
      "median": 0.27998199684,
      "user": 0.27115969999999995,
      "system": 0.6251186799999999,
      "min": 0.26087830134,
      "max": 0.34214071434
    },
    {
      "command": "pnpr@main",
      "mean": 0.27480896684,
      "stddev": 0.024892716348267098,
      "median": 0.27022951434,
      "user": 0.2556885,
      "system": 0.59205018,
      "min": 0.23953961134,
      "max": 0.32619805734
    }
  ]
}

Scenario: Isolated linker: repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.8 ± 1.9 7.5 20.3 1.00
pacquet@main 11.8 ± 2.1 8.0 20.6 1.10 ± 0.27
pnpr@HEAD 11.4 ± 1.6 8.4 16.8 1.06 ± 0.24
pnpr@main 11.8 ± 2.7 7.4 20.8 1.09 ± 0.31
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.010776886128187921,
      "stddev": 0.0018792482950923555,
      "median": 0.0105496079,
      "user": 0.005963321610738254,
      "system": 0.005479972550335568,
      "min": 0.0074777174,
      "max": 0.0203127804
    },
    {
      "command": "pacquet@main",
      "mean": 0.011808981487499998,
      "stddev": 0.002103168718738916,
      "median": 0.011342431900000002,
      "user": 0.006287036249999996,
      "system": 0.006259851875,
      "min": 0.0080263804,
      "max": 0.020576527400000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011427524519815666,
      "stddev": 0.001563265845853978,
      "median": 0.0113560324,
      "user": 0.006153710967741933,
      "system": 0.005962261935483868,
      "min": 0.0084355904,
      "max": 0.016810745400000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.011768628245528464,
      "stddev": 0.0026508825088790433,
      "median": 0.0110639519,
      "user": 0.006326665040650404,
      "system": 0.00609696308943089,
      "min": 0.0074218614,
      "max": 0.020753962400000003
    }
  ]
}

Scenario: Isolated linker: repeat install, cold cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.1 ± 1.3 7.3 15.1 1.00
pacquet@main 11.5 ± 2.9 7.1 20.9 1.14 ± 0.32
pnpr@HEAD 11.7 ± 2.3 8.0 24.9 1.16 ± 0.27
pnpr@main 10.8 ± 1.6 7.2 16.1 1.08 ± 0.21
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.010073743991250009,
      "stddev": 0.0012926856273313596,
      "median": 0.010021104460000001,
      "user": 0.005861676249999999,
      "system": 0.004781514821428574,
      "min": 0.007349481960000001,
      "max": 0.015098106960000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.01146212660976959,
      "stddev": 0.002892795879356101,
      "median": 0.01076328296,
      "user": 0.0058840595391705065,
      "system": 0.006231351336405529,
      "min": 0.007066118960000001,
      "max": 0.020937614960000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011653876090434782,
      "stddev": 0.0023287327199422174,
      "median": 0.011318907960000001,
      "user": 0.0068261078260869554,
      "system": 0.005462903105590066,
      "min": 0.00798899796,
      "max": 0.02494708596
    },
    {
      "command": "pnpr@main",
      "mean": 0.010847454030484588,
      "stddev": 0.0015711495561335444,
      "median": 0.01080899796,
      "user": 0.006442527577092511,
      "system": 0.0050528,
      "min": 0.007170745960000001,
      "max": 0.016061560960000002
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.740 ± 0.126 2.621 3.016 1.75 ± 0.12
pacquet@main 2.884 ± 0.145 2.712 3.119 1.84 ± 0.13
pnpr@HEAD 1.569 ± 0.083 1.499 1.756 1.00
pnpr@main 1.714 ± 0.138 1.567 1.946 1.09 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7404757586999997,
      "stddev": 0.12623927412408878,
      "median": 2.6973019065,
      "user": 2.51206172,
      "system": 2.1172048200000004,
      "min": 2.620731009,
      "max": 3.0155545519999998
    },
    {
      "command": "pacquet@main",
      "mean": 2.8842679469000005,
      "stddev": 0.1454862596810982,
      "median": 2.8410972675,
      "user": 2.89049122,
      "system": 2.4137328199999994,
      "min": 2.711583368,
      "max": 3.119361149
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5694010992999998,
      "stddev": 0.08320832858103902,
      "median": 1.530929212,
      "user": 1.48427172,
      "system": 1.7351719199999998,
      "min": 1.499467441,
      "max": 1.755528661
    },
    {
      "command": "pnpr@main",
      "mean": 1.7142962399000001,
      "stddev": 0.1376953546533109,
      "median": 1.6650015025,
      "user": 1.7304965200000002,
      "system": 2.01014832,
      "min": 1.567481677,
      "max": 1.946108831
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 531.8 ± 41.3 478.3 605.9 1.53 ± 0.14
pacquet@main 480.9 ± 21.6 433.2 509.8 1.39 ± 0.09
pnpr@HEAD 360.2 ± 35.7 335.2 457.0 1.04 ± 0.11
pnpr@main 346.6 ± 14.9 313.5 364.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5317605005400001,
      "stddev": 0.041278827216936195,
      "median": 0.52167684504,
      "user": 0.8015293400000001,
      "system": 1.04714788,
      "min": 0.47825078654000003,
      "max": 0.6059109225400001
    },
    {
      "command": "pacquet@main",
      "mean": 0.48092160484000007,
      "stddev": 0.021599532918669843,
      "median": 0.48375400654,
      "user": 0.72336384,
      "system": 1.00856338,
      "min": 0.43320173654,
      "max": 0.5097934195400001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3601733529400001,
      "stddev": 0.035679037204794505,
      "median": 0.35081355704,
      "user": 0.27905964,
      "system": 0.62804238,
      "min": 0.33521931954,
      "max": 0.45704038254
    },
    {
      "command": "pnpr@main",
      "mean": 0.34664101524,
      "stddev": 0.014871620257084633,
      "median": 0.34970743754,
      "user": 0.27726303999999996,
      "system": 0.60379458,
      "min": 0.31345798754,
      "max": 0.36435184054
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.782 ± 0.110 1.678 1.983 5.51 ± 0.49
pacquet@main 1.682 ± 0.083 1.589 1.818 5.20 ± 0.42
pnpr@HEAD 0.323 ± 0.021 0.282 0.344 1.00
pnpr@main 0.337 ± 0.013 0.317 0.364 1.04 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7822847124000003,
      "stddev": 0.10963516755142058,
      "median": 1.7341531284,
      "user": 1.2620652199999998,
      "system": 1.18625656,
      "min": 1.6778020329,
      "max": 1.9826138339000001
    },
    {
      "command": "pacquet@main",
      "mean": 1.6816557968,
      "stddev": 0.0826601394743861,
      "median": 1.6396904639,
      "user": 1.09528662,
      "system": 1.02886286,
      "min": 1.5885837289000002,
      "max": 1.8180033779000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3233902397,
      "stddev": 0.02053214101603496,
      "median": 0.32933896440000004,
      "user": 0.23932402000000003,
      "system": 0.58551306,
      "min": 0.2817702509,
      "max": 0.34418036290000004
    },
    {
      "command": "pnpr@main",
      "mean": 0.33710831730000007,
      "stddev": 0.0133781753399339,
      "median": 0.33568905390000003,
      "user": 0.25536711999999995,
      "system": 0.59629786,
      "min": 0.3171222609,
      "max": 0.36419560590000005
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 279.7 ± 24.4 244.5 320.7 2.50 ± 0.28
pacquet@main 280.2 ± 32.6 249.0 344.7 2.50 ± 0.34
pnpr@HEAD 114.2 ± 12.4 102.9 150.3 1.02 ± 0.13
pnpr@main 112.0 ± 8.2 101.9 130.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2797217512709091,
      "stddev": 0.024433336400099898,
      "median": 0.27137229518,
      "user": 0.31314951818181824,
      "system": 0.0911974418181818,
      "min": 0.24453919518,
      "max": 0.32066118418
    },
    {
      "command": "pacquet@main",
      "mean": 0.28015514963454546,
      "stddev": 0.032559627755461056,
      "median": 0.26359115318000004,
      "user": 0.30926133636363634,
      "system": 0.09543707818181818,
      "min": 0.24902312418,
      "max": 0.34472265018000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.11423546165826086,
      "stddev": 0.012386832014924954,
      "median": 0.10975388518,
      "user": 0.04976400434782609,
      "system": 0.02246317304347825,
      "min": 0.10294704018,
      "max": 0.15028309018
    },
    {
      "command": "pnpr@main",
      "mean": 0.11197634522000001,
      "stddev": 0.00818118070980486,
      "median": 0.11062992618,
      "user": 0.04781054,
      "system": 0.02184058,
      "min": 0.10190710118,
      "max": 0.13064056018
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 891.2 ± 124.2 735.7 1136.8 1.01 ± 0.22
pacquet@main 884.6 ± 144.2 699.3 1161.9 1.00
pnpm@HEAD 4570.7 ± 354.0 4058.2 4916.2 5.17 ± 0.93
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.8912379881755557,
      "stddev": 0.12420523863189532,
      "median": 0.88863810062,
      "user": 0.8985090133333333,
      "system": 0.23255253111111113,
      "min": 0.73565353862,
      "max": 1.1367847546199998
    },
    {
      "command": "pacquet@main",
      "mean": 0.88461716662,
      "stddev": 0.1441903361032443,
      "median": 0.84611609062,
      "user": 0.9045732355555555,
      "system": 0.22297686444444442,
      "min": 0.69932942762,
      "max": 1.16190452462
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.570685959731112,
      "stddev": 0.35399422441616124,
      "median": 4.69001237162,
      "user": 6.98671168,
      "system": 0.3824417533333333,
      "min": 4.05820296662,
      "max": 4.916249774620001
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.685 ± 0.221 4.353 5.025 1.34 ± 0.08
pacquet@main 4.418 ± 0.090 4.341 4.612 1.27 ± 0.05
pnpr@HEAD 3.547 ± 0.101 3.388 3.706 1.02 ± 0.05
pnpr@main 3.487 ± 0.133 3.375 3.793 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.68527798544,
      "stddev": 0.22142950728927133,
      "median": 4.73859124284,
      "user": 2.0553693599999994,
      "system": 1.9377169600000002,
      "min": 4.35332506234,
      "max": 5.02495162634
    },
    {
      "command": "pacquet@main",
      "mean": 4.41778244604,
      "stddev": 0.08981491903184612,
      "median": 4.37741722134,
      "user": 1.6481785599999998,
      "system": 1.62482966,
      "min": 4.34080838734,
      "max": 4.612048607339999
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5469178127400007,
      "stddev": 0.10091109254557096,
      "median": 3.59228204484,
      "user": 1.6857460599999996,
      "system": 1.7359911599999998,
      "min": 3.38758084134,
      "max": 3.7056640933400002
    },
    {
      "command": "pnpr@main",
      "mean": 3.48684167074,
      "stddev": 0.13311977874181855,
      "median": 3.42170213834,
      "user": 1.45195346,
      "system": 1.4929588599999999,
      "min": 3.3745432863400002,
      "max": 3.79314772834
    }
  ]
}

Scenario: GVS linker: fresh restore, hot cache + hot store

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store — the layout pnpm 12 installs into by default. Comparable to that scenario head-to-head.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 197.3 ± 35.7 149.9 264.4 1.04 ± 0.23
pacquet@main 234.9 ± 43.9 155.3 289.8 1.24 ± 0.28
pnpr@HEAD 189.0 ± 23.3 151.0 230.9 1.00
pnpr@main 191.4 ± 32.6 158.4 288.3 1.01 ± 0.21
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.1973411532988235,
      "stddev": 0.03568488315355807,
      "median": 0.19235215424000002,
      "user": 0.27005698588235294,
      "system": 0.18546428823529407,
      "min": 0.14989412524,
      "max": 0.26435892924000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.23487492044000002,
      "stddev": 0.043882528453083276,
      "median": 0.24837054874000003,
      "user": 0.29910238,
      "system": 0.2318698,
      "min": 0.15527085624000003,
      "max": 0.28975972924000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.1890360399323077,
      "stddev": 0.023314653647214058,
      "median": 0.19151277224000002,
      "user": 0.23595781846153846,
      "system": 0.20170116153846152,
      "min": 0.15100138124,
      "max": 0.23094940924000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.191446845365,
      "stddev": 0.032562990943989775,
      "median": 0.18451827374000002,
      "user": 0.23184952999999997,
      "system": 0.19456382499999997,
      "min": 0.15839485124000002,
      "max": 0.28827616424
    }
  ]
}

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/14748
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
149.89 ms
(+5.43%)Baseline: 142.17 ms
170.60 ms
(87.86%)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,620.73 ms
(+2.68%)Baseline: 2,552.37 ms
3,062.84 ms
(85.57%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,677.80 ms
(+4.88%)Baseline: 1,599.81 ms
1,919.77 ms
(87.40%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
478.25 ms
(+17.02%)Baseline: 408.68 ms
490.42 ms
(97.52%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
244.54 ms
(+8.53%)Baseline: 225.32 ms
270.38 ms
(90.44%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,326.09 ms
(+1.05%)Baseline: 2,301.93 ms
2,762.32 ms
(84.21%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,353.33 ms
(-0.35%)Baseline: 4,368.58 ms
5,242.29 ms
(83.04%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
218.06 ms
(-6.61%)Baseline: 233.48 ms
280.18 ms
(77.83%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
735.65 ms
(+11.03%)Baseline: 662.56 ms
795.07 ms
(92.53%)
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
🚷 view threshold
7.35 ms
(-0.66%)Baseline: 7.40 ms
8.88 ms
(82.79%)
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
🚷 view threshold
7.48 ms
(+5.22%)Baseline: 7.11 ms
8.53 ms
(87.69%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/14748
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
gvs-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
151.00 ms
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,499.47 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
281.77 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
335.22 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
102.95 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,394.86 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,387.58 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
260.88 ms
isolated-linker.repeat-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
7.99 ms
isolated-linker.repeat-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
8.44 ms
🐰 View full continuous benchmarking report in Bencher

zkochan and others added 4 commits September 9, 2026 23:34
…ds them

The workspace walk consumes the hooks and the reuse policy as a whole,
and every importer's resolve reads the config, the seeds and the
manifest hooks alongside; the pass inputs carry the two halves as
WorkspaceWalk and ImporterInputs, each building its own options,
instead of one struct the pass took apart into twenty-seven names. The
reuse seed reads its inputs in place and builds its two rewrite
contexts from one method.

Related to #14562.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
…solve hooks

ImporterTransforms owns the extenders, the overrider and the ignored-
optionals matcher it applies, drops an empty overrider at construction
where two sinks each filtered it, applies itself to every importer, and
turns into the three read-package hooks the resolver runs. The manifest
transforms carry those hooks as one ManifestHooks value.

Related to #14562.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
…m its inputs

The chain inputs construct the npm, git, tarball, node and named-
registry resolvers as methods sharing one retry-options and packument-
caches source, assemble the chain in its order, and build the prefetch
context; loading the pnpmfile with its custom resolvers and fetchers is
a step of its own. With this, the fresh install's submodules have no
function over the twelve-name cap.

Related to #14562.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
…efetch context its own lifetime

Two helper comments that restated their names are gone; the prefetch
context borrows for the call rather than for the inputs' lifetime,
which is what the borrow of the pnpmfile load's session needs read
literally, even though variance let the previous signature compile.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019kR4Ev797PFQ6iaC3AtzRw
@zkochan
zkochan force-pushed the perfectionist-fresh-submodules branch from 510a76e to 7b97a73 Compare September 9, 2026 21:36
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 7b97a73

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan
zkochan merged commit 73840ca into main Sep 9, 2026
34 checks passed
@zkochan
zkochan deleted the perfectionist-fresh-submodules branch September 9, 2026 22:13
biisal pushed a commit to biisal/pnpm that referenced this pull request Sep 15, 2026
… the bindings cap (pnpm#14748)

Bring the fresh install's submodules under the twelve-name cap.

Split the resolve pass's inputs into the WorkspaceWalk the walk
consumes whole and the ImporterInputs every importer reads, each
building its own options. Read the reuse seed's inputs in place and
build its rewrite contexts from one method. Let ImporterTransforms own
the extenders, the overrider and the matcher it applies, drop an empty
overrider at construction, and produce the read-package hooks as one
ManifestHooks value. Build each resolver of the chain from the chain
inputs by a method of its own, and load the pnpmfile with its custom
resolvers and fetchers as a step of its own.

Related to pnpm#14562.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants