Skip to content

ci(test): use prebuilt @pnpm/pnpr from npm instead of building locally#11964

Merged
zkochan merged 1 commit into
mainfrom
e2e-use-pnpr-from-npm
May 26, 2026
Merged

ci(test): use prebuilt @pnpm/pnpr from npm instead of building locally#11964
zkochan merged 1 commit into
mainfrom
e2e-use-pnpr-from-npm

Conversation

@zkochan

@zkochan zkochan commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

The e2e/integration test harness spawns pnpm-registry as a faster verdaccio replacement. Until now, CI installed the Rust toolchain and ran cargo build --release -p pnpm-registry --locked on every test job, adding a few minutes per platform.

@pnpm/pnpr is now publishing prebuilt binaries to npm via #11963, so the cargo build is redundant. pnpm install already pulls in the matching @pnpm/pnpr.<platform>-<arch> package via optionalDependencies; the Jest globalSetup now resolves the binary out of that.

Changes

  • pnpm-workspace.yaml: add @pnpm/pnpr to the catalog pinned at 0.0.0-26052601.
  • __utils__/jest-config/package.json: depend on @pnpm/pnpr via catalog:.
  • __utils__/jest-config/with-registry/globalSetup.js: replace the \$CARGO_TARGET_DIR lookup with require.resolve('@pnpm/pnpr.\${platform}-\${arch}/pnpr[.exe]'). Resolution goes through the @pnpm/pnpr wrapper's own module path because the platform sub-packages live in the wrapper's node_modules, not on the parent chain of globalSetup.js. PNPM_REGISTRY_BIN is still honored as the escape hatch for contributors who want to test in-progress changes to the Rust crate.
  • .github/workflows/test.yml: drop the Install Rust toolchain and Build pnpm-registry steps.

Verification

Ran cache/commands' test suite locally on darwin-arm64 — globalSetup spawned the binary from @pnpm/pnpr.darwin-arm64@0.0.0-26052601, the server reported pnpm-registry listening listen=127.0.0.1:53469, and the suite passed.

Test plan

  • CI's test matrix (ubuntu + windows, multiple Node versions) all pass
  • Compare wall-clock time of test jobs before vs. after — expect to save the time previously spent on Install Rust toolchain + Build pnpm-registry
  • Locally: run any with-registry test suite; confirm registry server starts and tests pass

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

Summary by CodeRabbit

  • Chores
    • Streamlined test infrastructure setup by adopting pre-built binaries, reducing CI execution time.
    • Updated test dependencies and workspace configuration to support improved registry binary resolution during test runs.

Review Change Stack

The e2e/integration test harness spawns `pnpm-registry` as a faster
verdaccio replacement. CI used to install Rust and build the crate
from source on every test job — adding several minutes per platform.

`@pnpm/pnpr` now publishes the prebuilt binary to npm, and `pnpm install`
already pulls in the matching `@pnpm/pnpr.<platform>-<arch>` package
via optionalDependencies. The Jest globalSetup resolves that binary
through `@pnpm/pnpr/bin/pnpr`'s own module path (the wrapper carries
the platform packages as siblings in its `node_modules`, not on the
parent chain of this file).

- Add `@pnpm/pnpr` to `pnpm-workspace.yaml` catalog and depend on it
  from `@pnpm/jest-config`.
- Replace `resolvePnpmRegistryBin`'s `$CARGO_TARGET_DIR` lookup with
  `require.resolve` through the npm-installed wrapper. The
  `PNPM_REGISTRY_BIN` env var is still honored as an escape hatch for
  contributors who want to point at a locally-built Rust binary.
- Remove the "Install Rust toolchain" + "Build pnpm-registry" steps
  from `.github/workflows/test.yml`.

---
Written by an agent (Claude Code, claude-opus-4-7).
@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 May 26, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f41713ee-002a-4464-b4e8-3cfcfa101921

📥 Commits

