Repository navigation
feat(pacquet): port whoami command - #12649
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAdds a Changeswhoami command
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 Qodofeat(pacquet): port Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
|
Code review by qodo was updated up to the latest commit 5ce8dfb |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12649 +/- ##
==========================================
+ Coverage 88.58% 88.75% +0.17%
==========================================
Files 339 343 +4
Lines 49171 50401 +1230
==========================================
+ Hits 43557 44733 +1176
- Misses 5614 5668 +54 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.864094166060001,
"stddev": 0.17769427227304574,
"median": 4.83173449906,
"user": 3.93635328,
"system": 3.42236676,
"min": 4.647822150560001,
"max": 5.12103370456,
"times": [
5.11020820756,
4.647822150560001,
4.90869242956,
5.12103370456,
4.80049034556,
4.68819868056,
4.762338644560001,
4.862978652560001,
5.047668278560001,
4.691510566560001
]
},
{
"command": "pacquet@main",
"mean": 4.74838664716,
"stddev": 0.11615723780025729,
"median": 4.75868838656,
"user": 3.9233657799999997,
"system": 3.4149010600000005,
"min": 4.6096803495600005,
"max": 5.01660500056,
"times": [
4.76668444456,
4.78012338456,
4.6571726165600005,
5.01660500056,
4.787682564560001,
4.6096803495600005,
4.650808473560001,
4.7506923285600005,
4.79927408356,
4.6651432255600005
]
},
{
"command": "pnpr@HEAD",
"mean": 2.96144065776,
"stddev": 0.13532265212088165,
"median": 2.90826033106,
"user": 2.82911438,
"system": 2.9493422600000003,
"min": 2.82831227756,
"max": 3.22959531756,
"times": [
2.94509662956,
2.88581161556,
3.13415846956,
2.93070904656,
2.84133280856,
2.87224326856,
2.88485870356,
2.82831227756,
3.0622884405599997,
3.22959531756
]
},
{
"command": "pnpr@main",
"mean": 2.9862415371599997,
"stddev": 0.0812662867686366,
"median": 2.98042767556,
"user": 2.7941205800000004,
"system": 2.9723697600000003,
"min": 2.88022257656,
"max": 3.17229122056,
"times": [
3.00220666756,
2.92991296756,
2.97858741356,
2.88022257656,
2.91982603056,
2.98859564756,
2.95417319956,
3.17229122056,
3.05433171056,
2.98226793756
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.67010295648,
"stddev": 0.011069218108875251,
"median": 0.6688689398800001,
"user": 0.3922988,
"system": 1.3523341399999997,
"min": 0.65358928788,
"max": 0.69252110088,
"times": [
0.66462941788,
0.6676378858800001,
0.6667963488800001,
0.65775865588,
0.67201286388,
0.67009999388,
0.65358928788,
0.69252110088,
0.67800472388,
0.67797928588
]
},
{
"command": "pacquet@main",
"mean": 0.66984542818,
"stddev": 0.042696959800272466,
"median": 0.65761188888,
"user": 0.39150840000000003,
"system": 1.34842144,
"min": 0.63909799588,
"max": 0.78793492188,
"times": [
0.63909799588,
0.66651944688,
0.64808949588,
0.67289733688,
0.66678744788,
0.65733500188,
0.65057032488,
0.65133353388,
0.65788877588,
0.78793492188
]
},
{
"command": "pnpr@HEAD",
"mean": 0.72873113508,
"stddev": 0.05082416051297911,
"median": 0.71394590288,
"user": 0.4054205000000001,
"system": 1.38651654,
"min": 0.68959527488,
"max": 0.86693384288,
"times": [
0.71519441488,
0.72023975688,
0.71019972888,
0.73668982488,
0.69695071688,
0.7126973908800001,
0.68959527488,
0.86693384288,
0.70338752988,
0.73542286988
]
},
{
"command": "pnpr@main",
"mean": 0.69900562258,
"stddev": 0.014977585006500583,
"median": 0.69700687088,
"user": 0.4104303999999999,
"system": 1.3638688399999999,
"min": 0.68083930888,
"max": 0.73267436688,
"times": [
0.70201587388,
0.68083930888,
0.70225788588,
0.69144200088,
0.73267436688,
0.7123393838800001,
0.6992556158800001,
0.69475812588,
0.68556288588,
0.68891077788
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.848727713040001,
"stddev": 0.04190722940736612,
"median": 4.84998570364,
"user": 3.9647195,
"system": 3.385104879999999,
"min": 4.78858826514,
"max": 4.90866860214,
"times": [
4.88602687814,
4.845567207139999,
4.858058274139999,
4.78858826514,
4.84746598014,
4.79049904514,
4.90866860214,
4.85250542714,
4.89751726314,
4.81238018814
]
},
{
"command": "pacquet@main",
"mean": 4.8611618956400005,
"stddev": 0.04747885672968611,
"median": 4.854944340139999,
"user": 3.9399488999999996,
"system": 3.378437279999999,
"min": 4.76752489914,
"max": 4.934810436139999,
"times": [
4.91053415714,
4.84566839714,
4.85311729514,
4.8452949921399995,
4.76752489914,
4.85908975314,
4.9077614141399994,
4.85677138514,
4.934810436139999,
4.83104622714
]
},
{
"command": "pnpr@HEAD",
"mean": 3.29196304374,
"stddev": 0.203962434514605,
"median": 3.21651413414,
"user": 2.9167686,
"system": 3.14745028,
"min": 3.14357077514,
"max": 3.8207702081400003,
"times": [
3.8207702081400003,
3.16371416914,
3.14357077514,
3.40840151714,
3.18305471014,
3.27380193714,
3.17711030114,
3.32711353414,
3.17211972714,
3.24997355814
]
},
{
"command": "pnpr@main",
"mean": 3.295977507240001,
"stddev": 0.14021113881992986,
"median": 3.29118923414,
"user": 2.9163267,
"system": 3.1848142799999994,
"min": 3.13032042814,
"max": 3.6029212521400003,
"times": [
3.42702901214,
3.13032042814,
3.25322389314,
3.1480755941400003,
3.6029212521400003,
3.18278227314,
3.2947479731400002,
3.29822054114,
3.33482361014,
3.28763049514
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.4255698105,
"stddev": 0.013630966635269979,
"median": 1.4232686947,
"user": 1.37731098,
"system": 1.7400994,
"min": 1.4044486731999999,
"max": 1.4524490082,
"times": [
1.4186117462,
1.4174900482,
1.4044486731999999,
1.4321133282,
1.4170711902,
1.4524490082,
1.4397978552,
1.4279256431999998,
1.4280237082,
1.4177669041999998
]
},
{
"command": "pacquet@main",
"mean": 1.423304772,
"stddev": 0.0393468233875543,
"median": 1.4102369377,
"user": 1.37264828,
"system": 1.7257032999999997,
"min": 1.3837818212,
"max": 1.5117846341999999,
"times": [
1.5117846341999999,
1.4666368881999998,
1.3963803752,
1.4007585012,
1.3951362301999999,
1.4397904741999998,
1.4100213592,
1.3837818212,
1.4183049202,
1.4104525162
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4860082091999998,
"stddev": 0.028661918304487114,
"median": 1.4815499782,
"user": 0.5894543800000001,
"system": 1.6052353999999998,
"min": 1.4526766702,
"max": 1.5438793722,
"times": [
1.5180393972,
1.5438793722,
1.4981114882,
1.4828565092,
1.4526766702,
1.4636101242,
1.4931207942,
1.4731712611999999,
1.4802434472,
1.4543730281999998
]
},
{
"command": "pnpr@main",
"mean": 1.4764544340999999,
"stddev": 0.027929791959927463,
"median": 1.4727656832,
"user": 0.5910135799999999,
"system": 1.5555837000000001,
"min": 1.4484701031999998,
"max": 1.5437580912,
"times": [
1.4767017342,
1.5437580912,
1.4484701031999998,
1.4761614062,
1.4504637722,
1.4693383982,
1.4988696242,
1.4717250402,
1.4552498452,
1.4738063261999998
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.16077598524,
"stddev": 0.0317425307982799,
"median": 3.15668504794,
"user": 1.8917846999999994,
"system": 2.01879054,
"min": 3.1178134709400003,
"max": 3.22561628294,
"times": [
3.15151672294,
3.1263248149400003,
3.18762334694,
3.17159801394,
3.16185337294,
3.17697830694,
3.15113558694,
3.22561628294,
3.13729993294,
3.1178134709400003
]
},
{
"command": "pacquet@main",
"mean": 3.1676650472400003,
"stddev": 0.03590975598317323,
"median": 3.1712296914399998,
"user": 1.8662812999999996,
"system": 2.07369884,
"min": 3.11299188194,
"max": 3.22869240094,
"times": [
3.16567989294,
3.11299188194,
3.14253149494,
3.11703587394,
3.17677948994,
3.17747487594,
3.19492736194,
3.16522010994,
3.22869240094,
3.19531708994
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4990574126400003,
"stddev": 0.01308049986263459,
"median": 1.50687623994,
"user": 0.5946219,
"system": 1.6284691399999995,
"min": 1.47509120494,
"max": 1.5108242169400001,
"times": [
1.50703542294,
1.5108242169400001,
1.50975722094,
1.50671705694,
1.4845734349400002,
1.47509120494,
1.5089232939400001,
1.5088337519400001,
1.48857796094,
1.49024056194
]
},
{
"command": "pnpr@main",
"mean": 1.51179386654,
"stddev": 0.052193427680892975,
"median": 1.49801161044,
"user": 0.5949089000000001,
"system": 1.6055806400000001,
"min": 1.47808868694,
"max": 1.65544122194,
"times": [
1.52556792194,
1.65544122194,
1.50026603194,
1.50053120794,
1.49575718894,
1.49345107994,
1.47808868694,
1.48522308494,
1.50177258594,
1.4818396549400001
]
}
]
} |
|
| Branch | pr/12649 |
| Testbed | pacquet |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result milliseconds (ms) (Result Δ%) | Upper Boundary milliseconds (ms) (Limit %) |
|---|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,848.73 ms(+2.17%)Baseline: 4,745.69 ms | 5,694.82 ms (85.14%) |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot 🚷 view threshold | 3,160.78 ms(+4.56%)Baseline: 3,022.92 ms | 3,627.50 ms (87.13%) |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 1,425.57 ms(+5.93%)Baseline: 1,345.73 ms | 1,614.87 ms (88.28%) |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,864.09 ms(+3.63%)Baseline: 4,693.56 ms | 5,632.27 ms (86.36%) |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 670.10 ms(+4.97%)Baseline: 638.38 ms | 766.05 ms (87.47%) |
|
| Branch | pr/12649 |
| 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 | 3,291.96 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 1,499.06 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 1,486.01 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,961.44 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 728.73 ms |
|
Code review by qodo was updated up to the latest commit 85b4a9d |
1 similar comment
|
Code review by qodo was updated up to the latest commit 85b4a9d |
|
Code review by qodo was updated up to the latest commit 46e54f8 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 46e54f8 |
|
About bot's Auth lookup URL mismatch. It was intentional. I kept it for parity with pnpm. pnpm resolves the auth header against the base registry URL, not the -/whoami request URL ( |
46e54f8 to
e22e29e
Compare
|
Code review by qodo was updated up to the latest commit e22e29e |
1 similar comment
|
Code review by qodo was updated up to the latest commit e22e29e |
e22e29e to
db00897
Compare
|
Code review by qodo was updated up to the latest commit db00897 |
|
Code review by qodo was updated up to the latest commit db00897 |
Summary
Ports pnpm's
whoamicommand to pacquet.pacquet whoamiprints the usernamethe configured registry associates with the current auth token.
It resolves the default registry and its
Authorizationheader from config(via the existing
AuthHeaders::for_url, pacquet's port ofcreateGetAuthHeaderByURI), issuesGET <registry>-/whoamithrough the sharednetwork client, and prints the response's
username. Errors mirror pnpmverbatim:
ERR_PNPM_WHOAMI_UNAUTHORIZED("You must be logged in to use whoami") when nocredentials are configured — raised before any request is made.
ERR_PNPM_WHOAMI_FAILED("Failed to find the current user: {status} {reason}")on a non-success response.
Source of truth: pnpm's registry-access
whoami(
pnpm11/registry-access/commands/src/whoami.ts). whoami already exists in theTypeScript CLI; this PR brings the Rust port to parity.
Relates to #11633.
Behavioral parity with pnpm
Matches: registry resolution + normalization, auth-header lookup (incl.
inline
user:pass@), URL construction (-/whoami, path prefix preserved),GET +
authorizationheader, 2xx success check, retry defaults (2 retries,factor 10, 10s/60s), 60s timeout,
usernameparsing (extra fields ignored),and — verified — cross-host-redirect stripping of
Authorizationvia reqwest'sdefault
remove_sensitive_headers, matching pnpm's redirect auth-stripworkaround (#1815).
Known divergences (all inert or deliberate; none user-visible in normal use):
Acceptheader. pnpm's generic fetch wrapper adds a packumentAccept(application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*)to every GET, including whoami; the
/-/whoamiendpoint ignores it. pacquetomits it, consistent with its other non-packument fetches (e.g. the
attestation lookup). No functional effect.
send_with_retry(retries 408/429/5xx); pnpm's
fetch.tsadditionally retries 409/420. Thisis a pacquet-wide policy, not whoami-specific.
statusText. TheWHOAMI_FAILEDmessage usesStatusCode::canonical_reason()(reqwest exposes no wire reason phrase) —identical to pnpm for standard codes; an empty reason for non-standard codes.
usernamefield errors in pacquet(strict deserialization) where pnpm would print
undefined.--registryflag. pnpm acceptswhoami --registry=<url>; in pacquetthe registry comes from config (
--config.registry=<url>), consistent withevery pacquet command.
Squash Commit Body
Checklist
pacquet/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.
Made with the help of Claude Code (claude-opus-4-8).
Summary by CodeRabbit
whoamiCLI command that displays your authenticated username for the configured registry.-/whoamiendpoint.