Skip to content

fix(audit): exit non-zero when vulnerabilities remain after ignoring - #17342

Merged
zkochan merged 2 commits into
mainfrom
fix-audit-ignore-exit-code
Oct 25, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-audit-ignore-exit-code

Conversation

@zkochan

@zkochan zkochan commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm audit --ignore <id> and pnpm audit --ignore-unfixable returned exit code 0 right after writing the ignore list, so CI passed even when vulnerabilities that were not ignored remained. Both CLIs now exit with code 1 when, after ignoring, an advisory at or above the audit level remains. This is the same rule a plain pnpm audit applies.

Part of pnpm/tasks#191

  • Fixed in both stacks (the bug and the old behavior were identical), with one shared changeset.
  • The ignore modes still write the ignores and print the same message. The remaining set excludes every GHSA in the merged list: the previously configured ignores plus the new ones, which with --ignore-unfixable is every advisory with no patched version.
  • --json still prints the ignore message, not a report, in both CLIs. Only the exit code changes.
  • --fix is unchanged. It takes precedence over --ignore in both CLIs.
  • Docs: the v12 audit page said the ignore modes always exit 0. That sentence is corrected, and the v11 page gets the same exit-code sentence.

Squash Commit Body

`pnpm audit --ignore` and `pnpm audit --ignore-unfixable` returned exit
code 0 right after writing the ignore list, so CI passed even when
vulnerabilities that were not ignored remained. Both CLIs now remove
every GHSA in the merged ignore list (the configured ignores plus the
new ones) from the report and apply the same audit-level check a plain
`pnpm audit` uses. The printed message is unchanged.

v11: the threshold filter is extracted into filterAdvisoriesByAuditLevel
and shared by the report and ignore paths.
v12: ignore_vulnerabilities returns the merged list it wrote, and
filter_ignored_advisories delegates to a new remove_advisories_by_ghsa.

Part of https://github.com/pnpm/tasks/issues/191

Checklist

  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • Added a changeset.
  • Added or updated tests. Each new exit-1 test fails with the old early
    exitCode: 0 / AuditOutcome::Clean. Each exit-0 test fails if the
    ignored advisories are not removed before the threshold check.
  • Updated the documentation.

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

🤖 Generated with Claude Code


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

Summary by CodeRabbit

  • Bug Fixes
    • pnpm audit now exits with a non-zero status when vulnerabilities at or above the configured audit level remain after using --ignore or --ignore-unfixable. Vulnerabilities below the configured level do not cause a failure, and the command succeeds when no qualifying vulnerabilities remain.
  • Documentation
    • Updated the audit command documentation to explain how ignored vulnerabilities and the configured audit level affect the command’s exit status.

`pnpm audit --ignore` and `pnpm audit --ignore-unfixable` returned exit
code 0 right after writing the ignore list, so CI passed even when
vulnerabilities that were not ignored remained. Both CLIs now remove
every GHSA in the merged ignore list from the report and apply the
same audit-level check a plain `pnpm audit` uses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between e3bc820 and 00eae87.

Files selected for processing: 1
  • pnpm11/deps/compliance/commands/test/audit/ignore.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Walkthrough

The Rust CLI and pnpm 11 audit command now return a non-zero exit code when an advisory at or above the configured audit level remains after ignored advisories are removed. Tests, documentation, and a changeset reflect the updated behavior.

Changes: Audit ignore exit-code handling

Layer / File(s) Summary
Rust CLI audit outcome
pnpm/crates/cli/src/cli_args/audit/advisories.rs, pnpm/crates/cli/src/cli_args/audit/fix.rs, pnpm/crates/cli/src/cli_args/audit.rs, pnpm/crates/cli/tests/suite/audit/fixes.rs, pnpm/docs/cli/audit.md
The Rust CLI removes ignored GHSA advisories before determining the audit outcome. The ignore operation returns its summary and persisted ignore IDs. Tests cover --ignore, --ignore-unfixable, and audit-level behavior.
pnpm 11 audit outcome
pnpm11/deps/compliance/commands/src/audit/audit.ts, pnpm11/deps/compliance/commands/test/audit/ignore.ts, pnpm11/docs/cli/audit.md, .changeset/audit-ignore-exit-code.md
The audit command uses a shared audit-level filter to determine its exit code after removing ignored advisories. Tests and documentation cover the updated exit behavior, and the changeset declares patch releases.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested labels: product: pacquet, product: pnpm@11

Merge Risk: Minimal · up to 00eae

Ignored advisories are removed before the audit-level check, so remaining vulnerabilities correctly produce a non-zero exit code.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.

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.

@garnet-runtime-review

garnet-runtime-review Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Execution Profiles recorded for 1 job, triggered by 00eae87

1 job changed +3 −1 destinations · compared with e3bc820
recorded at the kernel by Garnet · 2026-10-25 15:14 UTC

+3 −1 · TS CI / test ↗
@@ e3bc820 (previous) vs 00eae87 (current) @@
  systemd
  ├─ bash
  │  └─ bash
  │     └─ bash
  │        └─ bash
  │           └─ bash
  │              └─ bash
  │                 ├─ bash
  │                 │  ├─ node
  │                 │  │  ├─ git (step: "<unknown>")
  │                 │  │  │  ├─ git
  │                 │  │  │  │  └─ git
  │                 │  │  │  │     └─ git-remote-http
  │                 │  │  │  │        └─ ○ github[.]com
  │                 │  │  │  └─ ○ 192.168.127.1
  │                 │  │  └─ pn (step: "Validate test chunk inputs")
  │                 │  │     ├─ dash
  │                 │  │     │  └─ node
  │                 │  │     │     └─ pn
  │                 │  │     │        └─ dash
  │                 │  │     │           └─ pn
  │                 │  │     │              └─ dash
  │                 │  │     │                 └─ pnpm
  │                 │  │     │                    └─ dash
  │                 │  │     │                       └─ node
  │                 │  │     │                          ├─ ○ codeload.github[.]com
  │                 │  │     │                          └─ ○ registry.npmjs[.]org
  │                 │  │     └─ ○ nodejs[.]org
  │                 │  └─ gh (step: "Wait for prebuilt pnpr binaries")
  │                 │     └─ ○ api.github[.]com
  │                 └─ node (runner background · +1)
  │                    ├─ ○ blacksmith.blob.core.windows[.]net
+ │                    └─ ○ productionresultssa10.blob.core[.]windows
  ├─ chronyd (runner background · +4 −4)
+ │  ├─ ○ 136.55.219.181
- │  ├─ ○ 137.190.2.4
- │  ├─ ○ 162.210.6.162
  │  ├─ ○ 169.254.169.123
  │  ├─ ○ 185.125.190.56
  │  ├─ ○ 185.125.190.57
  │  ├─ ○ 185.125.190.58
+ │  ├─ ○ 198.178.138.196
+ │  ├─ ○ 216.240.36.24
- │  ├─ ○ 23.139.196.1
+ │  ├─ ○ 69.64.225.2
- │  ├─ ○ 69.9.131.113
  │  └─ ○ 91.189.91.157
  ├─ nginx (runner background · +2)
  │  └─ nginx
  │     ├─ ○ 140.82.113.21
  │     ├─ ○ 140.82.113.22
+ │     ├─ ○ 140.82.114.21
  │     ├─ ○ 8.8.8.8
+ │     └─ ○ glb-db52c2cf8be544.github[.]com
  └─ snapd
     └─ ○ api.snapcraft[.]io
 
  Runner.Worker
+ ├─ node
+ │  └─ ○ blob.blz25prdstrz09a.store.core[.]windows
  ├─ bash
  │  ├─ rustup (step: "Initialize Rust before dependenc…tion ($/.github/actions/rustup)")
  │  │  ├─ ○ dualstack.k.sni.global.fastly[.]net
  │  │  └─ ○ localhost (dns resolver)
  │  └─ MainThread
  │     └─ pn
  │        └─ dash
  │           └─ node
+ │              ├─ pn
+ │              │  └─ node (step: "Validate test chunk inputs")
+ │              │     ├─ ○ npm.jsr[.]io
+ │              │     └─ ○ pnpm[.]io
  │              └─ node
  │                 └─ node (step: "Validate test chunk inputs")
  │                    └─ ○ unofficial-builds.nodejs[.]org
- └─ MainThread
-    └─ ○ productionresultssa2.blob.core.windows[.]net

2 addresses rotated (github infra)

View this job's Execution Profile in Garnet →


💡 How to read this
Runner.Worker          ← process on a path
└─ npm
   └─ node             ← process that acted
      └─ ○ npmjs[.]org ← observed action

follow a path downward to see what ran and what it did — each path to an observed action is an execution chain

names on the path = processes · ○ = observed action · (…) = context

+ only in the current record · − only in the previous record · runner background = the runner's infrastructure, not your workflow

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                    pr
-----                                            ----                                    --
lockfile/parse_pnpm_lock                         1.06     15.9±1.03ms    23.6 MB/sec     1.00     15.1±0.60ms    24.9 MB/sec
packument/parse                                  1.05     43.6±1.28µs  1520.8 MB/sec     1.00     41.5±0.85µs  1598.0 MB/sec
tarball/download_dependency                      1.19  1297.7±358.17µs     3.3 MB/sec    1.00  1090.7±158.98µs     3.9 MB/sec
tarball_batch/cold_store_many_medium_tarballs    1.04   262.0±29.93ms 61.1 KElem/sec     1.00    252.8±9.17ms 63.3 KElem/sec
version_pick/repeated_ranges_file                1.13      5.0±0.30ms  6.3 KElem/sec     1.00      4.4±0.14ms  7.1 KElem/sec
version_pick/repeated_ranges_raw                 1.13      5.0±0.42ms  6.3 KElem/sec     1.00      4.4±0.09ms  7.1 KElem/sec
workspace_resolution/hoist_heavy                 1.27   450.6±25.86ms        ? ?/sec     1.00   354.8±27.95ms        ? ?/sec
workspace_sort/chained_projects                  1.66     31.5±8.77ms        ? ?/sec     1.00     19.0±3.72ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2582.98 ms 2373.14 ms -8.1% 129.15 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1562.71 ms 1630.27 ms 4.3% 78.14 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 389.77 ms 343.03 ms -12.0% 19.49 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 414.10 ms 389.63 ms -5.9% 20.70 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 8.53 ms 8.77 ms 2.8% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 8.68 ms 8.69 ms 0.2% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 12.20 ms 16.69 ms 36.8% 2.00 ms Inconclusive (overlapping samples)
isolated-repeat-install-cold-cache-hot-store pnpr 13.13 ms 11.62 ms -11.5% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2476.10 ms 2488.45 ms 0.5% 123.80 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1491.92 ms 1465.68 ms -1.8% 74.60 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 528.87 ms 535.90 ms 1.3% 26.44 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 330.28 ms 334.01 ms 1.1% 16.51 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1575.66 ms 1576.15 ms 0.0% 78.78 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 261.42 ms 263.06 ms 0.6% 13.07 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 249.77 ms 244.89 ms -2.0% 12.49 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 87.77 ms 89.65 ms 2.1% 4.39 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 201.27 ms 194.68 ms -3.3% 10.06 ms Within tolerance
isolated-linked-workspace-resolve-hot-cache-offline pacquet 113.38 ms 95.90 ms -15.4% 5.67 ms Within tolerance
isolated-injected-workspace-repeat-install-hot-cache-hot-store pacquet 92.42 ms 92.88 ms 0.5% 4.62 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4369.48 ms 4456.85 ms 2.0% 218.47 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3509.06 ms 3480.86 ms -0.8% 175.45 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 193.94 ms 196.32 ms 1.2% 9.70 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 233.81 ms 221.82 ms -5.1% 11.69 ms Within tolerance
store-only-unlocked-direct-deps-cold-cache-hot-store pacquet 1139.33 ms 1146.84 ms 0.7% 56.97 ms Within tolerance
cargo-repeat-install-hot-cache-hot-store pacquet 27.15 ms 27.47 ms 1.2% 2.00 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: 00eae8787748

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm; the linked, injected, and Cargo workspace scenarios compare current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.416 ± 0.105 2.301 2.643 1.51 ± 0.13
pacquet@main 2.563 ± 0.119 2.345 2.716 1.60 ± 0.14
pnpr@HEAD 1.660 ± 0.143 1.489 1.951 1.04 ± 0.12
pnpr@main 1.599 ± 0.124 1.447 1.789 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.41584390898,
      "stddev": 0.10495070739137353,
      "median": 2.3731436934800003,
      "user": 2.2032104599999998,
      "system": 1.9668928599999997,
      "min": 2.30075448348,
      "max": 2.64311427848
    },
    {
      "command": "pacquet@main",
      "mean": 2.5626592605800003,
      "stddev": 0.11923234256838658,
      "median": 2.58298008448,
      "user": 2.3689805599999993,
      "system": 2.07833766,
      "min": 2.34519927948,
      "max": 2.71648283348
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6604342569799997,
      "stddev": 0.143305386052531,
      "median": 1.63026797698,
      "user": 2.32241516,
      "system": 2.1671997600000004,
      "min": 1.48914495648,
      "max": 1.9508206094799998
    },
    {
      "command": "pnpr@main",
      "mean": 1.59948770378,
      "stddev": 0.12403581004515515,
      "median": 1.56270803198,
      "user": 2.2942212599999996,
      "system": 2.11120616,
      "min": 1.44724740848,
      "max": 1.78909530448
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 353.7 ± 34.4 307.9 412.8 1.00
pacquet@main 398.8 ± 35.7 358.0 461.8 1.13 ± 0.15
pnpr@HEAD 387.6 ± 20.7 356.0 412.2 1.10 ± 0.12
pnpr@main 417.2 ± 33.4 376.1 471.9 1.18 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.35372534978000003,
      "stddev": 0.034420681493631075,
      "median": 0.34303309618000005,
      "user": 0.42122393999999996,
      "system": 0.8093272199999999,
      "min": 0.30786991518000006,
      "max": 0.41282117318000006
    },
    {
      "command": "pacquet@main",
      "mean": 0.39876920148,
      "stddev": 0.035683953628151036,
      "median": 0.38976803618000005,
      "user": 0.44961754000000004,
      "system": 0.91116732,
      "min": 0.35801518218000006,
      "max": 0.46176075218000007
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.38761792608000006,
      "stddev": 0.020730518483954716,
      "median": 0.38962940668,
      "user": 0.43215994,
      "system": 0.8510778200000001,
      "min": 0.35595178918000003,
      "max": 0.41220860218000005
    },
    {
      "command": "pnpr@main",
      "mean": 0.41715898728,
      "stddev": 0.033411527617918914,
      "median": 0.41409535368000006,
      "user": 0.45593074,
      "system": 0.8922314199999999,
      "min": 0.37612418518000007,
      "max": 0.47188649718000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 9.0 ± 0.7 8.2 13.2 1.03 ± 0.12
pacquet@main 8.7 ± 0.7 8.1 12.4 1.00
pnpr@HEAD 9.0 ± 1.1 8.2 21.3 1.04 ± 0.15
pnpr@main 9.1 ± 1.1 8.2 14.1 1.05 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.009018638062524922,
      "stddev": 0.0007390893180809596,
      "median": 0.008765308820000001,
      "user": 0.004631872026578073,
      "system": 0.005316190631229238,
      "min": 0.008227333820000002,
      "max": 0.013245807820000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.008727254830489509,
      "stddev": 0.000693306296364563,
      "median": 0.008526118820000001,
      "user": 0.004733500979020979,
      "system": 0.004868771538461538,
      "min": 0.008055616820000002,
      "max": 0.012382431820000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009042973916463025,
      "stddev": 0.0011432491501913633,
      "median": 0.00869331182,
      "user": 0.004324414147909971,
      "system": 0.005639580643086817,
      "min": 0.008229288820000001,
      "max": 0.02125677082
    },
    {
      "command": "pnpr@main",
      "mean": 0.009120311981403515,
      "stddev": 0.0010608530507055256,
      "median": 0.008679129820000001,
      "user": 0.004594374736842105,
      "system": 0.00546612554385965,
      "min": 0.00819403282,
      "max": 0.014129415820000001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 18.6 ± 6.5 10.7 41.8 1.52 ± 0.59
pacquet@main 12.6 ± 1.8 10.1 21.9 1.04 ± 0.23
pnpr@HEAD 12.2 ± 2.1 9.7 22.0 1.00
pnpr@main 13.4 ± 1.7 10.5 22.5 1.09 ± 0.23
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.01855737074634145,
      "stddev": 0.006511955429818792,
      "median": 0.0166877012,
      "user": 0.009812807317073178,
      "system": 0.010290187317073167,
      "min": 0.0106552982,
      "max": 0.0418224922
    },
    {
      "command": "pacquet@main",
      "mean": 0.01263972472760736,
      "stddev": 0.0018406337932977883,
      "median": 0.012195545200000001,
      "user": 0.006953565030674843,
      "system": 0.00687744662576687,
      "min": 0.010076751200000001,
      "max": 0.021862080199999998
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.012207758627350431,
      "stddev": 0.0020882646002862056,
      "median": 0.011615573200000001,
      "user": 0.0069921444444444435,
      "system": 0.0064598666666666645,
      "min": 0.009689833200000001,
      "max": 0.0219597842
    },
    {
      "command": "pnpr@main",
      "mean": 0.013361846583886257,
      "stddev": 0.0016998236741110834,
      "median": 0.0131251022,
      "user": 0.007542903791469191,
      "system": 0.0071414654028436,
      "min": 0.0104776942,
      "max": 0.022531580199999998
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.485 ± 0.018 2.456 2.507 1.68 ± 0.10
pacquet@main 2.476 ± 0.029 2.436 2.519 1.67 ± 0.10
pnpr@HEAD 1.510 ± 0.145 1.335 1.732 1.02 ± 0.12
pnpr@main 1.482 ± 0.090 1.357 1.665 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.48479704896,
      "stddev": 0.017902666772172438,
      "median": 2.48845359086,
      "user": 2.09793098,
      "system": 1.6839514999999998,
      "min": 2.45587422036,
      "max": 2.50662254536
    },
    {
      "command": "pacquet@main",
      "mean": 2.4760702364599996,
      "stddev": 0.029429496947227764,
      "median": 2.47609800736,
      "user": 2.07216588,
      "system": 1.6209211999999997,
      "min": 2.43594166236,
      "max": 2.51884234636
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5103813571599995,
      "stddev": 0.1451316070242318,
      "median": 1.46568301836,
      "user": 1.5762841799999998,
      "system": 1.4021927,
      "min": 1.33506338736,
      "max": 1.73169305936
    },
    {
      "command": "pnpr@main",
      "mean": 1.4820231157600001,
      "stddev": 0.08981302338579515,
      "median": 1.49192185836,
      "user": 1.63762038,
      "system": 1.3691935000000002,
      "min": 1.3570753953599999,
      "max": 1.66547294936
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 559.0 ± 71.1 481.7 688.4 1.69 ± 0.22
pacquet@main 561.7 ± 63.6 488.2 664.3 1.70 ± 0.20
pnpr@HEAD 334.5 ± 5.0 326.5 341.4 1.01 ± 0.03
pnpr@main 330.7 ± 8.9 319.1 353.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.55900801926,
      "stddev": 0.07107028665724177,
      "median": 0.53590078046,
      "user": 0.76292466,
      "system": 1.31520796,
      "min": 0.48166562296000004,
      "max": 0.68842428596
    },
    {
      "command": "pacquet@main",
      "mean": 0.56168297196,
      "stddev": 0.06360822543220618,
      "median": 0.5288701529600001,
      "user": 0.7424641599999998,
      "system": 1.4146752599999999,
      "min": 0.48822810096,
      "max": 0.66434372296
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.33451595556,
      "stddev": 0.005027615109279069,
      "median": 0.33401424146,
      "user": 0.27951086,
      "system": 0.7588957599999999,
      "min": 0.32648954196,
      "max": 0.34139057096000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.33071828776,
      "stddev": 0.008867418331609629,
      "median": 0.33027517196,
      "user": 0.27586296,
      "system": 0.76578246,
      "min": 0.31909281296,
      "max": 0.35313332896
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.580 ± 0.019 1.546 1.615 6.03 ± 0.11
pacquet@main 1.574 ± 0.014 1.549 1.594 6.01 ± 0.10
pnpr@HEAD 0.264 ± 0.008 0.255 0.279 1.01 ± 0.03
pnpr@main 0.262 ± 0.003 0.256 0.269 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.57972966552,
      "stddev": 0.018770376106662667,
      "median": 1.5761505630200001,
      "user": 0.7235292400000001,
      "system": 0.9502165799999999,
      "min": 1.5456359445199999,
      "max": 1.61535796052
    },
    {
      "command": "pacquet@main",
      "mean": 1.5738227869199999,
      "stddev": 0.01405252073418863,
      "median": 1.5756552360199998,
      "user": 0.71877124,
      "system": 0.93783408,
      "min": 1.54909282652,
      "max": 1.5941581715200002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26397881302,
      "stddev": 0.00792661943408409,
      "median": 0.26305749952,
      "user": 0.19725324000000002,
      "system": 0.53307608,
      "min": 0.25477370352000006,
      "max": 0.27861779252
    },
    {
      "command": "pnpr@main",
      "mean": 0.26179790482000004,
      "stddev": 0.003423552634921611,
      "median": 0.26141873302000007,
      "user": 0.20679683999999998,
      "system": 0.5191582799999999,
      "min": 0.25595027552000005,
      "max": 0.26884458352000007
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 247.9 ± 16.4 221.2 273.4 2.78 ± 0.21
pacquet@main 243.6 ± 16.5 213.8 271.7 2.73 ± 0.21
pnpr@HEAD 89.7 ± 2.9 85.8 96.7 1.00 ± 0.05
pnpr@main 89.3 ± 3.3 85.6 98.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24786614991999997,
      "stddev": 0.01644244186289335,
      "median": 0.24489334312000002,
      "user": 0.20548171999999995,
      "system": 0.28230108,
      "min": 0.22117146362000004,
      "max": 0.27343762062000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.24364728470333338,
      "stddev": 0.016500231353598568,
      "median": 0.24977105162000002,
      "user": 0.19754083666666666,
      "system": 0.28247338,
      "min": 0.21381323162000002,
      "max": 0.27169371962000005
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08969699065030304,
      "stddev": 0.002889029644293991,
      "median": 0.08964648662000001,
      "user": 0.029800056363636366,
      "system": 0.023163773939393943,
      "min": 0.08575409662,
      "max": 0.09671082562
    },
    {
      "command": "pnpr@main",
      "mean": 0.08926267939419355,
      "stddev": 0.003303122087729936,
      "median": 0.08777008762,
      "user": 0.031119129677419352,
      "system": 0.021887819354838706,
      "min": 0.08560990562,
      "max": 0.09866405762
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 197.3 ± 7.5 190.5 214.4 1.00 ± 0.07
pacquet@main 196.8 ± 10.7 182.0 213.9 1.00
pnpm@HEAD 3941.0 ± 133.1 3765.4 4131.7 20.02 ± 1.28
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.19732358552444448,
      "stddev": 0.007516639021879331,
      "median": 0.19467719308000003,
      "user": 0.20757590444444443,
      "system": 0.048279851111111105,
      "min": 0.19048419308000003,
      "max": 0.21438946908000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.1968224498577778,
      "stddev": 0.010653137553265015,
      "median": 0.20127307108000003,
      "user": 0.21136190444444444,
      "system": 0.04088796222222221,
      "min": 0.18199303408000003,
      "max": 0.21390042908
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.940969169524444,
      "stddev": 0.13306962033864334,
      "median": 3.94025892908,
      "user": 6.211814015555556,
      "system": 0.3719848511111111,
      "min": 3.76536944908,
      "max": 4.13168503408
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 101.4 ± 15.8 86.3 160.3 1.00
pacquet@main 123.0 ± 23.7 99.8 202.0 1.21 ± 0.30
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.10136553647333334,
      "stddev": 0.015793589160443235,
      "median": 0.09590156034,
      "user": 0.09396368666666666,
      "system": 0.06625151333333332,
      "min": 0.08629804184,
      "max": 0.16027821684000002
    },
    {
      "command": "pacquet@main",
      "mean": 0.12303975106727273,
      "stddev": 0.02369687052977657,
      "median": 0.11338459334,
      "user": 0.11232092909090909,
      "system": 0.08585073454545454,
      "min": 0.09979922884,
      "max": 0.20196406784
    }
  ]
}

Scenario: Isolated linker: injected workspace repeat install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 94.1 ± 4.8 86.3 107.5 1.01 ± 0.07
pacquet@main 92.7 ± 3.6 87.9 102.5 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.09406035230000002,
      "stddev": 0.004819928103386242,
      "median": 0.09288390030000002,
      "user": 0.031017313333333327,
      "system": 0.07099076,
      "min": 0.0862813483,
      "max": 0.10746846730000001
    },
    {
      "command": "pacquet@main",
      "mean": 0.09267982755000002,
      "stddev": 0.0036049739696407544,
      "median": 0.0924217403,
      "user": 0.03503358625,
      "system": 0.06536472874999999,
      "min": 0.08792176430000001,
      "max": 0.10245823230000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.507 ± 0.178 4.327 4.757 1.29 ± 0.06
pacquet@main 4.436 ± 0.123 4.310 4.607 1.27 ± 0.05
pnpr@HEAD 3.506 ± 0.096 3.407 3.659 1.00
pnpr@main 3.530 ± 0.098 3.411 3.679 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.5069028512800005,
      "stddev": 0.17796420084703773,
      "median": 4.4568452797800004,
      "user": 1.8134050799999997,
      "system": 1.57984434,
      "min": 4.32716927178,
      "max": 4.75706801878
    },
    {
      "command": "pacquet@main",
      "mean": 4.43585681778,
      "stddev": 0.12264626525165674,
      "median": 4.36947996628,
      "user": 1.8957307799999998,
      "system": 1.5124032399999998,
      "min": 4.30962179678,
      "max": 4.60734110878
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.50591125528,
      "stddev": 0.09565425993773424,
      "median": 3.48086071178,
      "user": 1.79255128,
      "system": 1.48358414,
      "min": 3.40741811178,
      "max": 3.65866558678
    },
    {
      "command": "pnpr@main",
      "mean": 3.53037481828,
      "stddev": 0.09818398044642351,
      "median": 3.50905745478,
      "user": 1.83475938,
      "system": 1.5344139399999999,
      "min": 3.41134492778,
      "max": 3.6788032747800004
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 199.7 ± 13.8 183.1 235.7 1.02 ± 0.14
pacquet@main 195.6 ± 22.2 168.0 262.8 1.00
pnpr@HEAD 223.1 ± 11.8 205.6 249.7 1.14 ± 0.14
pnpr@main 233.9 ± 22.2 177.3 257.6 1.20 ± 0.18
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.19969920643000003,
      "stddev": 0.013811566904401582,
      "median": 0.19632185168000002,
      "user": 0.25632465333333326,
      "system": 0.21728361,
      "min": 0.18314428418,
      "max": 0.23565907718
    },
    {
      "command": "pacquet@main",
      "mean": 0.19557482139428567,
      "stddev": 0.022188634641648396,
      "median": 0.19394018468000002,
      "user": 0.24272053428571422,
      "system": 0.21370778857142855,
      "min": 0.16801680018,
      "max": 0.26277782818
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2230811763466667,
      "stddev": 0.011797043387274293,
      "median": 0.22181540168000002,
      "user": 0.2779709033333333,
      "system": 0.20314077666666663,
      "min": 0.20557078318000002,
      "max": 0.24972644718
    },
    {
      "command": "pnpr@main",
      "mean": 0.23386585545272728,
      "stddev": 0.0222251401566607,
      "median": 0.23381115518,
      "user": 0.2733005472727273,
      "system": 0.24353635999999998,
      "min": 0.17734233018,
      "max": 0.25758643317999996
    }
  ]
}

Scenario: Store only: unlocked direct deps, cold cache + hot store

Store-only install (enableModulesDir: false, per-file store index, trusted lockfile) against a lockfile missing the direct dependencies that have peers, with the metadata cache wiped per iteration: the install resolves those from the registry, reuses their subtrees from the lockfile and checks the store, linking nothing. Direct installs only.

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.146 ± 0.012 1.118 1.165 1.00 ± 0.02
pacquet@main 1.145 ± 0.016 1.125 1.178 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.1462451970999998,
      "stddev": 0.012355587801821898,
      "median": 1.1468406059,
      "user": 0.4412437799999999,
      "system": 0.21896776000000004,
      "min": 1.1180170954,
      "max": 1.1651825294
    },
    {
      "command": "pacquet@main",
      "mean": 1.1447705287999999,
      "stddev": 0.016482631922507422,
      "median": 1.1393329499,
      "user": 0.44154547999999993,
      "system": 0.21467676,
      "min": 1.1251112944,
      "max": 1.1777681434
    }
  ]
}

Scenario: Cargo: repeat install, hot cache + hot store

Frozen repeat install of a Cargo workspace (cargo.enabled: true) whose crates are already materialized in <storeDir>/v11/crates/ and linked into .pnpm/crates/crates-io. Direct installs only.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 27.6 ± 0.8 26.8 33.4 1.00 ± 0.06
pacquet@main 27.5 ± 1.3 26.4 35.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.0276363709659406,
      "stddev": 0.0008299771905652247,
      "median": 0.02747173956,
      "user": 0.01868054673267326,
      "system": 0.01699261386138613,
      "min": 0.02675566456,
      "max": 0.03340527056
    },
    {
      "command": "pacquet@main",
      "mean": 0.027516981017142866,
      "stddev": 0.0012726592787759648,
      "median": 0.02715226956,
      "user": 0.020276858095238097,
      "system": 0.014945166476190477,
      "min": 0.026444899560000002,
      "max": 0.03499710056
    }
  ]
}

@codecov-commenter

codecov-commenter commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.62%. Comparing base (ffec7bf) to head (00eae87).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #17342    +/-   ##
========================================
  Coverage   92.62%   92.62%            
========================================
  Files        1882     1884     +2     
  Lines      242997   243227   +230     
========================================
+ Hits       225065   225296   +231     
+ Misses      17932    17931     -1     

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

@zkochan
zkochan marked this pull request as ready for review October 25, 2026 14:48
@zkochan

zkochan commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review


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

Copilot AI balanced review requested due to automatic review settings October 25, 2026 14:48

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

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 insufficient remaining quota.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix audit exit codes after ignoring vulnerabilities

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Make both CLIs fail when unignored vulnerabilities remain at or above the audit level.
• Preserve ignore-list writes and messages while checking the merged list of existing and new
 ignores.
• Add exit-code tests and correct the v11 and v12 audit documentation.
Diagram

graph TD
  A["Audit report"] --> B["Persist merged ignores"] --> C["Print ignore summary"] --> D["Remove ignored GHSAs"] --> E{"At audit level?"}
  E -->|Yes| F["Exit code 1"]
  E -->|No| G["Exit code 0"]
Loading
High-Level Assessment

Keep the existing ignore-writing paths and apply the plain audit severity rule to advisories remaining after the merged ignores are removed. This reuses each CLI's filtering behavior without changing output or the separate --fix flow.

Files changed (9) +178 / -16

Bug fix (4) +35 / -13
audit-ignore-exit-code.mdRecord the audit exit-code fix +7/-0

Record the audit exit-code fix

• Adds a shared patch changeset for the affected audit packages and CLIs.

.changeset/audit-ignore-exit-code.md

audit.rsCheck Rust audit outcomes after ignoring +5/-4

Check Rust audit outcomes after ignoring

• The ignore path still prints its summary, but now removes advisories in the persisted ignore list and applies the normal audit-level outcome check.

pnpm/crates/cli/src/cli_args/audit.rs

fix.rsReturn persisted ignores with the summary +11/-3

Return persisted ignores with the summary

• Returns the merged GHSA list alongside the existing user-facing summary, allowing the caller to check the report against what was saved.

pnpm/crates/cli/src/cli_args/audit/fix.rs

audit.tsCheck TypeScript audit outcomes after ignoring +12/-6

Check TypeScript audit outcomes after ignoring

• Removes advisories covered by existing and new ignores before determining the exit code. Extracts the audit-level filter for use by both report and ignore paths.

pnpm11/deps/compliance/commands/src/audit/audit.ts

Refactor (1) +10 / -1
advisories.rsShare GHSA advisory removal +10/-1

Share GHSA advisory removal

• Extracts GHSA-based removal so both the normal report and ignore paths can exclude configured advisories.

pnpm/crates/cli/src/cli_args/audit/advisories.rs

Tests (2) +130 / -1
fixes.rsTest Rust ignore-mode exit codes +75/-0

Test Rust ignore-mode exit codes

• Adds mixed-advisory tests for remaining vulnerabilities, complete and pre-existing ignores, and advisories below the audit threshold.

pnpm/crates/cli/tests/suite/audit/fixes.rs

ignore.tsTest TypeScript ignore-mode exit codes +55/-1

Test TypeScript ignore-mode exit codes

• Adds mixed-advisory threshold and merged-ignore cases, and updates an existing expectation where a vulnerability remains.

pnpm11/deps/compliance/commands/test/audit/ignore.ts

Documentation (2) +3 / -1
audit.mdCorrect v12 ignore-mode exit-code guidance +1/-1

Correct v12 ignore-mode exit-code guidance

• Clarifies that ignore modes save IDs first but return code 1 if qualifying vulnerabilities remain.

pnpm/docs/cli/audit.md

audit.mdDocument v11 ignore-mode exit codes +2/-0

Document v11 ignore-mode exit codes

• States that ignore modes save IDs before returning code 1 when vulnerabilities at or above the audit level remain.

pnpm11/docs/cli/audit.md

@qodo-code-review

qodo-code-review Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (1)

Grey Divider


Remediation recommended

1. Audit tests declare helpers too early ✓ Resolved
Description
auditWithIgnores is a top-level function declaration that appears before every call site in the
same TypeScript test file. The new tests invoke it only on later lines, so the helper does not
follow the repository's declaration-order convention.
Code

pnpm11/deps/compliance/commands/test/audit/ignore.ts[61]

+async function auditWithIgnores (response: Record<string, unknown>, opts: Partial<audit.AuditOptions>): Promise<number> {
Relevance

●●● Strong

Simple declaration-order convention fix; moving the helper after its first use is deterministic and
low risk.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new helper is declared at line 61, while its first calls occur in the added tests beginning at
line 77. This violates the rule requiring a used top-level TypeScript function declaration to have
at least one usage before its declaration.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/deps/compliance/commands/test/audit/ignore.ts[61-78]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new TypeScript test helper `auditWithIgnores` is declared before its first usage, violating the declaration-order convention.

## Fix Focus Areas
- pnpm11/deps/compliance/commands/test/audit/ignore.ts[61-75]

## Recommended Fix
Move the `auditWithIgnores` function declaration below the first test that calls it, or otherwise place a call site before the declaration while preserving the test behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Older audit CLI lacks wiring coverage 📜 Skill insight ▣ Testability
Description
auditWithIgnores invokes audit.handler directly instead of the command entrypoint. As a result,
the new exit-code behavior can pass these tests even if argument parsing or command dispatch fails
to reach the updated ignore path.
Code

pnpm11/deps/compliance/commands/test/audit/ignore.ts[R61-74]

+async function auditWithIgnores (response: Record<string, unknown>, opts: Partial<audit.AuditOptions>): Promise<number> {
+  const tmp = testFixtures.prepare('has-vulnerabilities')
+  getMockAgent().get(AUDIT_REGISTRY.replace(/\/$/, ''))
+    .intercept({ path: '/-/npm/v1/security/advisories/bulk', method: 'POST' })
+    .reply(200, response)
+  const { exitCode } = await audit.handler({
+    ...AUDIT_REGISTRY_OPTS,
+    auditLevel: 'low',
+    dir: tmp,
+    rootProjectManifestDir: tmp,
+    fix: false,
+    ...opts,
+  })
+  return exitCode
Relevance

●● Moderate

Handler-level tests cover behavior, but CLI wiring coverage is a subjective test-scope concern
without close rejection precedent.

PR-#14708

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The compliance rule requires CLI wiring behavior to be tested through the real CLI path rather than
only an internal helper. The added v11 tests construct options and call audit.handler directly,
while the changed behavior is the command's exit code for --ignore and --ignore-unfixable.

pnpm11/deps/compliance/commands/test/audit/ignore.ts[61-74]
Skill: review-code

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The v11 regression tests call the internal audit handler directly, so they do not verify that the real CLI wiring reaches the changed ignore exit-code behavior.

## Fix Focus Areas
- pnpm11/deps/compliance/commands/test/audit/ignore.ts[61-74]

## Recommended Fix
Add or update a v11 test helper that invokes the actual pnpm audit command entrypoint with the ignore arguments, then assert the resulting process exit code for both remaining and fully ignored vulnerabilities.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 52 rules
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/pnpm.io (sha: 0aab2bac) — View relationship
Review mode: Auto: 🚀 Fast: Localized test-helper relocation with no runtime behavior changes.
✅ Fix-loop round: fix loop

Grey Divider

Tip of the day
💡 Did you know, you can enable the Remediation agent and Qodo fixes findings in a dedicated fix PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 00eae87

Results up to commit e3bc820 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (1)


Remediation recommended
1. Audit tests declare helpers too early ✓ Resolved
Description
auditWithIgnores is a top-level function declaration that appears before every call site in the
same TypeScript test file. The new tests invoke it only on later lines, so the helper does not
follow the repository's declaration-order convention.
Code

pnpm11/deps/compliance/commands/test/audit/ignore.ts[61]

+async function auditWithIgnores (response: Record<string, unknown>, opts: Partial<audit.AuditOptions>): Promise<number> {
Relevance

●●● Strong

Simple declaration-order convention fix; moving the helper after its first use is deterministic and
low risk.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new helper is declared at line 61, while its first calls occur in the added tests beginning at
line 77. This violates the rule requiring a used top-level TypeScript function declaration to have
at least one usage before its declaration.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/deps/compliance/commands/test/audit/ignore.ts[61-78]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new TypeScript test helper `auditWithIgnores` is declared before its first usage, violating the declaration-order convention.

## Fix Focus Areas
- pnpm11/deps/compliance/commands/test/audit/ignore.ts[61-75]

## Recommended Fix
Move the `auditWithIgnores` function declaration below the first test that calls it, or otherwise place a call site before the declaration while preserving the test behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Older audit CLI lacks wiring coverage 📜 Skill insight ▣ Testability
Description
auditWithIgnores invokes audit.handler directly instead of the command entrypoint. As a result,
the new exit-code behavior can pass these tests even if argument parsing or command dispatch fails
to reach the updated ignore path.
Code

pnpm11/deps/compliance/commands/test/audit/ignore.ts[R61-74]

+async function auditWithIgnores (response: Record<string, unknown>, opts: Partial<audit.AuditOptions>): Promise<number> {
+  const tmp = testFixtures.prepare('has-vulnerabilities')
+  getMockAgent().get(AUDIT_REGISTRY.replace(/\/$/, ''))
+    .intercept({ path: '/-/npm/v1/security/advisories/bulk', method: 'POST' })
+    .reply(200, response)
+  const { exitCode } = await audit.handler({
+    ...AUDIT_REGISTRY_OPTS,
+    auditLevel: 'low',
+    dir: tmp,
+    rootProjectManifestDir: tmp,
+    fix: false,
+    ...opts,
+  })
+  return exitCode
Relevance

●● Moderate

Handler-level tests cover behavior, but CLI wiring coverage is a subjective test-scope concern
without close rejection precedent.

PR-#14708

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The compliance rule requires CLI wiring behavior to be tested through the real CLI path rather than
only an internal helper. The added v11 tests construct options and call audit.handler directly,
while the changed behavior is the command's exit code for --ignore and --ignore-unfixable.

pnpm11/deps/compliance/commands/test/audit/ignore.ts[61-74]
Skill: review-code

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The v11 regression tests call the internal audit handler directly, so they do not verify that the real CLI wiring reaches the changed ignore exit-code behavior.

## Fix Focus Areas
- pnpm11/deps/compliance/commands/test/audit/ignore.ts[61-74]

## Recommended Fix
Add or update a v11 test helper that invokes the actual pnpm audit command entrypoint with the ignore arguments, then assert the resulting process exit code for both remaining and fully ignored vulnerabilities.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 25, 2026
Copilot AI balanced review requested due to automatic review settings October 25, 2026 14:56
@zkochan

zkochan commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

Qodo summary findings:

  1. Helper declared before its uses: fixed in 00eae87. auditWithIgnores now sits at the end of the file.
  2. Tests call audit.handler instead of the CLI entry point: not acting. This PR does not touch argument parsing or dispatch, and the handler's exitCode reaches the process through the same path a plain pnpm audit uses. The audit.handler tests in this suite follow the same pattern. The v12 tests run the real binary end to end, so they cover parsing on that side.

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

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

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 insufficient remaining quota.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 00eae87

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan
zkochan merged commit cbf9de2 into main Oct 25, 2026
75 checks passed
@zkochan
zkochan deleted the fix-audit-ignore-exit-code branch October 25, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants