Skip to content

test(cli): tighten the optional-peer node_modules and failure output - #13378

Merged
zkochan merged 2 commits into
mainfrom
tighten-optional-peer-test
Jul 25, 2026
Merged

zkochan merged 2 commits into
mainfrom
tighten-optional-peer-test

Conversation

@zkochan

@zkochan zkochan commented Jul 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-up to #13372, which merged while the last review round was still being addressed — this is the commit that missed the merge.

Two test-only refinements to optional_peer_stays_out_of_the_importer_without_auto_install_peers:

  • Path::exists follows the link, so a dangling @pnpm.e2e/peer-c link in pkg-a/node_modules would have read as "not linked" and passed the check. fs::symlink_metadata fails only when nothing is at that path at all, and still catches a Windows junction.
  • The importer snapshot moves out of an unconditional dbg! into the assertion message, so it is printed when a check fails rather than on every run.

No behavior change and no changeset: the regression this test guards is already fixed on main by #13372.

Squash Commit Body

`Path::exists` follows the link, so a dangling `peer-c` link in pkg-a's
`node_modules` would have read as "not linked" and passed the check;
`symlink_metadata` fails only when nothing is there at all.

The importer snapshot moves from an unconditional `dbg!` into the
assertion message, so it is printed when a check fails rather than on
every run.

Follow-up to pnpm/pnpm#13372, which merged before this commit landed.

Checklist

  • Added or updated tests.

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

  • Tests
    • Tightened the regression test coverage for optional peer dependencies when automatic peer installation is disabled.
    • Enhanced failure diagnostics by including full package debug state when unexpected peer dependencies are detected.
    • Updated the on-disk verification to more precisely distinguish missing paths from dangling symlinks (dangling symlinks are treated as linked).

`Path::exists` follows the link, so a dangling `peer-c` link in pkg-a's
`node_modules` would have read as "not linked" and passed the check;
`symlink_metadata` fails only when nothing is there at all.

The importer snapshot moves from an unconditional `dbg!` into the
assertion message, so it is printed when a check fails rather than on
every run.

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

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 Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f5c81c93-43a9-4a54-b2dd-66932c84372b

📥 Commits

Reviewing files that changed from the base of the PR and between 68f766a and d56d575.

📒 Files selected for processing (1)
  • pnpm/crates/cli/tests/workspace_install.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/cli/tests/workspace_install.rs

📝 Walkthrough

Walkthrough

The workspace install regression test now reports package details when an optional peer is unexpectedly present and uses symlink metadata to treat dangling symlinks as linked.

Changes

Optional peer assertion tightening

Layer / File(s) Summary
Strengthen optional peer assertions
pnpm/crates/cli/tests/workspace_install.rs
The autoInstallPeers: false test removes debug output, improves failure diagnostics, and replaces the path existence check with explicit NotFound handling via symlink_metadata.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

  • pnpm/pnpm#13372: Covers the same optional-peer behavior and autoInstallPeers: false workspace install test.
  • pnpm/pnpm#13381: Modifies related workspace install coverage for optional peer hoisting with autoInstallPeers: false.

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 tighten-optional-peer-test

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

test(cli): tighten optional-peer link detection and failure output

🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Strengthen regression test to catch dangling optional-peer links in node_modules.
• Print importer snapshot only on assertion failure to reduce noisy test output.
Diagram

graph TD
  A["workspace_install.rs test"] --> B["pnpm install"] --> C["read lockfile"] --> D["importer(pkg-a)"] --> E{Deps contain peer-c?}
  E -->|"yes"| F["fail: print pkg_a"]
  E -->|"no"| G{peer-c path exists?}
  G -->|"symlink_metadata ok"| H["fail: linked/dangling"]
  G -->|"symlink_metadata err"| I["pass"]
Loading
High-Level Assessment

The chosen approach is appropriate for the regression: fs::symlink_metadata correctly treats dangling symlinks/junctions as “present”, closing a false-negative gap that Path::exists() can introduce. Moving the importer snapshot into the assertion message improves signal-to-noise without reducing debuggability.

Files changed (1) +3 / -3

Tests (1) +3 / -3
workspace_install.rsHarden optional peer regression assertions and failure diagnostics +3/-3

Harden optional peer regression assertions and failure diagnostics

• Removes unconditional debug printing of the pkg-a importer and instead includes it in the assertion failure message. Replaces 'Path::exists()' with 'fs::symlink_metadata(...).is_err()' so dangling optional-peer links in 'node_modules' are detected and fail the test reliably (including Windows junction behavior).

pnpm/crates/cli/tests/workspace_install.rs

@greptile-apps

greptile-apps Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "test(cli): require NotFound from the opt..." | 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/cli/tests/workspace_install.rs`:
- Line 279: Update the symlink assertion in the workspace install test to
require that symlink_metadata returns an I/O error whose kind is
ErrorKind::NotFound, rather than accepting any error via is_err(). Preserve the
existing dangling-symlink-safe symlink_metadata check and ensure other failures
do not satisfy the assertion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7861c93a-18f4-4399-96d7-bed8ec6a3f99

📥 Commits

Reviewing files that changed from the base of the PR and between 063094d and 68f766a.

📒 Files selected for processing (1)
  • pnpm/crates/cli/tests/workspace_install.rs

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 24 rules

Grey Divider


Remediation recommended

1. Overbroad symlink check ✓ Resolved 🐞 Bug ☼ Reliability
Description
The test now treats any fs::symlink_metadata error as proof the optional-peer path is absent, so
PermissionDenied/InvalidInput/etc. would incorrectly pass even if the entry exists. This can mask a
real regression by producing a false-green test result for non-NotFound IO failures.
Code

pnpm/crates/cli/tests/workspace_install.rs[R277-281]

+    // `symlink_metadata` so a dangling link counts as linked too.
    assert!(
-        !workspace.join("pkg-a/node_modules/@pnpm.e2e/peer-c").exists(),
+        fs::symlink_metadata(workspace.join("pkg-a/node_modules/@pnpm.e2e/peer-c")).is_err(),
        "optional peer linked into pkg-a under `autoInstallPeers: false`",
    );
Relevance

⭐⭐⭐ High

Team prefers distinguishing NotFound vs other errors; overbroad is_err masking failures likely
corrected, especially in tests.

PR-#13131
PR-#13306

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new test assertion uses .is_err() on symlink_metadata, which conflates “path not found” with
any other IO failure; elsewhere in the codebase, NotFound is explicitly distinguished from other
errors, showing that treating all errors as absence is not the intended pattern.

pnpm/crates/cli/tests/workspace_install.rs[268-281]
pnpm/crates/package-manager/src/install_frozen_lockfile.rs[1866-1884]

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

### Issue description
`fs::symlink_metadata(...).is_err()` is used as the predicate for “the path does not exist”. This is too broad: it returns `true` for *any* IO error, not just `ErrorKind::NotFound`, allowing the test to pass when metadata lookup fails for reasons other than absence.

### Issue Context
This assertion is meant to ensure `pkg-a/node_modules/@pnpm.e2e/peer-c` does not exist (and that a dangling link should count as present). The predicate should therefore accept only `Err(e)` where `e.kind() == NotFound`; other errors should fail loudly so the regression test can’t false-green.

### Fix Focus Areas
- pnpm/crates/cli/tests/workspace_install.rs[277-281]

### Suggested fix
Replace the `is_err()` check with a `NotFound`-specific match, and fail on other errors. For example:

```rust
use std::io::ErrorKind;

let peer_c_path = workspace.join("pkg-a/node_modules/@pnpm.e2e/peer-c");
match fs::symlink_metadata(&peer_c_path) {
   Err(e) if e.kind() == ErrorKind::NotFound => {}
   Ok(_) => panic!("optional peer linked into pkg-a under `autoInstallPeers: false`: {peer_c_path:?}"),
   Err(e) => panic!("unexpected error lstat'ing {peer_c_path:?}: {e}"),
}
```

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


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.

@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.01     10.5±0.21ms    35.7 MB/sec    1.00     10.4±0.19ms    35.9 MB/sec
packument/parse                1.00     36.9±0.53µs  1799.1 MB/sec    1.00     36.8±0.59µs  1804.8 MB/sec
tarball/download_dependency    1.00      2.9±0.14ms  1502.2 KB/sec    1.00      2.9±0.11ms  1495.0 KB/sec

@codecov-commenter

codecov-commenter commented Jul 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.26%. Comparing base (d17710c) to head (d56d575).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13378      +/-   ##
==========================================
+ Coverage   87.22%   87.26%   +0.04%     
==========================================
  Files         536      540       +4     
  Lines       92059    92644     +585     
==========================================
+ Hits        80297    80847     +550     
- Misses      11762    11797      +35     

☔ 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

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 68f766a2e4ae

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.482 ± 0.105 2.358 2.712 1.65 ± 0.17
pacquet@main 2.441 ± 0.133 2.336 2.695 1.62 ± 0.18
pnpr@HEAD 1.503 ± 0.143 1.351 1.784 1.00
pnpr@main 1.564 ± 0.129 1.348 1.785 1.04 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4822043998,
      "stddev": 0.10500412350023003,
      "median": 2.4932405667,
      "user": 1.6748556999999997,
      "system": 1.27162716,
      "min": 2.3579934257,
      "max": 2.7119376527,
      "times": [
        2.4771597437,
        2.4023117237,
        2.3579934257,
        2.5093213897,
        2.5204812907,
        2.7119376527,
        2.5325691487,
        2.3749397807,
        2.4046045497,
        2.5307252927
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.4413234982,
      "stddev": 0.13292448841101603,
      "median": 2.3891483522000003,
      "user": 1.6365439,
      "system": 1.2915879600000002,
      "min": 2.3358200517000003,
      "max": 2.6945171457000003,
      "times": [
        2.6608905277,
        2.3981391027,
        2.3557286617,
        2.3358200517000003,
        2.3801576017,
        2.6945171457000003,
        2.3443764577,
        2.4943767687,
        2.3469886467000003,
        2.4022400177
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5031202467,
      "stddev": 0.14344390366771992,
      "median": 1.4917090372000001,
      "user": 1.1705877999999998,
      "system": 1.13320916,
      "min": 1.3508665707,
      "max": 1.7840098767,
      "times": [
        1.3511972267,
        1.5640686517,
        1.3694125157,
        1.4996137667,
        1.4838043077,
        1.4363045637,
        1.7840098767,
        1.3508665707,
        1.6863589647000001,
        1.5055660227
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5636948264000001,
      "stddev": 0.12884591942626397,
      "median": 1.5497397207,
      "user": 1.177514,
      "system": 1.14164296,
      "min": 1.3479643367,
      "max": 1.7852918567000002,
      "times": [
        1.3479643367,
        1.5114035357,
        1.5434103787,
        1.5560690627000002,
        1.5113293257000002,
        1.5566724837,
        1.4669886597000001,
        1.7559491177000002,
        1.6018695067,
        1.7852918567000002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 251.2 ± 6.4 245.4 267.6 1.01 ± 0.03
pacquet@main 247.7 ± 4.9 237.5 256.4 1.00
pnpr@HEAD 263.7 ± 8.1 255.6 281.7 1.06 ± 0.04
pnpr@main 268.6 ± 3.7 263.4 272.9 1.08 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25116959256000004,
      "stddev": 0.006403258111997361,
      "median": 0.24974196676,
      "user": 0.20770281999999995,
      "system": 0.4944283200000001,
      "min": 0.24543631276000002,
      "max": 0.26755887776,
      "times": [
        0.24543631276000002,
        0.25226162275999997,
        0.25300424575999997,
        0.24645527476,
        0.24786825776000002,
        0.24684870876,
        0.25124508176,
        0.24823885176000002,
        0.26755887776,
        0.25277869176
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24771915916,
      "stddev": 0.004886451686763972,
      "median": 0.24728792526,
      "user": 0.18104711999999998,
      "system": 0.52190282,
      "min": 0.23750352276,
      "max": 0.25637162376,
      "times": [
        0.24800735076000002,
        0.23750352276,
        0.24618704076,
        0.24605262476,
        0.24537171676000002,
        0.24958681176,
        0.24990171676000003,
        0.25164068376,
        0.25637162376,
        0.24656849976
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.26372536216,
      "stddev": 0.008111797578582536,
      "median": 0.26059586926,
      "user": 0.19839942,
      "system": 0.5221347199999999,
      "min": 0.25563531176,
      "max": 0.28169186875999996,
      "times": [
        0.26685922376,
        0.25563531176,
        0.26030222976,
        0.25830725476,
        0.27177082776,
        0.25828540376,
        0.26639014776,
        0.25712184476,
        0.26088950876,
        0.28169186875999996
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.26860930886,
      "stddev": 0.00370038088733701,
      "median": 0.26963617425999997,
      "user": 0.19894112,
      "system": 0.5180497199999999,
      "min": 0.26336605976,
      "max": 0.27293047876,
      "times": [
        0.27293047876,
        0.27030926476,
        0.26336605976,
        0.27199708276,
        0.26363892176,
        0.26685019676,
        0.26936270976,
        0.26483221376,
        0.27289652176,
        0.26990963876
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.753 ± 0.011 2.732 2.768 1.77 ± 0.13
pacquet@main 2.749 ± 0.021 2.722 2.783 1.77 ± 0.13
pnpr@HEAD 1.556 ± 0.110 1.438 1.747 1.00
pnpr@main 1.560 ± 0.161 1.424 1.873 1.00 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.75262092644,
      "stddev": 0.011074841527399818,
      "median": 2.75325266734,
      "user": 1.81612242,
      "system": 1.3557713999999998,
      "min": 2.73182298034,
      "max": 2.76759159634,
      "times": [
        2.76399307034,
        2.76187851834,
        2.7430227253400004,
        2.75929372034,
        2.75525946534,
        2.73182298034,
        2.76759159634,
        2.74564834234,
        2.74645297634,
        2.75124586934
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7488413555399993,
      "stddev": 0.020854347917988052,
      "median": 2.7497561363400003,
      "user": 1.85552822,
      "system": 1.2933097,
      "min": 2.72201282834,
      "max": 2.78337466934,
      "times": [
        2.77796715834,
        2.78337466934,
        2.72926017034,
        2.75292638234,
        2.75854544834,
        2.72201282834,
        2.74740190234,
        2.75211037034,
        2.72511660834,
        2.7396980173400003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5558922063400003,
      "stddev": 0.11019414179038275,
      "median": 1.53224072484,
      "user": 1.19239952,
      "system": 1.1463820999999996,
      "min": 1.4380068003400002,
      "max": 1.7467339483400002,
      "times": [
        1.6794653933400001,
        1.45799959634,
        1.5585484103400002,
        1.53899341634,
        1.6812513663400002,
        1.4427776323400001,
        1.4380068003400002,
        1.7467339483400002,
        1.52548803334,
        1.4896574663400002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.56023013864,
      "stddev": 0.16077884877692633,
      "median": 1.49597784984,
      "user": 1.18688832,
      "system": 1.1385777999999998,
      "min": 1.42449781234,
      "max": 1.87298336534,
      "times": [
        1.87298336534,
        1.5231487063400002,
        1.43282677934,
        1.78727765534,
        1.4366100833400002,
        1.42449781234,
        1.49027575234,
        1.67506209434,
        1.45793919034,
        1.50167994734
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 596.6 ± 19.1 572.2 637.5 2.03 ± 0.08
pacquet@main 575.4 ± 11.0 560.5 595.0 1.95 ± 0.06
pnpr@HEAD 298.3 ± 8.1 282.9 315.0 1.01 ± 0.04
pnpr@main 294.4 ± 6.8 285.6 308.7 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5966116562200001,
      "stddev": 0.019096972361655137,
      "median": 0.59340892622,
      "user": 0.7288176599999999,
      "system": 0.6645279399999999,
      "min": 0.5722084577200001,
      "max": 0.63748932372,
      "times": [
        0.5783668187200001,
        0.59275780572,
        0.61014208372,
        0.63748932372,
        0.59648351472,
        0.61230564472,
        0.59406004672,
        0.58357367072,
        0.58872919572,
        0.5722084577200001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5753662610200001,
      "stddev": 0.011007717816853765,
      "median": 0.5734195497200001,
      "user": 0.68156896,
      "system": 0.6773440399999999,
      "min": 0.56052664072,
      "max": 0.59497850472,
      "times": [
        0.57007552072,
        0.58031110972,
        0.57296649972,
        0.59017098972,
        0.57333298272,
        0.59497850472,
        0.5735061167200001,
        0.56124865672,
        0.56052664072,
        0.5765455887200001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29829060512000005,
      "stddev": 0.008065915927601542,
      "median": 0.29803085922000006,
      "user": 0.19275286,
      "system": 0.49190524,
      "min": 0.28287156572000005,
      "max": 0.31501828472000004,
      "times": [
        0.29391582372,
        0.29753409772,
        0.29579247072000003,
        0.29857654372000003,
        0.29852762072000005,
        0.31501828472000004,
        0.29936295272,
        0.28287156572000005,
        0.29680858872000004,
        0.30449810272000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.29436812201999996,
      "stddev": 0.00684048947858272,
      "median": 0.29264452172000005,
      "user": 0.18876695999999998,
      "system": 0.50324754,
      "min": 0.28564737072,
      "max": 0.30873972872000005,
      "times": [
        0.28564737072,
        0.29301533172000005,
        0.29227371172000005,
        0.29103489072000005,
        0.29794947172,
        0.28879564772000005,
        0.30164067272,
        0.29510481172,
        0.30873972872000005,
        0.28947958272
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.907 ± 0.011 1.885 1.922 6.34 ± 0.15
pacquet@main 1.890 ± 0.008 1.876 1.907 6.29 ± 0.15
pnpr@HEAD 0.301 ± 0.009 0.289 0.316 1.00 ± 0.04
pnpr@main 0.301 ± 0.007 0.288 0.311 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9070157563199999,
      "stddev": 0.01123809374725703,
      "median": 1.90637549852,
      "user": 0.9631566199999998,
      "system": 0.73668288,
      "min": 1.88458833752,
      "max": 1.9222384875199998,
      "times": [
        1.91912060652,
        1.90596416352,
        1.88458833752,
        1.90678683352,
        1.9184475105199998,
        1.9058602445200001,
        1.89963056952,
        1.9222384875199998,
        1.89893906552,
        1.90858174452
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8902944940200002,
      "stddev": 0.008263788262738533,
      "median": 1.89089645002,
      "user": 0.95677122,
      "system": 0.7309673799999999,
      "min": 1.87629209852,
      "max": 1.90735160652,
      "times": [
        1.8934251655199998,
        1.88367564452,
        1.8850061005199998,
        1.89202939552,
        1.89234799252,
        1.87629209852,
        1.88731501852,
        1.88976350452,
        1.90735160652,
        1.89573841352
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3011774107200001,
      "stddev": 0.008880110364171825,
      "median": 0.30083999602,
      "user": 0.19685581999999996,
      "system": 0.5028697799999999,
      "min": 0.28898498652000004,
      "max": 0.31580821352000005,
      "times": [
        0.31021467352000004,
        0.29852813752000007,
        0.30641534752000005,
        0.28898498652000004,
        0.30687932352,
        0.29351129752000005,
        0.31580821352000005,
        0.28975213552000006,
        0.30293989852000003,
        0.29874009352
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30056979332000006,
      "stddev": 0.006996440565563657,
      "median": 0.30141119952000006,
      "user": 0.18542602000000002,
      "system": 0.51069308,
      "min": 0.28780915852000005,
      "max": 0.31050265152000006,
      "times": [
        0.30244717852,
        0.30462539052000004,
        0.29755992552000005,
        0.29543545252000003,
        0.30983866752000006,
        0.30058199452000006,
        0.31050265152000006,
        0.29465710952,
        0.28780915852000005,
        0.30224040452000006
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 362.6 ± 5.9 355.4 373.0 4.05 ± 0.15
pacquet@main 369.7 ± 8.4 358.9 383.2 4.13 ± 0.16
pnpr@HEAD 89.6 ± 2.9 85.1 96.6 1.00
pnpr@main 90.9 ± 3.4 85.0 98.7 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.36258296335999995,
      "stddev": 0.00592759595580603,
      "median": 0.36190541956,
      "user": 0.36441643999999995,
      "system": 0.058645079999999995,
      "min": 0.35536727956,
      "max": 0.37297585656000004,
      "times": [
        0.37250252256,
        0.35658380856,
        0.36257424956,
        0.36148802756000004,
        0.36318887856000004,
        0.35928687756,
        0.37297585656000004,
        0.35953932156,
        0.36232281156,
        0.35536727956
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.36965388206000005,
      "stddev": 0.008430537040412849,
      "median": 0.36634063306000003,
      "user": 0.35622774,
      "system": 0.07416078,
      "min": 0.35892497856,
      "max": 0.38318132956,
      "times": [
        0.35892497856,
        0.36702879056000004,
        0.38194208156000004,
        0.37009353756,
        0.37762489056000004,
        0.36523579956,
        0.36157328356,
        0.36528165356000003,
        0.38318132956,
        0.36565247556
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08955075678580646,
      "stddev": 0.002877720894232919,
      "median": 0.08979226156,
      "user": 0.018972559354838704,
      "system": 0.01362984451612903,
      "min": 0.08511382256,
      "max": 0.09660563956,
      "times": [
        0.08991295256,
        0.09362487156,
        0.08896264856,
        0.09102272056,
        0.09235655056,
        0.08511382256,
        0.08670482756,
        0.09161041856,
        0.08584817556,
        0.08696540456,
        0.08730729656,
        0.08528995656,
        0.08892476556000001,
        0.08895336156,
        0.09375065056,
        0.08979226156,
        0.09003826056,
        0.09049756456000001,
        0.08632313256,
        0.09075598556,
        0.09660563956,
        0.08570556756,
        0.08739882356,
        0.09005581756,
        0.09016401656,
        0.09183834056,
        0.09141206356,
        0.08762903156,
        0.08879163756,
        0.09488998856,
        0.08782690556
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09086255023741938,
      "stddev": 0.0034337492315872683,
      "median": 0.09042222756,
      "user": 0.02166678516129032,
      "system": 0.011507245806451615,
      "min": 0.08499265956,
      "max": 0.09871477256,
      "times": [
        0.08999222556,
        0.09047395956,
        0.09150598056,
        0.09662259056,
        0.08997086656,
        0.08948694956,
        0.09061366856,
        0.09504990456,
        0.09034744056,
        0.09871477256,
        0.08962906356,
        0.09402417756,
        0.09252818956,
        0.09074989256,
        0.09140976856000001,
        0.09316102556,
        0.09042222756,
        0.08803162656,
        0.08552594456,
        0.08635002656,
        0.08726934856,
        0.09779098656,
        0.08953285856,
        0.09022464256,
        0.08537830656,
        0.09271614856,
        0.09074624356,
        0.09022703956,
        0.08499265956,
        0.09532909856,
        0.08792142356
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.509 ± 0.119 4.419 4.770 1.28 ± 0.04
pacquet@main 4.476 ± 0.060 4.421 4.587 1.27 ± 0.03
pnpr@HEAD 3.553 ± 0.160 3.450 3.864 1.01 ± 0.05
pnpr@main 3.526 ± 0.080 3.459 3.702 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.50875051342,
      "stddev": 0.11852827629462982,
      "median": 4.442513609020001,
      "user": 1.7986200799999998,
      "system": 1.3999281199999998,
      "min": 4.419335787520001,
      "max": 4.77023260552,
      "times": [
        4.77023260552,
        4.6018681175200005,
        4.4314478065200005,
        4.50758097052,
        4.62148463652,
        4.44230230752,
        4.42455536152,
        4.419335787520001,
        4.4259726305200005,
        4.44272491052
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.47572087342,
      "stddev": 0.059945564910812085,
      "median": 4.448935730520001,
      "user": 1.77943548,
      "system": 1.4195167199999998,
      "min": 4.420599177520001,
      "max": 4.58700287352,
      "times": [
        4.58700287352,
        4.54555936052,
        4.43366493252,
        4.420599177520001,
        4.462940665520001,
        4.434930795520001,
        4.534939485520001,
        4.424601555520001,
        4.42832645852,
        4.48464342952
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5534453000199995,
      "stddev": 0.15953338907394343,
      "median": 3.47796071352,
      "user": 1.29235438,
      "system": 1.21367062,
      "min": 3.45036099452,
      "max": 3.8635868965199998,
      "times": [
        3.45036099452,
        3.4647151735199997,
        3.51629544652,
        3.52362879852,
        3.46851707652,
        3.84121385952,
        3.8635868965199998,
        3.48740435052,
        3.45665579752,
        3.46207460652
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5257149865199997,
      "stddev": 0.07968821494645477,
      "median": 3.48672854552,
      "user": 1.2671349799999998,
      "system": 1.2425300199999998,
      "min": 3.45897122052,
      "max": 3.70195592452,
      "times": [
        3.55471003052,
        3.47648331952,
        3.57957371852,
        3.48736594752,
        3.70195592452,
        3.48609114352,
        3.58967652652,
        3.45960105252,
        3.45897122052,
        3.46272098152
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13378
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,731.82 ms
(-0.13%)Baseline: 2,735.31 ms
3,282.37 ms
(83.23%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,884.59 ms
(-0.34%)Baseline: 1,890.96 ms
2,269.15 ms
(83.05%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
572.21 ms
(+0.00%)Baseline: 572.18 ms
686.62 ms
(83.34%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
355.37 ms
(+3.01%)Baseline: 344.97 ms
413.97 ms
(85.84%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,357.99 ms
(-0.05%)Baseline: 2,359.25 ms
2,831.10 ms
(83.29%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,419.34 ms
(-0.19%)Baseline: 4,427.57 ms
5,313.08 ms
(83.18%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
245.44 ms
(-0.41%)Baseline: 246.45 ms
295.74 ms
(82.99%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13378
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,438.01 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
288.98 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
282.87 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
85.11 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,350.87 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,450.36 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
255.64 ms
🐰 View full continuous benchmarking report in Bencher

`is_err()` also accepts a permission or I/O failure on the path, which
would read as "the peer is not linked" for the wrong reason. Match
`ErrorKind::NotFound` so only a genuinely absent entry passes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 25, 2026 22:58

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.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 25, 2026
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit d56d575

@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 7a77822 into main Jul 25, 2026
35 checks passed
@zkochan
zkochan deleted the tighten-optional-peer-test branch July 25, 2026 23:12
kairosci added a commit to kairosci/pnpm that referenced this pull request Jul 27, 2026
…npm#13378)

`Path::exists` follows the link, so a dangling `peer-c` link in pkg-a's
`node_modules` would have read as "not linked" and passed the check;
`symlink_metadata` fails only when nothing is there at all.

The importer snapshot moves from an unconditional `dbg!` into the
assertion message, so it is printed when a check fails rather than on
every run.

Follow-up to pnpm#13372, which merged before this commit landed.
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