Repository navigation
refactor(pnpr): move resolver endpoints under the /-/pnpr namespace - #12565
Conversation
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.
📝 WalkthroughWalkthroughAll pnpr resolver HTTP endpoints are renamed from Changespnpr v0 namespace migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
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. Comment |
PR Summary by Qodorefactor(pnpr): move resolver endpoints under the /-/pnpr namespace Description
Diagram
High-Level Assessment
Files changed (17)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require review
Previous review resultsReview updated until commit b28ba3e Results up to commit b28ba3e
Great, no issues found!Qodo reviewed your code and found no material issues that require review
|
Micro-Benchmark ResultsLinux |
|
Code review by qodo was updated up to the latest commit b28ba3e |
There was a problem hiding this comment.
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
📒 Files selected for processing (17)
.changeset/pnpr-resolver-routes-under-pnpr-namespace.mdpacquet/crates/cli/src/cli_args/install.rspacquet/crates/cli/tests/pnpr_install.rspacquet/crates/package-manager/src/install_frozen_lockfile.rspacquet/crates/package-manager/src/tarball_prefetch.rspacquet/crates/pnpr-client/src/lib.rspacquet/crates/pnpr-client/tests/integration.rspnpm11/pnpm/test/install/pnpmRegistry.tspnpr/client/src/resolveViaPnprServer.tspnpr/crates/pnpr/config.yamlpnpr/crates/pnpr/src/config.rspnpr/crates/pnpr/src/main.rspnpr/crates/pnpr/src/resolver.rspnpr/crates/pnpr/src/resolver/protocol.rspnpr/crates/pnpr/src/resolver/resolve.rspnpr/crates/pnpr/src/server.rspnpr/crates/pnpr/tests/server.rs
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
Summary
In pnpr, every proprietary route except the resolver's two POST endpoints already lived under npm's reserved
/-/namespace (/-/ping,/-/pnprhandshake,/-/pnpm/v1/publish). The resolver endpoints sat at/v1/resolveand/v1/verify-lockfile, which overlaps the package path space — a package literally namedv1— forcing the server to keep thoseGETpaths 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/resolvePOST /v1/verify-lockfile→POST /-/pnpr/v0/verify-lockfileGET /-/pnprhandshake now advertises{"pnpr":{"versions":[0]}}; the Rust client'sPROTOCOL_VERSIONdrops to0.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
GETpaths. No backward compatibility is kept — the resolver protocol is not yet released — so the server and both clients (Rustpacquet-pnpr-clientand the TypeScript@pnpm/pnpr.client) change together.Squash Commit Body
Checklist
pacquet/port (server:pnprcrate; clients:pacquet-pnpr-clientand@pnpm/pnpr.client).pnpr_installtest, and the TS counting-proxy test).Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
Configuration
/-/pnprnamespace:POST /v1/resolve→POST /-/pnpr/v0/resolveandPOST /v1/verify-lockfile→POST /-/pnpr/v0/verify-lockfile.1to0in handshake responses.Chores