Reviewing files that changed from the base of the PR and between 0f5f338 and 15589f5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .github/workflows/test.yml
  • __utils__/jest-config/package.json
  • __utils__/jest-config/with-registry/globalSetup.js
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (1)
  • .github/workflows/test.yml
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Compile & Lint
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-05-05T23:03:04.286Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11479
File: __utils__/scripts/package.json:6-9
Timestamp: 2026-05-05T23:03:04.286Z
Learning: The pattern cross-env NODE_OPTIONS="$NODE_OPTIONS ..." in package.json scripts is an established convention in the pnpm/pnpm repository and is used across many packages (e.g., fs/hard-link-dir, worker, __utils__/scripts). Do not flag this as a cross-platform issue in individual files; if a change is needed, apply it as a repo-wide change in a separate PR. Scope this guidance to all package.json files in the repo; use the minimatch pattern '**/package.json' to identify relevant files and review changes at the repository level rather than per-file.

Applied to files:

  • __utils__/jest-config/package.json
📚 Learning: 2026-05-14T09:04:00.133Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11622
File: resolving/npm-resolver/test/publishedBy.test.ts:350-354
Timestamp: 2026-05-14T09:04:00.133Z
Learning: In the pnpm/pnpm repository, ESLint is the authoritative style linter. Do not raise review findings for missing trailing commas in multiline function calls (e.g., `fs.writeFileSync(...)`) when this repo’s ESLint configuration does not report them and lint passes. Prefer deferring to the ESLint results for this specific trailing-comma rule rather than enforcing it manually in code review.

Applied to files:

  • __utils__/jest-config/with-registry/globalSetup.js
🔇 Additional comments (3)
pnpm-workspace.yaml (1)

97-97: LGTM!

__utils__/jest-config/package.json (1)

10-10: LGTM!

__utils__/jest-config/with-registry/globalSetup.js (1)

89-117: LGTM!


📝 Walkthrough

Walkthrough

The PR removes the Rust toolchain build step from CI tests and replaces local pnpm-registry binary discovery with a pre-built binary from the new @pnpm/pnpr npm package. Workspace and package dependencies are declared, globalSetup.js is updated to resolve the binary via @pnpm/pnpr, and the cargo build step is removed from the test workflow.

Changes

pnpm-registry binary source migration

Layer / File(s) Summary
Add @pnpm/pnpr dependency declaration
pnpm-workspace.yaml, __utils__/jest-config/package.json
Workspace catalog and jest-config package.json declare the new @pnpm/pnpr dependency at version 0.0.0-26052601.
Update test binary resolution to use @pnpm/pnpr
__utils__/jest-config/with-registry/globalSetup.js
Imports are simplified to createRequire from node:module. resolvePnpmRegistryBin() is refactored to resolve the pnpm-registry binary from @pnpm/pnpr's platform-specific optional dependency using require.resolve, replacing the previous cargo-target filesystem probing and repoRoot() helper.
Remove Rust build step from test workflow
.github/workflows/test.yml
The workflow no longer installs the Rust toolchain or runs cargo build -p pnpm-registry --release --locked, since the binary is now sourced from the @pnpm/pnpr npm package.

Possibly Related PRs

  • pnpm/pnpm#11963: Introduces the @pnpm/pnpr npm wrapper and per-platform binary packages that this PR directly consumes for test-time pnpm-registry binary resolution.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰 Wheels turn from rust to npm, binaries pre-built and ready—
No more cargo waits, tests run steady.
Platform paths resolve with grace,
@pnpm/pnpr finds its place. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: switching from locally-built Rust binaries to prebuilt npm packages for the pnpm-registry, which is reflected across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 e2e-use-pnpr-from-npm

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 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 and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.065 ± 0.132 1.934 2.316 1.04 ± 0.07
pacquet@main 1.993 ± 0.040 1.925 2.071 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.06483593648,
      "stddev": 0.13168923896082896,
      "median": 2.01345316998,
      "user": 2.76415074,
      "system": 3.4983873799999996,
      "min": 1.9342898949799998,
      "max": 2.3160731669800003,
      "times": [
        1.9983054039800001,
        2.01860553398,
        2.0005702319800003,
        2.02952299498,
        2.0083008059800003,
        2.0327878419800003,
        2.30244821998,
        2.3160731669800003,
        2.0074552699800003,
        1.9342898949799998
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.9931997980799998,
      "stddev": 0.03958784291836677,
      "median": 1.98627692548,
      "user": 2.771042239999999,
      "system": 3.4231242799999997,
      "min": 1.92519006998,
      "max": 2.0706390159800003,
      "times": [
        2.01809194598,
        2.03094429098,
        1.98322596898,
        1.9705596969799999,
        1.96803788698,
        1.98011920098,
        1.92519006998,
        2.0706390159800003,
        1.98932788198,
        1.99586202198
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 634.2 ± 26.6 614.7 707.2 1.00
pacquet@main 656.5 ± 21.1 635.2 702.8 1.04 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.63415250638,
      "stddev": 0.026589139071216874,
      "median": 0.6274837423799999,
      "user": 0.3653155,
      "system": 1.3296928000000001,
      "min": 0.61472975838,
      "max": 0.70723820238,
      "times": [
        0.70723820238,
        0.63255298838,
        0.62015188638,
        0.62678666838,
        0.63242182538,
        0.62818081638,
        0.61810009838,
        0.62473102338,
        0.63663179638,
        0.61472975838
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.65653877228,
      "stddev": 0.021138033981784,
      "median": 0.6491286538800001,
      "user": 0.3663286,
      "system": 1.3415807,
      "min": 0.63519784338,
      "max": 0.70282983138,
      "times": [
        0.68036319538,
        0.64177536738,
        0.64501955838,
        0.63519784338,
        0.70282983138,
        0.65145542138,
        0.65913811138,
        0.64680188638,
        0.63866264338,
        0.66414386438
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.247 ± 0.030 2.189 2.288 1.00
pacquet@main 2.265 ± 0.039 2.212 2.320 1.01 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.2469317573799996,
      "stddev": 0.03009514424174808,
      "median": 2.2517030684800003,
      "user": 3.7872970399999994,
      "system": 3.0968587999999997,
      "min": 2.18859837348,
      "max": 2.28780362748,
      "times": [
        2.25602138148,
        2.27885741348,
        2.28780362748,
        2.24738475548,
        2.26342006648,
        2.18859837348,
        2.22682162748,
        2.2247066064800003,
        2.26790379048,
        2.2277999314800003
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.26545327098,
      "stddev": 0.03869259103151394,
      "median": 2.2628823014800004,
      "user": 3.7975375399999995,
      "system": 3.1336440999999993,
      "min": 2.21222634848,
      "max": 2.3197765394800003,
      "times": [
        2.23166860248,
        2.22013389448,
        2.24289685048,
        2.3197765394800003,
        2.30675070748,
        2.2878363154800003,
        2.26301819548,
        2.2627464074800003,
        2.21222634848,
        2.30747884848
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.426 ± 0.017 1.385 1.448 1.00
pacquet@main 1.431 ± 0.034 1.400 1.518 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.4259473543600003,
      "stddev": 0.016934238214531487,
      "median": 1.42818536466,
      "user": 1.72365502,
      "system": 1.8431851599999998,
      "min": 1.3853996666600001,
      "max": 1.4476586056600003,
      "times": [
        1.4476586056600003,
        1.42141743666,
        1.3853996666600001,
        1.4357654426600002,
        1.4270998106600001,
        1.4151655206600002,
        1.43199512266,
        1.4394838576600002,
        1.4262171616600001,
        1.4292709186600001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.43121886666,
      "stddev": 0.033781708342958634,
      "median": 1.42822169666,
      "user": 1.7304909199999998,
      "system": 1.81145526,
      "min": 1.40014601266,
      "max": 1.5176732856600001,
      "times": [
        1.43091789166,
        1.4267736906600001,
        1.5176732856600001,
        1.4315441206600001,
        1.4246103116600002,
        1.40014601266,
        1.4059287656600001,
        1.4004172896600002,
        1.4445075956600002,
        1.4296697026600003
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/11964
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,246.93 ms
(-21.93%)Baseline: 2,878.14 ms
3,453.77 ms
(65.06%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,425.95 ms
(-28.19%)Baseline: 1,985.75 ms
2,382.90 ms
(59.84%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,064.84 ms
(-0.89%)Baseline: 2,083.39 ms
2,500.07 ms
(82.59%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
634.15 ms
(-4.07%)Baseline: 661.07 ms
793.29 ms
(79.94%)
🐰 View full continuous benchmarking report in Bencher

@zkochan zkochan merged commit f107b1e into main May 26, 2026
16 checks passed
@zkochan zkochan deleted the e2e-use-pnpr-from-npm branch May 26, 2026 17:33
@zkochan zkochan mentioned this pull request May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant