Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughFast update paths now validate configured patches after dependency removal and lockfile composition. Unapplied patches trigger resolution fallback unless unused patches are allowed. Rust and TypeScript tests cover removal, retained reachability, and allowed unused patches. ChangesPatched dependency validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Assessment against linked issues
Suggested labels: Sequence Diagram(s)sequenceDiagram
participant Install
participant FastUpdateHandlers
participant PatchValidation
participant Resolver
Install->>FastUpdateHandlers: compose dependency and graph updates
FastUpdateHandlers-->>Install: return candidate lockfile
Install->>PatchValidation: validate configured patches
PatchValidation-->>Install: return validation result
Install->>Resolver: fall back when a patch is unapplied
✨ 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 |
PR Summary by QodoFix fast lockfile updates that leave patchedDependencies entries unused
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (7): Last reviewed commit: "style(package-manager): drop the needles..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
|
Caution CodeRabbit couldn't update its existing comment. The review summary may be out of date. Error details |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13828 +/- ##
=======================================
Coverage 88.23% 88.24%
=======================================
Files 625 625
Lines 102801 102847 +46
=======================================
+ Hits 90710 90756 +46
Misses 12091 12091 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts (1)
272-324: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd composed-update coverage for widened
ignoredOptionalDependencies.The added cases exercise importer and override removals. They do not exercise the required optional-dependency removal path.
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts#L272-L324: add adrift.ignoredOptionalDependenciescase that removes the final patched package edge.pnpm/crates/package-manager/src/fast_update_compose/tests.rs#L220-L251: add the equivalent pacquet regression case.The PR objective explicitly requires coverage for widened
ignoredOptionalDependencies.🤖 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 `@pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts` around lines 272 - 324, Add composed-update regression coverage for removing the final patched package edge through drift.ignoredOptionalDependencies in pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts, asserting the update falls back when unused patches are disallowed; add the equivalent pacquet regression case in pnpm/crates/package-manager/src/fast_update_compose/tests.rs. Preserve the existing importer and override removal cases.
🤖 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.
Inline comments:
In @.changeset/unused-patch-after-removal.md:
- Line 7: Update the changeset description to accurately state that configured
patchedDependencies entries remain during fast updates; when the fast path
detects an unused patch, it falls back to full resolution, which reports the
applicable error or warning.
In
`@pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts`:
- Around line 75-85: Do not let allowUnusedPatches bypass resolution when a
configured patch is unapplied: update tryFastUpdatePatchedDependencies.ts (lines
75-85) and fast_update_patched_dependencies.rs (lines 257-274) to detect the
missing applied patch and return false/None. Update
patchedDependenciesFastUpdate.ts (lines 316-324) and
fast_update_compose/tests.rs (lines 237-250) to expect fast-update composition
to decline, and add coverage that resolution emits the unused-patch warning.
---
Nitpick comments:
In
`@pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts`:
- Around line 272-324: Add composed-update regression coverage for removing the
final patched package edge through drift.ignoredOptionalDependencies in
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts,
asserting the update falls back when unused patches are disallowed; add the
equivalent pacquet regression case in
pnpm/crates/package-manager/src/fast_update_compose/tests.rs. Preserve the
existing importer and override removal cases.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c83a8346-bb06-4fc8-9aa0-39e69f311ccf
📒 Files selected for processing (7)
.changeset/unused-patch-after-removal.mdpnpm/crates/package-manager/src/fast_update_compose.rspnpm/crates/package-manager/src/fast_update_compose/tests.rspnpm/crates/package-manager/src/fast_update_patched_dependencies.rspnpm11/installing/deps-installer/src/install/tryComposeFastUpdates.tspnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.tspnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts
Code Review by Qodo
1. Redundant unused-patch scan
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Code review by qodo was updated up to the latest commit 5f010b9 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
Duplicate patch file hashing — fixed (29618e8). Correct: (The review lists this twice, as findings 1 and 2; they are the same finding and Written by an agent (Claude Code, claude-opus-5). |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs`:
- Around line 260-264: Update the fast-update guard around allow_unused_patches
and the hashes filter so unused patches fall back to full resolution instead of
returning true; preserve the existing fast path when all patches are used. Apply
the equivalent change in the TypeScript allowUnusedPatches implementation, and
add parity tests covering unused-patch warnings in both Rust and TypeScript.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 38986011-a650-4c29-af3f-5edaba4244c0
📒 Files selected for processing (2)
pnpm/crates/package-manager/src/fast_update_compose.rspnpm/crates/package-manager/src/fast_update_patched_dependencies.rs
|
Code review by qodo was updated up to the latest commit 29618e8 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pnpm/crates/cli/tests/suite/lockfile_resolution_reuse.rs (1)
1721-1816: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMove the add-command tests to a separate change.
These tests cover locked-version reuse for
add. They do not exercise unused-patch validation, warnings, or patch lockfile behavior. Keep this PR limited to the stated unused-patch fix.As per path instructions, “Keep the PR narrowly scoped.”
🤖 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/cli/tests/suite/lockfile_resolution_reuse.rs` around lines 1721 - 1816, Remove the add_command_reuses_a_locked_version_without_resolving and add_command_resolves_a_version_the_lockfile_does_not_hold tests from this change. Keep the PR scoped to the unused-patch fix, including only tests covering unused-patch validation, warnings, or patch lockfile behavior.Source: Path instructions
🤖 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.
Inline comments:
In `@pnpm/crates/package-manager/src/install/lockfile_freshness.rs`:
- Around line 55-57: Update check_lockfile_freshness and the surrounding
fast-update flow to compute Config::patched_dependency_hashes() once before
candidate composition, then reuse that snapshot for composition, freshness
validation, and fast_update_patched_dependencies::unused_patches instead of
reading the patch files again.
---
Nitpick comments:
In `@pnpm/crates/cli/tests/suite/lockfile_resolution_reuse.rs`:
- Around line 1721-1816: Remove the
add_command_reuses_a_locked_version_without_resolving and
add_command_resolves_a_version_the_lockfile_does_not_hold tests from this
change. Keep the PR scoped to the unused-patch fix, including only tests
covering unused-patch validation, warnings, or patch lockfile behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0ebe40a0-794d-4d23-8f08-246945a80356
📒 Files selected for processing (8)
.changeset/unused-patch-after-removal.mdpnpm/crates/cli/tests/suite/lockfile_resolution_reuse.rspnpm/crates/package-manager/src/fast_update_patched_dependencies.rspnpm/crates/package-manager/src/install/lockfile_freshness.rspnpm/crates/package-manager/src/install/run.rspnpm11/installing/deps-installer/src/install/index.tspnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.tspnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- .changeset/unused-patch-after-removal.md
The unused-patch report added a third read-and-hash of every configured patch file to a successful fast update, on top of the composition's and the freshness check's. The caller now takes that snapshot once and hands it to the pipeline, leaving the flow with the two it had before this branch. Passing the hashes in also puts the failure in one place: an unreadable patch file declines the attempt, where computing them per consumer left each free to read `Err` as "none configured" instead.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
Code review by qodo was updated up to the latest commit cef6769 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Summary
A patch whose last dependent is dropped has nothing left to apply to.
verifyPatchesruns from the resolver, so the composed fast-update pipelinewas the only path that could reach that state and not report it — it wrote a
lockfile whose
patchedDependenciesnamed a package it had just pruned, wherea resolution raises
ERR_PNPM_UNUSED_PATCH:The check already existed, but only inside the patched-dependencies handler,
which runs only when the patch configuration itself drifted. A removal is
exactly a run where it did not, so all three removal shapes were affected: a
dependency dropped from a manifest, a widened
ignoredOptionalDependencies,and a removal override.
It now runs over the settled graph at the end of the pipeline, after every
handler's removals are pruned, in both stacks.
allowUnusedPatcheskeeps itsexisting meaning — it downgrades the error to a warning the resolution emits,
and as elsewhere in these handlers a warning alone is not worth a full
resolution.
Both new tests were confirmed to fail against the unfixed source, so they pin
the behaviour rather than passing either way.
Closes #13827.
Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit