Skip to content

feat(pacquet-cli): implement the pnpm view command - #13181

Merged
zkochan merged 5 commits into
pnpm:mainfrom
Safort:feat/pacquet-view
Jul 21, 2026
Merged

zkochan merged 5 commits into
pnpm:mainfrom
Safort:feat/pacquet-view

Conversation

@Safort

@Safort Safort commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Port the view command (aliases info, show, v) to pacquet: fetch a package's registry metadata and render a formatted summary, a JSON dump (--json), or selected dotted fields. When the package name is omitted, the nearest project manifest's name is used, searching upward from --dir.

Reuses the existing metadata-fetch stack (full-metadata fetch, pick_package_from_meta version selection, registry/auth resolution) and assembles the info object from the picked version's raw JSON fragment so registry key order is preserved in --json output. Error codes match pnpm: ERR_PNPM_MISSING_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_JSON, ERR_PNPM_PACKAGE_NOT_FOUND, ERR_PNPM_FETCH_404.

The TypeScript pnpm CLI already ships view, so this only adds the pacquet side; no TypeScript change is needed. Covers the view item under the Stage 3 command surface in #11633.

Tests: unit tests for the pure helpers (byte/time/field formatting) plus an integration suite that drives the built binary against a mockito registry, covering the upstream view scenarios. package.yaml name resolution is left as an ignored test — pacquet's project-manifest reader is package.json only today.

Summary

Implements the pnpm view command (aliases info, show, v) in the pacquet
Rust CLI. pacquet view [<pkg>[@<spec>]] [field...] fetches a package's registry
metadata and prints either a formatted summary, a JSON dump (--json), or
selected dotted fields (e.g. dist.shasum). When the package name is omitted,
the nearest project manifest's name is used, searching upward from --dir.

The TypeScript pnpm CLI already ships view, so this PR only adds the pacquet
side — no TypeScript change is required. It covers the view item in the Stage 3
command surface of the Rust roadmap (Related to #11633).

Behavior parity:

  • Version selection via pick_package_from_meta (exact / range / dist-tag).
  • The info object is assembled from the picked version's raw JSON fragment, so
    registry key order is preserved in --json output.
  • Error codes match pnpm: ERR_PNPM_MISSING_PACKAGE_NAME,
    ERR_PNPM_INVALID_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_JSON,
    ERR_PNPM_PACKAGE_NOT_FOUND, ERR_PNPM_FETCH_404.
  • Colors follow the existing if_supports_color convention (styling off when
    stdout is not a TTY).

Known limitation: package.yaml / package.json5 name resolution isn't
supported — pacquet's project-manifest reader is package.json-only today. The
corresponding upstream test is ported as an #[ignore]d test documenting the
gap.

Squash Commit Body

Port the `view` command (aliases `info`, `show`, `v`) to pacquet: fetch a
package's registry metadata and render a formatted summary, a JSON dump
(`--json`), or selected dotted fields. When the package name is omitted, the
nearest project manifest's name is used, searching upward from `--dir`.

Reuses the existing metadata-fetch stack (full-metadata fetch,
`pick_package_from_meta` version selection, registry/auth resolution) and
assembles the info object from the picked version's raw JSON fragment so
registry key order is preserved in `--json` output. Error codes match pnpm:
ERR_PNPM_MISSING_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_NAME,
ERR_PNPM_INVALID_PACKAGE_JSON, ERR_PNPM_PACKAGE_NOT_FOUND, ERR_PNPM_FETCH_404.

The TypeScript pnpm CLI already ships `view`, so this only adds the pacquet
side; no TypeScript change is needed. Covers the `view` item under the Stage 3
command surface in pnpm/pnpm#11633.

Tests: unit tests for the pure helpers (byte/time/field formatting) plus an
integration suite that drives the built binary against a mockito registry,
covering the upstream view scenarios. `package.yaml` name resolution is left
as an ignored test — pacquet's project-manifest reader is package.json only
today.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting. — The
    TypeScript CLI already ships view; this PR adds the pacquet side to reach
    parity.
  • Added or updated tests. — Unit tests for the pure helpers plus an
    integration suite (mockito registry) covering the upstream view.ts
    scenarios.
  • Updated the documentation if needed. — No documentation change needed.

Made with the help of Claude Code (claude-opus-4-8).


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Added pacquet view command (aliases info, show, v) to display registry package info with version resolution (exact, semver ranges, dist-tags).
    • Can infer the package name from the nearest package.json (supports -C/--dir).
    • Supports human-readable output or --json with dotted-path field selection; absent fields output nothing.
  • Bug Fixes
    • Improved CLI startup reliability by performing argument parsing on a larger stack across platforms.
  • Tests
    • Added unit and integration coverage for formatting helpers, dotted-path selection, --json shapes, and registry/error/version-resolution scenarios (including 404).

@Safort
Safort requested a review from zkochan as a code owner July 20, 2026 21:50
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds the pacquet view command and aliases, including manifest-based package resolution, registry metadata fetching, JSON and human-readable rendering, error handling, unit/integration coverage, and large-stack CLI startup execution.

Changes

View command

Layer / File(s) Summary
Command parsing and dispatch
pnpm/crates/cli/src/cli_args.rs, pnpm/crates/cli/src/cli_args/cli_command.rs, pnpm/crates/cli/src/cli_args/dispatch.rs, pnpm/crates/cli/src/cli_args/dispatch_query.rs, pnpm/crates/cli/src/cli_args/switch_cli_version.rs
Registers view, its info, show, and v aliases, dispatches it to the query handler, and maps its command name.
Manifest resolution and registry lookup
pnpm/crates/cli/src/cli_args/view.rs
Resolves package names from package.json, fetches and selects registry metadata, assembles package information, and maps fetch errors.
Field and summary rendering
pnpm/crates/cli/src/cli_args/view.rs, pnpm/crates/cli/src/cli_args/view/tests.rs
Renders selected fields, JSON output, and formatted summaries with metadata, time, byte, JSON, and color helpers.
CLI integration coverage
pnpm/crates/cli/tests/view.rs
Tests aliases, validation failures, registry resolution, field selection, summary output, scoped packages, and manifest discovery.

CLI startup stack

Layer / File(s) Summary
Large-stack CLI execution
pnpm/crates/cli/src/lib.rs
Runs synchronous CLI startup on a configured large-stack thread and propagates thread panics after joining.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant CliCommand
  participant QueryView
  participant ViewRun
  participant Registry
  CLI->>CliCommand: parse view arguments
  CliCommand->>QueryView: route ViewArgs
  QueryView->>ViewRun: resolve config and directory
  ViewRun->>Registry: fetch package metadata
  Registry-->>ViewRun: return packument
  ViewRun-->>CLI: render summary or selected output
Loading

Possibly related PRs

  • pnpm/pnpm#12852: Adds another CLI subcommand through the shared command parsing and dispatch infrastructure.
  • pnpm/pnpm#12884: Extends the shared CLI command and dispatch paths with additional subcommands.

Suggested labels: product: pacquet

Suggested reviewers: zkochan

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The view command is a read-only registry query with no install pipeline, so the blast radius of any remaining issue is limited to output formatting. The one known behavioral gap — multi-field --json with all-absent fields emitting {} instead of no output — was flagged in a prior review comment and has not yet been addressed.

The implementation is well-structured and the integration suite covers the main paths. The outstanding gap is in render_fields: when every requested field is absent and --json is set for a multi-field query, the function returns the pretty-printed empty object {} rather than an empty string, causing dispatch_query::view to print {} instead of producing no output. This contradicts how pnpm view behaves for absent fields and was raised in a prior review comment on this PR.

pnpm/crates/cli/src/cli_args/view.rs — specifically the multi-field JSON path in render_fields (around the to_pretty(&Value::Object(map)) return when the collected map is empty).

Reviews (8): Last reviewed commit: "docs(cli): clarify when view skips print..." | Re-trigger Greptile

Comment thread pnpm/crates/cli/src/cli_args/view.rs Resolved
Comment thread pnpm/crates/cli/src/cli_args/view.rs Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

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/tests/view.rs (1)

715-732: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove the ignored test.

As per path instructions, do not ignore failing tests; every failure must be investigated and fixed as part of the PR. Since package.yaml and package.json5 are not yet supported, please remove this test completely. It can be safely introduced in a future PR alongside the actual functionality implementation.

♻️ Proposed fix to remove the test
-#[test]
-#[ignore = "pacquet's project-manifest reader (pnpm_workspace::try_read_project_manifest) \
-            reads package.json only; package.yaml / package.json5 are not supported yet"]
-fn uses_package_yaml_name_when_package_omitted() {
-    let CommandTempCwd { root, workspace, .. } = CommandTempCwd::init();
-    let mut server = mockito::Server::new();
-    write_registry_npmrc(&workspace, &format!("{}/", server.url()));
-    fs::write(workspace.join("package.yaml"), "name: is-negative\n").expect("write package.yaml");
-    let mock = serve(&mut server, "/is-negative", &is_negative_body());
-    let auth_file = empty_auth_file(root.path());
-
-    let output = run_view(&workspace, &auth_file, &[]);
-
-    mock.assert();
-    assert!(stdout_of(&output).contains("is-negative"), "summary derived from package.yaml name");
-    drop((root, server));
-}
🤖 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/view.rs` around lines 715 - 732, Remove the ignored
test function uses_package_yaml_name_when_package_omitted and its associated
setup entirely; do not replace it with another ignored test, since package.yaml
support is not implemented.

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/cli/src/cli_args/view.rs`:
- Around line 463-465: In the documentation comment describing the
published-time line near the relevant view formatting code, replace
“unparseable” with the repository-approved spelling “unparsable”; leave the rest
of the comment unchanged.

---

Outside diff comments:
In `@pnpm/crates/cli/tests/view.rs`:
- Around line 715-732: Remove the ignored test function
uses_package_yaml_name_when_package_omitted and its associated setup entirely;
do not replace it with another ignored test, since package.yaml support is not
implemented.
🪄 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: b8e84deb-49e3-412c-a8d2-3aacbaec004d

📥 Commits

Reviewing files that changed from the base of the PR and between 5e6dd35 and fb9b44d.

📒 Files selected for processing (8)
  • pnpm/crates/cli/src/cli_args.rs
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args/dispatch.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/switch_cli_version.rs
  • pnpm/crates/cli/src/cli_args/view.rs
  • pnpm/crates/cli/src/cli_args/view/tests.rs
  • pnpm/crates/cli/tests/view.rs

Comment thread pnpm/crates/cli/src/cli_args/view.rs Resolved
@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: e5c74d06df20

Each scenario reports direct installs and pnpr installs. 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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.458 ± 0.104 2.355 2.631 1.64 ± 0.17
pacquet@main 2.641 ± 0.148 2.361 2.803 1.76 ± 0.20
pnpr@HEAD 1.532 ± 0.145 1.376 1.754 1.02 ± 0.14
pnpr@main 1.503 ± 0.146 1.338 1.738 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4581047168600003,
      "stddev": 0.10421026303831014,
      "median": 2.4146731717599996,
      "user": 1.4809921199999998,
      "system": 1.2865927,
      "min": 2.35473563976,
      "max": 2.63089482076,
      "times": [
        2.5203452077599997,
        2.39681848976,
        2.38160368476,
        2.60701025876,
        2.63089482076,
        2.37903391976,
        2.43252785376,
        2.35473563976,
        2.5224289297599998,
        2.35564836376
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6411405645599997,
      "stddev": 0.14780809593030736,
      "median": 2.64968455376,
      "user": 1.5095982199999998,
      "system": 1.3072912,
      "min": 2.36149390976,
      "max": 2.80274403376,
      "times": [
        2.64466537576,
        2.6129148547599996,
        2.80274403376,
        2.64447404576,
        2.77144824576,
        2.80150860376,
        2.69105328676,
        2.36149390976,
        2.42639955776,
        2.6547037317599997
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.53195776186,
      "stddev": 0.14486338414042707,
      "median": 1.46005573526,
      "user": 1.05179802,
      "system": 1.1590107,
      "min": 1.37574102576,
      "max": 1.75381110176,
      "times": [
        1.37574102576,
        1.67977557176,
        1.41492298976,
        1.63307279976,
        1.42529604476,
        1.75381110176,
        1.48095071476,
        1.7092277477600002,
        1.40761886676,
        1.4391607557600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.50327458526,
      "stddev": 0.14569312532220766,
      "median": 1.4611961767600001,
      "user": 1.0971381199999999,
      "system": 1.1211237,
      "min": 1.3381099757600001,
      "max": 1.73814599176,
      "times": [
        1.40132448876,
        1.5138091157600002,
        1.39605015676,
        1.4291766807600002,
        1.36598102276,
        1.65888258576,
        1.6980501617600001,
        1.3381099757600001,
        1.73814599176,
        1.4932156727600001
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 261.8 ± 10.8 251.6 290.2 1.01 ± 0.05
pacquet@main 260.3 ± 5.5 249.9 267.0 1.00
pnpr@HEAD 280.9 ± 11.7 264.9 298.1 1.08 ± 0.05
pnpr@main 268.1 ± 7.4 256.9 279.7 1.03 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.26179620006,
      "stddev": 0.010784839341376048,
      "median": 0.26003269396,
      "user": 0.20517124,
      "system": 0.5473961999999999,
      "min": 0.25163794295999997,
      "max": 0.29016612896,
      "times": [
        0.26524569196,
        0.25936872796,
        0.25901519296,
        0.25163794295999997,
        0.26069665996,
        0.25531054896,
        0.26092949796,
        0.25348210496,
        0.26210950396,
        0.29016612896
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.26025853296,
      "stddev": 0.00545449045634929,
      "median": 0.25908793546,
      "user": 0.21708163999999996,
      "system": 0.5326376999999999,
      "min": 0.24994262996000002,
      "max": 0.26696255496,
      "times": [
        0.25887613296,
        0.26480962196,
        0.26671521995999997,
        0.25929973796,
        0.25776587796,
        0.26472782896,
        0.25710485696,
        0.24994262996000002,
        0.26696255496,
        0.25638086796
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28088174146,
      "stddev": 0.011655444280430827,
      "median": 0.28111709446,
      "user": 0.21430164000000002,
      "system": 0.5571135,
      "min": 0.26493710096,
      "max": 0.29805817596,
      "times": [
        0.29176688396,
        0.27988861196,
        0.27006612196,
        0.26590122196,
        0.29805817596,
        0.28241785196,
        0.27835456195999997,
        0.26493710096,
        0.28234557696,
        0.29508130696
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26807307556,
      "stddev": 0.007439297797496131,
      "median": 0.26782045046,
      "user": 0.22898873999999997,
      "system": 0.5169857999999999,
      "min": 0.25692779496,
      "max": 0.27965806996,
      "times": [
        0.27227731296,
        0.27014313596,
        0.27965806996,
        0.27767162996,
        0.26191637196,
        0.26549776496,
        0.26120678796,
        0.25692779496,
        0.26361546996,
        0.27181641696
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.779 ± 0.028 2.738 2.821 1.73 ± 0.14
pacquet@main 2.793 ± 0.029 2.741 2.833 1.74 ± 0.14
pnpr@HEAD 1.651 ± 0.175 1.457 1.959 1.03 ± 0.14
pnpr@main 1.603 ± 0.128 1.454 1.844 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.77931212274,
      "stddev": 0.027772669005122843,
      "median": 2.78082824474,
      "user": 1.7110688800000002,
      "system": 1.32190072,
      "min": 2.73844501924,
      "max": 2.82098638224,
      "times": [
        2.7999443832399997,
        2.82098638224,
        2.77532565224,
        2.78512767824,
        2.74565864724,
        2.74878692924,
        2.79709852324,
        2.77652881124,
        2.73844501924,
        2.80521920124
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.79285912904,
      "stddev": 0.029038423878770432,
      "median": 2.78972104174,
      "user": 1.7385000800000001,
      "system": 1.3196480199999996,
      "min": 2.74138080024,
      "max": 2.83295129724,
      "times": [
        2.80451215524,
        2.83295129724,
        2.77539298824,
        2.74138080024,
        2.82778420924,
        2.7722806582399997,
        2.77415025424,
        2.78254744724,
        2.79689463624,
        2.82069684424
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.65066801774,
      "stddev": 0.17466590785407782,
      "median": 1.58723618324,
      "user": 1.23491028,
      "system": 1.34354812,
      "min": 1.45675398924,
      "max": 1.95930030024,
      "times": [
        1.45675398924,
        1.54341860224,
        1.4656045152400001,
        1.5302778062400002,
        1.8589211352400001,
        1.61384577924,
        1.8098717772400001,
        1.70805968524,
        1.95930030024,
        1.56062658724
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.60331011494,
      "stddev": 0.12804554160002882,
      "median": 1.5835353147400002,
      "user": 1.1644691800000002,
      "system": 1.21822922,
      "min": 1.4538248742400002,
      "max": 1.8439918652400002,
      "times": [
        1.4538248742400002,
        1.7266079062400002,
        1.5265074032400001,
        1.49224272424,
        1.5808970292400002,
        1.68882322424,
        1.8439918652400002,
        1.67450451924,
        1.4595280032400002,
        1.5861736002400002
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 637.0 ± 23.9 602.6 678.6 1.97 ± 0.09
pacquet@main 596.2 ± 30.9 563.4 645.2 1.85 ± 0.11
pnpr@HEAD 322.8 ± 8.9 311.8 339.5 1.00
pnpr@main 325.0 ± 8.9 315.5 343.9 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.63697360592,
      "stddev": 0.02387036851279574,
      "median": 0.6372680594200001,
      "user": 0.7899328599999998,
      "system": 0.67181642,
      "min": 0.6025609124200001,
      "max": 0.67855988142,
      "times": [
        0.6555140504200001,
        0.67855988142,
        0.61185921842,
        0.6025609124200001,
        0.6142121634200001,
        0.6548068934200001,
        0.6420637024200001,
        0.6520862684200001,
        0.6324724164200001,
        0.62560055242
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.59620986482,
      "stddev": 0.030923883778854147,
      "median": 0.5910519029200001,
      "user": 0.71967316,
      "system": 0.6584637199999998,
      "min": 0.56337822242,
      "max": 0.64523257842,
      "times": [
        0.64523257842,
        0.6043430164200001,
        0.56887111042,
        0.59454270742,
        0.6405255564200001,
        0.62193533442,
        0.56838719142,
        0.56732183242,
        0.56337822242,
        0.58756109842
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32275579292,
      "stddev": 0.008874006040836165,
      "median": 0.32076672092,
      "user": 0.20912385999999997,
      "system": 0.5671717199999999,
      "min": 0.31182452642,
      "max": 0.33953915842000004,
      "times": [
        0.33263839142,
        0.31711352142000004,
        0.31600384942000004,
        0.31853469742,
        0.32439208842000006,
        0.33953915842000004,
        0.31182452642,
        0.32972023542,
        0.32299874442000004,
        0.31479271642
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.32498543822000003,
      "stddev": 0.008858289874233687,
      "median": 0.32290954142000006,
      "user": 0.22316605999999997,
      "system": 0.5684155199999998,
      "min": 0.31554218242000004,
      "max": 0.34388054442000004,
      "times": [
        0.33048076242,
        0.31628007642000006,
        0.33071292842000005,
        0.32998065342000005,
        0.31991035842000004,
        0.32189982142,
        0.31724779342000003,
        0.31554218242000004,
        0.34388054442000004,
        0.32391926142000005
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.922 ± 0.019 1.885 1.947 5.90 ± 0.26
pacquet@main 1.916 ± 0.029 1.884 1.986 5.88 ± 0.27
pnpr@HEAD 0.329 ± 0.015 0.308 0.354 1.01 ± 0.06
pnpr@main 0.326 ± 0.014 0.295 0.338 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9222224681,
      "stddev": 0.018938264231303743,
      "median": 1.9201355116,
      "user": 0.9370754800000001,
      "system": 0.7895057799999999,
      "min": 1.8849275356000001,
      "max": 1.9472309556,
      "times": [
        1.9143790146000002,
        1.9074432516000002,
        1.8849275356000001,
        1.9234188276000002,
        1.9390084486,
        1.9444916826,
        1.9168521956,
        1.9472309556,
        1.9143725216,
        1.9301002476000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.9159269053999999,
      "stddev": 0.02852459407678583,
      "median": 1.9150775546000003,
      "user": 0.9670168799999999,
      "system": 0.7582178800000001,
      "min": 1.8843438066000002,
      "max": 1.9858131626000002,
      "times": [
        1.9180563646000002,
        1.9289310036,
        1.9020334056000001,
        1.9045220046000002,
        1.9858131626000002,
        1.9120987446000002,
        1.9192469786000002,
        1.8843438066000002,
        1.8857234356,
        1.9185001476
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32864240110000004,
      "stddev": 0.014558643776174775,
      "median": 0.3264420471,
      "user": 0.22716018,
      "system": 0.5482794799999999,
      "min": 0.30830163160000007,
      "max": 0.35398068860000004,
      "times": [
        0.32711988960000005,
        0.32472342260000003,
        0.30830163160000007,
        0.31611046760000006,
        0.31414500860000005,
        0.32873549160000004,
        0.34312627660000006,
        0.35398068860000004,
        0.34441692960000003,
        0.32576420460000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3256319483000001,
      "stddev": 0.014235081671460034,
      "median": 0.33106995710000003,
      "user": 0.22920298,
      "system": 0.54721288,
      "min": 0.29507971860000004,
      "max": 0.33839977760000006,
      "times": [
        0.33024967260000004,
        0.3375555626,
        0.33540213160000004,
        0.33806540060000007,
        0.33839977760000006,
        0.31762271560000005,
        0.3318902416,
        0.29507971860000004,
        0.31242716560000006,
        0.31962709660000005
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 394.2 ± 20.2 358.1 417.5 4.30 ± 0.32
pacquet@main 397.2 ± 14.0 383.7 428.5 4.34 ± 0.28
pnpr@HEAD 95.9 ± 4.1 87.5 104.9 1.05 ± 0.07
pnpr@main 91.6 ± 4.9 85.7 104.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.39419934015999997,
      "stddev": 0.02021780253977315,
      "median": 0.39883519156,
      "user": 0.3830291,
      "system": 0.06457988,
      "min": 0.35809774656,
      "max": 0.41751919156,
      "times": [
        0.36713141956,
        0.35809774656,
        0.37666542156,
        0.39552640856,
        0.39799286556,
        0.39967751756000003,
        0.41293429656,
        0.40750782256,
        0.40894071156,
        0.41751919156
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.39721267646,
      "stddev": 0.013985859039971448,
      "median": 0.39189838456000003,
      "user": 0.3954775,
      "system": 0.05492187999999999,
      "min": 0.38365926756,
      "max": 0.42849117156,
      "times": [
        0.39574758356,
        0.38365926756,
        0.42849117156,
        0.39000673856,
        0.38438222456,
        0.39082394356,
        0.39297282556,
        0.40825169856,
        0.40872900456,
        0.38906230656
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09588246949548389,
      "stddev": 0.00414217101454964,
      "median": 0.09596674356000001,
      "user": 0.025766254838709673,
      "system": 0.010664599354838707,
      "min": 0.08747529956000001,
      "max": 0.10487916956000001,
      "times": [
        0.08973720256,
        0.09190649456000001,
        0.08798583556,
        0.08747529956000001,
        0.09299796256000001,
        0.09752038956,
        0.09472717756000001,
        0.10217161856000001,
        0.10487916956000001,
        0.09780713756000001,
        0.09340142956000001,
        0.09069809656000001,
        0.09469386556,
        0.09443677256,
        0.09260966356000001,
        0.10145736756000001,
        0.10222583056000001,
        0.09875718056,
        0.09571884756000001,
        0.09666853056000001,
        0.09964831256000001,
        0.09757676456000001,
        0.09659767756000001,
        0.09596674356000001,
        0.09673447456,
        0.09637873656000001,
        0.09265381756,
        0.09820796956000001,
        0.10106637456,
        0.09538282856000001,
        0.09426698256
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09162511038758622,
      "stddev": 0.0049356341004713885,
      "median": 0.09091327956,
      "user": 0.02339869310344827,
      "system": 0.00981782896551724,
      "min": 0.08569364456,
      "max": 0.10433011956,
      "times": [
        0.09595273756000001,
        0.09370761556000001,
        0.09903458056,
        0.09589666256000001,
        0.09212863056000001,
        0.10001923856000002,
        0.10433011956,
        0.09494826256000001,
        0.09336352856,
        0.09471112756000001,
        0.09338309556,
        0.09866302356000001,
        0.09464057556000001,
        0.09091327956,
        0.08730573956000001,
        0.08895745856000001,
        0.08981978856,
        0.09170477556000001,
        0.08668949356000001,
        0.08859913656000001,
        0.08713212356000001,
        0.08587028556000001,
        0.08645451156,
        0.08690663156,
        0.08779181156,
        0.08828494756000001,
        0.08569364456,
        0.08792556256,
        0.08629981256000001
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.599 ± 0.142 4.485 4.836 1.29 ± 0.06
pacquet@main 4.667 ± 0.144 4.479 4.902 1.31 ± 0.06
pnpr@HEAD 3.599 ± 0.129 3.493 3.870 1.01 ± 0.05
pnpr@main 3.567 ± 0.122 3.474 3.812 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.59931586132,
      "stddev": 0.14168235076093078,
      "median": 4.51884789472,
      "user": 1.90052336,
      "system": 1.4841048799999998,
      "min": 4.484723120220001,
      "max": 4.835644862220001,
      "times": [
        4.7235972552200005,
        4.48542431422,
        4.82808889122,
        4.5201825942200005,
        4.499147418220001,
        4.835644862220001,
        4.51751319522,
        4.484723120220001,
        4.58789503822,
        4.51094192422
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.667340113920001,
      "stddev": 0.1441236550445362,
      "median": 4.64662980272,
      "user": 2.00382626,
      "system": 1.5471830800000002,
      "min": 4.479102060220001,
      "max": 4.901557155220001,
      "times": [
        4.49068964022,
        4.479102060220001,
        4.76337331722,
        4.64820558322,
        4.83171492822,
        4.901557155220001,
        4.7666983402200005,
        4.55275490422,
        4.64505402222,
        4.59425118822
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.59948081342,
      "stddev": 0.12916156478192162,
      "median": 3.53154025122,
      "user": 1.3857628600000003,
      "system": 1.3615729799999998,
      "min": 3.49268114322,
      "max": 3.87019891122,
      "times": [
        3.50577128422,
        3.5012749952199997,
        3.54831851122,
        3.87019891122,
        3.49268114322,
        3.6485381872200002,
        3.50471489122,
        3.74831236522,
        3.51476199122,
        3.66023585422
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5665874054199995,
      "stddev": 0.12215903197974477,
      "median": 3.51002716622,
      "user": 1.32276736,
      "system": 1.3228381799999998,
      "min": 3.47361887122,
      "max": 3.81189033122,
      "times": [
        3.81189033122,
        3.47361887122,
        3.50184092922,
        3.65840276522,
        3.47442601622,
        3.72578400322,
        3.51821340322,
        3.47736352922,
        3.47471539822,
        3.54961880722
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13181
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,738.45 ms
(+1.40%)Baseline: 2,700.66 ms
3,240.79 ms
(84.50%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,884.93 ms
(+1.34%)Baseline: 1,860.03 ms
2,232.03 ms
(84.45%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
602.56 ms
(+8.36%)Baseline: 556.09 ms
667.31 ms
(90.30%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
358.10 ms
(+6.98%)Baseline: 334.73 ms
401.67 ms
(89.15%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,354.74 ms
(-0.50%)Baseline: 2,366.55 ms
2,839.86 ms
(82.92%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,484.72 ms
(+1.08%)Baseline: 4,436.72 ms
5,324.06 ms
(84.24%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
251.64 ms
(+1.31%)Baseline: 248.38 ms
298.05 ms
(84.43%)
🐰 View full continuous benchmarking report in Bencher

@Safort
Safort force-pushed the feat/pacquet-view branch from fb9b44d to 0acfa98 Compare July 20, 2026 22:28
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 20, 2026
@codecov-commenter

codecov-commenter commented Jul 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.10843% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.72%. Comparing base (5e6dd35) to head (e5c74d0).

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/view.rs 96.88% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13181      +/-   ##
==========================================
+ Coverage   86.68%   86.72%   +0.04%     
==========================================
  Files         522      523       +1     
  Lines       87872    88287     +415     
==========================================
+ Hits        76168    76571     +403     
- Misses      11704    11716      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Safort
Safort force-pushed the feat/pacquet-view branch from 0acfa98 to 666cb4a Compare July 20, 2026 23:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
pnpm/crates/cli/src/lib.rs (1)

121-140: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Deduplicate scoped thread logic.

run_on_big_stack elegantly encapsulates the exact thread-spawning and panic-propagation logic that is currently duplicated in the unmodified block_on_runtime function just below it. By parameterizing the thread name, block_on_runtime can reuse this helper to streamline the code.

♻️ Proposed refactor for `run_on_big_stack`
-fn run_on_big_stack<Work, Output>(work: Work) -> Output
+fn run_on_big_stack<Work, Output>(thread_name: &str, work: Work) -> Output
 where
     Work: FnOnce() -> Output + Send,
     Output: Send,
 {
     std::thread::scope(|scope| {
         std::thread::Builder::new()
-            .name("pacquet-startup".to_string())
+            .name(thread_name.to_string())
             .stack_size(MAIN_STACK_SIZE)
             .spawn_scoped(scope, work)
-            .expect("spawn the pacquet startup thread")
+            .expect("spawn the big-stack thread")
             .join()
             .unwrap_or_else(|payload| std::panic::resume_unwind(payload))
     })
 }

Then, apply these changes to the surrounding caller logic to use the updated signature:

@@ -29,3 +29,3 @@
     // the whole path has uniform headroom.
-    run_on_big_stack(run_cli)
+    run_on_big_stack("pacquet-startup", run_cli)
 }
@@ -140,25 +140,12 @@
 fn block_on_runtime<Work, Output>(thread_name: &str, work: Work) -> Output
 where
     Work: Future<Output = Output> + Send,
     Output: Send,
 {
-    std::thread::scope(|scope| {
-        let handle = std::thread::Builder::new()
-            .name(thread_name.to_string())
-            .stack_size(MAIN_STACK_SIZE)
-            .spawn_scoped(scope, move || {
-                tokio::runtime::Builder::new_multi_thread()
-                    .enable_all()
-                    .build()
-                    .expect("build the tokio runtime")
-                    // Boxed for `clippy::large_futures`: the command future
-                    // exceeds the lint's stack-size threshold.
-                    .block_on(Box::pin(work))
-            })
-            .expect("spawn the pacquet runtime thread");
-        handle
-            .join()
-            // Re-raise a panic from the worker on this thread so the process
-            // still aborts with the original message and backtrace.
-            .unwrap_or_else(|payload| std::panic::resume_unwind(payload))
-    })
+    run_on_big_stack(thread_name, move || {
+        tokio::runtime::Builder::new_multi_thread()
+            .enable_all()
+            .build()
+            .expect("build the tokio runtime")
+            // Boxed for `clippy::large_futures`: the command future
+            // exceeds the lint's stack-size threshold.
+            .block_on(Box::pin(work))
+    })
 }
🤖 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/lib.rs` around lines 121 - 140, Update run_on_big_stack
to accept the thread name as a parameter while preserving its stack size, scoped
spawning, joining, and panic propagation behavior. Refactor block_on_runtime to
call run_on_big_stack with its existing thread name and runtime-building
closure, removing the duplicated scoped-thread logic while keeping its current
runtime behavior 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/view/tests.rs`:
- Around line 67-71: Add diagnostic logging immediately before the non-assert_eq
assertions in parse_date_accepts_iso_timestamps_only, using eprintln! or dbg! to
show the parsed results and input context while preserving the existing
assertions and test behavior.

---

Nitpick comments:
In `@pnpm/crates/cli/src/lib.rs`:
- Around line 121-140: Update run_on_big_stack to accept the thread name as a
parameter while preserving its stack size, scoped spawning, joining, and panic
propagation behavior. Refactor block_on_runtime to call run_on_big_stack with
its existing thread name and runtime-building closure, removing the duplicated
scoped-thread logic while keeping its current runtime behavior 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: e29bf960-c351-4f9c-995c-e700bfbbdf63

📥 Commits

Reviewing files that changed from the base of the PR and between 0acfa98 and 666cb4a.

📒 Files selected for processing (9)
  • pnpm/crates/cli/src/cli_args.rs
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args/dispatch.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/switch_cli_version.rs
  • pnpm/crates/cli/src/cli_args/view.rs
  • pnpm/crates/cli/src/cli_args/view/tests.rs
  • pnpm/crates/cli/src/lib.rs
  • pnpm/crates/cli/tests/view.rs
🚧 Files skipped from review as they are similar to previous changes (7)
  • pnpm/crates/cli/src/cli_args/switch_cli_version.rs
  • pnpm/crates/cli/src/cli_args/dispatch.rs
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/tests/view.rs
  • pnpm/crates/cli/src/cli_args/view.rs

The synchronous startup — building the negation-augmented clap command (a
recursive walk over every subcommand) and parsing argv — runs on the OS main
thread, whose default stack is 1 MiB on Windows (Linux and macOS default to
8 MiB). That path sits close enough to the limit that a single added
subcommand can overflow it. `block_on_runtime` already runs the command body
on a `MAIN_STACK_SIZE` thread; run the parsing startup that precedes it on one
too so the whole path has uniform headroom on every platform.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@Safort
Safort force-pushed the feat/pacquet-view branch from 666cb4a to 881eef5 Compare July 20, 2026 23:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pnpm/crates/cli/tests/view.rs (1)

29-112: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a shared setup helper to cut per-test boilerplate.

Nearly every test repeats the same CommandTempCwd::init() → mockito::Server::new() → write_registry_npmrc → serve(...) → empty_auth_file sequence. A small helper bundling these (returning the pieces each test needs) would reduce duplication across ~20 tests without changing behavior.

🤖 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/view.rs` around lines 29 - 112, Introduce a shared test
setup helper near the existing helpers that performs the repeated CommandTempCwd
initialization, mockito server creation, registry npmrc writing, mock response
setup, and empty_auth_file creation, returning the workspace, server/mock, and
auth-file values needed by callers. Update the affected view tests to use this
helper while preserving their existing package paths, response bodies,
arguments, and assertions.
🤖 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/cli/tests/view.rs`:
- Around line 29-112: Introduce a shared test setup helper near the existing
helpers that performs the repeated CommandTempCwd initialization, mockito server
creation, registry npmrc writing, mock response setup, and empty_auth_file
creation, returning the workspace, server/mock, and auth-file values needed by
callers. Update the affected view tests to use this helper while preserving
their existing package paths, response bodies, arguments, and assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 01294552-4a39-4534-8316-255bd333996a

📥 Commits

Reviewing files that changed from the base of the PR and between 666cb4a and 881eef5.

📒 Files selected for processing (9)
  • pnpm/crates/cli/src/cli_args.rs
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args/dispatch.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/switch_cli_version.rs
  • pnpm/crates/cli/src/cli_args/view.rs
  • pnpm/crates/cli/src/cli_args/view/tests.rs
  • pnpm/crates/cli/src/lib.rs
  • pnpm/crates/cli/tests/view.rs
🚧 Files skipped from review as they are similar to previous changes (6)
  • pnpm/crates/cli/src/cli_args/dispatch.rs
  • pnpm/crates/cli/src/cli_args/view/tests.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/lib.rs
  • pnpm/crates/cli/src/cli_args/switch_cli_version.rs
  • pnpm/crates/cli/src/cli_args/view.rs

@Safort
Safort force-pushed the feat/pacquet-view branch from 881eef5 to 0a5b163 Compare July 21, 2026 07:17
Port the `view` command (aliases `info`, `show`, `v`) to pacquet: fetch a
package's registry metadata and render a formatted summary, a JSON dump
(`--json`), or selected dotted fields. When the package name is omitted, the
nearest project manifest's name is used, searching upward from `--dir`.

Reuses the existing metadata-fetch stack (full-metadata fetch,
`pick_package_from_meta` version selection, registry/auth resolution) and
assembles the info object from the picked version's raw JSON fragment so
registry key order is preserved in `--json` output. Error codes match pnpm:
ERR_PNPM_MISSING_PACKAGE_NAME, ERR_PNPM_INVALID_PACKAGE_NAME,
ERR_PNPM_INVALID_PACKAGE_JSON, ERR_PNPM_PACKAGE_NOT_FOUND, ERR_PNPM_FETCH_404.

The TypeScript pnpm CLI already ships `view`, so this only adds the pacquet
side; no TypeScript change is needed. Covers the `view` item under the Stage 3
command surface in pnpm#11633.

Tests: unit tests for the pure helpers (byte/time/field formatting) plus an
integration suite that drives the built binary against a mockito registry,
covering the upstream view scenarios. `package.yaml` name resolution is left
as an ignored test — pacquet's project-manifest reader is package.json only
today.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@Safort
Safort force-pushed the feat/pacquet-view branch from 0a5b163 to 97a283a Compare July 21, 2026 07:21
Comment thread pnpm/crates/cli/src/cli_args/view.rs Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/cli/src/cli_args/view/tests.rs`:
- Around line 136-138: Update the assertions in
pnpm/crates/cli/src/cli_args/view/tests.rs at lines 136-138, 147-148, 167-170,
172-173, 204-205, and 215-216 to provide diagnostic context: replace simple
assert! checks with assert_eq! comparisons where appropriate, or include the
tested values in custom messages/debug output. Cover the bin_summary results,
with_email, no_email, many, future, and with_email format assertions without
changing their expected behavior.
🪄 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: 078aa9d6-eed0-4903-9498-55e1fc6615d7

📥 Commits

Reviewing files that changed from the base of the PR and between 881eef5 and 97a283a.

📒 Files selected for processing (8)
  • pnpm/crates/cli/src/cli_args.rs
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args/dispatch.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/switch_cli_version.rs
  • pnpm/crates/cli/src/cli_args/view.rs
  • pnpm/crates/cli/src/cli_args/view/tests.rs
  • pnpm/crates/cli/tests/view.rs
🚧 Files skipped from review as they are similar to previous changes (7)
  • pnpm/crates/cli/src/cli_args/switch_cli_version.rs
  • pnpm/crates/cli/src/cli_args/cli_command.rs
  • pnpm/crates/cli/src/cli_args.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/dispatch.rs
  • pnpm/crates/cli/src/cli_args/view.rs
  • pnpm/crates/cli/tests/view.rs

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13181
Testbedpnpr

⚠️ 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-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,456.75 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
308.30 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
311.82 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
87.48 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,375.74 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,492.68 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
264.94 ms
🐰 View full continuous benchmarking report in Bencher

Add in-process unit tests for the pure `view` rendering helpers — the full
summary block (every optional section), the bin / publisher / person /
field-selection formatters, and the published-by line with and without a
publisher and for a future or unparsable timestamp — plus an integration test
that a version's object `author` collapses to its name. These exercise the
branches the subprocess-driven integration suite left uncovered.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@Safort
Safort force-pushed the feat/pacquet-view branch from 97a283a to c48ad1b Compare July 21, 2026 07:51
Safort and others added 2 commits July 21, 2026 10:13
Review feedback: bare boolean assertions panic without showing what was
being tested; give both parse_date assertions a diagnostic message, in
line with the test-logging convention in the style guide.

Co-Authored-By: Claude Fable 5 <[email protected]>
Review feedback: the comment implied every absent-field selection emits
no output, but a multi-field --json selection of absent fields prints {}
(as pnpm view does, printing whatever truthy string the handler
returns). Spell out both cases; no behavior change.

Co-Authored-By: Claude Fable 5 <[email protected]>
@zkochan
zkochan merged commit 2e2c322 into pnpm:main Jul 21, 2026
37 of 38 checks passed
aqeelat added a commit to aqeelat/pnpm that referenced this pull request Jul 22, 2026
…aOutcome

view.rs (added in pnpm#13181 after this branch forked from main)
called pick_package_from_meta(...)?.ok_or_else(...), assuming the
function returned Option<Arc<PackageVersion>>. The previous commit on
this branch changed that return to PickFromMetaOutcome { package,
latest }. Read .package before the ok_or_else.
aqeelat added a commit to aqeelat/pnpm that referenced this pull request Jul 22, 2026
The lazy policy_aware_latest helper from the previous commit doubled
the filter cost on the resolver hot path: filter_pkg_metadata_by_publish_date
ran once inside pick_package_from_meta and again inside the helper.
With minimumReleaseAge default-on (24h), that regression would have
shipped to every install — popular packages with hundreds of versions
spend hundreds of microseconds per filter call, multiplied across every
resolution.

Threading latest through the picker chain eliminates the duplicate call:
the filter runs once, captures the rewritten dist-tags.latest as a String,
and rides it along on the outcome. Zero extra allocations relative to the
original code (the resolver layer was already allocating latest; it just
moved earlier in the chain).

- pick_package_from_meta returns PickFromMetaOutcome { package, latest },
  threaded through pick_package, run_picker, pick_max,
  pick_matching_version_fast/final, pick_from_meta, pick_from_meta_fast.
- Resolver reads picked.latest directly at both latest: sites
  (npm path, workspace shadow, JSR, named-registry).
- pick_from_registry_with_guard threads latest through PickedFromRegistry,
  and build_resolve_result reads it via BuildResolveResult.latest.

Also fixes a pre-existing divergence in the Rust reporter: it gated
'(X is available)' on 'latest != version' rather than 'latest > version',
so it would suggest downgrading to an older latest tag. Now uses
node-semver comparison, matching the TS semver.lt check.

Adapts the one out-of-tree caller (view.rs, added in pnpm#13181
after this branch forked from main) to read .package before ok_or_else.
aqeelat added a commit to aqeelat/pnpm that referenced this pull request Jul 23, 2026
The lazy policy_aware_latest helper from the previous commit doubled
the filter cost on the resolver hot path: filter_pkg_metadata_by_publish_date
ran once inside pick_package_from_meta and again inside the helper.
With minimumReleaseAge default-on (24h), that regression would have
shipped to every install — popular packages with hundreds of versions
spend hundreds of microseconds per filter call, multiplied across every
resolution.

Threading latest through the picker chain eliminates the duplicate call:
the filter runs once, captures the rewritten dist-tags.latest as a String,
and rides it along on the outcome. Zero extra allocations relative to the
original code (the resolver layer was already allocating latest; it just
moved earlier in the chain).

- pick_package_from_meta returns PickFromMetaOutcome { package, latest },
  threaded through pick_package, run_picker, pick_max,
  pick_matching_version_fast/final, pick_from_meta, pick_from_meta_fast.
- Resolver reads picked.latest directly at both latest: sites
  (npm path, workspace shadow, JSR, named-registry).
- pick_from_registry_with_guard threads latest through PickedFromRegistry,
  and build_resolve_result reads it via BuildResolveResult.latest.

Also fixes a pre-existing divergence in the Rust reporter: it gated
'(X is available)' on 'latest != version' rather than 'latest > version',
so it would suggest downgrading to an older latest tag. Now uses
node-semver comparison, matching the TS semver.lt check.

Adapts the one out-of-tree caller (view.rs, added in pnpm#13181
after this branch forked from main) to read .package before ok_or_else.
aqeelat added a commit to aqeelat/pnpm that referenced this pull request Jul 30, 2026
The lazy policy_aware_latest helper from the previous commit doubled
the filter cost on the resolver hot path: filter_pkg_metadata_by_publish_date
ran once inside pick_package_from_meta and again inside the helper.
With minimumReleaseAge default-on (24h), that regression would have
shipped to every install — popular packages with hundreds of versions
spend hundreds of microseconds per filter call, multiplied across every
resolution.

Threading latest through the picker chain eliminates the duplicate call:
the filter runs once, captures the rewritten dist-tags.latest as a String,
and rides it along on the outcome. Zero extra allocations relative to the
original code (the resolver layer was already allocating latest; it just
moved earlier in the chain).

- pick_package_from_meta returns PickFromMetaOutcome { package, latest },
  threaded through pick_package, run_picker, pick_max,
  pick_matching_version_fast/final, pick_from_meta, pick_from_meta_fast.
- Resolver reads picked.latest directly at both latest: sites
  (npm path, workspace shadow, JSR, named-registry).
- pick_from_registry_with_guard threads latest through PickedFromRegistry,
  and build_resolve_result reads it via BuildResolveResult.latest.

Also fixes a pre-existing divergence in the Rust reporter: it gated
'(X is available)' on 'latest != version' rather than 'latest > version',
so it would suggest downgrading to an older latest tag. Now uses
node-semver comparison, matching the TS semver.lt check.

Adapts the one out-of-tree caller (view.rs, added in pnpm#13181
after this branch forked from main) to read .package before ok_or_else.
zkochan pushed a commit to aqeelat/pnpm that referenced this pull request Jul 30, 2026
The lazy policy_aware_latest helper from the previous commit doubled
the filter cost on the resolver hot path: filter_pkg_metadata_by_publish_date
ran once inside pick_package_from_meta and again inside the helper.
With minimumReleaseAge default-on (24h), that regression would have
shipped to every install — popular packages with hundreds of versions
spend hundreds of microseconds per filter call, multiplied across every
resolution.

Threading latest through the picker chain eliminates the duplicate call:
the filter runs once, captures the rewritten dist-tags.latest as a String,
and rides it along on the outcome. Zero extra allocations relative to the
original code (the resolver layer was already allocating latest; it just
moved earlier in the chain).

- pick_package_from_meta returns PickFromMetaOutcome { package, latest },
  threaded through pick_package, run_picker, pick_max,
  pick_matching_version_fast/final, pick_from_meta, pick_from_meta_fast.
- Resolver reads picked.latest directly at both latest: sites
  (npm path, workspace shadow, JSR, named-registry).
- pick_from_registry_with_guard threads latest through PickedFromRegistry,
  and build_resolve_result reads it via BuildResolveResult.latest.

Also fixes a pre-existing divergence in the Rust reporter: it gated
'(X is available)' on 'latest != version' rather than 'latest > version',
so it would suggest downgrading to an older latest tag. Now uses
node-semver comparison, matching the TS semver.lt check.

Adapts the one out-of-tree caller (view.rs, added in pnpm#13181
after this branch forked from main) to read .package before ok_or_else.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants