Repository navigation
fix(install): ignore stale pnpm patch entries - #1022
Conversation
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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 |
Greptile SummaryThis PR fixes a bug where stale
Confidence Score: 4/5Safe to merge; the change is narrowly scoped to the pnpm re-resolve path and is backed by two new end-to-end tests exercising both stale-entry shapes. The logic is straightforward: one conditional that replaces at most one field on the graph object, only on the non-frozen pnpm re-resolve path. The read_patched_dependencies function is already well-exercised by existing unit tests, and the new bats tests cover the exact failure mode being fixed. The one edge worth noting is that the override fires even when the overlay_metadata_from branches were both skipped (e.g. lockfile parse failure), but in that case the graph's patch map would be empty and the manifest read is the correct thing to do anyway. No files require special attention; both changed files are focused and self-contained. Important Files Changed
Reviews (1): Last reviewed commit: "fix(install): ignore stale pnpm patch en..." | Re-trigger Greptile |
Summary
Root cause
Fresh resolution produced an empty patch map, then
overlay_metadata_fromrestored every patch entry from the prior lockfile. Materialization merged those stale entries with current declarations and eagerly read both keys, even when the stale package version was no longer in the resolved graph.Fixes the bug reported in Discussion #1019.
Validation
mise run test:bats test/patch.batscargo fmt --checkcargo clippy -p aube --all-targets -- -D warningsThis PR was generated by Codex.
Note
Medium Risk
Touches install graph state for pnpm patch metadata on the re-resolve path; behavior change is intentional but could affect edge cases where users relied on lockfile-only patch entries without manifest declarations.
Overview
After a non-frozen install re-resolves because the lockfile no longer matches the manifest,
overlay_metadata_fromcould copypatchedDependenciesfrom the oldpnpm-lock.yaml, so removed or wrong-version patches were still applied and written back.For projects that already use a pnpm lockfile, the fresh-resolve path now replaces
graph.patched_dependencieswithread_patched_dependenciesfrom the currentpackage.json/ workspace yaml. Materialization and the rewritten lockfile follow today’s patch declarations only, and pnpm 11 hash-only scalars are not treated as patch file paths.Bats coverage was added for stale lockfile entries (object
pathform and hash-only form) while the workspace still declares a patch for the resolved version.Reviewed by Cursor Bugbot for commit 775089f. Bugbot is set up for automated code reviews on this repo. Configure here.