Repository navigation
Conversation
… focused modules resolve_dependency_tree.rs carried the public options/error types, the shared workspace context, the per-importer tree context, the recursive walk, node reuse and children-ownership bookkeeping, lockfile-snapshot reuse checks, catalog specifier resolution, and manifest extraction in one 4,037-line file. Keep resolve_dependency_tree.rs as the facade holding the options, error, and notification types plus the two entry points, and move the implementation into resolve_dependency_tree/: workspace_ctx.rs (WorkspaceTreeCtx, the shared per-pkgIdWithPatchHash dedup maps, and the children-ownership claim/handover), tree_ctx.rs (TreeCtx and the per-edge ResolveOptions derivations), walk.rs (the fresh-resolve walk — seed, children walk, per-wanted resolve cache, level folds), reuse.rs (ReuseSource, the update scope, direct-dep change bookkeeping, subtree-reuse predicates, and the snapshot-driven walk), manifest.rs (what the walk reads off a resolved package: pkg id, child specs, peers, leaf classification, deprecation), and catalogs.rs (catalog: specifier resolution). TreeCtx and WorkspaceTreeCtx stay one struct each; their inherent impls are divided across the modules with pub(super) visibility, so every cross-module item stays private to resolve_dependency_tree and the crate's public API is unchanged. The pub(super) surface was derived mechanically: every marker was stripped and the compiler re-added only the ones the crate cannot compile without. The unit tests that drive one module's internals move next to it, with the shared result builder lifted into a test_support module; the end-to-end tree-walk tests stay at the facade. Pure code movement: no behavior, allocation, cloning, dispatch, or traversal change. After normalizing away imports, module declarations, visibility markers, and reference-style doc links, the multiset of source lines before and after differs only by the eleven signatures rustfmt re-wrapped because pub(super) pushed them past the width. Closes #13554.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe monolithic dependency-tree resolver is now a facade over focused modules for workspace state, per-importer context, manifest processing, catalog resolution, fresh walking, and lockfile reuse. Module-specific tests cover the extracted behavior. ChangesDependency tree resolver
Estimated code review effort: 4 (Complex) | ~45 minutes Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (5): Last reviewed commit: "docs(resolving-deps-resolver): stop narr..." | Re-trigger Greptile |
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTo customize comments, go to the Qodo configuration screen, or learn more in the docs. Previous review resultsReview updated until commit dc4fd25 Results up to commit b58c2f4
|
PR Summary by QodoSplit resolve_dependency_tree into focused internal modules
AI Description
Diagram
High-Level Assessment
Files changed (13)
|
Micro-Benchmark ResultsLinux |
There was a problem hiding this comment.
Pull request overview
Refactors the pacquet (Rust) dependency-tree resolver by splitting the previously very large resolve_dependency_tree.rs implementation into focused submodules under resolve_dependency_tree/, while keeping the public API and user-visible behavior unchanged.
Changes:
- Introduces a module layout that separates workspace-shared state (
workspace_ctx), per-importer state (tree_ctx), the fresh-resolve walk (walk), lockfile reuse (reuse), manifest-derived logic (manifest), and catalog specifier resolution (catalogs). - Moves and rehomes unit tests alongside their corresponding modules, adding shared helpers in
test_support. - Keeps the facade (
resolve_dependency_tree.rs) as the entry-point surface (options/errors/types + entry points), delegating implementation to submodules.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs | Facade: entry points, option/error/notification types, module wiring, and shared helpers. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs | Workspace-shared context, dedup maps, ownership bookkeeping, and snapshot helpers. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs | Workspace context unit tests moved next to implementation. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tree_ctx.rs | Per-importer TreeCtx and per-edge ResolveOptions derivations. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rs | Fresh dependency-walk implementation and per-wanted caching path. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk/tests.rs | Walk-specific unit tests relocated into the walk module. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/reuse.rs | Prior-lockfile reuse logic, update scope handling, and snapshot-driven traversal. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/reuse/tests.rs | Reuse/update-related unit tests relocated into the reuse module. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest.rs | Manifest-driven extraction (children/peers/leaf/deprecation) and pkg-id construction. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest/tests.rs | Manifest-related unit tests relocated into the manifest module. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/catalogs.rs | catalog: specifier resolution moved into a dedicated helper module. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rs | Keeps the end-to-end/facade-level tests; removes tests relocated into submodules. |
| pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/test_support.rs | Shared test helpers extracted for reuse across module-level tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The `Rust CI / Doc` job runs `cargo doc --document-private-items`, so it resolves the doc links on private items too — 23 of them broke when the items they name moved into sibling modules. Neither the local `cargo doc` nor the pre-push hook passes that flag, so the breakage only surfaced in CI. Point them at their new homes with reference-style link definitions, keeping the prose lines unchanged. Three links named a helper that is private to another module and so is not nameable from a sibling at all (`walk::fallback_manifest`, `walk::overlay_lookup_names`, `reuse::subtree_fully_reusable`); those become plain code spans rather than widening the helpers' visibility for the sake of a link.
PR Code Suggestions ✨Latest suggestions up to dc4fd25 Warning
Previous suggestionsSuggestions up to commit b1bbb42
Suggestions up to commit 83590db
Suggestions up to commit a09a4ca
Suggestions up to commit b58c2f4
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest/tests.rs (1)
8-31: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse
manifest_resultfor this fixture.This literal matches
test_support::manifest_resultin every field exceptmanifest. The helper is already imported on Line 4 and the other four tests in this file use it. Reusing it removes the duplicatedResolveResultconstruction and the now-unneededPkgResolutionId,LockfileResolution, andDirectoryResolutionimports for this test.As per path instructions, report "missed reuse or duplication across the monorepo".♻️ Proposed reuse of the shared fixture
- let result = ResolveResult { - id: PkgResolutionId::from("[email protected]"), - name_ver: None, - latest: None, - published_at: None, - manifest: Some(std::sync::Arc::new(serde_json::json!({ - "name": "parent", - "version": "1.0.0", - "engines": { - "runtime": { - "name": "node", - "version": "22.19.0", - "onFail": "download", - }, - }, - }))), - resolution: LockfileResolution::Directory(DirectoryResolution { - directory: "parent".to_string(), - }), - resolved_via: "npm-registry".to_string(), - normalized_bare_specifier: None, - alias: Some("parent".to_string()), - policy_violation: None, - }; + let result = manifest_result(serde_json::json!({ + "name": "parent", + "version": "1.0.0", + "engines": { + "runtime": { + "name": "node", + "version": "22.19.0", + "onFail": "download", + }, + }, + }));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest/tests.rs` around lines 8 - 31, Replace the duplicated ResolveResult literal in the affected test with the imported test_support::manifest_result fixture, then override only its manifest field with the test-specific JSON. Remove the now-unused PkgResolutionId, LockfileResolution, and DirectoryResolution imports, and report “missed reuse or duplication across the monorepo” as required.Source: Path instructions
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tree_ctx.rs (1)
141-182: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the duplicated
lockfile_dirderivation.
TreeCtx::newandTreeCtx::with_workspaceboth computelockfile_dirwith the same fallback logic. Extract a small private helper and call it from both constructors to remove the duplication.♻️ Proposed refactor
+fn resolve_lockfile_dir(base_opts: &ResolveOptions) -> PathBuf { + if base_opts.lockfile_dir.as_os_str().is_empty() { + base_opts.project_dir.clone() + } else { + base_opts.lockfile_dir.clone() + } +} + impl TreeCtx { #[must_use] pub fn new(base_opts: ResolveOptions) -> Self { - let lockfile_dir = if base_opts.lockfile_dir.as_os_str().is_empty() { - base_opts.project_dir.clone() - } else { - base_opts.lockfile_dir.clone() - }; + let lockfile_dir = resolve_lockfile_dir(&base_opts); TreeCtx { ... } } pub fn with_workspace(workspace: Arc<WorkspaceTreeCtx>, base_opts: ResolveOptions) -> Self { - let lockfile_dir = if base_opts.lockfile_dir.as_os_str().is_empty() { - base_opts.project_dir.clone() - } else { - base_opts.lockfile_dir.clone() - }; + let lockfile_dir = resolve_lockfile_dir(&base_opts); TreeCtx { ... } } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tree_ctx.rs` around lines 141 - 182, Extract the shared lockfile directory fallback logic from TreeCtx::new and TreeCtx::with_workspace into a small private helper, then call that helper from both constructors before lexical normalization. Preserve the existing behavior of using project_dir when lockfile_dir is empty and lockfile_dir otherwise.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest/tests.rs`:
- Around line 8-31: Replace the duplicated ResolveResult literal in the affected
test with the imported test_support::manifest_result fixture, then override only
its manifest field with the test-specific JSON. Remove the now-unused
PkgResolutionId, LockfileResolution, and DirectoryResolution imports, and report
“missed reuse or duplication across the monorepo” as required.
In `@pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tree_ctx.rs`:
- Around line 141-182: Extract the shared lockfile directory fallback logic from
TreeCtx::new and TreeCtx::with_workspace into a small private helper, then call
that helper from both constructors before lexical normalization. Preserve the
existing behavior of using project_dir when lockfile_dir is empty and
lockfile_dir otherwise.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 646fb722-3608-4e47-a4ca-ec3b76696d08
📒 Files selected for processing (13)
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/catalogs.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/manifest/tests.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/reuse.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/reuse/tests.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/test_support.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tests.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/tree_ctx.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/walk/tests.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rspnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx/tests.rs
|
Both Qodo suggestions land on That said, the underlying concern is worth recording, and the real inversion
Two threads entering those concurrently can deadlock. Whether they ever do The surrounding code shows the lock order is maintained deliberately elsewhere: Fixing it means either hoisting Written by an agent (Claude Code, claude-opus-5[1m]). |
… the shared helper The engines-runtime test built a `ResolveResult` literal identical to `test_support::manifest_result` in every field but the manifest. The two sat in different parts of the old 871-line test module; the split puts them in the same file, where the duplication is plain. Only the literal goes — `PkgResolutionId`, `LockfileResolution`, and `DirectoryResolution` stay imported, because the deprecation test below builds its own result with different values for all three.
|
Thanks — taking one of the two.
One correction to the proposed diff: it also removes the
Written by an agent (Claude Code, claude-opus-5[1m]). |
|
Code review by qodo was updated up to the latest commit 83590db |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.
Suppressed comments (2)
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs:659
provider_pkg_ids()currently locksdependencies_treeand thenpackagesand holds both guards at the same time. Elsewhere (e.g.snapshot()and parts of the walk) the lock order ispackages→dependencies_tree, so this inverted acquisition order can deadlock under concurrent access. Collect the(NodeId, pkg_id)pairs under one lock, drop it, then filter againstpackagesunder the second lock (or otherwise enforce a single global lock order).
let dependencies_tree = lock_recoverable(&self.dependencies_tree);
let packages = lock_recoverable(&self.packages);
node_ids
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree/workspace_ctx.rs:366
snapshot()builds theResolvedTreeusing multiplelock_recoverable(...).clone()calls inline. In Rust, the temporaryMutexGuards created for those field initializers can live until the end of the struct literal, meaning this can hold several workspace locks at once. That increases the risk of deadlocks with other code that acquires these mutexes in a different order (e.g.provider_pkg_ids). Cloning each map into locals first drops each guard immediately and keeps lock acquisition single-at-a-time.
This issue also appears on line 657 of the same file.
pub fn snapshot(&self, direct: Vec<DirectDep>) -> ResolvedTree {
ResolvedTree {
direct,
packages: lock_recoverable(&self.packages).clone(),
dependencies_tree: lock_recoverable(&self.dependencies_tree).clone(),
|
Corroboration on the lock-ordering point above: Copilot's latest pass So two independent reviewers land on the same pre-existing ABBA pair. Still Written by an agent (Claude Code, claude-opus-5[1m]). |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13562 +/- ##
==========================================
+ Coverage 87.94% 87.96% +0.01%
==========================================
Files 556 563 +7
Lines 97218 97334 +116
==========================================
+ Hits 85502 85616 +114
- Misses 11716 11718 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…r own contents Two of the module docs added with the split repeat documentation that already exists elsewhere, which the comment conventions rule out. The facade's `//!` said the file holds the entry points and then toured the six submodules. Both halves are already written down: the crate-level docs in lib.rs describe the tree pass, `resolve_dependency_tree`'s own doc states its contract, and rustdoc renders the module index with each submodule's first doc line — the tour was a paraphrase sitting directly above the thing it paraphrased. The file carried no module doc before the split; it doesn't need one now. The paragraph appended to reuse.rs said which functions "live here too". That is an inventory of the module, not a contract, and the item list renders itself. The remaining six module docs stay: a module has no name or signature to carry its contract, and they follow the shape the resolve_peers split established in #13551.
|
Code review by qodo was updated up to the latest commit b1bbb42 |
…ady pin The split moves each unit test next to the item it exercises; they used to sit up to ~3,200 lines apart in one file. Co-locating them exposes doc comments that walk through scenarios the tests below already state by name, which the comment conventions rule out — tests are the documentation for behavior, and prose that repeats them reads as missing coverage. Trimmed to the contract plus the non-obvious why, dropping what a test pins: - `is_update_target` loses the paragraph enumerating its four outcomes; the ten tests in `mod is_update_target` name each one. The contract it feeds (the `update_requested` flag behind the picker's held-back-update warning) stays. - `real_package_name_of` loses the per-protocol worked examples and the four inline blocks narrating each branch; thirteen tests cover them, and the test for the scoped case names the `idx >= 1` guard directly. - `higher_direct_dep_version` loses the prerelease note. Both directions are tested, and the test's own comment anchors the rule to pnpm's `semver.satisfies(.., true)` — a better reference than the one removed. - `fallback_manifest` loses the list of identities it falls back to; its four tests are that list. Why a fallback exists at all, and that `0.0.0` is what pnpm writes into `packages:`, stay. - `extract_children` keeps both rationales (npm merges `optionalDependencies` at publish time; npm ships bundled deps inside the tarball) and drops the restatement of what the four bundled-dependency tests assert. - The `deprecated_pkg_name_ver` test doc shrinks to its why; the asserts and the test name already carry the rest.
|
Code review by qodo was updated up to the latest commit dc4fd25 |
Integrated-Benchmark Report (Linux)Commit: 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
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.6120207586399995,
"stddev": 0.1499137711164567,
"median": 2.67175315584,
"user": 1.6253422199999998,
"system": 1.3335271599999996,
"min": 2.35211037334,
"max": 2.77800327534,
"times": [
2.70789724134,
2.47780433734,
2.65775257034,
2.44200933234,
2.77800327534,
2.6857537413399997,
2.52845470634,
2.35211037334,
2.72215788734,
2.76826412134
]
},
{
"command": "pacquet@main",
"mean": 2.54215679704,
"stddev": 0.17870792131110558,
"median": 2.54682352734,
"user": 1.6323010200000003,
"system": 1.30477286,
"min": 2.3351285543399998,
"max": 2.80142398534,
"times": [
2.73793596634,
2.69121405534,
2.53802146334,
2.5556255913399997,
2.34841087934,
2.33867781334,
2.80142398534,
2.67471276834,
2.3351285543399998,
2.40041689334
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4826338806400001,
"stddev": 0.1553691594763171,
"median": 1.4406576633400001,
"user": 1.1904545199999998,
"system": 1.15323156,
"min": 1.3496296973400002,
"max": 1.78140225034,
"times": [
1.4044868763400002,
1.4523712183400002,
1.49112325534,
1.3496296973400002,
1.4376179613400002,
1.7462916463400002,
1.3611941313400002,
1.35852440434,
1.44369736534,
1.78140225034
]
},
{
"command": "pnpr@main",
"mean": 1.5542538020400003,
"stddev": 0.15692376218895107,
"median": 1.51870977934,
"user": 1.1646199199999998,
"system": 1.1519864599999998,
"min": 1.33348947434,
"max": 1.7553407863400001,
"times": [
1.7553407863400001,
1.4809078743400002,
1.49960808034,
1.3478175833400001,
1.63317256534,
1.53781147834,
1.47524593534,
1.33348947434,
1.7442904403400001,
1.7348538023400002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24926396033999998,
"stddev": 0.004250072661081425,
"median": 0.24808232784,
"user": 0.19335194,
"system": 0.51474048,
"min": 0.24605744634,
"max": 0.26034921534,
"times": [
0.24679374934,
0.24909528134,
0.24940374334,
0.24605744634,
0.24851656534,
0.26034921534,
0.25162122334000003,
0.24764809034000002,
0.24678836634,
0.24636592234000002
]
},
{
"command": "pacquet@main",
"mean": 0.25294208644000005,
"stddev": 0.006366761219865584,
"median": 0.25230058633999997,
"user": 0.19644574,
"system": 0.49786127999999985,
"min": 0.24039169134000002,
"max": 0.26554604634,
"times": [
0.24940282934000002,
0.25467718334,
0.25133173334000003,
0.24039169134000002,
0.26554604634,
0.25326892534,
0.25133224734,
0.25732835634,
0.25102794934,
0.25511390234000003
]
},
{
"command": "pnpr@HEAD",
"mean": 0.26868472064000004,
"stddev": 0.0056604703677040425,
"median": 0.26824624984,
"user": 0.20549014000000004,
"system": 0.50955988,
"min": 0.26138033234,
"max": 0.27621984134,
"times": [
0.27621984134,
0.26913832934,
0.26138033234,
0.26338723834,
0.27387587634,
0.26581984934,
0.26139962334,
0.26735417034000003,
0.27361818034,
0.27465376534
]
},
{
"command": "pnpr@main",
"mean": 0.26361740623999996,
"stddev": 0.005750850134497339,
"median": 0.26518732284,
"user": 0.21740034000000003,
"system": 0.49942758,
"min": 0.25532226534,
"max": 0.26978238434,
"times": [
0.26025416134,
0.26771391134,
0.26978238434,
0.26884012634,
0.25532226534,
0.25664807034000003,
0.26778403134,
0.26266073434000003,
0.26944143934000003,
0.25772693834
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5862005004600004,
"stddev": 0.011095168542474856,
"median": 2.5845091674600003,
"user": 1.63814888,
"system": 1.3100106599999999,
"min": 2.57029810546,
"max": 2.60437131046,
"times": [
2.6015330694600003,
2.57029810546,
2.57820868046,
2.5907858684600003,
2.58958077746,
2.5773474264600003,
2.57943755746,
2.60437131046,
2.57941512046,
2.59102708846
]
},
{
"command": "pacquet@main",
"mean": 2.5696394010600003,
"stddev": 0.014441855279438283,
"median": 2.57111854446,
"user": 1.61180518,
"system": 1.3083730599999999,
"min": 2.54683431846,
"max": 2.58819481446,
"times": [
2.58819481446,
2.5601272444600003,
2.58114117246,
2.5622826294600003,
2.57903183046,
2.55209784046,
2.58005261146,
2.5834262904600003,
2.56320525846,
2.54683431846
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5883011061599999,
"stddev": 0.11692848618158978,
"median": 1.61470556796,
"user": 1.16846438,
"system": 1.15035216,
"min": 1.4306545664599999,
"max": 1.7724862104599999,
"times": [
1.6325472214599999,
1.4944654394599999,
1.5041177344599999,
1.43756322346,
1.61634660446,
1.4306545664599999,
1.71594750846,
1.61306453146,
1.66581802146,
1.7724862104599999
]
},
{
"command": "pnpr@main",
"mean": 1.5503228620599998,
"stddev": 0.13818943588284738,
"median": 1.48863341696,
"user": 1.15417648,
"system": 1.1607215599999998,
"min": 1.42368989046,
"max": 1.8775471324600002,
"times": [
1.8775471324600002,
1.49071636246,
1.44509223746,
1.62204095846,
1.45585503446,
1.42368989046,
1.48037863246,
1.65436159146,
1.56699630946,
1.48655047146
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.3902193183,
"stddev": 0.00948795366047521,
"median": 0.39152705340000005,
"user": 0.50480148,
"system": 0.6911481599999998,
"min": 0.3690562409,
"max": 0.4028993369,
"times": [
0.3690562409,
0.38561898990000004,
0.3937662049,
0.39126554490000004,
0.3917885619,
0.3926629359,
0.38803976090000003,
0.4016518999,
0.4028993369,
0.3854437069
]
},
{
"command": "pacquet@main",
"mean": 0.38319266589999995,
"stddev": 0.014209498206762441,
"median": 0.3786909519,
"user": 0.4865458799999999,
"system": 0.69287386,
"min": 0.37111881490000004,
"max": 0.4182611479,
"times": [
0.38222244790000004,
0.3723163659,
0.37111881490000004,
0.37977033590000003,
0.37550487990000003,
0.3758703679,
0.3961075979,
0.4182611479,
0.3776115679,
0.3831431329
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30500056640000006,
"stddev": 0.011766032100813124,
"median": 0.3038826309,
"user": 0.18428538,
"system": 0.5216550600000001,
"min": 0.2896670169,
"max": 0.3315567149,
"times": [
0.3072378719,
0.3131357329,
0.2896670169,
0.2984972929,
0.2926695789,
0.3018174649,
0.3009361639,
0.3059477969,
0.3315567149,
0.3085400299
]
},
{
"command": "pnpr@main",
"mean": 0.29828707830000006,
"stddev": 0.0057774441137276025,
"median": 0.29946430290000003,
"user": 0.18326668000000002,
"system": 0.50617896,
"min": 0.2906454609,
"max": 0.3068192429,
"times": [
0.30133227290000003,
0.3023913429,
0.2906454609,
0.2937864409,
0.2979909959,
0.3009376099,
0.2938360909,
0.3068192429,
0.3044532789,
0.2906780469
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.73108718688,
"stddev": 0.011647110636078366,
"median": 1.73010601018,
"user": 0.7120430399999998,
"system": 0.7698841399999999,
"min": 1.71649478318,
"max": 1.7511615141799999,
"times": [
1.7511615141799999,
1.7228327151799998,
1.7347475081800001,
1.72839488818,
1.74625649418,
1.73181713218,
1.71649478318,
1.73814675418,
1.7229561391800001,
1.71806394018
]
},
{
"command": "pacquet@main",
"mean": 1.72640863748,
"stddev": 0.009735550368287663,
"median": 1.72608632118,
"user": 0.7105086399999999,
"system": 0.76247654,
"min": 1.71071290518,
"max": 1.74471613518,
"times": [
1.72794541018,
1.71558855418,
1.73383768718,
1.7211500521799998,
1.72381305418,
1.7242272321799998,
1.73375799918,
1.71071290518,
1.72833734518,
1.74471613518
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29678821688,
"stddev": 0.007326880220399501,
"median": 0.29630088968,
"user": 0.20000694000000002,
"system": 0.49474534,
"min": 0.28821867118000005,
"max": 0.3143078441800001,
"times": [
0.29170738718000006,
0.28821867118000005,
0.29710808318000004,
0.29939608218,
0.29825761718000005,
0.3143078441800001,
0.30001638818000004,
0.29549369618000004,
0.29306290718000005,
0.29031349218
]
},
{
"command": "pnpr@main",
"mean": 0.3044823521800001,
"stddev": 0.008795761959015916,
"median": 0.30326857618,
"user": 0.18073073999999997,
"system": 0.5142743399999999,
"min": 0.29519792118000004,
"max": 0.31863373518000004,
"times": [
0.31863373518000004,
0.29541876618000007,
0.30255557818000006,
0.30492089118000004,
0.29519792118000004,
0.31448963218000003,
0.31525001018000004,
0.29789854918,
0.29647686418,
0.30398157418000005
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.18276893106000003,
"stddev": 0.00335205807690214,
"median": 0.18174633486000003,
"user": 0.16551002666666664,
"system": 0.08445468666666667,
"min": 0.17735230886000003,
"max": 0.19031852686000003,
"times": [
0.18284605786000002,
0.18413857986,
0.17735230886000003,
0.18174633486000003,
0.18647600886000001,
0.18136899586000002,
0.17983986886000003,
0.18066239686000002,
0.17961560886000003,
0.18552457486,
0.19031852686000003,
0.18679613186000002,
0.18259542086000002,
0.18139588786000002,
0.18085726286000003
]
},
{
"command": "pacquet@main",
"mean": 0.18605782219333333,
"stddev": 0.006473569519374859,
"median": 0.18600069786000004,
"user": 0.16594555999999996,
"system": 0.08836328666666665,
"min": 0.17713838686000002,
"max": 0.20183769586000003,
"times": [
0.19030207586000003,
0.18693532686000003,
0.20183769586000003,
0.18828163086000002,
0.17795868486000002,
0.17713838686000002,
0.18529358686000003,
0.18084550486000003,
0.18596167186000004,
0.18621543986000003,
0.18001174786000002,
0.19222330986000002,
0.18016782486000002,
0.18600069786000004,
0.19169374786
]
},
{
"command": "pnpr@HEAD",
"mean": 0.0897091521725,
"stddev": 0.002707440597028367,
"median": 0.09044987586,
"user": 0.020638366249999995,
"system": 0.012109395,
"min": 0.08540777086000001,
"max": 0.09576008686000001,
"times": [
0.08815506686,
0.09175859186,
0.09112213886000001,
0.09284150686,
0.08870678086,
0.08992822086,
0.08641699186,
0.08540777086000001,
0.09218264886000001,
0.09576008686000001,
0.08669376886,
0.09163831486,
0.09189571986,
0.09000337786000001,
0.09199369986,
0.09099381386000001,
0.09370359686,
0.08892030586,
0.08619678286,
0.09155303586,
0.08642839686,
0.08617934486,
0.09146314486000001,
0.08645075386000001,
0.09044353186000001,
0.09175133286,
0.09158854386000001,
0.09045621986,
0.08584979986,
0.09065334186,
0.08651514986,
0.08704108786
]
},
{
"command": "pnpr@main",
"mean": 0.09076273708580646,
"stddev": 0.0033522960614069163,
"median": 0.09098344786000001,
"user": 0.02040641161290323,
"system": 0.012717536129032255,
"min": 0.08611815586,
"max": 0.10265305686000001,
"times": [
0.09155933886,
0.08892310586,
0.08656844286000001,
0.08678452286,
0.09017004886,
0.10265305686000001,
0.09082754686000001,
0.08934669386,
0.08722421986000001,
0.08734703886,
0.08744137886,
0.09035356186,
0.09255983786000001,
0.09104651286000001,
0.08809340886,
0.09254931786000001,
0.08611815586,
0.09145630886,
0.09144406786,
0.09098344786000001,
0.09315023386,
0.09771598286000001,
0.08826476986000001,
0.09099431286000001,
0.09115628686,
0.09136166286000001,
0.09105197986,
0.09503793586,
0.08899905986000001,
0.09033314586,
0.09212946486000001
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.5956824455911114,
"stddev": 0.2601557744624836,
"median": 1.53606121248,
"user": 1.4915673822222222,
"system": 0.2289361155555555,
"min": 1.27184578448,
"max": 2.10547408148,
"times": [
1.7667936324800002,
1.4000990564800002,
1.37679726448,
1.27184578448,
1.7879591974800002,
1.65263744748,
1.53606121248,
2.10547408148,
1.4634743334800002
]
},
{
"command": "pacquet@main",
"mean": 1.7973308509244446,
"stddev": 0.4591837226970484,
"median": 1.66844449348,
"user": 1.6746047155555557,
"system": 0.2491724488888889,
"min": 1.32826681948,
"max": 2.5434085204800003,
"times": [
2.5434085204800003,
2.0325727914800003,
1.53482649648,
1.3681222964800002,
1.79351875948,
1.4355620234800002,
1.32826681948,
1.66844449348,
2.4712554574800003
]
},
{
"command": "pnpm@HEAD",
"mean": 3.0015650730355556,
"stddev": 0.20496192459852058,
"median": 2.89589282848,
"user": 4.240982382222223,
"system": 0.30717455999999993,
"min": 2.82241931748,
"max": 3.35683851448,
"times": [
3.35683851448,
2.91770855748,
3.19808264948,
2.8544148754800003,
2.85865225948,
2.86379374948,
2.89589282848,
2.82241931748,
3.24628290548
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.515280160960001,
"stddev": 0.15355636708749756,
"median": 4.43524681616,
"user": 1.7487802199999998,
"system": 1.4387636399999997,
"min": 4.40439294316,
"max": 4.83969668016,
"times": [
4.42109664016,
4.41365174216,
4.40439294316,
4.83969668016,
4.43258960316,
4.49552119116,
4.43790402916,
4.74751198316,
4.42604454816,
4.53439224916
]
},
{
"command": "pacquet@main",
"mean": 4.59729464406,
"stddev": 0.1897130718172032,
"median": 4.5176641791600005,
"user": 1.76127142,
"system": 1.4261948400000002,
"min": 4.40792307716,
"max": 4.88315910716,
"times": [
4.49651467216,
4.40792307716,
4.44019863916,
4.79859440916,
4.72683385116,
4.88315910716,
4.82630426016,
4.53881368616,
4.41084891816,
4.44375582016
]
},
{
"command": "pnpr@HEAD",
"mean": 3.5075660291600004,
"stddev": 0.12135633153460529,
"median": 3.47909009766,
"user": 1.3149868200000001,
"system": 1.18423454,
"min": 3.43950947216,
"max": 3.84577993216,
"times": [
3.48426318816,
3.47391700716,
3.48816614616,
3.51410192816,
3.43950947216,
3.44542300516,
3.48963800316,
3.44461289916,
3.45024871016,
3.84577993216
]
},
{
"command": "pnpr@main",
"mean": 3.50496756036,
"stddev": 0.08560304960232624,
"median": 3.45734438866,
"user": 1.29302532,
"system": 1.2153613399999998,
"min": 3.44197718316,
"max": 3.70176734216,
"times": [
3.54975253216,
3.70176734216,
3.44197718316,
3.45801745116,
3.45348543716,
3.45667132616,
3.59432792016,
3.4518032441599997,
3.44934813416,
3.4925250331599997
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13562 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,430.65 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 288.22 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 289.67 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 85.41 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,349.63 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,439.51 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 261.38 ms |
Summary
resolve_dependency_tree.rswas 4,037 lines — the largest file inresolving-deps-resolverand the same shaperesolve_peers.rswas in before#13551. It combined the public options/error types, the shared
workspace context, the per-importer tree context, the recursive walk, node
reuse and children-ownership bookkeeping, lockfile-snapshot reuse checks,
catalog specifier resolution, and manifest extraction.
Same pattern as #13551: the file stays as the facade and the
implementation moves under
resolve_dependency_tree/.resolve_dependency_tree.rsworkspace_ctx.rsWorkspaceTreeCtx, the shared dedup maps, children-ownership claim/handoverwalk.rsreuse.rsReuseSource, the update scope, direct-dep change bookkeeping, subtree-reuse predicates, snapshot-driven walktree_ctx.rsTreeCtxand the per-edgeResolveOptionsderivationsmanifest.rscatalogs.rscatalog:specifier resolutionThe boundaries follow the dependency graph rather than the line ranges the
issue sketched. Two deviations worth calling out: the importer direct-dep
bookkeeping (
record_changed_direct_deps,record_direct_dep_versions,higher_direct_dep_version) went toreuse.rsbecause it exists only to feedthe reuse gates, and
build_pkg_id_with_patch_hashwent tomanifest.rsbecause it derives the id from
name_ver/ the manifest.Invariants
allocation, cloning, dispatch, or traversal change. Release builds use
lto = "fat"withcodegen-units = 1, so the module boundaries cannot shiftinlining either.
TreeCtxandWorkspaceTreeCtxstay one structeach with their inherent impls divided across modules; cross-module items are
pub(super), so they stay private toresolve_dependency_tree. Nopub/pub(crate)item was widened.pub(super)surface was derived mechanically, as refactor(resolving-deps-resolver): split resolve_peers into focused modules #13551recommended: every marker was stripped and the compiler re-added only the
ones the crate cannot compile without (59 → 25 → 6 → 0 names over three
rounds).
Proof of movement
No implementation line changed. Comparing the multiset of executable source
lines before and after — normalizing away imports, module declarations,
visibility markers and comments — the only differences are:
rustfmtre-wrapped becausepub(super)pushed them pastthe width, and
engines-runtime fixture now calls
test_support::manifest_resultinstead ofrepeating a
ResolveResultliteral identical to it in every field but themanifest.
Every one of the 46 test functions is preserved; only their module paths
changed. No stranded doc comments turned up this time (#13551 had two).
Comments
The only new prose is one
//!per new module, in the shape #13551established — a module has no name or signature to carry its contract. Two
first drafts were dropped again for restating documentation that already
exists: the facade's
//!(the crate-level docs inlib.rsalready describethe tree pass, and rustdoc renders the module index with each submodule's own
first line, so the module tour paraphrased the thing directly below it), and a
paragraph in
reuse.rsthat inventoried which functions live there.Co-locating each test with the item it exercises — they used to sit up to
~3,200 lines apart — also exposed six pre-existing doc comments that walk
through scenarios the tests below now state by name. Those are trimmed to the
contract plus the non-obvious why (34 net lines), since tests are the
documentation for behavior and prose repeating them reads as missing coverage.
The clearest case:
is_update_targetenumerated four outcomes that the tentests in
mod is_update_targeteach name outright. Details in the commit.Everything else is moved verbatim.
Intra-doc links
Twenty-three doc links broke where the item they name moved into a sibling
module. They are repointed with reference-style link definitions, so the prose
lines stay unchanged. Three named a helper that is private to another module
and so is not nameable from a sibling at all (
walk::fallback_manifest,walk::overlay_lookup_names,reuse::subtree_fully_reusable); those becameplain code spans rather than widening the helpers' visibility for a link.
Worth flagging for a separate fix: only
Rust CI / Doccatches this class ofbreakage, because it passes
--document-private-items. Thepre-pushhook runscargo doc --no-deps --workspace --all-featureswithout that flag, so it cannotsee a broken link on a private item — the divergence is why this surfaced in CI
rather than locally.
Tests
Unit tests that drive one module's internals moved next to it
(
workspace_ctx/tests.rs,walk/tests.rs,reuse/tests.rs,manifest/tests.rs), with the sharedResolveResultbuilder lifted into atest_supportmodule. The end-to-end tree-walk test stays at the facade.just readypasses: 7,541 tests, 0 failures.cargo docwas re-run withtarget/doccleared so the intra-doc-link check was not served from cache.Closes #13554.
Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.(pacquet-only internal module reorganization — no user-visible surface and
no TypeScript counterpart, as the issue states.)
existing tests are preserved and moved next to the module they exercise.)
Written by an agent (Claude Code, claude-opus-5[1m]).
Summary by CodeRabbit
New Features
Bug Fixes
Tests