Skip to content

feat(pacquet): port whoami command - #12649

Merged
zkochan merged 3 commits into
pnpm:mainfrom
Safort:feat/pacquet-whoami
Jun 25, 2026
Merged

zkochan merged 3 commits into
pnpm:mainfrom
Safort:feat/pacquet-whoami

Conversation

@Safort

@Safort Safort commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Ports pnpm's whoami command to pacquet. pacquet whoami prints the username
the configured registry associates with the current auth token.

It resolves the default registry and its Authorization header from config
(via the existing AuthHeaders::for_url, pacquet's port of
createGetAuthHeaderByURI), issues GET <registry>-/whoami through the shared
network client, and prints the response's username. Errors mirror pnpm
verbatim:

  • ERR_PNPM_WHOAMI_UNAUTHORIZED ("You must be logged in to use whoami") when no
    credentials 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 the
TypeScript 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 + authorization header, 2xx success check, retry defaults (2 retries,
factor 10, 10s/60s), 60s timeout, username parsing (extra fields ignored),
and — verified — cross-host-redirect stripping of Authorization via reqwest's
default remove_sensitive_headers, matching pnpm's redirect auth-strip
workaround (#1815).

Known divergences (all inert or deliberate; none user-visible in normal use):

  1. No Accept header. pnpm's generic fetch wrapper adds a packument
    Accept (application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*)
    to every GET, including whoami; the /-/whoami endpoint ignores it. pacquet
    omits it, consistent with its other non-packument fetches (e.g. the
    attestation lookup). No functional effect.
  2. Retry status set. pacquet routes through the shared send_with_retry
    (retries 408/429/5xx); pnpm's fetch.ts additionally retries 409/420. This
    is a pacquet-wide policy, not whoami-specific.
  3. statusText. The WHOAMI_FAILED message uses
    StatusCode::canonical_reason() (reqwest exposes no wire reason phrase) —
    identical to pnpm for standard codes; an empty reason for non-standard codes.
  4. Non-conformant 200. A 200 without a username field errors in pacquet
    (strict deserialization) where pnpm would print undefined.
  5. No --registry flag. pnpm accepts whoami --registry=<url>; in pacquet
    the registry comes from config (--config.registry=<url>), consistent with
    every pacquet command.

Squash Commit Body

Print the username the configured registry associates with the current
auth token, mirroring pnpm's whoami.

Resolve the default registry and its Authorization header from config,
GET <registry>-/whoami, and print the response's username. Reuse the
shared network client and send_with_retry so proxy/TLS/timeout/retry
config behaves as for every other registry request. Surface pnpm's
error codes verbatim: ERR_PNPM_WHOAMI_UNAUTHORIZED when no credentials
are configured (before any request), ERR_PNPM_WHOAMI_FAILED on a
non-success response.

Known parity gaps, all inert or deliberate: no packument Accept header
(the endpoint ignores it; consistent with pacquet's other non-packument
fetches); retries follow pacquet's shared policy (408/429/5xx) rather
than fetch.ts's extra 409/420; the failure message uses the canonical
status reason since reqwest exposes no wire reason phrase; a 200 without
a username field errors instead of yielding undefined; the registry is
taken from config (--config.registry) rather than a dedicated --registry
flag.

Ported from pnpm's registry-access whoami command (pnpm/pnpm#11633).

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pacquet/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

Made with the help of Claude Code (claude-opus-4-8).

Summary by CodeRabbit

  • New Features
    • Added a whoami CLI command that displays your authenticated username for the configured registry.
    • Fetches the username from the registry’s -/whoami endpoint.
  • Bug Fixes
    • Improved error messages for unauthorized access and unsuccessful registry responses.
    • Sanitizes registry-provided usernames to remove control characters.
    • Correctly supports registries that include URL path prefixes.
  • Tests
    • Added integration tests covering success, sanitization, unauthorized/failure cases, and prefixed registry URL handling.

@Safort
Safort requested a review from zkochan as a code owner June 25, 2026 08:17
@coderabbitai

coderabbitai Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1074e639-186f-463c-89d7-7da93635a2ce

📥 Commits

Reviewing files that changed from the base of the PR and between e22e29e and db00897.

📒 Files selected for processing (3)
  • pacquet/crates/cli/src/cli_args.rs
  • pacquet/crates/cli/src/cli_args/whoami.rs
  • pacquet/crates/cli/tests/whoami.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • pacquet/crates/cli/src/cli_args/whoami.rs
  • pacquet/crates/cli/src/cli_args.rs
  • pacquet/crates/cli/tests/whoami.rs

📝 Walkthrough

Walkthrough

Adds a whoami subcommand that reads registry credentials, resolves the current username from the registry, and prints it. The PR also adds tests for authorized success, unauthorized access, registry rejection, control-character stripping, and registry path prefixes.

Changes

whoami command

Layer / File(s) Summary
Command registration and dispatch
pacquet/crates/cli/src/cli_args.rs
pub mod whoami is exported, CliCommand gains Whoami, and CliArgs::run invokes whoami::whoami(cfg) and prints the returned username.
Registry lookup and error handling
pacquet/crates/cli/src/cli_args/whoami.rs
WhoamiError and WhoamiResponse are added, whoami(config) resolves registry auth and builds the HTTP client, and fetch_whoami requests /<registry>-/whoami while mapping failed responses.
CLI test coverage
pacquet/crates/cli/tests/whoami.rs
The new test module sets up registry and auth-file fixtures, then covers success, missing auth, registry rejection, control-character stripping, and path-prefixed registries.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • pnpm/pnpm#12011: Adds the registry /-/whoami auth endpoint behavior that this CLI command calls.
  • pnpm/pnpm#12497: Extends the shared CLI command enum and dispatch path with another subcommand in cli_args.rs.

Suggested labels

product: pacquet

Suggested reviewers

  • zkochan
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: porting the whoami command to pacquet.
Description check ✅ Passed The description matches the template with Summary, Squash Commit Body, and Checklist, and it includes enough implementation and parity detail.
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 unit tests (beta)
  • Create PR with unit tests

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.

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

Copy link
Copy Markdown

PR Summary by Qodo

feat(pacquet): port whoami command
✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

Description

• Add pacquet whoami to print the registry username for the configured auth token.
• Mirror pnpm’s unauthorized/failed error codes and status handling for parity.
• Add mock-registry integration tests for success, missing auth, rejection, and path prefixes.
Diagram

graph TD
  U[User] --> CLI["pacquet CLI (whoami)"] --> CFG[/"Config (.npmrc)"/] --> AUTH["AuthHeaders::for_url"] --> NET["ThrottledClient + send_with_retry"] --> REG{{"Registry /-/whoami"}}
  REG -->|"2xx: { username }"| CLI
  REG -->|"non-2xx: ERR_PNPM_WHOAMI_FAILED"| CLI
  AUTH -->|"missing creds: ERR_PNPM_WHOAMI_UNAUTHORIZED"| CLI

  subgraph Legend
    direction LR
    _p["Process"] ~~~ _f[/"Config file"/] ~~~ _e{{"External service"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Reuse `State::init`/shared client construction helper
  • ➕ Avoids duplicating HTTP client construction logic in each read-only command
  • ➕ Potentially reuses shared connection pooling/caching behavior across commands
  • ➖ May require more CLI plumbing/state setup than a simple read-only command needs
  • ➖ Risks coupling whoami to install-oriented state initialization
2. Match pnpm’s permissive parsing (allow missing `username`)
  • ➕ Closer behavioral parity with pnpm for non-conformant 200 responses
  • ➕ Avoids failing on registries returning unexpected but non-fatal payloads
  • ➖ Can hide upstream API regressions/misconfigurations
  • ➖ Weakens the contract of the command output (may print empty/undefined-like values)

Recommendation: The PR’s approach is appropriate for a lightweight, read-only command: resolve auth via existing config logic, use the shared retry sender, and keep the CLI dispatch simple. If more registry read-only commands are added, consider extracting build_http_client into a shared helper to prevent repetition; otherwise the current duplication is acceptable. Keeping strict {username} deserialization is reasonable unless parity with pnpm’s permissiveness becomes a compatibility requirement.

Files changed (3) +276 / -0

Enhancement (2) +121 / -0
cli_args.rsRegister 'whoami' subcommand and dispatch execution path +17/-0

Register 'whoami' subcommand and dispatch execution path

• Adds the 'whoami' module, introduces a 'Whoami' CLI subcommand, and wires it into the main command dispatcher. Execution loads config, runs the async whoami request, and prints the username.

pacquet/crates/cli/src/cli_args.rs

whoami.rsImplement 'pacquet whoami' registry request with pnpm-matching diagnostics +104/-0

Implement 'pacquet whoami' registry request with pnpm-matching diagnostics

• Implements the whoami flow: resolve the registry auth header, build a throttled HTTP client from config, and GET '<registry>-/whoami' with retries. Returns the parsed 'username' on success and emits pnpm’s 'ERR_PNPM_WHOAMI_UNAUTHORIZED' / 'ERR_PNPM_WHOAMI_FAILED' diagnostics on failure.

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

Tests (1) +155 / -0
whoami.rsAdd integration tests for whoami behavior and registry URL handling +155/-0

Add integration tests for whoami behavior and registry URL handling

• Adds mockito-based integration tests covering success output, missing credentials (no request), non-success registry responses, and preservation of registry path prefixes when building '/-/whoami' URLs.

pacquet/crates/cli/tests/whoami.rs

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

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Credentials leaked in errors ✓ Resolved 🐞 Bug ⛨ Security
Description
fetch_whoami() formats the full request URL into error context strings; because pacquet supports
inline user:password@ registry URLs, failures can print embedded credentials to stderr/CI logs.
Code

pacquet/crates/cli/src/cli_args/whoami.rs[R82-101]

+    let url = format!("{registry_url}-/whoami");
+    let (client, response) = send_with_retry(http_client, &url, retry_opts, |client| {
+        client.get(&url).header("authorization", auth_header)
+    })
+    .await
+    .into_diagnostic()
+    .wrap_err_with(|| format!("requesting {url}"))?;
+    if !response.status().is_success() {
+        let status = response.status();
+        return Err(WhoamiError::Failed {
+            status: status.as_u16(),
+            status_text: status.canonical_reason().unwrap_or_default().to_string(),
+        }
+        .into());
+    }
+    let body = response
+        .json::<WhoamiResponse>()
+        .await
+        .into_diagnostic()
+        .wrap_err_with(|| format!("parsing the whoami response from {url}"))?;
Evidence
The code directly interpolates the request URL into error messages, and the auth subsystem
explicitly supports inline user:password@ URLs, making it possible for real credentials to be
printed on failures.

pacquet/crates/cli/src/cli_args/whoami.rs[82-101]
pacquet/crates/network/src/auth.rs[6-8]
pacquet/crates/network/src/auth.rs[180-217]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`fetch_whoami()` includes `{url}` in diagnostic context messages. If the configured registry URL contains inline credentials (supported by pacquet auth resolution), those credentials can be exposed in user-visible errors and CI logs.
### Issue Context
`AuthHeaders` explicitly supports `user:password@` in URLs and turns it into a `Basic` header. That makes credential-bearing URLs a real, supported input shape, so any error message that prints the raw URL is a secret disclosure risk.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/whoami.rs[82-101]
### Suggested change
- Before interpolating the URL into error strings, build a redacted display version:
- Parse with `url::Url`/`reqwest::Url`.
- Clear username/password (`set_username("")`, `set_password(None)`).
- Use the redacted string in `wrap_err_with` messages.
- Keep the original URL for the actual request; only redact for logging/diagnostics.
- Apply the same redaction to both `requesting {url}` and `parsing ... from {url}` contexts.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Missing body-parse retry 🐞 Bug ☼ Reliability
Description
fetch_whoami() retries only the request via send_with_retry; if reading or decoding the response
body fails after a 2xx (e.g., mid-stream reset / truncated transfer), the command errors without
retrying. This is less resilient than other registry fetchers that wrap request + body consumption
in retry_async().
Code

pacquet/crates/cli/src/cli_args/whoami.rs[R86-104]

+    let (client, response) = send_with_retry(http_client, &url, retry_opts, |client| {
+        client.get(&url).header("authorization", auth_header)
+    })
+    .await
+    .into_diagnostic()
+    .wrap_err("requesting the registry whoami endpoint")?;
+    if !response.status().is_success() {
+        let status = response.status();
+        return Err(WhoamiError::Failed {
+            status: status.as_u16(),
+            status_text: status.canonical_reason().unwrap_or_default().to_string(),
+        }
+        .into());
+    }
+    let body = response
+        .json::<WhoamiResponse>()
+        .await
+        .into_diagnostic()
+        .wrap_err("parsing the whoami response")?;
Evidence
The network retry module explicitly calls out that body reads/parsing can fail after a successful
send_with_retry call and that retry_async exists to re-issue the request in that case; packument
fetch uses retry_async accordingly. The new whoami path parses via response.json() outside any
retry_async loop, so those errors will not be retried.

pacquet/crates/cli/src/cli_args/whoami.rs[76-106]
pacquet/crates/network/src/retry.rs[17-20]
pacquet/crates/network/src/retry.rs[177-195]
pacquet/crates/resolving-npm-resolver/src/fetch_full_metadata.rs[94-147]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`fetch_whoami()` uses `send_with_retry()` (request-level retry) and then parses the body outside any `retry_async()` wrapper. This means transient failures during body streaming or JSON decoding after a 2xx response are not retried.
### Issue Context
`pacquet_network::retry` explicitly documents that body consumption can fail after `send_with_retry()` returns a success response, and provides `retry_async()` for retrying the full request+parse operation. Other registry fetchers (e.g. packument fetch) already follow this pattern.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/whoami.rs[76-107]
### Implementation notes
- Wrap the whole attempt (`send_with_retry` + status check + body read + JSON decode) in `pacquet_network::retry_async`.
- Model errors similarly to `FetchMetadataError`:
- keep request errors/status failures non-retryable at the `retry_async` layer (they’re already handled by `send_with_retry`),
- retry only body-read and decode errors.
- Consider buffering `response.text().await`, `drop(client)`, then `serde_json::from_str` (small response, but matches the established pattern and avoids holding the concurrency permit during parsing).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Whoami mocks don't assert auth 🐞 Bug ⚙ Maintainability
Description
Several pacquet whoami integration tests set up mockito mocks without matching the
authorization header, so they can pass even if the command stops sending credentials. This weakens
regression protection for the security-critical guarantee that whoami authenticates its registry
request.
Code

pacquet/crates/cli/tests/whoami.rs[R92-99]

+    // A malicious/compromised registry returns a username carrying an ESC
+    // (0x1b) and a BEL (0x07); pacquet must not emit them raw to the terminal.
+    let esc = char::from(0x1b);
+    let bel = char::from(0x07);
+    let username = format!("al{esc}[31mice{bel}");
+    let body = serde_json::json!({ "username": username }).to_string();
+    let mock = server.mock("GET", "/-/whoami").with_status(200).with_body(body).create();
+    let auth_file = configure(root.path(), &workspace, &registry, Some("test-token"));
Evidence
The success-path test asserts the authorization header, but the other tests that also configure
test-token create mocks without any header match, so they won’t fail if the header is omitted.

pacquet/crates/cli/tests/whoami.rs[67-72]
pacquet/crates/cli/tests/whoami.rs[88-99]
pacquet/crates/cli/tests/whoami.rs[139-145]
pacquet/crates/cli/tests/whoami.rs[168-173]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Some whoami tests configure an auth token but do not assert that the HTTP request includes the expected `Authorization` header. This can allow regressions (e.g., header accidentally removed) to go undetected.
### Issue Context
One test (`returns_the_current_username`) already asserts the header, but other tests with a configured token do not.
### Fix
Update the following mocks to include `.match_header("authorization", "Bearer test-token")` (or the exact expected value), similar to `returns_the_current_username()`:
- `strips_control_characters_from_the_username`
- `fails_when_the_registry_rejects_the_request`
- `preserves_a_registry_path_prefix`
### Fix Focus Areas
- pacquet/crates/cli/tests/whoami.rs[67-72]
- pacquet/crates/cli/tests/whoami.rs[88-99]
- pacquet/crates/cli/tests/whoami.rs[139-145]
- pacquet/crates/cli/tests/whoami.rs[168-173]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Terminal escape injection ✓ Resolved 🐞 Bug ⛨ Security
Description
pacquet whoami prints the registry-provided username directly to stdout, so a
malicious/compromised registry can return control characters (ANSI escapes/newlines) to spoof
terminal output or CI logs. The CLI already has a sanitization helper for untrusted text, but it is
not applied here.
Code

pacquet/crates/cli/src/cli_args.rs[R429-433]

+                let cfg: &Config = config()?;
+                Box::pin(async move {
+                    let username = whoami::whoami(cfg).await?;
+                    println!("{username}");
+                    Ok(())
Evidence
The username field comes directly from the registry JSON response and is printed with println!
without any filtering. The repo already defines and uses a sanitization helper to prevent control
characters from reaching the terminal, but whoami bypasses that pattern.

pacquet/crates/cli/src/cli_args/whoami.rs[24-29]
pacquet/crates/cli/src/cli_args.rs[421-435]
pacquet/crates/cli/src/cli_args/sanitize.rs[1-18]
pacquet/crates/cli/src/cli_args/why.rs[481-489]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`pacquet whoami` prints `username` from the registry response verbatim. Because the registry response is attacker-controlled, this can include terminal control characters (e.g., ANSI escapes) or embedded newlines that spoof output/logs.
### Issue Context
The CLI already contains `cli_args::sanitize::sanitize()` specifically to strip control characters before emitting untrusted text to the terminal, and other commands use it.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args.rs[421-435]
- pacquet/crates/cli/src/cli_args/sanitize.rs[1-18]
- pacquet/crates/cli/src/cli_args/whoami.rs[24-104]
### Suggested fix
- Add a stricter helper (e.g. `sanitize_one_line`) that strips *all* control characters including `\n`/`\t`, or otherwise ensure the username cannot emit newlines/escapes.
- Apply that sanitization either:
- right before printing in the `CliCommand::Whoami` arm, or
- in `whoami::whoami()` before returning `body.username`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (1)
5. Auth lookup URL mismatch 🐞 Bug ≡ Correctness
Description
whoami() resolves the Authorization header using config.registry instead of the actual request
URL (-/whoami), so path-scoped credentials may not match and the command can incorrectly error as
unauthorized or use a less-specific credential.
Code

pacquet/crates/cli/src/cli_args/whoami.rs[R37-47]

+pub async fn whoami(config: &Config) -> miette::Result<String> {
+    let auth_header =
+        config.auth_headers.for_url(&config.registry).ok_or(WhoamiError::Unauthorized)?;
+    let http_client = build_http_client(config)?;
+    let retry_opts = RetryOpts {
+        retries: config.fetch_retries,
+        factor: config.fetch_retry_factor,
+        min_timeout: Duration::from_millis(config.fetch_retry_mintimeout),
+        max_timeout: Duration::from_millis(config.fetch_retry_maxtimeout),
+    };
+    fetch_whoami(&config.registry, &http_client, &auth_header, retry_opts).await
Evidence
AuthHeaders is designed to resolve based on the *request* URL and supports path-prefix-specific
keys; using config.registry instead of the whoami request URL can miss more-specific matches.
Existing registry request code performs auth lookup against the formatted request URL, showing the
intended pattern.

pacquet/crates/cli/src/cli_args/whoami.rs[37-48]
pacquet/crates/network/src/auth.rs[4-18]
pacquet/crates/network/src/auth.rs[180-237]
pacquet/crates/registry/src/package.rs[109-128]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`whoami()` computes the auth header using the base registry URL (`config.registry`), but the auth resolution logic is path-prefix sensitive and is intended to run against the *request* URL. This can miss credentials that are keyed to a deeper prefix (e.g. `//host/custom-prefix/-/`) and cause a false `ERR_PNPM_WHOAMI_UNAUTHORIZED` before any request is made.
### Issue Context
`AuthHeaders` explicitly walks parts of the *request* URL and picks the longest matching path prefix. Other registry fetches in the repo format the request URL first and then run auth lookup against that URL.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/whoami.rs[37-48]
### Suggested change
- Build the whoami request URL first (same string you will GET), then call `config.auth_headers.for_url(&whoami_url)`.
- Consider passing the already-built URL into `fetch_whoami` (or make `fetch_whoami` accept `url: &str`) so the auth lookup and request URL are guaranteed identical.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 5ce8dfb

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jun 25, 2026
@codecov-commenter

codecov-commenter commented Jun 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.75%. Comparing base (54c5c0e) to head (46e54f8).
⚠️ Report is 7 commits behind head on main.

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.
📢 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 commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: db00897b370d

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.864 ± 0.178 4.648 5.121 1.64 ± 0.10
pacquet@main 4.748 ± 0.116 4.610 5.017 1.60 ± 0.08
pnpr@HEAD 2.961 ± 0.135 2.828 3.230 1.00
pnpr@main 2.986 ± 0.081 2.880 3.172 1.01 ± 0.05
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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 670.1 ± 11.1 653.6 692.5 1.00 ± 0.07
pacquet@main 669.8 ± 42.7 639.1 787.9 1.00
pnpr@HEAD 728.7 ± 50.8 689.6 866.9 1.09 ± 0.10
pnpr@main 699.0 ± 15.0 680.8 732.7 1.04 ± 0.07
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.849 ± 0.042 4.789 4.909 1.47 ± 0.09
pacquet@main 4.861 ± 0.047 4.768 4.935 1.48 ± 0.09
pnpr@HEAD 3.292 ± 0.204 3.144 3.821 1.00
pnpr@main 3.296 ± 0.140 3.130 3.603 1.00 ± 0.08
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.426 ± 0.014 1.404 1.452 1.00 ± 0.03
pacquet@main 1.423 ± 0.039 1.384 1.512 1.00
pnpr@HEAD 1.486 ± 0.029 1.453 1.544 1.04 ± 0.04
pnpr@main 1.476 ± 0.028 1.448 1.544 1.04 ± 0.03
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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.161 ± 0.032 3.118 3.226 2.11 ± 0.03
pacquet@main 3.168 ± 0.036 3.113 3.229 2.11 ± 0.03
pnpr@HEAD 1.499 ± 0.013 1.475 1.511 1.00
pnpr@main 1.512 ± 0.052 1.478 1.655 1.01 ± 0.04
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
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12649
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
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%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12649
Testbedpnpr

⚠️ 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-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
3,291.96 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
1,499.06 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
1,486.01 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,961.44 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
728.73 ms
🐰 View full continuous benchmarking report in Bencher

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 85b4a9d

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 85b4a9d

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 46e54f8

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 46e54f8

@Safort

Safort commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

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 (registry-access/commands/src/whoami.ts:38 → getAuthHeader(registryUrl); the whoami URL is built later only for the request). pacquet mirrors that with for_url(&config.registry). The nerf-dart lookup resolves to the same credential for all realistic token keyings, so there's no functional difference — resolving against the request URL would diverge from the source of truth.

@Safort Safort mentioned this pull request Jun 25, 2026
@Safort
Safort force-pushed the feat/pacquet-whoami branch from 46e54f8 to e22e29e Compare June 25, 2026 13:20
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

@Safort
Safort force-pushed the feat/pacquet-whoami branch from e22e29e to db00897 Compare June 25, 2026 15:20
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review state: automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants