Repository navigation
feat(pacquet): support recursive outdated queries - #13202
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:
📝 WalkthroughWalkthroughChangesRecursive workspace queries
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant Workspace
participant Lockfiles
participant PackumentCache
participant Output
CLI->>Workspace: Resolve selected projects
Workspace-->>CLI: Workspace projects and configuration
CLI->>Lockfiles: Load shared or project lockfiles
Lockfiles-->>CLI: Dependency lock data
CLI->>PackumentCache: Fetch package metadata
PackumentCache-->>CLI: Cached package metadata
CLI->>Output: Render aggregated outdated packages and dependents
Possibly related issues
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 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 Qodopacquet: make
AI Description
Diagram
High-Level Assessment
Files changed (7)
|
Confidence Score: 5/5This looks safe to merge.
Reviews (6): Last reviewed commit: "fix(cli): handle non-UTF-8 outdated path..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
pnpm/crates/cli/src/cli_args/outdated.rs (1)
431-489: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoffSequential per-project registry checks in the recursive loop.
Each iteration of the
for (project_dir, node) in &selection.selectedloop awaitscollect_outdated_for_importerbefore moving to the next project, serializing registry lookups across the whole workspace. For workspaces with many packages this could add up; consider running these concurrently (e.g.futures::stream::iter(...).buffer_unordered(n)) once correctness in the aggregation/rendering (see above) is settled.🤖 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/src/cli_args/outdated.rs` around lines 431 - 489, Update the per-project processing in the loop over selection.selected to run collect_outdated_for_importer concurrently, using the project’s lockfile, importer_id, and dependent metadata as each task’s result. Buffer concurrency with the established limit or an appropriate bounded value, then perform the existing outdated_indexes aggregation after results complete so output grouping and rendering remain unchanged.
🤖 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/cli/src/cli_args/outdated.rs`:
- Around line 402-502: Thread self.sort_by through run_recursive into
sort_workspace_outdated, updating its signature and the compare_outdated call so
recursive output honors the requested sorting. Preserve the existing default
ordering when no sort option is provided.
- Around line 446-458: Update the missing-lockfile error in the lockfile
selection flow around config.shared_workspace_lockfile and the shared_lockfile
binding to report workspace_root for shared-lockfile workspaces, while retaining
project_dir for project-specific lockfiles. Ensure the error path passes the
directory corresponding to the lockfile that was actually attempted.
- Around line 803-831: Update render_recursive_json so entries with the same
package name but different current versions or dependencyType values are not
overwritten by map.insert. Use a composite identity consistent with
run_recursive, or group each package name’s values in an array, while preserving
the existing JSON fields and long-mode latestManifest data for every workspace
entry.
---
Nitpick comments:
In `@pnpm/crates/cli/src/cli_args/outdated.rs`:
- Around line 431-489: Update the per-project processing in the loop over
selection.selected to run collect_outdated_for_importer concurrently, using the
project’s lockfile, importer_id, and dependent metadata as each task’s result.
Buffer concurrency with the established limit or an appropriate bounded value,
then perform the existing outdated_indexes aggregation after results complete so
output grouping and rendering remain unchanged.
🪄 Autofix (Beta)
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: 2eaf9a3a-6aa1-4e83-8967-ebaa6d0853f4
📒 Files selected for processing (7)
.changeset/recursive-outdated-queries.mdpnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/outdated.rspnpm/crates/cli/src/cli_args/tests.rspnpm/crates/cli/src/lib.rspnpm/crates/cli/tests/list.rspnpm/crates/cli/tests/outdated.rs
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13202 +/- ##
==========================================
+ Coverage 86.68% 86.78% +0.10%
==========================================
Files 523 525 +2
Lines 87948 89206 +1258
==========================================
+ Hits 76238 77421 +1183
- Misses 11710 11785 +75 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Addressed the actionable summary-only performance feedback in
The target-grouping, recursive JSON-keying, and recursive Written by an agent (Codex, GPT-5). |
|
Code review by qodo was updated up to the latest commit c175291 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pnpm/crates/cli/src/cli_args/outdated.rs (1)
183-233: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winFetch failures are cached forever in the shared
PackumentCache, silently poisoning results for every other workspace project.
fetch_package_cachedstores whateverPackage::fetch_from_registry(...).ok()returns — includingNoneon any error (timeout, 5xx, connection reset, not just a genuine 404) — inside theOnceCellfor the(registry, package_name)key. Previously eachcollect_outdated_for_importercall got its own throwawayPackumentCache::default(), so a fetch failure only affected that one project's single call. Now, inrun_recursive, onepackument_cacheis shared across every selected workspace project for the whole command run (line 482), so a single transient failure fetching a commonly-depended-on package will permanently suppress that package from the aggregated outdated report for all other projects that depend on it during this run — with no retry.🔧 Proposed fix: don't let a failed fetch permanently poison the cache
async fn fetch_package_cached( cache: &PackumentCache, package_name: &str, http_client: &ThrottledClient, registry: &str, auth_headers: &pacquet_network::AuthHeaders, ) -> Option<Arc<Package>> { let key = (registry.to_string(), package_name.to_string()); let entry = { let mut cache = cache.lock().expect("packument cache mutex poisoned"); - Arc::clone(cache.entry(key).or_default()) + Arc::clone(cache.entry(key.clone()).or_default()) }; - entry + let result = entry .get_or_init(|| async { Package::fetch_from_registry(package_name, http_client, registry, auth_headers) .await .ok() .map(Arc::new) }) .await - .clone() + .clone(); + if result.is_none() { + // Don't let one transient failure permanently poison the shared + // cache for every other project in this recursive run. + cache.lock().expect("packument cache mutex poisoned").remove(&key); + } + result }Concurrent callers that grabbed the same
OnceCellbefore eviction still coalesce onto the one in-flight request; eviction only affects later, non-concurrent lookups so they can retry.As per path instructions, REVIEW_GUIDE.md directs reviewers to "check changed network/registry/cache logic for cache-poisoning or trust-boundary mistakes (especially concurrent packument requests)."
🤖 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/src/cli_args/outdated.rs` around lines 183 - 233, Update fetch_package_cached so failed Package::fetch_from_registry results are not retained in the shared PackumentCache: only cache successful fetches, and evict the corresponding (registry, package_name) entry after an error or None result. Preserve OnceCell coalescing for callers already sharing an in-flight request, while allowing later lookups to retry transient failures.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.
Outside diff comments:
In `@pnpm/crates/cli/src/cli_args/outdated.rs`:
- Around line 183-233: Update fetch_package_cached so failed
Package::fetch_from_registry results are not retained in the shared
PackumentCache: only cache successful fetches, and evict the corresponding
(registry, package_name) entry after an error or None result. Preserve OnceCell
coalescing for callers already sharing an in-flight request, while allowing
later lookups to retry transient failures.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3e78dc47-5f6e-4f37-a5d6-8f302f49db76
📒 Files selected for processing (4)
pnpm/crates/cli/src/cli_args/outdated.rspnpm/crates/cli/src/cli_args/outdated/tests.rspnpm/crates/cli/src/cli_args/sanitize.rspnpm/crates/cli/tests/outdated.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- pnpm/crates/cli/tests/outdated.rs
|
Also addressed the new summary-only dedicated-lockfile performance finding in The repeated target-grouping observation remains intentionally aligned with the TypeScript recursive implementation, whose aggregation key is Written by an agent (Codex, GPT-5). |
Summary
pnpm outdated, including filters and both shared and dedicated lockfiles.pnpm list/lsandpnpm ll/larecursive by default inside workspaces, as they are in the TypeScript CLI.The TypeScript CLI already supports these behaviors, so this PR only changes the Rust implementation. This is a partial fix for the recursive-command parity audit; the remaining commands stay tracked in #13201.
Related to #13201.
Squash Commit Body
Checklist
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 (Codex, GPT-5).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
pnpm listandpnpm llnow run recursively by default within workspaces (standalone projects remain non-recursive).pnpm outdated --recursiveis now supported, aggregating workspace results and reporting dependents in table/list/JSON.outdatedbehavior and output ordering.outdateddependents/filtering, and cache deduplication/retry behavior.