Skip to content

refactor(cli): split the audit command into per-concern modules - #13657

Merged
zkochan merged 1 commit into
mainfrom
split-audit-cli
Aug 5, 2026
Merged

zkochan merged 1 commit into
mainfrom
split-audit-cli

Conversation

@zkochan

@zkochan zkochan commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

Summary

cli_args/audit.rs was 2126 lines holding four unrelated jobs: the command itself, the registry wire format, the dependency graph sent for audit, and everything --fix does. Split along those lines:

Module Concern Lines
report the audit response and the report derived from it 331
request turning a lockfile into the graph the registry audits 285
paths dependency paths reported with each advisory 179
render JSON and text renderings 150
version_ranges semver questions asked of advisory ranges 86
fix overrides, ignores, and dependency updates 548

audit.rs keeps the argument types and the command body, at 624 lines.

Re-exports are explicit rather than glob — pub(crate) use report::{…} — and list only what is actually used outside the owning module, so the crate root no longer advertises module-internal helpers. The tests import each item from the module that defines it, which makes an item's home visible at the use site.

Squash Commit Body

Split the 2126-line cli_args/audit.rs into per-concern modules (report, request, paths, render, version_ranges, fix), leaving the command's argument types and body in the root at 624 lines. Pure code motion; no behaviour change.

Checklist

  • Pure code motion — no behaviour change, verified mechanically by comparing every content line of the original against the union of the new modules (the only differences are visibility prefixes and four rustfmt-reflowed signatures)
  • No changeset — internal refactor with no user-visible effect
  • cargo clippy --all-targets -D warnings, cargo doc --document-private-items -D warnings, and cargo dylint --all all clean
  • 1052 pacquet-cli tests pass

Written by an agent (Claude Code, claude-opus-5).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features

    • Added comprehensive audit reporting in text and JSON formats, including severity filtering, dependency paths, summaries, and sanitized metadata.
    • Added dependency graph analysis across production, development, optional, and environment dependencies.
    • Added audit --fix workflows with interactive selection, override generation, vulnerability validation, and lockfile rechecking.
    • Improved handling of version ranges, prereleases, patched versions, ignored advisories, and vulnerability classifications.
  • Refactor

    • Reorganized audit functionality into focused modules without changing public behavior.

`cli_args/audit.rs` held four unrelated jobs in one file: the command
itself, the registry wire format, the dependency graph sent for audit,
and everything the `--fix` flag does. Split along those lines:

- `report` — the audit response and the report derived from it
- `request` — turning a lockfile into the graph the registry audits
- `paths` — the dependency paths reported with each advisory
- `render` — the JSON and text renderings
- `version_ranges` — the semver questions asked of advisory ranges
- `fix` — overrides, ignores, and dependency updates

`audit.rs` keeps the argument types and the command body, at 2126 lines
down to 624. Re-exports are explicit rather than glob, and cover only
what is used outside the owning module; the tests now import each item
from the module that defines it.

Pure code motion: no behaviour change, verified by comparing every
content line of the original against the union of the new modules.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings August 5, 2026 08:36

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The audit CLI is split into focused modules for dependency graph construction, path analysis, report modeling, rendering, semver handling, and advisory fixes. The fix workflow supports overrides, ignores, minimum-release-age exclusions, interactive selection, and guarded dependency updates.

Changes

Audit CLI

Layer / File(s) Summary
Dependency graph and path analysis
pnpm/crates/cli/src/cli_args/audit.rs, pnpm/crates/cli/src/cli_args/audit/request.rs, pnpm/crates/cli/src/cli_args/audit/paths.rs
The audit request builder now aggregates classified packages from main and environment lockfile graphs. Path traversal records deduplicated, cycle-safe dependency trails.
Report model and advisory normalization
pnpm/crates/cli/src/cli_args/audit/report.rs, pnpm/crates/cli/src/cli_args/audit/version_ranges.rs
Bulk advisories are converted into normalized reports with findings, metadata, counts, sanitized values, and inferred patched versions.
Audit report rendering
pnpm/crates/cli/src/cli_args/audit/render.rs
JSON and text output filter advisories by severity, format paths and metadata, and render vulnerability summaries with terminal styling.
Override and interactive fix workflows
pnpm/crates/cli/src/cli_args/audit/fix.rs
Fix handling creates overrides, persists ignore settings and age exclusions, filters advisories, and supports interactive selection.
Resolver-based update fixing
pnpm/crates/cli/src/cli_args/audit/fix.rs, pnpm/crates/cli/src/cli_args/audit/tests.rs
Update fixing applies vulnerability guards, re-resolves dependencies, reloads the lockfile, classifies fixed and remaining advisories, and formats results. Test imports follow the new module exports.

Estimated code review effort: 5 (Critical) | ~90 minutes

Possibly related PRs

  • pnpm/pnpm#13159: Related audit-fix logic for inferred patched versions and override generation.
  • pnpm/pnpm#13215: Related audit fix and version-range formatting for patched-version overrides.

Suggested labels: product: pacquet

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch split-audit-cli

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 Aug 5, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, build, or maintainability issues identified.

The extracted implementations preserve their prior behavior, constants and helper bindings resolve to the same definitions, external audit command entry points remain unchanged, and the updated tests retain their existing assertions.

Reviews (1): Last reviewed commit: "refactor(cli): split the audit command i..." | Re-trigger Greptile

@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 (4)
pnpm/crates/cli/src/cli_args/audit/version_ranges.rs (1)

11-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document why satisfies_including_prerelease re-parses the range from its string form.

The function converts Range back to a string, splits on || and whitespace, and re-evaluates each comparator by hand. The reason is not obvious from the code: node_semver excludes prerelease versions from comparator matches unless the comparator itself carries a prerelease, so the manual pass restores npm audit's prerelease-inclusive behavior.

Add a short comment stating that invariant. caret_range_for_patched at lines 76-80 already documents its rationale this way.

As per coding guidelines, pnpm/CODE_STYLE_GUIDE.md requires comments that "explain only non-obvious reasons or invariants".

📝 Proposed comment
+/// Prerelease-inclusive range matching. `node_semver` excludes prerelease
+/// versions from a comparator unless that comparator carries a prerelease of
+/// the same tuple, but npm audit reports prereleases inside a vulnerable
+/// range. The fallback re-evaluates the normalized comparator set by hand to
+/// restore that behavior.
 pub(crate) fn satisfies_including_prerelease(version: &Version, range: &Range) -> bool {
🤖 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/audit/version_ranges.rs` around lines 11 - 18,
Document the non-obvious rationale in satisfies_including_prerelease: explain
that node_semver excludes prerelease versions unless comparators explicitly
include a prerelease, so the range is re-parsed and manually evaluated to
preserve npm audit’s prerelease-inclusive behavior. Place the short invariant
comment immediately before the string-based re-evaluation.

Source: Coding guidelines

pnpm/crates/cli/src/cli_args/audit/report.rs (1)

1-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reconsider placing the whole AuditError enum in report.rs.

The module doc says this module holds "The registry audit response, and the report shape derived from it." Four variants do not belong to that scope:

  • UnknownSubcommand and InvalidFixOption are produced by the command body in audit.rs.
  • NoLockfileAfterUpdate and MissingGhsa are produced by fix.rs.

Only Network, InvalidJson, UnexpectedBody, EndpointNotExists, and BadStatus are report/response concerns.

A shared error enum across modules is a reasonable choice, but then it should not live inside one concern-specific module. Move AuditError to audit.rs next to the command body, or narrow the module doc to state that report.rs also owns the shared audit error type.

As per path instructions, REVIEW_GUIDE.md requires you to "Ensure logic remains in its owning module".

🤖 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/audit/report.rs` around lines 1 - 12, The
AuditError definition in report.rs mixes report/response errors with command and
fix errors, violating module ownership. Move AuditError to audit.rs alongside
the audit command body, update imports and references in report.rs and fix.rs,
and preserve all existing variants and behavior.

Source: Path instructions

pnpm/crates/cli/src/cli_args/audit/request.rs (1)

200-214: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Make module-internal audit request helpers private.

AuditRequestBuilder, VersionState, append_importer_edges, collect_optional_only_keys, walk_reachable, and selected_root_edges are used only inside request.rs. Make them private instead of exposing them on the module boundary, and keep pub(crate) use limited to the exported symbols used outside audit::request.

🤖 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/audit/request.rs` around lines 200 - 214,
Restrict the audit request helpers to module visibility: remove `pub(crate)`
from `AuditRequestBuilder`, `VersionState`, `append_importer_edges`,
`collect_optional_only_keys`, `walk_reachable`, and `selected_root_edges`.
Preserve `pub(crate) use` only for symbols referenced outside `audit::request`,
leaving externally consumed exports unchanged.

Source: Coding guidelines

pnpm/crates/cli/src/cli_args/audit.rs (1)

29-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move the AuditGraph inherent impl into request.rs.

AuditGraph, Edge, GraphImporter, DepKind, and empty_snapshots live in pnpm/crates/cli/src/cli_args/audit/request.rs, but main, env, and children remain in pnpm/crates/cli/src/cli_args/audit.rs. Move the impl block next to AuditGraph in request.rs so the graph logic stays in its owning module.

🤖 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/audit.rs` around lines 29 - 56, Move the
inherent impl for AuditGraph, including its main, env, and children methods,
from audit.rs into request.rs alongside the AuditGraph definition and related
graph symbols. Remove the original impl from audit.rs while preserving all
method behavior and visibility.

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.

Nitpick comments:
In `@pnpm/crates/cli/src/cli_args/audit.rs`:
- Around line 29-56: Move the inherent impl for AuditGraph, including its main,
env, and children methods, from audit.rs into request.rs alongside the
AuditGraph definition and related graph symbols. Remove the original impl from
audit.rs while preserving all method behavior and visibility.

In `@pnpm/crates/cli/src/cli_args/audit/report.rs`:
- Around line 1-12: The AuditError definition in report.rs mixes report/response
errors with command and fix errors, violating module ownership. Move AuditError
to audit.rs alongside the audit command body, update imports and references in
report.rs and fix.rs, and preserve all existing variants and behavior.

In `@pnpm/crates/cli/src/cli_args/audit/request.rs`:
- Around line 200-214: Restrict the audit request helpers to module visibility:
remove `pub(crate)` from `AuditRequestBuilder`, `VersionState`,
`append_importer_edges`, `collect_optional_only_keys`, `walk_reachable`, and
`selected_root_edges`. Preserve `pub(crate) use` only for symbols referenced
outside `audit::request`, leaving externally consumed exports unchanged.

In `@pnpm/crates/cli/src/cli_args/audit/version_ranges.rs`:
- Around line 11-18: Document the non-obvious rationale in
satisfies_including_prerelease: explain that node_semver excludes prerelease
versions unless comparators explicitly include a prerelease, so the range is
re-parsed and manually evaluated to preserve npm audit’s prerelease-inclusive
behavior. Place the short invariant comment immediately before the string-based
re-evaluation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 16182a6e-3ecc-45dd-8508-652fb4cf5723

📥 Commits

Reviewing files that changed from the base of the PR and between 420f91b and 1b74675.

📒 Files selected for processing (8)
  • pnpm/crates/cli/src/cli_args/audit.rs
  • pnpm/crates/cli/src/cli_args/audit/fix.rs
  • pnpm/crates/cli/src/cli_args/audit/paths.rs
  • pnpm/crates/cli/src/cli_args/audit/render.rs
  • pnpm/crates/cli/src/cli_args/audit/report.rs
  • pnpm/crates/cli/src/cli_args/audit/request.rs
  • pnpm/crates/cli/src/cli_args/audit/tests.rs
  • pnpm/crates/cli/src/cli_args/audit/version_ranges.rs

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     12.1±0.20ms    30.9 MB/sec    1.00     12.1±0.08ms    31.0 MB/sec
packument/parse                                  1.00     38.2±0.10µs  1738.4 MB/sec    1.00     38.2±0.32µs  1736.4 MB/sec
tarball/download_dependency                      1.00      2.3±0.08ms  1888.1 KB/sec    1.00      2.3±0.06ms  1895.5 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.01    176.7±2.04ms 90.6 KElem/sec    1.00    175.6±4.99ms 91.1 KElem/sec
workspace_resolution/hoist_heavy                 1.01   259.2±10.85ms        ? ?/sec    1.00    257.0±3.02ms        ? ?/sec

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.91423% with 124 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.07%. Comparing base (420f91b) to head (1b74675).

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/audit/fix.rs 77.71% 80 Missing ⚠️
...pm/crates/cli/src/cli_args/audit/version_ranges.rs 76.11% 16 Missing ⚠️
pnpm/crates/cli/src/cli_args/audit/request.rs 93.12% 13 Missing ⚠️
pnpm/crates/cli/src/cli_args/audit/render.rs 89.74% 12 Missing ⚠️
pnpm/crates/cli/src/cli_args/audit/report.rs 98.10% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13657      +/-   ##
==========================================
- Coverage   88.07%   88.07%   -0.01%     
==========================================
  Files         590      596       +6     
  Lines       98802    98812      +10     
==========================================
+ Hits        87016    87024       +8     
- Misses      11786    11788       +2     

☔ 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.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 1b74675f7f6b

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. 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.602 ± 0.190 2.386 2.868 1.62 ± 0.15
pacquet@main 2.671 ± 0.183 2.448 2.920 1.66 ± 0.15
pnpr@HEAD 1.606 ± 0.087 1.452 1.711 1.00
pnpr@main 1.618 ± 0.178 1.443 1.921 1.01 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.60152707902,
      "stddev": 0.1902924678930185,
      "median": 2.5677835039200003,
      "user": 1.9632614199999998,
      "system": 1.50022892,
      "min": 2.3859032729200003,
      "max": 2.86780840892,
      "times": [
        2.8161985939200003,
        2.55808579192,
        2.4560925999200003,
        2.3859032729200003,
        2.40917150292,
        2.83630962392,
        2.4088842879200003,
        2.6993354919200003,
        2.5774812159200002,
        2.86780840892
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.67071990852,
      "stddev": 0.18305174851515482,
      "median": 2.6751907504200005,
      "user": 2.40460232,
      "system": 1.8450805200000002,
      "min": 2.44764615792,
      "max": 2.92012352992,
      "times": [
        2.5888497159200003,
        2.90020823492,
        2.7889964909200002,
        2.47066161092,
        2.52522079492,
        2.80381581592,
        2.7615317849200003,
        2.92012352992,
        2.50014494892,
        2.44764615792
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6061989323199999,
      "stddev": 0.08671542334794848,
      "median": 1.61721450292,
      "user": 1.6469375200000003,
      "system": 1.49552692,
      "min": 1.4521834309200001,
      "max": 1.71138882892,
      "times": [
        1.6854326159200002,
        1.65145456692,
        1.6249117129200001,
        1.4521834309200001,
        1.65961554192,
        1.6095172929200001,
        1.71138882892,
        1.46012806892,
        1.60414171992,
        1.6032155439200002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.61829264912,
      "stddev": 0.17830485509506164,
      "median": 1.58202989792,
      "user": 1.8754489199999997,
      "system": 1.7806130199999999,
      "min": 1.44276724392,
      "max": 1.9212067859200002,
      "times": [
        1.60455757692,
        1.9212067859200002,
        1.4538177969200001,
        1.60361817192,
        1.56044162392,
        1.7007093209200002,
        1.5299052619200002,
        1.4486455659200002,
        1.91725714292,
        1.44276724392
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 365.4 ± 21.9 334.1 407.8 1.23 ± 0.09
pacquet@main 306.1 ± 20.6 280.1 339.6 1.03 ± 0.08
pnpr@HEAD 298.2 ± 14.0 275.4 313.0 1.00
pnpr@main 330.3 ± 14.8 302.5 358.9 1.11 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.36542352240000003,
      "stddev": 0.021927432261257904,
      "median": 0.36631146020000005,
      "user": 0.29900462,
      "system": 0.7215267799999999,
      "min": 0.3341242012,
      "max": 0.40779240220000007,
      "times": [
        0.36016102120000004,
        0.3443215552,
        0.38511043320000005,
        0.37556799320000006,
        0.37234040720000006,
        0.36615019520000003,
        0.36647272520000007,
        0.40779240220000007,
        0.3341242012,
        0.34219429020000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3061318128,
      "stddev": 0.020622171449979833,
      "median": 0.3078337727,
      "user": 0.25573462,
      "system": 0.6102730800000001,
      "min": 0.28013775720000006,
      "max": 0.33958528220000006,
      "times": [
        0.33958528220000006,
        0.32212308720000005,
        0.31897605320000005,
        0.32533002120000004,
        0.31240135020000004,
        0.30326619520000003,
        0.2883807272,
        0.28142010120000005,
        0.28013775720000006,
        0.2896975532
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2982020523,
      "stddev": 0.014021478677466042,
      "median": 0.30350557170000003,
      "user": 0.24384962,
      "system": 0.56658898,
      "min": 0.27540225220000003,
      "max": 0.31303411020000005,
      "times": [
        0.28822232620000005,
        0.3023553452,
        0.27749446920000004,
        0.27540225220000003,
        0.3087869112,
        0.2920337042,
        0.30465579820000005,
        0.31303411020000005,
        0.31256580720000005,
        0.30746979920000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3303141186000001,
      "stddev": 0.014827119013973085,
      "median": 0.3305039042000001,
      "user": 0.27454342,
      "system": 0.62309938,
      "min": 0.30251202720000003,
      "max": 0.35888325220000006,
      "times": [
        0.34026225420000006,
        0.32684391020000003,
        0.30251202720000003,
        0.32332229320000005,
        0.31822926920000005,
        0.33276099020000005,
        0.32824681820000007,
        0.33408239520000005,
        0.33799797620000005,
        0.35888325220000006
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.838 ± 0.074 2.731 2.962 1.69 ± 0.15
pacquet@main 2.785 ± 0.043 2.725 2.860 1.66 ± 0.15
pnpr@HEAD 1.689 ± 0.119 1.519 1.876 1.01 ± 0.11
pnpr@main 1.675 ± 0.144 1.526 1.929 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.8381568418200005,
      "stddev": 0.07428958556468954,
      "median": 2.8159839782200002,
      "user": 2.41157164,
      "system": 1.93139592,
      "min": 2.73136434172,
      "max": 2.96182622172,
      "times": [
        2.73136434172,
        2.78724165172,
        2.8297538867200003,
        2.80221406972,
        2.7831784867200002,
        2.7978023207200002,
        2.85093505672,
        2.89360761872,
        2.96182622172,
        2.94364476372
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.78474953212,
      "stddev": 0.0430934467407228,
      "median": 2.77895997772,
      "user": 2.36798394,
      "system": 1.9207880200000003,
      "min": 2.72458670672,
      "max": 2.8600581747200002,
      "times": [
        2.76670532372,
        2.74519962272,
        2.72458670672,
        2.74686812072,
        2.79121463172,
        2.81717919372,
        2.8600581747200002,
        2.83366693372,
        2.79808567272,
        2.76393094072
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6893473539200001,
      "stddev": 0.11949472191770749,
      "median": 1.71575327422,
      "user": 1.7171949399999995,
      "system": 1.64284782,
      "min": 1.51875061272,
      "max": 1.87596524372,
      "times": [
        1.74182879872,
        1.74891987072,
        1.73161279172,
        1.60450419472,
        1.83257680972,
        1.57427961472,
        1.56514184572,
        1.69989375672,
        1.51875061272,
        1.87596524372
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6753356494199998,
      "stddev": 0.1444438528440505,
      "median": 1.6101224572200001,
      "user": 1.6035572399999996,
      "system": 1.5601790199999996,
      "min": 1.52566137972,
      "max": 1.9286658297200001,
      "times": [
        1.61551254372,
        1.56550146772,
        1.60473237072,
        1.52566137972,
        1.81582655672,
        1.88604266372,
        1.9286658297200001,
        1.59587457572,
        1.63002870972,
        1.5855103967200002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 517.7 ± 43.9 459.6 613.3 1.68 ± 0.15
pacquet@main 473.8 ± 44.4 411.3 535.2 1.54 ± 0.15
pnpr@HEAD 320.6 ± 13.8 293.1 341.1 1.04 ± 0.06
pnpr@main 307.5 ± 10.1 295.5 324.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.51772236636,
      "stddev": 0.043909876545733674,
      "median": 0.50419261456,
      "user": 0.7020188999999999,
      "system": 0.92802312,
      "min": 0.45955882006000004,
      "max": 0.61330338506,
      "times": [
        0.50702176806,
        0.49077312606000006,
        0.50136346106,
        0.54385135506,
        0.49726519906000005,
        0.51810105406,
        0.45955882006000004,
        0.48715512106000003,
        0.61330338506,
        0.55883037406
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.4737907335600001,
      "stddev": 0.04439968243814334,
      "median": 0.4788071010600001,
      "user": 0.6219252999999999,
      "system": 0.89424622,
      "min": 0.41128993406000003,
      "max": 0.53519726906,
      "times": [
        0.52353259206,
        0.53519726906,
        0.41327619406000005,
        0.4897798580600001,
        0.51186043806,
        0.44217924306000006,
        0.49575013006000007,
        0.44720733306000005,
        0.4678343440600001,
        0.41128993406000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.32056762016000007,
      "stddev": 0.013806069080274735,
      "median": 0.31994930806000005,
      "user": 0.20896699999999999,
      "system": 0.54824032,
      "min": 0.29307496006000006,
      "max": 0.34110912906000007,
      "times": [
        0.31050334606,
        0.31904333506000004,
        0.34110912906000007,
        0.33655655206000007,
        0.32645541206000006,
        0.31917638106000007,
        0.29307496006000006,
        0.32072223506,
        0.32787139406000004,
        0.31116345706000004
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30754999266000005,
      "stddev": 0.01007227566903217,
      "median": 0.30518787406000003,
      "user": 0.20476450000000002,
      "system": 0.5126900200000001,
      "min": 0.29553770506000004,
      "max": 0.32422793506,
      "times": [
        0.29971323006000006,
        0.30675864306000006,
        0.29553770506000004,
        0.30136219206000003,
        0.29817661606000007,
        0.32422793506,
        0.30361710506000006,
        0.31059604506000005,
        0.31186549106000006,
        0.32364496406000004
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.816 ± 0.075 1.752 1.964 5.37 ± 0.33
pacquet@main 1.751 ± 0.030 1.710 1.796 5.18 ± 0.25
pnpr@HEAD 0.338 ± 0.015 0.318 0.369 1.00
pnpr@main 0.357 ± 0.011 0.336 0.375 1.06 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8159221114799997,
      "stddev": 0.07517211592894503,
      "median": 1.77751400788,
      "user": 0.8550708199999999,
      "system": 0.9763972000000001,
      "min": 1.75181953088,
      "max": 1.96391745488,
      "times": [
        1.78232851388,
        1.90993501588,
        1.96391745488,
        1.87935828588,
        1.81522756988,
        1.77269950188,
        1.76431598088,
        1.75181953088,
        1.76339196488,
        1.75622729588
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.7506014799799998,
      "stddev": 0.030394213605474677,
      "median": 1.74370488588,
      "user": 0.79538862,
      "system": 0.8345556999999999,
      "min": 1.70956812688,
      "max": 1.79633587488,
      "times": [
        1.70956812688,
        1.7710616048799999,
        1.7257818228800001,
        1.7521421048799999,
        1.73526766688,
        1.79204703288,
        1.72815257088,
        1.72513857088,
        1.7705194238800002,
        1.79633587488
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33793073267999996,
      "stddev": 0.015010336691774807,
      "median": 0.33777611838,
      "user": 0.23931831999999997,
      "system": 0.5650786,
      "min": 0.31839903788,
      "max": 0.36878128888,
      "times": [
        0.32872289388,
        0.34020730588,
        0.33534493088,
        0.32428430788,
        0.34132253488,
        0.36878128888,
        0.31839903788,
        0.32492474588,
        0.34803998188,
        0.34928029888
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.35671101118000004,
      "stddev": 0.011461032183295576,
      "median": 0.35841923488,
      "user": 0.24422812,
      "system": 0.6309454,
      "min": 0.33633543488,
      "max": 0.37513757588,
      "times": [
        0.34804102688,
        0.34889172288,
        0.35845659788,
        0.33633543488,
        0.36018598988,
        0.35036151188,
        0.35838187188,
        0.37513757588,
        0.35962533688,
        0.37169304288
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 184.2 ± 6.2 172.7 193.0 1.98 ± 0.10
pacquet@main 219.4 ± 14.7 197.2 245.1 2.36 ± 0.18
pnpr@HEAD 92.8 ± 3.3 87.0 100.3 1.00
pnpr@main 95.1 ± 3.7 89.5 104.9 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.18415881010666668,
      "stddev": 0.006177917395805713,
      "median": 0.18458068844,
      "user": 0.15649923999999996,
      "system": 0.09697322,
      "min": 0.17269370844,
      "max": 0.19297426944,
      "times": [
        0.19096262544,
        0.19172960744,
        0.19297426944,
        0.18954009744,
        0.18852534944000002,
        0.18458068844,
        0.18693845844,
        0.17905373644,
        0.17738779344,
        0.18631623744,
        0.17812919744,
        0.17269370844,
        0.18314025244,
        0.18339985444,
        0.17701027544
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.21940993065428568,
      "stddev": 0.014699337373058854,
      "median": 0.21455365944000002,
      "user": 0.19519412571428568,
      "system": 0.11779849142857145,
      "min": 0.19718419144000002,
      "max": 0.24507666844,
      "times": [
        0.19791493544000002,
        0.21408439244000002,
        0.22327839744000003,
        0.21054064044,
        0.20971181644,
        0.21132355844,
        0.23901457444000002,
        0.23638095444,
        0.23091372344000002,
        0.21463769744000002,
        0.22720785744000002,
        0.21446962144,
        0.24507666844,
        0.19718419144000002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09277726969806453,
      "stddev": 0.0032819918926794926,
      "median": 0.09207477344000001,
      "user": 0.024381452903225805,
      "system": 0.011498890322580644,
      "min": 0.08704216644,
      "max": 0.10026948644,
      "times": [
        0.08963477444000001,
        0.08738511344000001,
        0.08704216644,
        0.09120079544000001,
        0.09445822544,
        0.09503424144,
        0.09185160944000001,
        0.09346089944000001,
        0.09288705644,
        0.09702783944,
        0.09318094244,
        0.09667867244,
        0.09580275444,
        0.10026948644,
        0.09421716344,
        0.09113562044000001,
        0.08952558444,
        0.08805922044,
        0.09511064944,
        0.09190251844,
        0.09117226144,
        0.09199611844000001,
        0.08991267744,
        0.09623728644,
        0.09090538044,
        0.08889806644,
        0.09477745644,
        0.09207477344000001,
        0.09855794544,
        0.09577943344,
        0.08991862744000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09505782616413792,
      "stddev": 0.0036964600192832923,
      "median": 0.09454676844,
      "user": 0.022014081379310345,
      "system": 0.015168419999999998,
      "min": 0.08946370944,
      "max": 0.10493876044,
      "times": [
        0.09681783244,
        0.09367417244000001,
        0.09654133044,
        0.09368176544000001,
        0.09192870844,
        0.09159632544,
        0.10001869544,
        0.09477647244000001,
        0.08946370944,
        0.09102597344,
        0.09079819044000001,
        0.09753521344,
        0.09848138244,
        0.09573958644000001,
        0.10493876044,
        0.09175688544,
        0.09472201744,
        0.09235415044,
        0.09304941644,
        0.09434925044,
        0.09338897544000001,
        0.09653410144,
        0.10166550544,
        0.09265542044000001,
        0.09454676844,
        0.09128996744000001,
        0.09581906544,
        0.09518514644,
        0.10234216944
      ]
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.028 ± 0.335 0.662 1.580 1.00
pacquet@main 1.059 ± 0.344 0.710 1.681 1.03 ± 0.47
pnpm@HEAD 2.986 ± 0.114 2.859 3.153 2.91 ± 0.95
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.027670306988889,
      "stddev": 0.3349839614385386,
      "median": 0.9199141391000001,
      "user": 0.977008502222222,
      "system": 0.29322141555555553,
      "min": 0.6617895811000001,
      "max": 1.5796583491,
      "times": [
        1.1571317361,
        0.8155252501000001,
        0.6617895811000001,
        0.7704474321,
        0.8002839611,
        1.5445170020999999,
        0.9997653121000001,
        0.9199141391000001,
        1.5796583491
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.0592274729888889,
      "stddev": 0.34384095776733725,
      "median": 0.8857375901000001,
      "user": 0.9952789466666666,
      "system": 0.30544841555555563,
      "min": 0.7097318321,
      "max": 1.6807526321000001,
      "times": [
        0.8857375901000001,
        1.6807526321000001,
        0.8245049531,
        0.7097318321,
        1.2713555481,
        1.4714688681,
        0.8242924931000001,
        1.0906756811,
        0.7745276591000001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 2.985963129766667,
      "stddev": 0.11392494070932863,
      "median": 2.9448952181000005,
      "user": 4.244740946666665,
      "system": 0.3103421933333333,
      "min": 2.8591414801000004,
      "max": 3.1533122451000004,
      "times": [
        2.8769248561,
        2.8591414801000004,
        3.1179549391,
        3.0395804251,
        3.0861356931,
        2.9448952181000005,
        3.1533122451000004,
        2.8853951571,
        2.9103281541
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.619 ± 0.159 4.463 4.900 1.29 ± 0.07
pacquet@main 4.640 ± 0.179 4.438 4.950 1.29 ± 0.07
pnpr@HEAD 3.611 ± 0.074 3.494 3.713 1.01 ± 0.04
pnpr@main 3.586 ± 0.134 3.465 3.923 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.6187608761600005,
      "stddev": 0.15862498761666735,
      "median": 4.575664936959999,
      "user": 2.1498853799999997,
      "system": 1.7023193999999997,
      "min": 4.46320455196,
      "max": 4.90021146696,
      "times": [
        4.46432070996,
        4.46320455196,
        4.47516255896,
        4.74919211796,
        4.49563708296,
        4.80993104096,
        4.61142221996,
        4.67861935796,
        4.539907653959999,
        4.90021146696
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.63983032136,
      "stddev": 0.1792949859126578,
      "median": 4.542923781459999,
      "user": 2.3907333799999995,
      "system": 1.8027994,
      "min": 4.43804590396,
      "max": 4.95006402396,
      "times": [
        4.5613713879599995,
        4.8729593399599995,
        4.523975688959999,
        4.683578273959999,
        4.524476174959999,
        4.43804590396,
        4.50886230596,
        4.51827306896,
        4.95006402396,
        4.81669704496
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.61140670276,
      "stddev": 0.07382513571364868,
      "median": 3.6036285499600003,
      "user": 1.79545338,
      "system": 1.6802677000000004,
      "min": 3.4939617209600002,
      "max": 3.71313737596,
      "times": [
        3.5991507349600003,
        3.70988903996,
        3.61075414596,
        3.71313737596,
        3.6081063649600003,
        3.56324189996,
        3.6957732789600004,
        3.54715898696,
        3.57289347896,
        3.4939617209600002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5859401813600003,
      "stddev": 0.13390022964704915,
      "median": 3.54963147146,
      "user": 1.41948638,
      "system": 1.3149186,
      "min": 3.46496039696,
      "max": 3.9230635779600003,
      "times": [
        3.67068382896,
        3.61236981996,
        3.4998958789600003,
        3.57585149796,
        3.9230635779600003,
        3.50395175796,
        3.5832407079600004,
        3.46496039696,
        3.5234114449600002,
        3.50197290196
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13657
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-restore.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
334.12 ms
(+20.37%)Baseline: 277.59 ms
333.10 ms
(100.31%)

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,731.36 ms
(+2.53%)Baseline: 2,663.97 ms
3,196.77 ms
(85.44%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,751.82 ms
(-2.39%)Baseline: 1,794.73 ms
2,153.67 ms
(81.34%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
459.56 ms
(+4.82%)Baseline: 438.44 ms
526.13 ms
(87.35%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
172.69 ms
(-13.01%)Baseline: 198.51 ms
238.21 ms
(72.50%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,385.90 ms
(-1.16%)Baseline: 2,413.83 ms
2,896.59 ms
(82.37%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,463.20 ms
(-0.33%)Baseline: 4,477.95 ms
5,373.54 ms
(83.06%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
334.12 ms
(+20.37%)Baseline: 277.59 ms
333.10 ms
(100.31%)

isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
661.79 ms
(-1.66%)Baseline: 672.95 ms
807.54 ms
(81.95%)
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit 29b6da6 into main Aug 5, 2026
34 of 35 checks passed
@zkochan
zkochan deleted the split-audit-cli branch August 5, 2026 09:06
KSXGitHub pushed a commit that referenced this pull request Aug 6, 2026
Picks up sixteen commits, most of them module splits: the optimistic
repeat-install check (#13661), the frozen install and its build
phase (#13659, #13662), `create_virtual_store`
(#13649), the tarball crate root (#13652), and the
audit command (#13657). Also the move to the `rc` lane and
pacquet 12.0.0-rc.0 (#13666, #13667).

#13661 split `optimistic_repeat_install.rs` into per-concern
modules, moving one of this branch's two `build_workspace_state::<Host>`
call sites into the new `deps_status.rs`. The turbofish is re-applied at
both of its new homes.

# Conflicts:
#	pnpm/crates/package-manager/src/optimistic_repeat_install.rs
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