feat(pacquet): attach patch hashes to resolved pkg ids#11791
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)pacquet/**/*.rs📄 CodeRabbit inference engine (pacquet/AGENTS.md)
Files:
🧠 Learnings (2)📚 Learning: 2026-05-20T19:40:55.051ZApplied to files:
📚 Learning: 2026-05-20T23:07:58.444ZApplied to files:
🔇 Additional comments (7)
📝 WalkthroughWalkthroughThis PR wires pnpm's ChangesPatch resolution and application
Sequence DiagramsequenceDiagram
participant InstallWithoutLockfile
participant pacquet_patching
participant ResolveImporter
participant TreeCtx
participant ResolveDependencyTree
participant ResolvedTree
InstallWithoutLockfile->>pacquet_patching: resolve_patched_dependencies
pacquet_patching-->>InstallWithoutLockfile: PatchGroupRecord or Error
InstallWithoutLockfile->>ResolveImporter: set patched_dependencies
ResolveImporter->>TreeCtx: with_patched_dependencies
TreeCtx->>ResolveDependencyTree: walk nodes
ResolveDependencyTree->>TreeCtx: build_pkg_id_with_patch_hash
ResolveDependencyTree->>ResolvedTree: produce resolved tree
🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs:
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Micro-Benchmark ResultsLinux |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Thread `patchedDependencies` into the tree walker so each matched package's `pkgIdWithPatchHash` gains the `(patch_hash=<hash>)` suffix upstream's `resolveDependencies.ts` produces. The peer resolver concatenates the peer suffix onto the patched id, so the install layer's depPath-keyed lookups land on the patched virtual-store slot without further changes. Surfaces `ResolvedTree::applied_patches` for the post-walk `ERR_PNPM_UNUSED_PATCH` check, and propagates `ERR_PNPM_PATCH_KEY_CONFLICT` from `get_patch_info` through the resolver error surface.
The two `pub` items pointed at `resolve_node`, which is private — fine under `--document-private-items` but rejected when CI runs `cargo doc` with `-D rustdoc::private-intra-doc-links`. Rephrase to plain prose; the call site is obvious from the surrounding context.
Dylint's `perfectionist::macro_trailing_comma` rejects a trailing comma on a single-line macro invocation.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11791 +/- ##
=======================================
Coverage 87.40% 87.40%
=======================================
Files 198 198
Lines 23081 23119 +38
=======================================
+ Hits 20173 20208 +35
- Misses 2908 2911 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Scenario: Frozen Lockfile
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.39203637396,
"stddev": 0.04235123621870255,
"median": 2.38906087526,
"user": 2.7293383399999995,
"system": 3.7284531199999997,
"min": 2.3195400997599998,
"max": 2.47317259976,
"times": [
2.39880246076,
2.43131172576,
2.40201159876,
2.37931928976,
2.37054934176,
2.47317259976,
2.41313627076,
2.35580640876,
2.3195400997599998,
2.37671394376
]
},
{
"command": "pacquet@main",
"mean": 2.41299451416,
"stddev": 0.051862667021599966,
"median": 2.40556182126,
"user": 2.7080303399999996,
"system": 3.6974539199999996,
"min": 2.32699536476,
"max": 2.51202276976,
"times": [
2.4547949287599997,
2.36994820276,
2.45651773176,
2.38971373576,
2.51202276976,
2.38558387276,
2.42324489276,
2.40462670076,
2.32699536476,
2.40649694176
]
},
{
"command": "pnpm",
"mean": 4.825326063660001,
"stddev": 0.06331963561203664,
"median": 4.81030275576,
"user": 8.14648884,
"system": 4.21497802,
"min": 4.7395447207600006,
"max": 4.941348056760001,
"times": [
4.777850029760001,
4.7395447207600006,
4.78880660276,
4.831132359760001,
4.897916982760001,
4.840549927760001,
4.7740812337600005,
4.78947315176,
4.941348056760001,
4.872557570760001
]
}
]
}Scenario: Frozen Lockfile (Hot Cache)
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6875353973000001,
"stddev": 0.025236436406210778,
"median": 0.6802416312,
"user": 0.39243204,
"system": 1.56175918,
"min": 0.6654421787,
"max": 0.7544787167,
"times": [
0.7544787167,
0.6787467077,
0.6741226357,
0.6743591347,
0.6817365547,
0.6941768937,
0.6950901037,
0.6654421787,
0.6742906237,
0.6829104237
]
},
{
"command": "pacquet@main",
"mean": 0.7067191785,
"stddev": 0.059722988163716774,
"median": 0.6836056511999999,
"user": 0.37288354,
"system": 1.56221788,
"min": 0.6642020377,
"max": 0.8493336127,
"times": [
0.7721672327,
0.6715828447,
0.6956284577,
0.6709565787,
0.6642020377,
0.6969589797,
0.8493336127,
0.7092768587,
0.6655218707,
0.6715633117
]
},
{
"command": "pnpm",
"mean": 2.5762384227000004,
"stddev": 0.09643510802418613,
"median": 2.5632368352,
"user": 3.2212885399999998,
"system": 2.2468199799999997,
"min": 2.4461038007,
"max": 2.7953722467,
"times": [
2.6583593487,
2.5636903517,
2.5666748777,
2.7953722467,
2.5192518727,
2.5627833187,
2.5176520907,
2.4461038007,
2.6146717087,
2.5178246107
]
}
]
} |
Summary
patchedDependencies(already parsed and hashed bypacquet-patching) into the resolver's tree walker so every matched package'spkgIdWithPatchHashcarries the(patch_hash=<hash>)suffix upstream'sresolveDependencies.ts:1502-1507produces.ResolvedTree::applied_patchesfor the post-walkERR_PNPM_UNUSED_PATCHcheck, and propagatesERR_PNPM_PATCH_KEY_CONFLICTfromget_patch_infothrough the resolver's error surface.install_without_lockfileto pullconfig.resolved_patched_dependencies()and hand it to the resolver.The peer-resolution stage already concatenates the peer suffix onto
pkg.id, so the patched id flows naturally into theDepPathkeys the install layer consumes — the installer picks the patched virtual-store slot without further changes.Test plan
pacquet-resolving-deps-resolvercovering exact match, range match, unused patch, andERR_PNPM_PATCH_KEY_CONFLICT.cargo check --locked --workspace --all-targetscargo clippy --locked --workspace --all-targets -- --deny warningscargo nextest run— 1835/1835 passingcargo fmt --checkpatchedDependenciesentry against the mocked registry — the existing frozen-lockfile path already covers this viainstall_frozen_lockfile.rs; the without-lockfile path now uses the sameresolved_patched_dependencies()source.Written by an agent (Claude Code, claude-opus-4-7).
Summary by CodeRabbit
New Features
Tests