Repository navigation
Conversation
`pnpm login`, `pnpm adduser`, and `pnpm logout` dropped the last path segment of a registry hosted under a URL subpath when the configured URL had no trailing slash: `[email protected]` returns URLs that already contain a path unchanged instead of appending the slash, and the WHATWG relative resolution used to build the `-/v1/login`, couchdb user, and token-revocation endpoints then resolves against the truncated parent path. The auth token was likewise stored under a truncated key. Registries at a domain root were unaffected, and so were subpath URLs written with a trailing slash. Fix the package once for every consumer (config reader, login, logout, publish registry keys) with a `patchedDependencies` patch that always appends the trailing slash, matching the Rust CLI, whose normalization was already correct. The lockfile diff is limited to the patch hashes; the unrelated peer-context re-resolution a full install wanted to make was reverted deliberately. The config-reader test expectations that encoded the old truncating behavior are updated to expect the trailing slash. The Rust side gains the mirrored subpath-without-trailing-slash tests for web login, classic login, and logout; its behavior is unchanged.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (10)
📝 WalkthroughWalkthroughRegistry URLs with subpaths are normalized with trailing slashes through a patched dependency. Login and logout tests verify correct endpoint construction and token keys, while configuration tests update expected normalized registry mappings. ChangesRegistry subpath normalization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 QodoFix auth subpath registry URL normalization by enforcing trailing slash
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Confidence Score: 5/5Safe to merge — the change is a narrow one-line patch to an isolated normalization utility, all existing tests are updated to reflect the corrected behavior, and new tests exercise the previously broken paths on both the TypeScript and Rust sides. The patch is minimal and surgical: it removes exactly the condition that caused path-containing URLs to skip normalization. Root-level registries (which get a trailing slash from the WHATWG URL constructor itself) and URLs already ending with No files require special attention. The patch file and lockfile changes are mechanical; the test updates are straightforward expectation corrections. Reviews (1): Last reviewed commit: "style(auth-commands): end multi-line mac..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13137 +/- ##
==========================================
+ Coverage 85.64% 85.66% +0.01%
==========================================
Files 505 505
Lines 83652 83705 +53
==========================================
+ Hits 71647 71703 +56
+ Misses 12005 12002 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Integrated-Benchmark Report (Linux)Commit: 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
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.52009695744,
"stddev": 0.1687118767420939,
"median": 2.48585801904,
"user": 1.64809192,
"system": 1.2817284399999997,
"min": 2.34457545354,
"max": 2.79554210154,
"times": [
2.79554210154,
2.75942473554,
2.63477454954,
2.37298370754,
2.34457545354,
2.35560359654,
2.54412464054,
2.57936519954,
2.38698419254,
2.42759139754
]
},
{
"command": "pacquet@main",
"mean": 2.51239627104,
"stddev": 0.1874493704508379,
"median": 2.4315663495399997,
"user": 1.65179302,
"system": 1.27895614,
"min": 2.33409432354,
"max": 2.77867340354,
"times": [
2.73403450554,
2.64191743054,
2.34225295554,
2.33881179254,
2.40451735654,
2.73504293554,
2.33409432354,
2.45861534254,
2.77867340354,
2.35600266454
]
},
{
"command": "pnpr@HEAD",
"mean": 1.51054647624,
"stddev": 0.1441334456423289,
"median": 1.45406370154,
"user": 1.19016592,
"system": 1.1425605399999998,
"min": 1.36459917154,
"max": 1.79273631954,
"times": [
1.79273631954,
1.44253481454,
1.66958099254,
1.5500451265400002,
1.4635697035400002,
1.37421690154,
1.3808555145399999,
1.44455769954,
1.62276851854,
1.36459917154
]
},
{
"command": "pnpr@main",
"mean": 1.5474568300399998,
"stddev": 0.18062628201870515,
"median": 1.5132945955400001,
"user": 1.1831330199999999,
"system": 1.14073344,
"min": 1.34272285654,
"max": 1.78514220954,
"times": [
1.78514220954,
1.40625402654,
1.68335629954,
1.73133853554,
1.34272285654,
1.75603318754,
1.35375037754,
1.3893816165400001,
1.59889479654,
1.42769439454
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24859168192000003,
"stddev": 0.006650543956995059,
"median": 0.24838027542000002,
"user": 0.2021626,
"system": 0.50108856,
"min": 0.23998276042000002,
"max": 0.26423810342,
"times": [
0.24875228042000003,
0.26423810342,
0.24903412742000003,
0.24088829642,
0.25065880042,
0.24576713442,
0.25102605042000004,
0.24800827042,
0.23998276042000002,
0.24756099542
]
},
{
"command": "pacquet@main",
"mean": 0.24628559922,
"stddev": 0.005483226192613504,
"median": 0.24607526842000002,
"user": 0.2011127,
"system": 0.50239846,
"min": 0.23715421842,
"max": 0.25474077342,
"times": [
0.24532352842000002,
0.24782719242,
0.25474077342,
0.25182512942,
0.23715421842,
0.25203636141999997,
0.24344619142,
0.24123001442000003,
0.24682700842000002,
0.24244557442
]
},
{
"command": "pnpr@HEAD",
"mean": 0.26034281922,
"stddev": 0.005512471528757464,
"median": 0.25880798342000005,
"user": 0.2073481,
"system": 0.50881926,
"min": 0.25317136742,
"max": 0.26867011941999996,
"times": [
0.26507133642,
0.26699138442000003,
0.25887876742000004,
0.25429916242000006,
0.25317136742,
0.26867011941999996,
0.25588553742,
0.25873719942000006,
0.26436145442000003,
0.25736186342
]
},
{
"command": "pnpr@main",
"mean": 0.26565458112000007,
"stddev": 0.007527600627795442,
"median": 0.26588355042000006,
"user": 0.20879849999999997,
"system": 0.5155262599999999,
"min": 0.25195403742,
"max": 0.27636400642000003,
"times": [
0.26365385242000006,
0.27241066042000006,
0.27636400642000003,
0.26804940842,
0.25840948941999997,
0.26588933842000007,
0.25195403742,
0.26003487642,
0.27390237942000006,
0.26587776242000005
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.68946159972,
"stddev": 0.013449491101456743,
"median": 2.68828130802,
"user": 1.7312919999999998,
"system": 1.2886735000000002,
"min": 2.66630823802,
"max": 2.70600138102,
"times": [
2.68581924202,
2.70600138102,
2.67764606902,
2.66630823802,
2.69074337402,
2.70229446002,
2.67689059802,
2.70472725602,
2.6852282020200002,
2.69895717702
]
},
{
"command": "pacquet@main",
"mean": 2.669474352320001,
"stddev": 0.012692536464529993,
"median": 2.67112479252,
"user": 1.7674879000000001,
"system": 1.242078,
"min": 2.6448370490200004,
"max": 2.6833053170200003,
"times": [
2.66588967702,
2.68155745502,
2.65587188302,
2.67906612302,
2.6833053170200003,
2.66277992802,
2.6797745390200003,
2.6448370490200004,
2.6653016440200004,
2.6763599080200002
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5390595112200003,
"stddev": 0.1519980963925698,
"median": 1.47975369352,
"user": 1.1270463,
"system": 1.1353727,
"min": 1.41526825202,
"max": 1.82737683002,
"times": [
1.41826101602,
1.45783730002,
1.41566405802,
1.43731779202,
1.82737683002,
1.41526825202,
1.58066709402,
1.50167008702,
1.78270962502,
1.55382305802
]
},
{
"command": "pnpr@main",
"mean": 1.6084619410199998,
"stddev": 0.15788337096308283,
"median": 1.6626261200199999,
"user": 1.1000299,
"system": 1.1410174,
"min": 1.3897057230199998,
"max": 1.77178396702,
"times": [
1.39050176702,
1.75679202202,
1.3897057230199998,
1.77178396702,
1.5202641180199998,
1.6973711570199999,
1.62788108302,
1.72661366802,
1.76028214202,
1.44342376302
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5493101696400001,
"stddev": 0.01020588193664249,
"median": 0.54928730554,
"user": 0.64410764,
"system": 0.6874080800000001,
"min": 0.5327188190400001,
"max": 0.5637745300400001,
"times": [
0.5502148600400001,
0.5637745300400001,
0.54228256204,
0.55680362804,
0.5596266430400001,
0.5582447880400001,
0.5388749700400001,
0.5483597510400001,
0.5327188190400001,
0.54220114504
]
},
{
"command": "pacquet@main",
"mean": 0.53300698104,
"stddev": 0.013772166684974432,
"median": 0.5295155280400001,
"user": 0.65545324,
"system": 0.64244198,
"min": 0.51580086804,
"max": 0.55704908604,
"times": [
0.51580086804,
0.5181120010400001,
0.5230515590400001,
0.54346215604,
0.52375442404,
0.5462869920400001,
0.55704908604,
0.5435216680400001,
0.5312171250400001,
0.5278139310400001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.28846679044,
"stddev": 0.004646522352704796,
"median": 0.28777636354,
"user": 0.16721244,
"system": 0.50822768,
"min": 0.28094014404,
"max": 0.29648677904,
"times": [
0.28575907204,
0.28779974404,
0.28094014404,
0.29012594104,
0.29403472104,
0.28775298304,
0.28579421104,
0.29142934004,
0.28454496904,
0.29648677904
]
},
{
"command": "pnpr@main",
"mean": 0.29101366714,
"stddev": 0.005617996075040465,
"median": 0.28846057404000003,
"user": 0.17811554000000002,
"system": 0.48796527999999995,
"min": 0.28272581604,
"max": 0.29890738704,
"times": [
0.28272581604,
0.29890738704,
0.28691607804,
0.28742156504,
0.28770605104,
0.28844609604,
0.29464198004000003,
0.29875458404,
0.29614206204,
0.28847505204
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.8467664818400003,
"stddev": 0.014261727001288516,
"median": 1.8457444547400002,
"user": 0.8530418599999997,
"system": 0.7870064,
"min": 1.82744143724,
"max": 1.87437228524,
"times": [
1.8517881492400001,
1.8402672312400001,
1.8589213152400001,
1.84996678424,
1.83713047224,
1.87437228524,
1.84152212524,
1.83042407524,
1.82744143724,
1.8558309432400002
]
},
{
"command": "pacquet@main",
"mean": 1.8310194246399998,
"stddev": 0.012540513863049102,
"median": 1.8232166632400002,
"user": 0.8724095599999998,
"system": 0.7145886,
"min": 1.81927487124,
"max": 1.8527511222400002,
"times": [
1.8527511222400002,
1.84175943324,
1.84600613024,
1.82278993124,
1.82182353824,
1.8220541112400002,
1.8394336902400001,
1.8236433952400002,
1.81927487124,
1.82065802324
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29201887563999995,
"stddev": 0.0071508478991054985,
"median": 0.29022750624,
"user": 0.17403285999999998,
"system": 0.4944426,
"min": 0.28425217124,
"max": 0.30611625824,
"times": [
0.28559097824,
0.29546789824,
0.29739049924,
0.28913422924,
0.28458093824,
0.28805302724,
0.29828197324,
0.28425217124,
0.29132078324,
0.30611625824
]
},
{
"command": "pnpr@main",
"mean": 0.28839726073999994,
"stddev": 0.008932966639008857,
"median": 0.28588438074,
"user": 0.18299406,
"system": 0.48405810000000005,
"min": 0.27944575724,
"max": 0.30654858124,
"times": [
0.28429490524,
0.28747385624,
0.27944575724,
0.28397760524,
0.28046505924,
0.28231667424,
0.30654858124,
0.30144911424,
0.28944422824,
0.28855682624
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.33039386274000004,
"stddev": 0.007521954578635853,
"median": 0.32824798524,
"user": 0.31672876,
"system": 0.07235322,
"min": 0.32244229674,
"max": 0.34564459474000003,
"times": [
0.34564459474000003,
0.32538439274000003,
0.32289946874000003,
0.33592947974,
0.32244229674,
0.32674316674000004,
0.32975280374,
0.32439085774,
0.33435389274,
0.33639767374
]
},
{
"command": "pacquet@main",
"mean": 0.32957669824,
"stddev": 0.00906002776765496,
"median": 0.32929701924,
"user": 0.31513376,
"system": 0.07310362,
"min": 0.31630480674,
"max": 0.34109324574,
"times": [
0.33533179374,
0.31630480674,
0.32725628374,
0.32745610174,
0.34109324574,
0.31842844174,
0.34040670674,
0.32073044874,
0.33113793674,
0.33762121674
]
},
{
"command": "pnpr@HEAD",
"mean": 0.0883519283157576,
"stddev": 0.0038312884940508345,
"median": 0.08707810974,
"user": 0.020803566060606057,
"system": 0.011028532121212119,
"min": 0.08373564174,
"max": 0.09858479974,
"times": [
0.08442933474,
0.08707810974,
0.09049432174000001,
0.08692505074000001,
0.08560513474,
0.09410810074,
0.09797973374,
0.09083267374000001,
0.08583299974000001,
0.09858479974,
0.08373564174,
0.08590646174000001,
0.08764791074,
0.08459904374,
0.09003299974000001,
0.08634598174000001,
0.08770578774000001,
0.08888962874,
0.08716927374000001,
0.08599584574000001,
0.08982527874,
0.08558598474000001,
0.08616388374,
0.08660097374,
0.08514131174,
0.08728471674,
0.08535639874,
0.08627655774000001,
0.08608402074,
0.09079858574,
0.09239324674,
0.09663715274000001,
0.08756668774000001
]
},
{
"command": "pnpr@main",
"mean": 0.08757941906258064,
"stddev": 0.00271762966503031,
"median": 0.08652669874,
"user": 0.02181641161290323,
"system": 0.00918671870967742,
"min": 0.08422356374000001,
"max": 0.09589005374000001,
"times": [
0.08974419974,
0.08648163374000001,
0.08909570174,
0.08734383374,
0.08985611474,
0.08647730174000001,
0.08600418874,
0.08516765974000001,
0.08652669874,
0.08613877274000001,
0.08587409474,
0.08710989974000001,
0.09589005374000001,
0.08731111374,
0.09179187474,
0.08527666674,
0.08619340174000001,
0.08890496274000001,
0.08457744574,
0.08647533474,
0.08888642174000001,
0.08723365074,
0.08598117874000001,
0.08606943874,
0.08783166374000001,
0.08426707974,
0.09407067174,
0.08422356374000001,
0.08581236574000001,
0.09103290374,
0.08731209874000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.544303234619999,
"stddev": 0.16080697168942157,
"median": 4.46553987032,
"user": 1.78176314,
"system": 1.3988615999999998,
"min": 4.41425423982,
"max": 4.83643617782,
"times": [
4.83643617782,
4.429109760819999,
4.47627054182,
4.45480919882,
4.56935683482,
4.44125629982,
4.58378168182,
4.41807984782,
4.41425423982,
4.81967776282
]
},
{
"command": "pacquet@main",
"mean": 4.50607715342,
"stddev": 0.07900665901947429,
"median": 4.47011736532,
"user": 1.7865694400000003,
"system": 1.4047926999999998,
"min": 4.41961985082,
"max": 4.61428724182,
"times": [
4.61428724182,
4.58009600782,
4.41961985082,
4.46032533282,
4.59809461582,
4.43031659582,
4.43044033982,
4.47990939782,
4.459893859819999,
4.58778829182
]
},
{
"command": "pnpr@HEAD",
"mean": 3.54885195082,
"stddev": 0.13879173732009165,
"median": 3.4841522303200003,
"user": 1.2943736399999999,
"system": 1.2391832,
"min": 3.4415049578200003,
"max": 3.8615060418200002,
"times": [
3.47333113082,
3.6182364428200002,
3.50058934782,
3.4415049578200003,
3.49230366982,
3.47600079082,
3.46528057582,
3.7099417588200003,
3.4498247918200002,
3.8615060418200002
]
},
{
"command": "pnpr@main",
"mean": 3.51124415022,
"stddev": 0.12380848467670247,
"median": 3.46634124482,
"user": 1.24763664,
"system": 1.2651543,
"min": 3.44319125082,
"max": 3.85122375782,
"times": [
3.4701145608200004,
3.46927802282,
3.4551467968200003,
3.46340446682,
3.85122375782,
3.4464547648200003,
3.5512765498200003,
3.44319125082,
3.4562487238200004,
3.5061026078200004
]
}
]
} |
|
| Branch | pr/13137 |
| Testbed | pnpr |
⚠️ 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-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,415.27 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 284.25 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 280.94 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 83.74 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,364.60 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,441.50 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 253.17 ms |
Summary
pnpm login(andadduser/logout) failed against a registry hosted under a URL subpath (e.g.https://example.com/npm/registry) whenever the configured URL had no trailing slash.[email protected]returns URLs that already contain a path unchanged instead of appending the trailing slash, and the WHATWG relative resolution used to build the-/v1/login, couchdb-user, and token-revocation endpoints then drops the last path segment — the CLI contactedhttps://example.com/npm/-/v1/logininstead ofhttps://example.com/npm/registry/-/v1/loginand stored the auth token under a truncated key. Root-level registries and subpath URLs written with a trailing slash were unaffected.The fix patches
normalize-registry-urlthroughpatchedDependencies(the same mechanism as the existinggraceful-fspatch) so the trailing slash is always appended. That repairs every consumer at once: the config reader, login, logout, and the publish registry keys. The resulting endpoints match what the npm CLI produces for the same configuration (npm joins registry and path by stripping/re-adding the slash at request time, so it never had this bug).The Rust CLI already normalizes correctly (
registry_url.rsappends the slash unconditionally), so it gains only the mirrored subpath-without-trailing-slash tests for web login, classic login, and logout — no behavior change, hence the changeset targets onlypnpm.The lockfile diff is limited to the patch hashes. A full install also wanted to re-resolve unrelated
@types/nodejest peer contexts from 22.x to 26.x (against the catalog's documented 22.x pin); that churn was deliberately kept out, and the resulting lockfile was verified with both a full and a--frozen-lockfileinstall.Follow-up (out of scope here): publishing a fixed
normalize-registry-url2.0.2 upstream would let us drop the patch on the next dependency bump and would also fix external consumers of the published@pnpm/*v11 library packages, which resolve the unpatched 2.0.1 from npm.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-fable-5).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
pnpm login,adduser, andlogoutfor registries hosted under URL subpaths without trailing slashes.