Skip to content

refactor(pnpr): move resolver endpoints under the /-/pnpr namespace - #12565

Merged
zkochan merged 1 commit into
mainfrom
pnpr-resolver-routes-namespace
Jun 22, 2026
Merged

zkochan merged 1 commit into
mainfrom
pnpr-resolver-routes-namespace

Conversation

@zkochan

@zkochan zkochan commented Jun 22, 2026 •

Copy link
Copy Markdown
Member

Summary

In pnpr, every proprietary route except the resolver's two POST endpoints already lived under npm's reserved /-/ namespace (/-/ping, /-/pnpr handshake, /-/pnpm/v1/publish). The resolver endpoints sat at /v1/resolve and /v1/verify-lockfile, which overlaps the package path space — a package literally named v1 — forcing the server to keep those GET paths npm-compatible.

This PR moves the two endpoints into the reserved namespace, grouping them with the handshake they're discovered through:

  • POST /v1/resolve → POST /-/pnpr/v0/resolve
  • POST /v1/verify-lockfile → POST /-/pnpr/v0/verify-lockfile
  • GET /-/pnpr handshake now advertises {"pnpr":{"versions":[0]}}; the Rust client's PROTOCOL_VERSION drops to 0.

Putting all pnpr routes in the reserved namespace removes the package-collision concern entirely and lets the disabled-resolver branch stop special-casing the old npm-compatible GET paths. No backward compatibility is kept — the resolver protocol is not yet released — so the server and both clients (Rust pacquet-pnpr-client and the TypeScript @pnpm/pnpr.client) change together.

Squash Commit Body

refactor(pnpr): move resolver endpoints under the /-/pnpr namespace

The pnpr resolver's two POST endpoints were the only proprietary routes
served outside npm's reserved /-/ namespace, where they overlapped the
package path space (a package literally named `v1`). Move them under the
/-/pnpr namespace alongside the existing capability handshake:

  POST /v1/resolve         -> POST /-/pnpr/v0/resolve
  POST /v1/verify-lockfile -> POST /-/pnpr/v0/verify-lockfile

The GET /-/pnpr handshake now advertises protocol version 0 to match, and
the Rust client's PROTOCOL_VERSION drops to 0. Keeping every pnpr route in
the reserved namespace removes the package-collision concern and lets the
disabled-resolver branch stop special-casing the old npm-compatible GET
paths.

No backward compatibility is kept: the resolver protocol is not yet
released. Server and both clients (Rust pacquet-pnpr-client and the
TypeScript @pnpm/pnpr.client) change together.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pacquet/ port (server: pnpr crate; clients: pacquet-pnpr-client and @pnpm/pnpr.client).
  • Added a changeset.
  • Added or updated tests (route-mounting tests, pnpr-client integration tests, CLI pnpr_install test, and the TS counting-proxy test).
  • Updated the documentation if needed.

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

Summary by CodeRabbit

  • Configuration

    • Migrated pnpr resolver endpoints to the reserved /-/pnpr namespace: POST /v1/resolve → POST /-/pnpr/v0/resolve and POST /v1/verify-lockfile → POST /-/pnpr/v0/verify-lockfile.
    • Updated protocol version from 1 to 0 in handshake responses.
  • Chores

    • Updated documentation and test expectations across client and server implementations to reflect new endpoint paths.

The pnpr resolver's two POST endpoints were the only proprietary routes
served outside npm's reserved /-/ namespace, where they overlapped the
package path space (a package literally named `v1`). Move them under the
/-/pnpr namespace alongside the existing capability handshake:

  POST /v1/resolve         -> POST /-/pnpr/v0/resolve
  POST /v1/verify-lockfile -> POST /-/pnpr/v0/verify-lockfile

The GET /-/pnpr handshake now advertises protocol version 0 to match, and
the Rust client's PROTOCOL_VERSION drops to 0. Keeping every pnpr route in
the reserved namespace removes the package-collision concern and lets the
disabled-resolver branch stop special-casing the old npm-compatible GET
paths.

No backward compatibility is kept: the resolver protocol is not yet
released. Server and both clients (Rust pacquet-pnpr-client and the
TypeScript `@pnpm/pnpr.client`) change together.
@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

All pnpr resolver HTTP endpoints are renamed from /v1/resolve and /v1/verify-lockfile to /-/pnpr/v0/resolve and /-/pnpr/v0/verify-lockfile. The capability handshake now advertises protocol version 0 instead of 1. The Rust PROTOCOL_VERSION constant, the TypeScript postResolve URL, all client error messages, server route mounts, tests, inline docs, CLI help text, and a changeset entry are updated to match.

Changes

pnpr v0 namespace migration

Layer / File(s) Summary
Server route wiring and handshake version
pnpr/crates/pnpr/src/server.rs, pacquet/crates/pnpr-client/src/lib.rs
Router mounts POST /-/pnpr/v0/resolve and POST /-/pnpr/v0/verify-lockfile (replacing /v1/*), serve_pnpr_handshake advertises versions:[0], and PROTOCOL_VERSION changes from 1 to 0.
Client URL rewiring (Rust + TypeScript)
pacquet/crates/pnpr-client/src/lib.rs, pnpr/client/src/resolveViaPnprServer.ts
verify_lockfile and resolve_streaming POST to /-/pnpr/v0/verify-lockfile and /-/pnpr/v0/resolve; TypeScript postResolve constructs new URL('-/pnpr/v0/resolve', base); all associated error messages updated.
Test expectations updated to v0 paths
pnpr/crates/pnpr/tests/server.rs, pacquet/crates/pnpr-client/tests/integration.rs, pacquet/crates/cli/tests/pnpr_install.rs, pnpm11/pnpm/test/install/pnpmRegistry.ts
Mock and stub URL assertions updated from /v1/* to /-/pnpr/v0/* across server routing tests, pnpr-client integration tests, pacquet CLI frozen-install test, and pnpm11 proxy harness.
Docs, comments, config, and changeset
.changeset/pnpr-resolver-routes-under-pnpr-namespace.md, pnpr/crates/pnpr/src/resolver.rs, pnpr/crates/pnpr/src/resolver/protocol.rs, pnpr/crates/pnpr/src/resolver/resolve.rs, pnpr/crates/pnpr/src/config.rs, pnpr/crates/pnpr/src/main.rs, pnpr/crates/pnpr/config.yaml, pacquet/crates/cli/src/cli_args/install.rs, pacquet/crates/package-manager/src/..., pnpr/client/src/resolveViaPnprServer.ts
All inline doc comments, CLI help text, YAML config examples, module headers, and the changeset entry updated to reference /-/pnpr/v0/resolve and /-/pnpr/v0/verify-lockfile; no logic changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • pnpm/pnpm#12246: Touches the same pnpr/client/src/resolveViaPnprServer.ts NDJSON parsing and terminal-frame handling that this PR updates endpoint paths within.
  • pnpm/pnpm#12563: Modifies the same pnpr/crates/pnpr/src/server.rs resolver feature-toggle route mounting that this PR rewires to the /-/pnpr/v0/* namespace.

Suggested labels

product: pnpm@11, product: pacquet, product: pnpr

✨ 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 pnpr-resolver-routes-namespace

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.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

refactor(pnpr): move resolver endpoints under the /-/pnpr namespace
✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

Description

• Move pnpr resolver endpoints to /-/pnpr/v0/* to avoid collisions with package paths.
• Update handshake to advertise protocol v0 and align Rust/TS clients to new routes.
• Refresh server/client integration tests and add a changeset for the coordinated break.
Diagram

graph TD
  TS["TS pnpr client"] --> HS["GET /-/pnpr handshake"] --> SVC["pnpr server router"] --> RES["POST /-/pnpr/v0/resolve"]
  Rust["Rust pnpr client"] --> HS
  SVC --> VER["POST /-/pnpr/v0/verify-lockfile"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep temporary aliases for /v1/* endpoints
  • ➕ Allows mixed server/client deployments during rollout
  • ➕ Reduces breakage risk if any downstream tooling already integrated with /v1/*
  • ➖ Reintroduces the original package-path collision concern (e.g., package named v1)
  • ➖ More routing/stubbing complexity, especially in registry-only / resolver-disabled modes
  • ➖ Extra deprecation/removal work later
2. Version only the payload; keep stable /-/pnpr/resolve path
  • ➕ Fewer URL changes across versions; version negotiation happens in-body or headers
  • ➖ Harder to reason about caching/observability by protocol version
  • ➖ More complex server dispatch and client error reporting
  • ➖ Less consistent with the existing versioned-path convention implied by handshake

Recommendation: The PR’s approach (move resolver endpoints under reserved /-/pnpr/v0/* and advertise [0] in the handshake) is the cleanest given the stated goal of eliminating package-path collisions and simplifying resolver-disabled behavior. Since the resolver protocol is explicitly unreleased, not carrying backward compatibility is reasonable; if that assumption changes, adding short-lived aliases for /v1/* would be the least invasive fallback.

Files changed (17) +78 / -71

Refactor (3) +35 / -34
lib.rsSwitch Rust pnpr client to protocol v0 and /-/pnpr/v0 endpoints +13/-11

Switch Rust pnpr client to protocol v0 and /-/pnpr/v0 endpoints

• Updates request URLs for resolve and verify-lockfile to '/-/pnpr/v0/*', adjusts error messages accordingly, and drops 'PROTOCOL_VERSION' from 1 to 0 to match the updated handshake advertisement.

pacquet/crates/pnpr-client/src/lib.rs

resolveViaPnprServer.tsSwitch TS pnpr client resolve URL and diagnostics to /-/pnpr/v0 +7/-7

Switch TS pnpr client resolve URL and diagnostics to /-/pnpr/v0

• Updates the resolve request URL from 'v1/resolve' to '-/pnpr/v0/resolve' and rewrites NDJSON parsing error messages/docs to match the new endpoint path.

pnpr/client/src/resolveViaPnprServer.ts

server.rsMount resolver endpoints under /-/pnpr/v0 and advertise handshake v0 +15/-16

Mount resolver endpoints under /-/pnpr/v0 and advertise handshake v0

• Moves resolver route mounting from '/v1/*' to '/-/pnpr/v0/*', updates the handshake response to advertise 'versions: [0]', and simplifies the resolver-disabled commentary now that the endpoints no longer overlap registry package path space.

pnpr/crates/pnpr/src/server.rs

Tests (4) +16 / -16
pnpr_install.rsUpdate pnpr CLI install test to hit new verify endpoint +1/-1

Update pnpr CLI install test to hit new verify endpoint

• Changes the mocked verification route from '/v1/verify-lockfile' to '/-/pnpr/v0/verify-lockfile' for the pnpr install test.

pacquet/crates/cli/tests/pnpr_install.rs

integration.rsUpdate Rust pnpr client integration tests for /-/pnpr/v0 routes +3/-3

Update Rust pnpr client integration tests for /-/pnpr/v0 routes

• Adjusts test documentation and mock server expectations to target '/-/pnpr/v0/resolve', and updates commentary around verification forwarding to the new verify endpoint path.

pacquet/crates/pnpr-client/tests/integration.rs

pnpmRegistry.tsUpdate counting-proxy test to count /-/pnpr/v0/resolve requests +3/-3

Update counting-proxy test to count /-/pnpr/v0/resolve requests

• Changes the proxy counter logic and comments to detect the new resolver URL path '/-/pnpr/v0/resolve'.

pnpm11/pnpm/test/install/pnpmRegistry.ts

server.rsUpdate pnpr server routing tests for /-/pnpr/v0 endpoints +9/-9

Update pnpr server routing tests for /-/pnpr/v0 endpoints

• Adjusts assertions to use the new resolver endpoint paths and updates the registry-only behavior explanation to reflect that only '/-/pnpr' needs a stub for capability detection.

pnpr/crates/pnpr/tests/server.rs

Documentation (9) +21 / -21
install.rsUpdate pnpr CLI docs to reference new resolve endpoint path +3/-3

Update pnpr CLI docs to reference new resolve endpoint path

• Adjusts CLI argument doc comments to reference forwarding options to '/-/pnpr/v0/resolve' instead of '/v1/resolve'. No functional logic change.

pacquet/crates/cli/src/cli_args/install.rs

install_frozen_lockfile.rsUpdate lockfile verification override docs for new endpoint path +1/-1

Update lockfile verification override docs for new endpoint path

• Updates documentation to reflect that pnpr delegates lockfile verification to '/-/pnpr/v0/verify-lockfile'.

pacquet/crates/package-manager/src/install_frozen_lockfile.rs

tarball_prefetch.rsUpdate tarball prefetch docs for new resolve endpoint path +2/-2

Update tarball prefetch docs for new resolve endpoint path

• Rewords module and function doc comments to reference streaming packages from '/-/pnpr/v0/resolve' rather than '/v1/resolve'.

pacquet/crates/package-manager/src/tarball_prefetch.rs

config.yamlUpdate sample config comments for new resolver endpoints +2/-2

Update sample config comments for new resolver endpoints

• Updates commented documentation in the example config to reference '/-/pnpr/v0/resolve' and '/-/pnpr/v0/verify-lockfile'.

pnpr/crates/pnpr/config.yaml

config.rsUpdate resolver feature docs to list /-/pnpr/v0 endpoints +3/-3

Update resolver feature docs to list /-/pnpr/v0 endpoints

• Adjusts Rust doc comments describing the resolver surface and the resolver feature master switch to reference the new namespaced, versioned routes.

pnpr/crates/pnpr/src/config.rs

main.rsUpdate CLI help text for disabling resolver surface +2/-2

Update CLI help text for disabling resolver surface

• Updates the '--disable-resolver' help text to list the '/-/pnpr/v0/*' endpoints instead of '/v1/*'.

pnpr/crates/pnpr/src/main.rs

resolver.rsRename resolver endpoint documentation to /-/pnpr/v0 paths +6/-6

Rename resolver endpoint documentation to /-/pnpr/v0 paths

• Updates module-level and handler docstrings to reference 'POST /-/pnpr/v0/resolve' and 'POST /-/pnpr/v0/verify-lockfile', and adjusts an inline comment referencing sized package frames.

pnpr/crates/pnpr/src/resolver.rs

protocol.rsUpdate protocol type docs for new resolve endpoint path +1/-1

Update protocol type docs for new resolve endpoint path

• Adjusts documentation describing the request body to reference 'POST /-/pnpr/v0/resolve'.

pnpr/crates/pnpr/src/resolver/protocol.rs

resolve.rsUpdate resolve streaming comment for new endpoint path +1/-1

Update resolve streaming comment for new endpoint path

• Updates a comment describing NDJSON 'package' frames to reference the new '/-/pnpr/v0/resolve' endpoint.

pnpr/crates/pnpr/src/resolver/resolve.rs

Other (1) +6 / -0
pnpr-resolver-routes-under-pnpr-namespace.mdAdd changeset documenting pnpr resolver route namespace move +6/-0

Add changeset documenting pnpr resolver route namespace move

• Introduces a patch changeset for 'pnpm' and '@pnpm/pnpr.client' describing the endpoint migrations to '/-/pnpr/v0/*' and the handshake protocol version change to 0.

.changeset/pnpr-resolver-routes-under-pnpr-namespace.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Auto-approved notes - no code review findings
- 'auto_approve_for_no_suggestions' flag enabled

Previous review results

Review updated until commit b28ba3e

Results up to commit b28ba3e


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review
Auto-approved notes - no code review findings
- 'auto_approve_for_no_suggestions' flag enabled

Qodo Logo

@github-actions

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      7.6±0.34ms   570.4 KB/sec    1.01      7.7±0.29ms   565.1 KB/sec

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@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 `@pnpr/crates/pnpr/tests/server.rs`:
- Around line 993-1010: The current test only verifies that the new
`/-/pnpr/v0/resolve` and `/-/pnpr/v0/verify-lockfile` endpoints return
METHOD_NOT_ALLOWED, but it does not test that the legacy `/v1/resolve` and
`/v1/verify-lockfile` routes are properly rejected. Add additional assertion
blocks following the existing pattern in this test to verify that POST requests
to the old `/v1/resolve` and `/v1/verify-lockfile` paths also return appropriate
error responses (such as METHOD_NOT_ALLOWED or 404), ensuring regression
coverage for the endpoint migration as required by the coding guidelines.
🪄 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: 9100deee-7b6b-4b39-b762-8ed2a5dce1da

📥 Commits

Reviewing files that changed from the base of the PR and between bed6c59 and b28ba3e.

📒 Files selected for processing (17)
  • .changeset/pnpr-resolver-routes-under-pnpr-namespace.md
  • pacquet/crates/cli/src/cli_args/install.rs
  • pacquet/crates/cli/tests/pnpr_install.rs
  • pacquet/crates/package-manager/src/install_frozen_lockfile.rs
  • pacquet/crates/package-manager/src/tarball_prefetch.rs
  • pacquet/crates/pnpr-client/src/lib.rs
  • pacquet/crates/pnpr-client/tests/integration.rs
  • pnpm11/pnpm/test/install/pnpmRegistry.ts
  • pnpr/client/src/resolveViaPnprServer.ts
  • pnpr/crates/pnpr/config.yaml
  • pnpr/crates/pnpr/src/config.rs
  • pnpr/crates/pnpr/src/main.rs
  • pnpr/crates/pnpr/src/resolver.rs
  • pnpr/crates/pnpr/src/resolver/protocol.rs
  • pnpr/crates/pnpr/src/resolver/resolve.rs
  • pnpr/crates/pnpr/src/server.rs
  • pnpr/crates/pnpr/tests/server.rs

Comment thread pnpr/crates/pnpr/tests/server.rs Resolved
@zkochan
zkochan enabled auto-merge (squash) June 22, 2026 01:05
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.07%. Comparing base (bed6c59) to head (b28ba3e).

Files with missing lines Patch % Lines
pacquet/crates/pnpr-client/src/lib.rs 62.50% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12565   +/-   ##
=======================================
  Coverage   88.07%   88.07%           
=======================================
  Files         321      321           
  Lines       45078    45080    +2     
=======================================
+ Hits        39704    39706    +2     
  Misses       5374     5374           

☔ 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 added the reviewed: coderabbit CodeRabbit submitted an approving review label Jun 22, 2026
@zkochan
zkochan merged commit 4d3fe4b into main Jun 22, 2026
37 checks passed
@zkochan
zkochan deleted the pnpr-resolver-routes-namespace branch June 22, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants