Skip to content

feat(network/web-auth): bound the token-poll body and make QR failure non-fatal - #13191

Merged
zkochan merged 41 commits into
mainfrom
claude/pacquet-registry-url-poll-body-bf43kp
Jul 23, 2026
Merged

zkochan merged 41 commits into
mainfrom
claude/pacquet-registry-url-poll-body-bf43kp

Conversation

@KSXGitHub

@KSXGitHub KSXGitHub commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #12721.

Summary

Hardens the web-based authentication flow — the pnpm login web login and web-auth OTP challenges — against a malicious or compromised registry. The change applies to both the TypeScript CLI (@pnpm/network.web-auth) and its pacquet port.

The token poll no longer reads registry-controlled response bodies without bound. While waiting for browser authentication to complete, pnpm polls a registry-supplied "done" URL. It now caps the token response body it reads at 64 KiB, and does not read the body of non-OK or still-pending (HTTP 202) responses at all, so a registry cannot grow pnpm's memory through the poll loop.

A QR code that cannot be generated no longer aborts authentication. The authentication URL is the actual sign-in mechanism and the QR code only a convenience, so when a QR code cannot be rendered — for example when the authentication URL exceeds the maximum QR data capacity — pnpm now warns and displays the URL on its own instead of failing the login.

Squash Commit Body

Harden the web-based authentication flow against a malicious or
compromised registry, in both @pnpm/network.web-auth and its pacquet
port.

Bound the token poll: cap the token response body read from the
registry-supplied "done" URL at 64 KiB, and do not read the body of
non-OK or still-pending (HTTP 202) responses at all, so a registry
cannot grow pnpm's memory through the poll loop.

Make a failed QR code non-fatal: when a QR code cannot be generated
(for example when the authentication URL exceeds the maximum QR data
capacity), warn and display the URL on its own instead of aborting
authentication.

Resolves pnpm/pnpm#12721.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ 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.

Summary by CodeRabbit

  • New Features

    • Web authentication now falls back to displaying the full authentication URL (URL-only) with a warning when a QR code can’t be generated.
    • Web-auth token polling is hardened to limit how much response data is read and to better handle truncated results.
  • Bug Fixes

    • Prevented QR-code rendering issues from aborting an otherwise successful login flow.
    • Improved handling of oversized, truncated, invalid, and non-JSON authentication responses so polling continues appropriately until a valid token is available.

claude added 2 commits July 21, 2026 02:28
Cap the web-auth token poll body and skip unread poll bodies in both
stacks: `@pnpm/network.web-auth` now reads the token body through a
size-capped stream reader (64 KiB) and cancels the bodies of non-OK and
202 responses, and pacquet's `Host::fetch` reads through
`read_limited_body` and skips non-OK / 202 bodies entirely, so a
malicious or compromised registry can no longer grow memory through the
once-a-second poll.

Downgrade QR-code generation failure from a fatal error to a warning
with a URL-only display in the OTP-challenge and login flows of both
stacks, via a shared `formatAuthUrlMessage` / `format_auth_url_message`
helper: the URL is the authentication mechanism and the QR code only a
convenience. This removes pacquet's `WithOtpError::QrCode` and
`LoginError::QrCode` (`ERR_PNPM_AUTH_COMMANDS_LOGIN_QR_CODE`) arms, and
pins pacquet's QR data capacity (2953 bytes, version 40 at EC level L)
to qrcode-terminal's so both stacks render and fail on the same inputs.

Model pacquet's `HostEnterHandle` lifecycle as an explicit
Waiting / Completed / Disabled state enum so a completed handle
re-polls as `Ready` instead of hanging, and document the residual
best-effort window between the cancel-flag re-check and `event::read()`
in the enter-key listener.

Resolves #12721.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
Add the clippy-required must_use attribute to
format_auth_url_message and the WHATWG initialism to the cspell
dictionary.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 6c5d42be-a9dc-45e2-afc7-f3528606dd1f

📥 Commits

Reviewing files that changed from the base of the PR and between 2da8936 and 7e3193b.

📒 Files selected for processing (1)
  • pnpm/crates/network-web-auth/src/format_auth_url_message/tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/network-web-auth/src/format_auth_url_message/tests.rs

📝 Walkthrough

Walkthrough

Web-auth polling now bounds and conditionally consumes response bodies, while authentication URL formatting falls back to URL-only output when QR generation fails. Rust and TypeScript flows, error types, listener state handling, tests, and release notes are updated.

Changes

Web authentication hardening

Layer / File(s) Summary
Bounded poll-body handling
pnpm/crates/network-web-auth/..., pnpm11/network/web-auth/..., .changeset/harden-web-auth-poll-body.md
Polling responses now use byte or streamed bodies, truncation metadata, bounded reads, and cancellation or skipping for non-token responses.
QR fallback authentication flow
pnpm/crates/auth-commands/..., pnpm/crates/network-web-auth/..., pnpm11/auth/commands/..., pnpm11/network/web-auth/..., .changeset/web-auth-qr-code-fallback.md
Auth URL formatting warns on QR-generation failure and displays the URL without a QR code; callers and error variants are updated.
Enter-listener state lifecycle
pnpm/crates/network-web-auth/src/capabilities.rs, pnpm/crates/network-web-auth/src/capabilities/tests.rs
HostEnterHandle tracks waiting, completed, and disabled states, with tests covering polling and cancellation behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Assessment against linked issues

Objective Addressed Explanation
Sanitize registry-controlled authUrl and doneUrl before display, QR encoding, and browser opening [#12721] ❌ No URL control-character rejection or credential redaction is added.
Cap and conditionally consume web-auth poll response bodies [#12721] ✅
Fall back to URL-only display when QR generation fails [#12721] ✅
Model HostEnterHandle completion with explicit states and document best-effort cancellation [#12721] ✅

Suggested labels: product: pacquet, product: pnpm@11

Suggested reviewers: zkochan, copilot

✨ 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 claude/pacquet-registry-url-poll-body-bf43kp

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.

@KSXGitHub KSXGitHub changed the title feat(pacquet/network-web-auth): harden registry-controlled URL and poll-body handling feat(network/web-auth): harden registry-controlled URL and poll-body handling Jul 21, 2026
@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.02     12.5±0.30ms    30.0 MB/sec    1.00     12.3±0.19ms    30.5 MB/sec
packument/parse                1.00     41.9±0.37µs  1584.2 MB/sec    1.04     43.6±1.74µs  1521.9 MB/sec
tarball/download_dependency    1.01      2.5±0.21ms  1729.9 KB/sec    1.00      2.5±0.11ms  1749.0 KB/sec

@codecov-commenter

codecov-commenter commented Jul 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.80220% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.94%. Comparing base (66ae0f0) to head (7e3193b).

Files with missing lines Patch % Lines
...s/auth-commands/src/login/test_web_login_errors.rs 90.90% 1 Missing ⚠️
pnpm/crates/network-web-auth/src/capabilities.rs 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13191      +/-   ##
==========================================
+ Coverage   86.90%   86.94%   +0.04%     
==========================================
  Files         526      527       +1     
  Lines       90011    90053      +42     
==========================================
+ Hits        78221    78296      +75     
+ Misses      11790    11757      -33     

☔ 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 Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 7e3193b04a0c

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.595 ± 0.186 2.431 2.943 1.71 ± 0.20
pacquet@main 2.547 ± 0.137 2.433 2.811 1.67 ± 0.18
pnpr@HEAD 1.583 ± 0.154 1.366 1.816 1.04 ± 0.14
pnpr@main 1.521 ± 0.140 1.378 1.762 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5953385974399996,
      "stddev": 0.1859955081879739,
      "median": 2.53726178444,
      "user": 2.17832836,
      "system": 1.7085021999999999,
      "min": 2.43081121094,
      "max": 2.94301766194,
      "times": [
        2.48287141894,
        2.4607128169399997,
        2.43081121094,
        2.54929159194,
        2.94301766194,
        2.5862046999399997,
        2.93091118694,
        2.55525820094,
        2.52523197694,
        2.4890752089399997
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.54691705884,
      "stddev": 0.13722661354135804,
      "median": 2.4738166249399995,
      "user": 2.12456976,
      "system": 1.5870539999999997,
      "min": 2.43280168094,
      "max": 2.8106255559399997,
      "times": [
        2.4638281109399998,
        2.66545083994,
        2.43280168094,
        2.44760966094,
        2.47249433994,
        2.8106255559399997,
        2.5001435279399997,
        2.73741590094,
        2.46366206094,
        2.4751389099399996
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.58252067464,
      "stddev": 0.15375791461627134,
      "median": 1.58815686244,
      "user": 1.39141606,
      "system": 1.2482889999999998,
      "min": 1.36560048494,
      "max": 1.81635001894,
      "times": [
        1.48375866994,
        1.36560048494,
        1.59620581294,
        1.81635001894,
        1.44166342194,
        1.6892618939400001,
        1.58010791194,
        1.80284311794,
        1.6102494709400001,
        1.43916594294
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5208814936400001,
      "stddev": 0.13992070180384522,
      "median": 1.5010016149399998,
      "user": 1.33822496,
      "system": 1.2733729999999999,
      "min": 1.37834059594,
      "max": 1.7615490469400001,
      "times": [
        1.38311189394,
        1.43395380694,
        1.37834059594,
        1.5014349279399999,
        1.38987535394,
        1.72457868894,
        1.7615490469400001,
        1.62932277994,
        1.50056830194,
        1.50607953994
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 286.4 ± 26.8 256.3 349.3 1.05 ± 0.12
pacquet@main 272.0 ± 18.9 251.4 308.9 1.00
pnpr@HEAD 284.7 ± 16.3 272.0 315.6 1.05 ± 0.09
pnpr@main 272.5 ± 9.5 259.5 293.8 1.00 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2864189568,
      "stddev": 0.026827947716232904,
      "median": 0.2797926463,
      "user": 0.23698109999999994,
      "system": 0.58034334,
      "min": 0.2563434928,
      "max": 0.3493308458,
      "times": [
        0.3039283588,
        0.27415992580000004,
        0.2678811908,
        0.2842802548,
        0.2851777958,
        0.27530503780000004,
        0.2655571238,
        0.2563434928,
        0.3022255418,
        0.3493308458
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.2719882927,
      "stddev": 0.018856824509017996,
      "median": 0.27339329730000006,
      "user": 0.2272739,
      "system": 0.55610454,
      "min": 0.25136486280000003,
      "max": 0.30888046880000003,
      "times": [
        0.27619257680000003,
        0.27975906980000004,
        0.2793848218,
        0.27059401780000003,
        0.2548561708,
        0.25136486280000003,
        0.29057657080000004,
        0.2553179608,
        0.25295640680000003,
        0.30888046880000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.28471433330000007,
      "stddev": 0.016301619464077162,
      "median": 0.27599609030000005,
      "user": 0.217142,
      "system": 0.55503654,
      "min": 0.2720065648,
      "max": 0.3155971088,
      "times": [
        0.2780534998,
        0.27543565080000004,
        0.27308878880000004,
        0.3053824818,
        0.3155971088,
        0.2765565298,
        0.3021559858,
        0.2735650578,
        0.2753016648,
        0.2720065648
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.2724615267,
      "stddev": 0.00950772777721928,
      "median": 0.2723864343,
      "user": 0.21477839999999998,
      "system": 0.5210324399999999,
      "min": 0.2594705718,
      "max": 0.29377933380000004,
      "times": [
        0.29377933380000004,
        0.2759899958,
        0.2768415078,
        0.2594705718,
        0.26554079480000004,
        0.2748797678,
        0.2646700958,
        0.2760607068,
        0.26748939180000003,
        0.2698931008
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.830 ± 0.061 2.776 2.977 1.80 ± 0.13
pacquet@main 2.854 ± 0.029 2.793 2.892 1.81 ± 0.13
pnpr@HEAD 1.574 ± 0.113 1.449 1.814 1.00
pnpr@main 1.669 ± 0.133 1.486 1.862 1.06 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.82974867646,
      "stddev": 0.060744676905404346,
      "median": 2.8148904983599996,
      "user": 2.19744562,
      "system": 1.5439509599999999,
      "min": 2.7761974603599997,
      "max": 2.9769161403599997,
      "times": [
        2.7761974603599997,
        2.84691983036,
        2.77801937136,
        2.7850713153599997,
        2.7912563953599996,
        2.8440299803599998,
        2.9769161403599997,
        2.8692952743599998,
        2.8113313563599998,
        2.81844964036
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.85434401706,
      "stddev": 0.029100305517683212,
      "median": 2.8587742548599997,
      "user": 2.2683859199999996,
      "system": 1.62247406,
      "min": 2.79261440336,
      "max": 2.89234867236,
      "times": [
        2.83925709236,
        2.79261440336,
        2.82466308236,
        2.89234867236,
        2.87839308936,
        2.8720697073599997,
        2.8553764823599996,
        2.85479844736,
        2.8621720273599998,
        2.8717471663599996
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5744004332600001,
      "stddev": 0.11274575138358715,
      "median": 1.57957005786,
      "user": 1.4062752199999997,
      "system": 1.3382435600000002,
      "min": 1.4486726683600002,
      "max": 1.81353818236,
      "times": [
        1.6479083083600001,
        1.58900891336,
        1.4486726683600002,
        1.57013120236,
        1.45129966236,
        1.63577544536,
        1.6137510343600001,
        1.81353818236,
        1.48430857236,
        1.48961034336
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.6690686984600003,
      "stddev": 0.13262449707344354,
      "median": 1.63449424136,
      "user": 1.36911622,
      "system": 1.30914026,
      "min": 1.4856379053600002,
      "max": 1.8620659083600002,
      "times": [
        1.4856379053600002,
        1.73605775236,
        1.8126485873600002,
        1.8620659083600002,
        1.6086522973600001,
        1.60264220236,
        1.66033618536,
        1.5811084343600001,
        1.82312395336,
        1.5184137583600001
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 617.2 ± 18.5 590.8 656.8 1.99 ± 0.08
pacquet@main 598.8 ± 22.9 571.7 651.5 1.93 ± 0.09
pnpr@HEAD 313.4 ± 11.9 299.4 333.6 1.01 ± 0.05
pnpr@main 310.7 ± 8.2 297.6 322.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6171687369400001,
      "stddev": 0.018549003999368107,
      "median": 0.61326961564,
      "user": 0.77811164,
      "system": 0.71988858,
      "min": 0.59076811364,
      "max": 0.65682598564,
      "times": [
        0.61480634964,
        0.65682598564,
        0.63670434064,
        0.61592001664,
        0.61041341964,
        0.62436495864,
        0.6117328816400001,
        0.59076811364,
        0.60202067164,
        0.60813063164
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.59878236454,
      "stddev": 0.022948607038970947,
      "median": 0.59064024914,
      "user": 0.7488814400000001,
      "system": 0.6968348799999999,
      "min": 0.57171205864,
      "max": 0.65145081364,
      "times": [
        0.62417526264,
        0.58945025964,
        0.59183023864,
        0.65145081364,
        0.58753151964,
        0.58612857264,
        0.57171205864,
        0.59185591964,
        0.58940896564,
        0.60428003464
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31335049004000004,
      "stddev": 0.011895317232348827,
      "median": 0.31152931464000005,
      "user": 0.21658974,
      "system": 0.5108035799999999,
      "min": 0.29938228064000005,
      "max": 0.33356391264000007,
      "times": [
        0.32608413564000005,
        0.30835857864000005,
        0.30245894864000006,
        0.31986163464000006,
        0.29938228064000005,
        0.33356391264000007,
        0.30693029564,
        0.29949847464000007,
        0.32266658864000003,
        0.31470005064000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.31071971964000006,
      "stddev": 0.008199038160827012,
      "median": 0.31045026414000004,
      "user": 0.19786714,
      "system": 0.5350218800000001,
      "min": 0.29763555964000005,
      "max": 0.32239066364,
      "times": [
        0.30334117564,
        0.32239066364,
        0.31323009664000007,
        0.30206972064000004,
        0.30852397464000003,
        0.32018375064000004,
        0.31079462364000005,
        0.31892172664000007,
        0.31010590464000004,
        0.29763555964000005
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.931 ± 0.034 1.898 1.990 5.77 ± 0.18
pacquet@main 1.958 ± 0.039 1.911 2.026 5.85 ± 0.19
pnpr@HEAD 0.343 ± 0.026 0.315 0.393 1.03 ± 0.08
pnpr@main 0.335 ± 0.008 0.325 0.351 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9314864791800002,
      "stddev": 0.033760975802398945,
      "median": 1.92347781018,
      "user": 0.998339,
      "system": 0.79345858,
      "min": 1.89807172168,
      "max": 1.98975959468,
      "times": [
        1.93839266368,
        1.98975959468,
        1.98645149068,
        1.9134736396799998,
        1.93102838668,
        1.94198238168,
        1.90117987268,
        1.89807172168,
        1.91592723368,
        1.89859780668
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.95792773788,
      "stddev": 0.039137078496320594,
      "median": 1.94702538068,
      "user": 1.0735308,
      "system": 0.82766728,
      "min": 1.91108439568,
      "max": 2.02593897568,
      "times": [
        1.98161707068,
        1.91108439568,
        1.93519715268,
        1.92470621768,
        1.99892260768,
        1.9588536086800001,
        1.93384321268,
        1.98991109168,
        2.02593897568,
        1.91920304568
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.34345116128000003,
      "stddev": 0.026043354201182728,
      "median": 0.33656762718,
      "user": 0.23511209999999996,
      "system": 0.59843248,
      "min": 0.31491939268,
      "max": 0.39305914268000003,
      "times": [
        0.38721809868,
        0.33347201368,
        0.31491939268,
        0.32607766868000004,
        0.32519266768000005,
        0.34020882068,
        0.33103951968,
        0.39305914268000003,
        0.33966324068000003,
        0.34366104768
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.33458955168000004,
      "stddev": 0.008428669965711186,
      "median": 0.33215911518,
      "user": 0.23233159999999997,
      "system": 0.5871073800000001,
      "min": 0.32491862668000004,
      "max": 0.35059626868000004,
      "times": [
        0.32782659768,
        0.32491862668000004,
        0.33591269368000004,
        0.33361003068,
        0.32758869368000004,
        0.34129523468,
        0.32887498168,
        0.34456418968,
        0.33070819968000004,
        0.35059626868000004
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 413.4 ± 29.9 388.8 468.3 4.54 ± 0.39
pacquet@main 387.9 ± 8.3 372.0 399.9 4.26 ± 0.22
pnpr@HEAD 93.0 ± 3.5 87.9 104.4 1.02 ± 0.06
pnpr@main 91.1 ± 4.3 84.5 104.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.41343213704000004,
      "stddev": 0.029918820878111194,
      "median": 0.40363584484000004,
      "user": 0.4031458600000001,
      "system": 0.08132609999999998,
      "min": 0.38882595384,
      "max": 0.46829821984000003,
      "times": [
        0.41011356384000003,
        0.38882595384,
        0.38943461084000003,
        0.39435755484,
        0.41504545784,
        0.46829821984000003,
        0.46506130184000005,
        0.41604432684000003,
        0.39715812584000004,
        0.38998225484000004
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.38785848214000007,
      "stddev": 0.008279627890805387,
      "median": 0.38927446934000004,
      "user": 0.37136346000000003,
      "system": 0.0835545,
      "min": 0.37204592884000004,
      "max": 0.39993809584000006,
      "times": [
        0.39993809584000006,
        0.39170386384000005,
        0.38381371084000004,
        0.37204592884000004,
        0.39200308384000004,
        0.39424607184000005,
        0.38684507484,
        0.39495715584,
        0.38142741384000006,
        0.38160442184000004
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09298312480774197,
      "stddev": 0.0034830151293436026,
      "median": 0.09199293184,
      "user": 0.023276201935483867,
      "system": 0.012480225806451617,
      "min": 0.08793755784,
      "max": 0.10436146284,
      "times": [
        0.09016895284000001,
        0.08999625884000001,
        0.09912903384,
        0.09613289184000001,
        0.09001309484,
        0.08793755784,
        0.09199293184,
        0.09150208184,
        0.09683265384,
        0.08973808284000001,
        0.09014880384,
        0.09256118984,
        0.10436146284,
        0.09455712084000001,
        0.09480125184,
        0.09144331284,
        0.09048332984,
        0.09001656584,
        0.09893902784,
        0.09219467684,
        0.09083444484,
        0.09634614384000001,
        0.09461204684,
        0.09140963884,
        0.09132727484,
        0.09474336784000001,
        0.08972462384,
        0.09166586084,
        0.09330662884,
        0.09308805184,
        0.09246850384000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09112121548516129,
      "stddev": 0.004286369713601962,
      "median": 0.09035336184000001,
      "user": 0.023427847096774194,
      "system": 0.01040506451612903,
      "min": 0.08449408684000001,
      "max": 0.10420467784000001,
      "times": [
        0.08956074284,
        0.09536244884,
        0.10420467784000001,
        0.09161016784,
        0.09358982984,
        0.09299347284000001,
        0.08997510884,
        0.09727226784000001,
        0.08685880784000001,
        0.09167630184,
        0.08825541484,
        0.08757364284000001,
        0.09036787684,
        0.09428500684,
        0.08957145984,
        0.09107448784000001,
        0.08899235284000001,
        0.09597468284,
        0.09157281584,
        0.08789583284000001,
        0.08982749284000001,
        0.08764443784,
        0.09062776784000001,
        0.09009111784,
        0.10098069284000001,
        0.09225029584000001,
        0.08449408684000001,
        0.08605955484000001,
        0.08681676884,
        0.08694470284,
        0.09035336184000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.583 ± 0.135 4.454 4.853 1.28 ± 0.05
pacquet@main 4.549 ± 0.064 4.451 4.659 1.27 ± 0.03
pnpr@HEAD 3.570 ± 0.080 3.497 3.759 1.00
pnpr@main 3.671 ± 0.163 3.477 3.892 1.03 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.58317297544,
      "stddev": 0.13545361786510665,
      "median": 4.526631269139999,
      "user": 2.0057954199999997,
      "system": 1.50546362,
      "min": 4.45360422164,
      "max": 4.85311922964,
      "times": [
        4.49484740464,
        4.49300735064,
        4.47440956064,
        4.66645013464,
        4.85311922964,
        4.45360422164,
        4.45521075964,
        4.70529429764,
        4.55841513364,
        4.67737166164
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.54869596134,
      "stddev": 0.06415327735012408,
      "median": 4.54445763664,
      "user": 2.41153372,
      "system": 1.77498582,
      "min": 4.45138577064,
      "max": 4.65940689664,
      "times": [
        4.45138577064,
        4.49637717364,
        4.55297820664,
        4.48720487964,
        4.6302279756399995,
        4.53593706664,
        4.52831913164,
        4.58693619464,
        4.65940689664,
        4.55818631764
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5703147376399995,
      "stddev": 0.0796689582071124,
      "median": 3.55478454364,
      "user": 1.6557048199999997,
      "system": 1.49091892,
      "min": 3.49678660264,
      "max": 3.75930353764,
      "times": [
        3.52729512464,
        3.51743256564,
        3.49678660264,
        3.65177317764,
        3.75930353764,
        3.55119481964,
        3.5739759746399997,
        3.5607735476399998,
        3.5062377586399998,
        3.5583742676399996
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.6709072570399996,
      "stddev": 0.16274582979963867,
      "median": 3.66318868714,
      "user": 1.58152202,
      "system": 1.42843802,
      "min": 3.47653066064,
      "max": 3.89168048264,
      "times": [
        3.84711591164,
        3.70108770564,
        3.87122320364,
        3.89168048264,
        3.7460348146399998,
        3.47653066064,
        3.52039832864,
        3.53334689664,
        3.62528966864,
        3.49636489764
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13191
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
2,776.20 ms
(-1.56%)Baseline: 2,820.13 ms
3,384.15 ms
(82.04%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,898.07 ms
(-3.79%)Baseline: 1,972.84 ms
2,367.41 ms
(80.18%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
590.77 ms
(-9.11%)Baseline: 649.98 ms
779.97 ms
(75.74%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
388.83 ms
(-1.01%)Baseline: 392.80 ms
471.36 ms
(82.49%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,430.81 ms
(+0.32%)Baseline: 2,422.98 ms
2,907.57 ms
(83.60%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,453.60 ms
(-0.79%)Baseline: 4,488.98 ms
5,386.77 ms
(82.68%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
256.34 ms
(-6.41%)Baseline: 273.89 ms
328.67 ms
(77.99%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13191
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
1,448.67 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
314.92 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
299.38 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
87.94 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,365.60 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,496.79 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
272.01 ms
🐰 View full continuous benchmarking report in Bencher

@KSXGitHub KSXGitHub left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code,

Below are many different reviews. Each may belong to different categories.

I wish that you do not collapse all the unrelated tasks into a single commit.

You shall analyze the reviews. You shall make groups of related reviews.

Each group of related reviews correspond to a task and a git commit.

A git commit should have its purpose clear and focused.

If there would be multiple groups of related reviews, then I expect multiple commits.

Comment thread pnpm11/auth/commands/test/login.test.ts Resolved
Comment thread pnpm11/auth/commands/test/login.test.ts Resolved
claude added 5 commits July 21, 2026 23:55
The `WebAuthFetchResponse.body` field's JSDoc duplicated the size-cap and
`json()`-fallback contract already documented on `readTokenBody`, and its
"WHATWG" wording was the only thing that required a `cspell.json` entry.
Replace it with a one-line note on why the field is optional and drop the
now-unused dictionary word.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
Replace regex matchers and a vague length check in the QR tests with
exact string-literal assertions that produce clear diffs on failure:

- formatAuthUrlMessage: assert the composed message equals the exact
  `prefix + generateQrCode(url)` rather than matching a prefix regex and
  a length lower bound (the length check only proved "something was
  appended"; exact equality states the full contract).
- login: assert `globalWarn` fired exactly once with a message that
  contains the literal prefix, and switch the `globalInfo` check to
  `toStrictEqual`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
… value

`format_auth_url_message` returned an owned `String`, which the reporter
then copied a second time into its `GlobalLog` allocation. Return a
two-variant `AuthUrlMessage` enum (`derive_more::Display`) instead and
let `global_info` / `global_warn` accept any `Display`, so the message —
whose QR block is several kilobytes — is written straight into the one
allocation the reporter sink requires, rather than being concatenated
into an intermediate `String` first.

The turbofished `Reporter` type parameter means every call site now
spells the inferred message type as `::<Reporter, _>`; the emitted
message bytes are unchanged, so reporter parity with the TypeScript CLI
holds.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
…the DI seam

The token-body size limit lived entirely inside `Host::fetch`, where the
`WebAuthFetch` fakes used by the `login` and `publish` OTP tests could not
reach it — so the feature could only be exercised against the real HTTP
transport.

Surface the cap on `WebAuthFetchResponse` instead: a new `truncated` flag
records that the provider's capped read stopped short of the full body,
and `WebAuthFetchResponse::token` — a pure, directly unit-tested method —
treats a truncated body as carrying no token, so the poll keeps waiting.
The read-or-skip decision moves into the pure `body_may_carry_token`
helper. `Host::fetch` is now a thin orchestrator: it caps the read via
`read_limited_body` (whose byte-level behavior is covered in
`pacquet-network`) and passes `truncated` through, without mapping or
branching logic of its own.

A fake can now return a truncated response, so the size-limit branch is
covered by ordinary DI-based tests: a `poll_for_web_auth_token` test and a
`with_otp_handling` test both drive it through the same seam the `login`
and `publish` flows use.

The TypeScript `@pnpm/network.web-auth` does not have the equivalent
violation: its cap lives in `readTokenBody` inside `pollForWebAuthToken`
(the code under test), not in the injected `fetch`, and is already
covered by the poll tests — so no TypeScript change is needed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 22, 2026
@blacksmith-sh

This comment has been minimized.

claude and others added 7 commits July 22, 2026 07:14
Fix Claude Code's idiocy
Replace the two-step `toHaveBeenCalledTimes` + `toContain` check with one
`toStrictEqual` over `globalWarn.mock.calls`, which also asserts the call
count and argument arity in a single expectation.
`global_info` and `global_warn` took `impl Display` and cloned via
`.to_string()` internally, so every `format!(...)` caller allocated a
second `String` and discarded the first. Accept an owned `String` and
move it straight into the `LogEvent`, mirroring the same helpers in
`pacquet-auth-commands`.
`Host::fetch` decoded the capped token body with strict
`String::from_utf8`, which drops an otherwise-parsable body to empty on a
single invalid byte, and it kept a leading UTF-8 BOM, which makes
`serde_json` reject an otherwise-valid body. The TypeScript side reads the
same body through `new TextDecoder().decode(...)`, which is non-fatal
(invalid UTF-8 becomes U+FFFD) and strips a leading BOM, so a registry
response with a stray non-UTF-8 byte or a leading BOM made pacquet poll to
timeout while the TypeScript CLI returned a token. Decode with
`String::from_utf8_lossy` and strip a leading BOM to restore parity, each
pinned with a mockito test that the previous decode fails.
perfectionist's `macro-trailing-comma` requires a trailing comma on a
multi-line macro invocation; rustfmt wrapped this `assert_eq!` across
lines without one, so `cargo dylint --all -- --all-targets` (which lints
the test target) rejected it.

@KSXGitHub KSXGitHub left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code,

Below are many different reviews. Each may belong to different categories.

I wish that you do not collapse all the unrelated tasks into a single commit.

You shall analyze the reviews. You shall make groups of related reviews.

Each group of related reviews correspond to a task and a git commit.

A git commit should have its purpose clear and focused.

If there would be multiple groups of related reviews, then I expect multiple commits.

KSXGitHub and others added 3 commits July 23, 2026 01:21
Collapse the two sequential `fetchedUrls[0]` / `fetchedUrls[1]` checks into
one `toStrictEqual` over the whole array, which also pins the fetch count —
the same assertion-merge applied elsewhere in these web-auth tests.
Bring the macro into scope with `use derive_more::Display` and write
`#[derive(Display)]` instead of qualifying it at the derive site.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.changeset/harden-web-auth-url-poll-body.md (1)

1-9: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Split into two changesets — one per logical change.

This single changeset bundles two independent, separately-shippable behaviors: the poll-body size cap/skip-for-202/non-OK hardening, and the QR-generation-failure URL-only fallback. Per the review guide for this PR, each user-visible change should get its own changeset so changelog entries map 1:1 to reviewable units.

♻️ Suggested split
-.changeset/harden-web-auth-url-poll-body.md
+.changeset/harden-web-auth-poll-body.md
+.changeset/qr-fallback-on-generation-failure.md

Each file keeps only the package bumps and description relevant to its own change.

As per path instructions, "Because the change is user-visible (auth UX/logging), require a changeset and one logical change per changeset."

🤖 Prompt for 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.

In @.changeset/harden-web-auth-url-poll-body.md around lines 1 - 9, Split
.changeset/harden-web-auth-url-poll-body.md into two changesets, keeping the
existing package bumps and retaining only the token poll response-body hardening
description in one, and only the QR-generation-failure URL-only fallback
description in the other. Ensure each changeset represents one independently
shippable user-visible change.

Source: Path instructions

🧹 Nitpick comments (1)
pnpm/crates/auth-commands/src/login/test_web_login_errors.rs (1)

2-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use regular comments only for non-obvious test invariants.

These private-test rustdoc comments restate test behavior; one also narrates prior implementation details.

  • pnpm/crates/auth-commands/src/login/test_web_login_errors.rs#L2-L4: remove the test-arm inventory or reduce it to a module-level invariant.
  • pnpm/crates/auth-commands/src/login/test_web_login_errors.rs#L149-L151: remove the behavior summary; the test name already states it.
  • pnpm/crates/network-web-auth/src/generate_qr_code/tests.rs#L24-L27: use a concise // comment only for the qrcode-terminal capacity-parity invariant.
  • pnpm/crates/network-web-auth/tests/with_otp_handling.rs#L333-L338: retain only the truncation invariant; remove implementation-history narration.
  • pnpm/crates/network-web-auth/tests/with_otp_handling.rs#L374-L376: remove the behavior summary; the test name already states it.

As per coding guidelines, “Use rustdoc comments for public API contracts and regular comments for implementation rationale. Do not duplicate test behavior in documentation; comments should explain only non-obvious reasons or invariants.”

🤖 Prompt for 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.

In `@pnpm/crates/auth-commands/src/login/test_web_login_errors.rs` around lines 2
- 4, Replace redundant test rustdoc summaries with regular comments only where
they preserve non-obvious invariants: in
pnpm/crates/auth-commands/src/login/test_web_login_errors.rs lines 2-4 remove
the test-arm inventory or reduce it to a module-level invariant, and lines
149-151 remove the behavior summary; in
pnpm/crates/network-web-auth/src/generate_qr_code/tests.rs lines 24-27 retain
only a concise // comment explaining the qrcode-terminal capacity-parity
invariant; in pnpm/crates/network-web-auth/tests/with_otp_handling.rs lines
333-338 retain only the truncation invariant and remove implementation-history
narration, and lines 374-376 remove the behavior summary.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In @.changeset/harden-web-auth-url-poll-body.md:
- Around line 1-9: Split .changeset/harden-web-auth-url-poll-body.md into two
changesets, keeping the existing package bumps and retaining only the token poll
response-body hardening description in one, and only the QR-generation-failure
URL-only fallback description in the other. Ensure each changeset represents one
independently shippable user-visible change.

---

Nitpick comments:
In `@pnpm/crates/auth-commands/src/login/test_web_login_errors.rs`:
- Around line 2-4: Replace redundant test rustdoc summaries with regular
comments only where they preserve non-obvious invariants: in
pnpm/crates/auth-commands/src/login/test_web_login_errors.rs lines 2-4 remove
the test-arm inventory or reduce it to a module-level invariant, and lines
149-151 remove the behavior summary; in
pnpm/crates/network-web-auth/src/generate_qr_code/tests.rs lines 24-27 retain
only a concise // comment explaining the qrcode-terminal capacity-parity
invariant; in pnpm/crates/network-web-auth/tests/with_otp_handling.rs lines
333-338 retain only the truncation invariant and remove implementation-history
narration, and lines 374-376 remove the behavior summary.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6a15e626-2aee-44e9-a627-c1754ea0e4f9

📥 Commits

Reviewing files that changed from the base of the PR and between d1edab4 and ea905f8.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (28)
  • .changeset/harden-web-auth-url-poll-body.md
  • pnpm/crates/auth-commands/src/login.rs
  • pnpm/crates/auth-commands/src/login/classic_login.rs
  • pnpm/crates/auth-commands/src/login/error.rs
  • pnpm/crates/auth-commands/src/login/test_web_login_errors.rs
  • pnpm/crates/auth-commands/src/login/web_login.rs
  • pnpm/crates/network-web-auth-testing/src/lib.rs
  • pnpm/crates/network-web-auth/Cargo.toml
  • pnpm/crates/network-web-auth/src/capabilities.rs
  • pnpm/crates/network-web-auth/src/capabilities/tests.rs
  • pnpm/crates/network-web-auth/src/format_auth_url_message.rs
  • pnpm/crates/network-web-auth/src/generate_qr_code/tests.rs
  • pnpm/crates/network-web-auth/src/global_log.rs
  • pnpm/crates/network-web-auth/src/lib.rs
  • pnpm/crates/network-web-auth/src/poll_for_web_auth_token.rs
  • pnpm/crates/network-web-auth/src/poll_for_web_auth_token/tests.rs
  • pnpm/crates/network-web-auth/src/prompt_browser_open.rs
  • pnpm/crates/network-web-auth/src/with_otp_handling.rs
  • pnpm/crates/network-web-auth/tests/with_otp_handling.rs
  • pnpm11/auth/commands/src/login.ts
  • pnpm11/auth/commands/test/login.test.ts
  • pnpm11/network/web-auth/src/formatAuthUrlMessage.ts
  • pnpm11/network/web-auth/src/index.ts
  • pnpm11/network/web-auth/src/pollForWebAuthToken.ts
  • pnpm11/network/web-auth/src/withOtpHandling.ts
  • pnpm11/network/web-auth/test/formatAuthUrlMessage.test.ts
  • pnpm11/network/web-auth/test/pollForWebAuthToken.test.ts
  • pnpm11/network/web-auth/test/withOtpHandling.test.ts

claude and others added 9 commits July 22, 2026 22:36
Mutation testing surfaced a gap: dropping the QR code from the WithQrCode
Display variant went uncaught, since no Rust test asserted the happy-path
message includes it — only the URL-only fallback and the "auth URL is
surfaced" checks existed. The TypeScript formatAuthUrlMessage test already
pins this. Add the matching unit test so the regression is caught in both
stacks.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
readTokenBody falls back to response.json() when a response exposes no
readable body stream, which the 64 KiB cap cannot bound. Production's
undici-backed fetch always exposes a ReadableStream, so this path is
reached only by stream-less WebAuthFetch stand-ins (the json()-based test
mocks); document that boundary so a future implementor of the interface
knows the cap only governs the stream read.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
The single changeset bundled two independently shippable behaviors — the
poll-body size cap / skip-for-202-and-non-OK hardening, and the
non-fatal QR-code fallback. REVIEW_GUIDE.md requires one changeset per
logical change, so split them: the poll-body changeset drops
`@pnpm/auth.commands` (untouched by the cap), and the QR-fallback
changeset keeps it (its login output now routes through the shared
formatter).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
Drop doc comments that only restate what an explicit test name already
says, and remove implementation-history narration ("while it lived only
in the Host provider") from the truncated-body test. The qrcode-terminal
capacity-parity invariant is kept: its 2953-byte figure is a genuine
non-obvious reason, not a restatement.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
The struct summary still said "body text", left over from when the field
was a String; it is now a Vec<u8> that token() decodes then parses, as the
field's own doc already states.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
@KSXGitHub
KSXGitHub marked this pull request as ready for review July 23, 2026 00:13
Copilot AI review requested due to automatic review settings July 23, 2026 00:13

@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.

🧹 Nitpick comments (1)
pnpm/crates/network-web-auth/src/format_auth_url_message/tests.rs (1)

18-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep the test comment focused on rationale.

Lines 18-20 restate behavior already covered by the assertions. Per the Rust comment guidelines, remove the behavioral narration or retain only a concise parity rationale.

Suggested wording
-/// The happy path renders the auth URL followed by its QR code. This mirrors
-/// the TypeScript `formatAuthUrlMessage` "appends a QR code" unit test, so a
-/// regression that drops the code from the message is caught in both stacks.
+/// Keep this assertion aligned with the equivalent TypeScript test.
🤖 Prompt for 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.

In `@pnpm/crates/network-web-auth/src/format_auth_url_message/tests.rs` around
lines 18 - 20, Shorten the comment above the happy-path test to retain only the
concise cross-stack parity rationale, removing the explanation that restates the
auth URL and QR-code behavior already verified by the assertions.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@pnpm/crates/network-web-auth/src/format_auth_url_message/tests.rs`:
- Around line 18-20: Shorten the comment above the happy-path test to retain
only the concise cross-stack parity rationale, removing the explanation that
restates the auth URL and QR-code behavior already verified by the assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fdc1ec4b-b6c4-44a8-99f3-65f84f7294db

📥 Commits

Reviewing files that changed from the base of the PR and between ea905f8 and 2da8936.

📒 Files selected for processing (8)
  • .changeset/harden-web-auth-poll-body.md
  • .changeset/web-auth-qr-code-fallback.md
  • pnpm/crates/auth-commands/src/login/test_web_login_errors.rs
  • pnpm/crates/network-web-auth/src/format_auth_url_message.rs
  • pnpm/crates/network-web-auth/src/format_auth_url_message/tests.rs
  • pnpm/crates/network-web-auth/src/poll_for_web_auth_token.rs
  • pnpm/crates/network-web-auth/tests/with_otp_handling.rs
  • pnpm11/network/web-auth/src/pollForWebAuthToken.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • pnpm/crates/network-web-auth/tests/with_otp_handling.rs
  • pnpm/crates/network-web-auth/src/format_auth_url_message.rs
  • pnpm/crates/network-web-auth/src/poll_for_web_auth_token.rs
  • pnpm11/network/web-auth/src/pollForWebAuthToken.ts

Copilot AI 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.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

pnpm/crates/network-web-auth/src/global_log.rs:18

  • global_warn now forces String allocations for constant warnings. Taking impl Into<String> avoids the extra .to_owned()/format! plumbing without changing behavior.
pub(crate) fn global_warn<Reporter: self::Reporter>(message: String) {
    Reporter::emit(&LogEvent::Global(GlobalLog { level: LogLevel::Warn, message }));
}

Comment thread pnpm/crates/auth-commands/src/login.rs Resolved
claude added 2 commits July 23, 2026 00:20
The comment's first sentence restated the test name and the assertions;
keep only the non-obvious why — that this test mirrors the TypeScript
`formatAuthUrlMessage` one so a dropped-QR regression is caught in both
stacks.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XwWZa842XVDLkodGcTwQXd
Copilot AI review requested due to automatic review settings July 23, 2026 00:28

Copilot AI 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.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated no new comments.

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.

pacquet network-web-auth: harden registry-controlled URL and poll-body handling (beyond current pnpm parity)

5 participants