Skip to content

fix(pnpr): validate and key forwarded catalogs - #13632

Merged
zkochan merged 4 commits into
pnpm:mainfrom
YESHYUNGSEOK:fix/pnpr-catalog-resolution-boundary
Aug 10, 2026
Merged

zkochan merged 4 commits into
pnpm:mainfrom
YESHYUNGSEOK:fix/pnpr-catalog-resolution-boundary

Conversation

@YESHYUNGSEOK

@YESHYUNGSEOK YESHYUNGSEOK commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Forwarded catalogs were omitted from pnpr's resolution cache identity and URL safety scans. Requests with different catalog mappings could therefore share resolver output, while catalog-supplied fetch URLs did not pass through the route allowlist and inline-credential checks.

  • Include default and named catalogs in the stable resolution key.
  • Validate catalog values with the same destination and credential checks used for other forwarded package specs.
  • Cover catalog isolation, JSON key-order normalization, disallowed destinations, and inline credentials.

Squash Commit Body

Include forwarded catalogs in pnpr's resolution cache identity so requests with different catalog mappings cannot reuse each other's resolver output.

Route catalog URL values through the existing forwarded-input validation, applying the same destination allowlist and inline-credential rules as dependency specs, overrides, and lockfile tarballs.

Checklist

  • Added a changeset (pnpm changeset) for @pnpm/pnpr.
  • Added or updated tests.
  • Updated the documentation if needed.

Written by an agent (Codex, GPT-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

  • Bug Fixes

    • Improved validation for catalog dependency sources, including URL, Git, and inline credential checks.
    • Allowed bare SSH usernames while continuing to reject embedded passwords and credentials in unsupported URL formats.
    • Prevented catalog-specific resolutions from being incorrectly shared through caching.
    • Ensured catalog changes trigger fresh resolution while preserving consistent results regardless of catalog key order.
  • Tests

    • Added coverage for catalog validation, cache isolation, cache-key behavior, and credential detection.

@YESHYUNGSEOK
YESHYUNGSEOK requested a review from zkochan as a code owner August 4, 2026 07:13
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

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

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

@coderabbitai

coderabbitai Bot commented Aug 4, 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: 0622b0b5-ed1a-4e7a-bf70-ba9ea1aebaa7

📥 Commits

Reviewing files that changed from the base of the PR and between 6c176a2 and 4b6b0b6.

📒 Files selected for processing (3)
  • pnpr/crates/pnpr/src/resolver/tests.rs
  • pnpr/crates/pnpr/src/route.rs
  • pnpr/crates/pnpr/src/route/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpr/crates/pnpr/src/resolver/tests.rs

📝 Walkthrough

Walkthrough

The resolver now includes catalogs in resolution cache keys and validates catalog values for off-allowlist fetch targets and inline URL credentials. SSH transport usernames remain valid without passwords. Tests cover these behaviors.

Changes

Catalog resolution and validation

Layer / File(s) Summary
Resolver cache and catalog validation
pnpr/crates/pnpr/src/resolver.rs
Catalog values now contribute to resolution cache keys and undergo fetch-allowlist and inline-credential checks.
SSH credential classification
pnpr/crates/pnpr/src/route.rs, pnpr/crates/pnpr/src/route/tests.rs
Bare SSH usernames are allowed. SSH passwords and non-SSH URL credentials remain rejected.
Catalog validation coverage
pnpr/crates/pnpr/src/resolver/tests.rs, .changeset/secure-catalogs-route.md
Tests cover cache-key stability, catalog rejection responses, accepted semver ranges, clean URLs, and SSH usernames. A patch changeset documents the release.

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

Possibly related PRs

  • pnpm/pnpm#13196: Both PRs modify catalog-related dependency resolution behavior and tests.
  • pnpm/pnpm#13233: Both PRs modify pnpr catalog handling in resolver.rs.
  • pnpm/pnpm#13279: Both PRs modify pnpr catalog handling in resolution requests and cache validation.

Suggested labels: product: pnpr

Suggested reviewers: zkochan

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@greptile-apps

greptile-apps Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; current code fixes both previously reported SSH username rejection paths while retaining rejection of password-bearing URL userinfo.

Reviews (4): Last reviewed commit: "fix(pnpr): match ssh schemes case-insens..." | Re-trigger Greptile

Comment thread pnpr/crates/pnpr/src/resolver.rs Resolved
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

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

codecov-commenter commented Aug 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.20%. Comparing base (b11fa81) to head (4b6b0b6).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13632      +/-   ##
==========================================
+ Coverage   88.19%   88.20%   +0.01%     
==========================================
  Files         615      616       +1     
  Lines       99955   100084     +129     
==========================================
+ Hits        88157    88283     +126     
- Misses      11798    11801       +3     

☔ 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 4, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 4b6b0b620bdc

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.683 ± 0.201 2.480 3.137 1.66 ± 0.19
pacquet@main 2.922 ± 0.123 2.759 3.142 1.81 ± 0.17
pnpr@HEAD 1.794 ± 0.127 1.634 1.991 1.11 ± 0.12
pnpr@main 1.616 ± 0.134 1.452 1.831 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6827387307,
      "stddev": 0.20054900621834287,
      "median": 2.6469650836000005,
      "user": 2.5064416599999992,
      "system": 1.8836723,
      "min": 2.4802073041000003,
      "max": 3.1367447581000003,
      "times": [
        2.5100636121,
        2.7762773251,
        2.4802073041000003,
        2.5471934091,
        2.7217341371000003,
        2.5288564311000004,
        2.5721960301,
        2.7403967971000003,
        2.8137175031000004,
        3.1367447581000003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.9221497719,
      "stddev": 0.1233336765830386,
      "median": 2.8842514906000005,
      "user": 3.0300595599999998,
      "system": 2.2536546999999993,
      "min": 2.7589508641,
      "max": 3.1422472301,
      "times": [
        2.8910381031000005,
        2.9476589561,
        2.8774648781000005,
        2.8219368451,
        2.7589508641,
        3.0385785671,
        2.8223361261,
        3.0647681571,
        3.1422472301,
        2.8565179921
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.7941300967,
      "stddev": 0.12667803483689705,
      "median": 1.7446045226,
      "user": 1.7930782599999997,
      "system": 1.9117553999999999,
      "min": 1.6338731921,
      "max": 1.9912639361,
      "times": [
        1.9247123541000002,
        1.9129134751,
        1.7042658471,
        1.7448592571000001,
        1.9089842861000001,
        1.6837122120999999,
        1.9912639361,
        1.6338731921,
        1.6923666191000002,
        1.7443497881
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6161194774000003,
      "stddev": 0.13364144938150935,
      "median": 1.5432487161000001,
      "user": 1.6457889600000002,
      "system": 1.6651078,
      "min": 1.4519547671,
      "max": 1.8312102531,
      "times": [
        1.8312102531,
        1.5476557691000001,
        1.8047563081,
        1.5274424661,
        1.5287868271,
        1.7457896491,
        1.5297246331,
        1.4519547671,
        1.6550324381,
        1.5388416631000001
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 353.7 ± 22.2 313.2 384.4 1.00
pacquet@main 367.2 ± 22.4 337.2 407.5 1.04 ± 0.09
pnpr@HEAD 366.1 ± 31.6 318.2 411.6 1.04 ± 0.11
pnpr@main 378.5 ± 22.9 351.2 426.2 1.07 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.35370537774000005,
      "stddev": 0.022193487626017284,
      "median": 0.35526853004000003,
      "user": 0.3122580999999999,
      "system": 0.65433948,
      "min": 0.31323383954000006,
      "max": 0.38439618654,
      "times": [
        0.35340254654000003,
        0.35713451354000003,
        0.37937372954000004,
        0.33989012354000003,
        0.36919260854,
        0.36003459454000003,
        0.38439618654,
        0.31323383954000006,
        0.35336385354000005,
        0.32703178154
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.36715010284000005,
      "stddev": 0.022440273094287096,
      "median": 0.36254264154000004,
      "user": 0.3081607,
      "system": 0.69484648,
      "min": 0.33716234654000005,
      "max": 0.40748861954000004,
      "times": [
        0.33716234654000005,
        0.40748861954000004,
        0.39391432954000005,
        0.36271776654000004,
        0.35145451954,
        0.35791920054000004,
        0.38121721054,
        0.37554353754,
        0.36236751654000005,
        0.34171598154000005
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.36608565554000005,
      "stddev": 0.03160232451649466,
      "median": 0.35987411754000004,
      "user": 0.2975701999999999,
      "system": 0.6648675799999999,
      "min": 0.31817355154000004,
      "max": 0.41157295954000006,
      "times": [
        0.41157295954000006,
        0.40546156254000004,
        0.31817355154000004,
        0.35875383254000004,
        0.35664118454000004,
        0.33655565454,
        0.37310776054000006,
        0.33852907054000003,
        0.36099440254000004,
        0.40106657654000005
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.37852347554000004,
      "stddev": 0.02294372689894701,
      "median": 0.36987803404,
      "user": 0.3190357,
      "system": 0.6731806800000001,
      "min": 0.35122320254000006,
      "max": 0.42622967754,
      "times": [
        0.39911243754000003,
        0.42622967754,
        0.37999300554000004,
        0.37167048454,
        0.36808558354000004,
        0.36013765954000004,
        0.35122320254000006,
        0.39881044854000003,
        0.36194903954,
        0.36802321654000003
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.948 ± 0.043 2.873 3.010 1.72 ± 0.14
pacquet@main 2.951 ± 0.069 2.867 3.111 1.72 ± 0.15
pnpr@HEAD 1.717 ± 0.140 1.563 1.960 1.00
pnpr@main 1.805 ± 0.186 1.587 2.237 1.05 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.9481157922000003,
      "stddev": 0.04283370350779932,
      "median": 2.9551253413000005,
      "user": 2.4100683399999996,
      "system": 1.9185402599999999,
      "min": 2.8728597188000005,
      "max": 3.0100049258,
      "times": [
        2.9635948728000003,
        3.0100049258,
        2.8728597188000005,
        2.9265247148,
        2.9466558098,
        2.9006790798,
        2.9869527458000005,
        2.9672336558000003,
        2.9206723648,
        2.9859800338
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.9507559956000002,
      "stddev": 0.06934479886834426,
      "median": 2.9391235268000004,
      "user": 2.48062454,
      "system": 1.9885914599999999,
      "min": 2.8672176348000002,
      "max": 3.1111356198,
      "times": [
        2.9049955468000004,
        2.9206129028000003,
        2.8903134828000003,
        3.1111356198,
        2.8672176348000002,
        2.9688798248,
        2.9930304578,
        2.9762725048000003,
        2.9174678308,
        2.9576341508
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.7174140198,
      "stddev": 0.13964194401683447,
      "median": 1.7194218138,
      "user": 1.56224504,
      "system": 1.7143319599999998,
      "min": 1.5625493668000001,
      "max": 1.9601176508,
      "times": [
        1.5625493668000001,
        1.7615500468,
        1.8191102978,
        1.5803948578,
        1.8179974418,
        1.5906082598,
        1.8312567578,
        1.9601176508,
        1.5732619378000001,
        1.6772935808
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.8053738043999998,
      "stddev": 0.18600580771669817,
      "median": 1.7402000473,
      "user": 1.77748724,
      "system": 1.92723016,
      "min": 1.5868345238000001,
      "max": 2.2373227118,
      "times": [
        1.6876926518000002,
        1.5868345238000001,
        1.8738895918,
        1.7555351518,
        2.2373227118,
        1.9583936548,
        1.6692271008,
        1.7248649428,
        1.7238838518,
        1.8360938628
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 539.7 ± 50.3 448.6 648.2 1.58 ± 0.18
pacquet@main 481.6 ± 27.0 453.3 537.0 1.41 ± 0.12
pnpr@HEAD 342.2 ± 21.4 320.2 385.5 1.00
pnpr@main 425.8 ± 52.6 351.2 524.1 1.24 ± 0.17
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.53968550692,
      "stddev": 0.050302165199859014,
      "median": 0.5367156417200001,
      "user": 0.7318313799999999,
      "system": 0.8343469000000001,
      "min": 0.44862652222,
      "max": 0.64823138422,
      "times": [
        0.64823138422,
        0.56041989822,
        0.5585743032200001,
        0.5412458922200001,
        0.5527353772200001,
        0.5069797962200001,
        0.51628327622,
        0.5321853912200001,
        0.44862652222,
        0.5315732282200001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.48164205342,
      "stddev": 0.02696382627735837,
      "median": 0.47401303722,
      "user": 0.6393870799999999,
      "system": 0.7426742999999999,
      "min": 0.45329068522,
      "max": 0.5369661332200001,
      "times": [
        0.50252387622,
        0.45329068522,
        0.45601000622,
        0.46926278222,
        0.5369661332200001,
        0.47876329222,
        0.46581080222,
        0.50625328822,
        0.48866960622,
        0.45887006222
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.34217164292,
      "stddev": 0.021436430497704124,
      "median": 0.33515541222,
      "user": 0.23751018,
      "system": 0.5791702999999999,
      "min": 0.32021506422,
      "max": 0.38553213122,
      "times": [
        0.33870515222,
        0.32477293622,
        0.32021506422,
        0.33749261822,
        0.33184080622,
        0.33184421322,
        0.33281820622,
        0.34262254922,
        0.37587275222,
        0.38553213122
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.42581793341999996,
      "stddev": 0.05260126373876778,
      "median": 0.42045830522000005,
      "user": 0.33078418,
      "system": 0.6921733999999999,
      "min": 0.35123265122,
      "max": 0.5240565842200001,
      "times": [
        0.40909206722,
        0.40010207822,
        0.43538437722,
        0.40079621322000003,
        0.35123265122,
        0.36346967622,
        0.43182454322,
        0.47240398722,
        0.46981715622000003,
        0.5240565842200001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.829 ± 0.041 1.775 1.886 5.29 ± 0.26
pacquet@main 1.884 ± 0.105 1.793 2.071 5.46 ± 0.38
pnpr@HEAD 0.345 ± 0.015 0.319 0.373 1.00
pnpr@main 0.355 ± 0.012 0.336 0.371 1.03 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8285577970000002,
      "stddev": 0.04077581791678436,
      "median": 1.8306768297,
      "user": 0.9422708999999999,
      "system": 0.8414622599999999,
      "min": 1.7747863062,
      "max": 1.8858215932,
      "times": [
        1.7747863062,
        1.7759416051999999,
        1.8111664832,
        1.8858215932,
        1.8689916252,
        1.8541377382,
        1.7891299572000001,
        1.8134149672,
        1.8642490022,
        1.8479386922
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.8844894388,
      "stddev": 0.10463465370182995,
      "median": 1.8269396907000002,
      "user": 1.0578119,
      "system": 0.9399712600000001,
      "min": 1.7934048792000001,
      "max": 2.0711189082,
      "times": [
        2.0356547412,
        2.0711189082,
        1.9904448792,
        1.8250015402000002,
        1.8237733972,
        1.8153911902000002,
        1.8453366012,
        1.8158904102000002,
        1.8288778412000002,
        1.7934048792000001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3454373931,
      "stddev": 0.0147734417575373,
      "median": 0.3452563742,
      "user": 0.22098900000000002,
      "system": 0.5995751599999999,
      "min": 0.3187590022,
      "max": 0.3725809042,
      "times": [
        0.3392191272,
        0.3368999102,
        0.3187590022,
        0.3337197502,
        0.3423954702,
        0.3546500912,
        0.3570514252,
        0.3509809722,
        0.3481172782,
        0.3725809042
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3545583011999999,
      "stddev": 0.012069228404430522,
      "median": 0.3556382482,
      "user": 0.24444239999999998,
      "system": 0.59178776,
      "min": 0.3362476312,
      "max": 0.3705119372,
      "times": [
        0.3705119372,
        0.3511569722,
        0.3367158442,
        0.3362476312,
        0.3660888072,
        0.3610902022,
        0.3472970922,
        0.3509040162,
        0.3654509852,
        0.3601195242
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 243.0 ± 21.2 216.3 280.4 2.52 ± 0.27
pacquet@main 266.6 ± 37.5 223.2 351.6 2.76 ± 0.42
pnpr@HEAD 96.5 ± 5.8 88.8 110.7 1.00
pnpr@main 98.1 ± 10.2 88.9 130.2 1.02 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2430249053745455,
      "stddev": 0.021219431578739293,
      "median": 0.23350393192000002,
      "user": 0.2047937581818182,
      "system": 0.07456252363636363,
      "min": 0.21634032392000002,
      "max": 0.28036511392,
      "times": [
        0.26567759192,
        0.22268394992000004,
        0.22788163592000002,
        0.24940403992000004,
        0.22805167592000003,
        0.23350393192000002,
        0.21634032392000002,
        0.23172748392000003,
        0.27017653192,
        0.24746167992000004,
        0.28036511392
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.26664939012000005,
      "stddev": 0.03751019601603843,
      "median": 0.25678943492000006,
      "user": 0.24333473999999997,
      "system": 0.08841335999999997,
      "min": 0.22317023492000002,
      "max": 0.35163652292,
      "times": [
        0.29010670492,
        0.25643770692,
        0.23554163192000002,
        0.22317023492000002,
        0.26550551792000004,
        0.25714116292000005,
        0.25171056692000005,
        0.29600230592000004,
        0.35163652292,
        0.23924154592000002
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09651708050620687,
      "stddev": 0.005838919064255892,
      "median": 0.09669803792000001,
      "user": 0.02385666413793103,
      "system": 0.014593045517241377,
      "min": 0.08875280292,
      "max": 0.11068886792,
      "times": [
        0.09789813992,
        0.09467583592,
        0.09662008092,
        0.10094087392000001,
        0.09669803792000001,
        0.08875280292,
        0.09772547392,
        0.10060386992,
        0.09067842292,
        0.09159543092,
        0.09330439192000001,
        0.09826891892,
        0.11068886792,
        0.09870948792,
        0.09670389892,
        0.08988969592,
        0.08910651892,
        0.10613900192,
        0.09967743292,
        0.09201534192000001,
        0.10417763492000001,
        0.10868665292,
        0.09407094492000001,
        0.08969315592,
        0.09814578692,
        0.08918626992,
        0.09888963892000001,
        0.09374990092,
        0.09170282292000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09806334927483869,
      "stddev": 0.010160426222869551,
      "median": 0.09439761192,
      "user": 0.026027262580645156,
      "system": 0.013770030967741934,
      "min": 0.08889028192000001,
      "max": 0.13017743792000003,
      "times": [
        0.09195226392,
        0.09130566392,
        0.09085861192,
        0.09039800392000001,
        0.08889028192000001,
        0.09362529692,
        0.08939683792,
        0.09238619192,
        0.09380390392,
        0.10009919892000001,
        0.12212387992000001,
        0.09463843592,
        0.08984691392000001,
        0.10416672392000001,
        0.09835251592000001,
        0.09779580692,
        0.13017743792000003,
        0.11054334292000001,
        0.09802478892000001,
        0.10217858792000001,
        0.10941124892000001,
        0.09439761192,
        0.09068860092,
        0.11825950692000001,
        0.09717133992,
        0.09337754892000001,
        0.09151128192,
        0.09073483892,
        0.09605493592,
        0.09585662192000001,
        0.09193560192
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.174 ± 0.541 0.755 2.099 1.00
pacquet@main 1.229 ± 0.446 0.825 2.190 1.05 ± 0.61
pnpm@HEAD 3.459 ± 0.338 3.036 4.047 2.95 ± 1.39
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.1737107901000001,
      "stddev": 0.5412018365458254,
      "median": 0.8912244921,
      "user": 1.1285799755555557,
      "system": 0.22276843333333332,
      "min": 0.7550499221,
      "max": 2.0992132731,
      "times": [
        1.6959768021,
        0.8912244921,
        2.0992132731,
        0.7795657291,
        1.8413756761,
        0.9093137361,
        0.7627007321,
        0.7550499221,
        0.8289767481
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.2290492082111113,
      "stddev": 0.4464993111475574,
      "median": 1.1474966881,
      "user": 1.1807001977777776,
      "system": 0.24499154444444443,
      "min": 0.8245150481,
      "max": 2.1895800751000003,
      "times": [
        1.6001376650999999,
        1.3509213571,
        2.1895800751000003,
        1.1474966881,
        1.2733776661,
        0.9562122591000001,
        0.8559621091,
        0.8245150481,
        0.8632400061000001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.4592280039888887,
      "stddev": 0.3377001574915721,
      "median": 3.3399687731000003,
      "user": 5.290467420000001,
      "system": 0.29307610000000006,
      "min": 3.0363305451000002,
      "max": 4.0469666281,
      "times": [
        4.0469666281,
        3.6624616811000004,
        3.3388423791000004,
        3.6080663371000004,
        3.1604824111000003,
        3.7912145311,
        3.3399687731000003,
        3.1487187501,
        3.0363305451000002
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.683 ± 0.193 4.472 4.934 1.30 ± 0.06
pacquet@main 4.602 ± 0.121 4.483 4.819 1.28 ± 0.05
pnpr@HEAD 3.638 ± 0.143 3.510 3.983 1.01 ± 0.05
pnpr@main 3.603 ± 0.086 3.501 3.781 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.6829311287,
      "stddev": 0.1932965039016112,
      "median": 4.6919187646000005,
      "user": 1.98965988,
      "system": 1.5385299399999999,
      "min": 4.4723256171,
      "max": 4.9344650091,
      "times": [
        4.4985767871,
        4.4818296431,
        4.6271718301,
        4.7566656991,
        4.4723256171,
        4.4769609101,
        4.8871167001,
        4.9344650091,
        4.7852301771,
        4.9089689141
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.601734856399999,
      "stddev": 0.1213751349039427,
      "median": 4.5677559380999995,
      "user": 2.1335077800000004,
      "system": 1.6397227400000003,
      "min": 4.482504030099999,
      "max": 4.8194543191,
      "times": [
        4.6188317271,
        4.4825275841,
        4.5313136101,
        4.482504030099999,
        4.8194543191,
        4.8038868081,
        4.5146855921,
        4.5637499131,
        4.6286330171,
        4.5717619631
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.6379388623999995,
      "stddev": 0.1431017997731368,
      "median": 3.5805326630999996,
      "user": 1.6117570799999998,
      "system": 1.5692032400000002,
      "min": 3.5095272930999997,
      "max": 3.9830478500999997,
      "times": [
        3.5538825670999996,
        3.7479495971,
        3.6664180341,
        3.6818904001,
        3.9830478500999997,
        3.5754553341,
        3.5450902640999997,
        3.5305172921,
        3.5095272930999997,
        3.5856099920999998
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.6029293512000002,
      "stddev": 0.08600854838242052,
      "median": 3.5862846431,
      "user": 1.31342818,
      "system": 1.38217894,
      "min": 3.5005643590999997,
      "max": 3.7810607701,
      "times": [
        3.6089610500999996,
        3.7014806820999997,
        3.6179396721,
        3.5636082361,
        3.6315824821,
        3.5005643590999997,
        3.5228217651,
        3.5590181200999997,
        3.5422563751,
        3.7810607701
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13632
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,872.86 ms
(+7.66%)Baseline: 2,668.40 ms
3,202.08 ms
(89.72%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,774.79 ms
(+0.33%)Baseline: 1,768.97 ms
2,122.76 ms
(83.61%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
448.63 ms
(-0.01%)Baseline: 448.68 ms
538.41 ms
(83.32%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
216.34 ms
(+1.15%)Baseline: 213.89 ms
256.66 ms
(84.29%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,480.21 ms
(+1.06%)Baseline: 2,454.13 ms
2,944.95 ms
(84.22%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,472.33 ms
(-0.93%)Baseline: 4,514.27 ms
5,417.13 ms
(82.56%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
313.23 ms
(+9.68%)Baseline: 285.59 ms
342.71 ms
(91.40%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
755.05 ms
(+3.28%)Baseline: 731.05 ms
877.26 ms
(86.07%)
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan force-pushed the fix/pnpr-catalog-resolution-boundary branch from 24ae5e5 to 6c176a2 Compare August 7, 2026 13:44
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@qodo-code-review

qodo-code-review Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Redundant url_has_inline_credentials comment 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The new test includes a call-site comment that repeats the behavior already documented on
url_has_inline_credentials, adding little call-specific context. This increases duplication and
makes it easier for documentation and tests to drift out of sync.
Code

pnpr/crates/pnpr/src/route/tests.rs[R50-53]

+    // An ssh login username is transport addressing, not a credential.
+    assert!(!url_has_inline_credentials("git+ssh://[email protected]/org/repo.git"));
+    assert!(!url_has_inline_credentials("ssh://[email protected]/org/repo.git"));
+    // A password is a credential on every scheme, ssh included.
Relevance

●●● Strong

Repo frequently accepts comment/doc cleanup to reduce drift and improve clarity; this is a small,
low-risk nit.

PR-#12645
PR-#12778

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule discourages repeating a function’s own documentation at its call sites. The added test
comment paraphrases the updated doc comment on url_has_inline_credentials instead of providing
call-specific context.

Rule 713431: Avoid duplicating JSDoc content in call-site comments
pnpr/crates/pnpr/src/route/tests.rs[47-62]
pnpr/crates/pnpr/src/route.rs[800-803]

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 test `url_has_inline_credentials_allows_bare_ssh_usernames` adds inline comments that restate the callee’s existing doc comment, rather than adding call-specific rationale.

## Issue Context
`url_has_inline_credentials` was updated with a detailed doc comment describing ssh username handling. Duplicating the same explanation at call sites (tests) is discouraged; tests should either be self-evident from assertions or add context that is specific to why this case matters (e.g., regression ID, threat model, or invariant).

## Fix Focus Areas
- pnpr/crates/pnpr/src/route/tests.rs[47-62]

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


2. Cache key splits empties 🐞 Bug ➹ Performance
Description
resolution_cache_key hashes request.catalogs directly, so Some(empty) serializes as {} while None
serializes as null, yielding different cache keys for the same effective “no catalogs” behavior.
This can lower cache hit rate and increase cache memory/CPU by storing duplicate resolution
candidates when clients/configs send an explicitly empty catalogs map.
Code

pnpr/crates/pnpr/src/resolver.rs[R784-787]

        "namedRegistries": &request.named_registries,
        "overrides": &request.overrides,
+        "catalogs": &request.catalogs,
        "projects": projects,
Relevance

●●● Strong

Team has accepted prior fixes normalizing null/empty shapes to avoid semantic splits; likely accept
empty-catalogs key normalization.

PR-#12563
PR-#12787

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The cache key now includes request.catalogs verbatim in the serialized JSON that gets SHA-256
hashed; since catalogs is Option<Catalogs> and Catalogs is a map type that may be empty,
None vs Some(empty) will serialize differently (null vs {}). The pnpm CLI can forward a
Some(catalogs) value from config without filtering emptiness, making Some(empty) a plausible
input shape.

pnpr/crates/pnpr/src/resolver.rs[767-804]
pnpr/crates/pnpr/src/resolver/protocol.rs[72-79]
pnpm/crates/catalogs-types/src/lib.rs[13-19]
pnpm/crates/cli/src/cli_args/install.rs[1116-1119]

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

### Issue description
`resolution_cache_key()` includes `request.catalogs` in the hashed JSON input. Because `catalogs` is an `Option<Catalogs>`, an explicitly empty map (`Some({})`) hashes differently than an absent/null catalogs (`None`), even though both represent “no catalogs” for resolution.

### Issue Context
This PR adds catalog isolation to the resolution cache identity, which is correct. However, the cache key should ideally treat *empty* catalogs the same as *missing* catalogs to avoid duplicate cache entries and reduced cache reuse.

### Fix Focus Areas
- pnpr/crates/pnpr/src/resolver.rs[767-804]

### Proposed change
- In `resolution_cache_key()`, replace `&request.catalogs` with a normalized value:
 - `let catalogs = request.catalogs.as_ref().filter(|c| !c.is_empty());`
 - Hash `catalogs` (an `Option<&Catalogs>`) instead of the raw `Option<Catalogs>`.
- (Optional) Add a regression test asserting `catalogs: {}` and omitted/`null` catalogs produce the same cache key.

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


Grey Divider

Context used
✅ Compliance rules (platform): 26 rules

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous review results

Review updated until commit 4b6b0b6

Results up to commit 6c176a2 ⚖️ Balanced


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


Remediation recommended
1. Cache key splits empties 🐞 Bug ➹ Performance
Description
resolution_cache_key hashes request.catalogs directly, so Some(empty) serializes as {} while None
serializes as null, yielding different cache keys for the same effective “no catalogs” behavior.
This can lower cache hit rate and increase cache memory/CPU by storing duplicate resolution
candidates when clients/configs send an explicitly empty catalogs map.
Code

pnpr/crates/pnpr/src/resolver.rs[R784-787]

        "namedRegistries": &request.named_registries,
        "overrides": &request.overrides,
+        "catalogs": &request.catalogs,
        "projects": projects,
Relevance

●●● Strong

Team has accepted prior fixes normalizing null/empty shapes to avoid semantic splits; likely accept
empty-catalogs key normalization.

PR-#12563
PR-#12787

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The cache key now includes request.catalogs verbatim in the serialized JSON that gets SHA-256
hashed; since catalogs is Option<Catalogs> and Catalogs is a map type that may be empty,
None vs Some(empty) will serialize differently (null vs {}). The pnpm CLI can forward a
Some(catalogs) value from config without filtering emptiness, making Some(empty) a plausible
input shape.

pnpr/crates/pnpr/src/resolver.rs[767-804]
pnpr/crates/pnpr/src/resolver/protocol.rs[72-79]
pnpm/crates/catalogs-types/src/lib.rs[13-19]
pnpm/crates/cli/src/cli_args/install.rs[1116-1119]

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

### Issue description
`resolution_cache_key()` includes `request.catalogs` in the hashed JSON input. Because `catalogs` is an `Option<Catalogs>`, an explicitly empty map (`Some({})`) hashes differently than an absent/null catalogs (`None`), even though both represent “no catalogs” for resolution.

### Issue Context
This PR adds catalog isolation to the resolution cache identity, which is correct. However, the cache key should ideally treat *empty* catalogs the same as *missing* catalogs to avoid duplicate cache entries and reduced cache reuse.

### Fix Focus Areas
- pnpr/crates/pnpr/src/resolver.rs[767-804]

### Proposed change
- In `resolution_cache_key()`, replace `&request.catalogs` with a normalized value:
 - `let catalogs = request.catalogs.as_ref().filter(|c| !c.is_empty());`
 - Hash `catalogs` (an `Option<&Catalogs>`) instead of the raw `Option<Catalogs>`.
- (Optional) Add a regression test asserting `catalogs: {}` and omitted/`null` catalogs produce the same cache key.

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


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.

An ssh remote's bare login username (git+ssh://git@host/...) is transport
addressing with no secret — the same login the scp form git@host:path
spells, which the inline-credential gate already accepts. Reject only a
user:pass@ userinfo on ssh schemes; non-ssh schemes keep rejecting any
userinfo. The off-allowlist gate still decides whether the host may be
fetched at all.

Also adds the trailing comma dylint requires in the catalog cache-key test.

Co-Authored-By: Claude Fable 5 <[email protected]>
Comment thread pnpr/crates/pnpr/src/route.rs Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 33e5414

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

URL schemes are case-insensitive (RFC 3986), so GIT+SSH://git@host/...
must get the same bare-username allowance as the lowercase spelling. A
user:pass@ userinfo is still rejected on every casing.

Co-Authored-By: Claude Fable 5 <[email protected]>
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 4b6b0b6

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

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13632
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,562.55 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
318.76 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
320.22 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
88.75 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,633.87 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,509.53 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
318.17 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit a30a1fa into pnpm:main Aug 10, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pnpr reviewed: coderabbit CodeRabbit submitted an approving review state: automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants