Skip to content

feat(releasing): publish a new package's first release at its manifest version - #13207

Merged
zkochan merged 8 commits into
mainfrom
first-release-verbatim
Jul 22, 2026
Merged

zkochan merged 8 commits into
mainfrom
first-release-verbatim

Conversation

@zkochan

@zkochan zkochan commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Summary

The release engine computed every new version as inc(currentVersion, bump), with no notion of whether currentVersion was ever published. A brand-new package seeded at the epic band floor (e.g. 1100.0.0) with a minor changeset therefore debuted at 1100.1.0, silently skipping 1100.0.0 — even though epic re-base already publishes members at the x00.0.0 floor, so a new package should debut there too. This surfaced in #13198, which adds @pnpm/deps.github-actions at 1100.0.0 with a minor changeset; that package would have first published as 1100.1.0.

This teaches the engine that a package's first release publishes the version in its manifest verbatim. pnpm version -r and pnpm change status now probe the registry for each release's current version and hold the never-published ones at that version: the first release publishes it as-is, and the pending changesets — still composed into the changelog and recorded in the ledger — apply only from the next release.

Per the discussion that motivated this approach:

  • Always probe, uniformly. The probe runs the same way in pnpm version -r, pnpm change status, and --dry-run — no offline special case.
  • Fail on error. Only a definitive 404 means "not published"; any other registry/network failure fails the command rather than guessing a version's fate.

How it's wired (both stacks, in lockstep):

  • @pnpm/releasing.versioning / pacquet-versioning: assembleReleasePlan gains an unpublishedDirs input; computeNewVersion returns the current version verbatim for those dirs (and, on a lane, a prerelease of the current version without incrementing).
  • @pnpm/releasing.commands / the pacquet CLI: a registry probe (isVersionPublished / unpublished_release_dirs, reusing the existing packument-fetch plumbing) resolves that set, threaded through a two-pass assembly (assemble → probe the plan's releases → re-assemble). Holding a package at its current version can only remove dependent propagation, never add it, so the second pass is a subset of the first — every dir it can hold was probed.

Notes for review

  • TS test seam. The command handlers accept an injectable checkVersionPublished (mirroring the existing injected verifyPublished gate) so the command tests steer first-vs-follow-up without a network round trip. Production leaves it unset and probes.
  • Rust test seam. The engine's Rust integration tests advance manifests without a real publish cycle (a lane prerelease is written but never published), so they set a debug_assertions-gated PACQUET_ASSUME_VERSIONS_PUBLISHED env var that makes every release bump as if published. It is compiled out of release builds, so a production pnpm always probes — worst-case misuse in a debug build only reverts to the pre-PR bump-always behavior, never an incorrect publish. Two new integration tests exercise the real probe against the mock registry (@pnpm.e2e/[email protected] → bumps; @pnpm.e2e/[email protected] → verbatim).
  • The pacquet change command became async to run the probe (its dispatch now awaits it).

Validation: @pnpm/releasing.versioning (63) and @pnpm/releasing.commands change-suite (15) Jest tests, pacquet-versioning (66) and pacquet-cli::change (9) tests, plus workspace cargo fmt / taplo / clippy -D warnings.

Squash Commit Body

The release engine computed every new version as inc(currentVersion, bump),
with no notion of whether currentVersion was ever published. A brand-new
package seeded at the epic band floor (e.g. 1100.0.0) with a minor changeset
therefore debuted at 1100.1.0, silently skipping 1100.0.0 — the deliberate
band-floor debut that epic re-base already publishes members at. Surfaced by
pnpm/pnpm#13198, which adds `@pnpm/deps.github-actions` at 1100.0.0.

pnpm version -r and pnpm change status now probe the registry for each
release's current version and hold the never-published ones at their manifest
version: the first release publishes it verbatim, and the pending changesets
(still composed into the changelog and recorded in the ledger) apply only from
the next release. The probe always runs (version, change status, dry-run alike)
and a probe failure fails the command rather than guessing.

Mirrored in both stacks: `@pnpm/releasing.versioning` gains an unpublishedDirs
input to assembleReleasePlan, resolved by `@pnpm/releasing.commands` via a
registry probe threaded through a two-pass assembly; pacquet mirrors it in
pacquet-versioning's plan and the CLI's change/version commands. Command tests
inject the probe (TS) or a debug-only PACQUET_ASSUME_VERSIONS_PUBLISHED seam
that is compiled out of release builds (Rust); two Rust tests exercise the real
probe against the mock registry.

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.

Written by an agent (Claude Code, claude-opus-4-8).


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Added registry probing to detect whether package versions are already published during change and recursive version -r.
    • Updated change status previews to reflect the effective published/unpublished state used for planning.
  • Bug Fixes
    • First releases of packages that are not yet published now debut verbatim at the manifest version, including correct lane/prerelease behavior.
    • Registry probe failures now fail the commands instead of falling back to guessed versions.
    • Prevents incorrect dependent version propagation when the first release does not advance the package version.
  • Tests
    • Added end-to-end and unit coverage for published vs unpublished first-release behavior and probe failure scenarios.

zkochan added 3 commits July 22, 2026 01:22
…t version

The release engine computed every new version as inc(currentVersion, bump),
with no notion of whether currentVersion was ever published. A brand-new
package seeded at the epic band floor (e.g. 1100.0.0) with a minor changeset
therefore debuted at 1100.1.0, silently skipping 1100.0.0 — the deliberate
band-floor debut that epic re-base already publishes members at. Surfaced by
#13198, which adds `@pnpm/deps.github-actions` at 1100.0.0.

pnpm version -r and pnpm change status now probe the registry for each
release's current version and hold the never-published ones at their manifest
version: the first release publishes it verbatim, and the pending changesets
(still composed into the changelog and recorded in the ledger) apply only from
the next release. A probe failure fails the command rather than guessing.

Mirrored in both stacks: `@pnpm/releasing.versioning` gains an unpublishedDirs
input to assembleReleasePlan, resolved by `@pnpm/releasing.commands` via a
registry probe threaded through a two-pass assembly; pacquet mirrors it in
pacquet-versioning's plan and the CLI's change/version commands. The engine's
Rust integration tests advance manifests without a real publish cycle, so a
debug-only PACQUET_ASSUME_VERSIONS_PUBLISHED seam (compiled out of release
builds) keeps them network-free; two new tests exercise the real probe against
the mock registry.
Use the existing `lib` fixture name instead of a coined word in the
first-release assembleReleasePlan tests.
The `perfectionist::impure_macro_arguments` dylint rejects passing
`response.status()` directly into `miette!`; bind it to a `let` first, which
also evaluates it once.
Copilot AI review requested due to automatic review settings July 21, 2026 23:33

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 21, 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
📝 Walkthrough

Walkthrough

Release planning now probes registry publication state and preserves unpublished manifest versions for first releases. Rust and TypeScript change and version flows reassemble plans using those results, with coverage for lanes, dependencies, epic rebasing, and probe failures.

Changes

Registry-aware first-release versioning

Layer / File(s) Summary
First-release version calculation
pnpm/crates/versioning/src/plan.rs, pnpm11/releasing/versioning/src/assembleReleasePlan.ts, pnpm/crates/versioning/src/plan/tests.rs, pnpm11/releasing/versioning/test/assembleReleasePlan.ts, .changeset/first-release-verbatim.md
Release plans preserve unpublished manifest versions on first stable releases, derive lane prereleases from the current version, and handle subsequent bumps, dependency propagation, and epic rebasing.
TypeScript registry probing and command wiring
pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts, pnpm11/releasing/commands/src/publish/previousChangelog.ts, pnpm11/releasing/commands/src/change/index.ts, pnpm11/releasing/commands/src/version/index.ts, pnpm11/releasing/commands/test/change/index.test.ts
Commands probe publication state concurrently, support injected probes, and reassemble plans for change status and version; tests cover debut versions and probe failures.
Rust CLI registry-aware status and version flow
pnpm/crates/cli/src/cli_args/changelog.rs, pnpm/crates/cli/src/cli_args/change.rs, pnpm/crates/cli/src/cli_args/version.rs, pnpm/crates/cli/src/cli_args/dispatch_query.rs, pnpm/crates/cli/tests/change.rs
Rust CLI commands perform asynchronous registry checks, reassemble plans with unpublished directories, and test published-version bumps, verbatim first releases, and probe errors.

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

Sequence Diagram(s)

sequenceDiagram
  participant Command
  participant ReleasePlan
  participant Registry
  Command->>ReleasePlan: assemble initial plan
  ReleasePlan-->>Command: current release versions
  Command->>Registry: check package@currentVersion
  Registry-->>Command: published status
  Command->>ReleasePlan: assemble with unpublishedDirs
  ReleasePlan-->>Command: final release plan
Loading

Possibly related issues

  • pnpm/pnpm#12952 — Addresses registry-backed unpublished-version detection and first-release behavior in native monorepo versioning.

Possibly related PRs

Suggested labels: product: pnpm@11

Suggested reviewers: copilot, qodo-code-review

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch first-release-verbatim

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-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Publish first releases at the manifest version by probing the registry

🐞 Bug fix ✨ Enhancement 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Probe the registry to detect never-published package versions before versioning.
• Treat first releases as “publish manifest version verbatim”; apply bumps starting next release.
• Mirror behavior across Rust and TypeScript stacks with focused unit/e2e coverage.
Diagram

graph TD
  cli["pnpm change/status & version -r"] --> plan1["Assemble plan (pass 1)"] --> probe{"Probe current versions"} --> reg[("Registry packument")]
  reg --> plan2["Assemble plan (pass 2)"] --> out["Render/apply release plan"]

  subgraph Legend
    direction LR
    _proc["Process"] ~~~ _dec{"Probe/decision"} ~~~ _reg[("Registry")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Heuristic “new package” detection (no registry probe)
  • ➕ Works offline; no registry latency or auth complexity
  • ➕ No additional network-failure modes for version/status commands
  • ➖ Cannot reliably distinguish “never published” vs “published but yanked / different registry” cases
  • ➖ Breaks for existing packages seeded to new versions intentionally
  • ➖ Risks silently releasing incorrect versions (the failure mode this PR targets)
2. Probe only on publish/apply, not during status/version planning
  • ➕ Status stays fast/offline-friendly
  • ➕ Network access is limited to the point of actual side effects
  • ➖ pnpm change status and pnpm version -r --dry-run would still preview the wrong versions
  • ➖ Increases surprise: plan differs between preview and apply
3. Cache probe results locally (memoization/store)
  • ➕ Reduces repeated registry calls across commands and reruns
  • ➕ Could improve performance in large workspaces
  • ➖ Cache invalidation and multi-registry scoping complexity
  • ➖ Stale cache could reintroduce incorrect-version releases unless carefully bounded

Recommendation: Keep the PR’s uniform, fail-closed registry probing and two-pass planning: it makes status, dry-run, and actual version -r agree, and avoids guessing when the registry is unreachable. If probe cost becomes an issue later, add bounded in-process memoization per invocation (safe, no persistence) rather than introducing a persistent cache.

Files changed (15) +459 / -41

Enhancement (3) +116 / -2
changelog.rsAdd registry probe to detect unpublished current versions +63/-2

Add registry probe to detect unpublished current versions

• Introduces 'unpublished_release_dirs' and a strict 'is_version_published' helper that treats only HTTP 404 as “unpublished” and fails on other errors. Includes a debug-only 'PACQUET_ASSUME_VERSIONS_PUBLISHED' seam for integration tests.

pnpm/crates/cli/src/cli_args/changelog.rs

previousChangelog.tsExpose 'isVersionPublished' via packument fetch +12/-0

Expose 'isVersionPublished' via packument fetch

• Adds and exports an 'isVersionPublished' helper built on existing packument fetch plumbing, with fail-on-error semantics and 404/missing-version treated as unpublished.

pnpm11/releasing/commands/src/publish/previousChangelog.ts

resolveUnpublishedDirs.tsNew TS helper to resolve 'unpublishedDirs' with injectable probe seam +41/-0

New TS helper to resolve 'unpublishedDirs' with injectable probe seam

• Introduces a dedicated module that concurrently probes all releases in a plan to compute 'unpublishedDirs', allowing tests to inject 'checkVersionPublished' to avoid network round trips.

pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts

Bug fix (6) +101 / -34
change.rsMake 'pnpm change status' registry-aware via two-pass plan assembly +21/-12

Make 'pnpm change status' registry-aware via two-pass plan assembly

• Converts the change command flow to async and updates 'render_status' to assemble a draft plan, probe which releases are unpublished, and re-assemble using 'unpublished_dirs' so first-release previews match actual releases.

pnpm/crates/cli/src/cli_args/change.rs

version.rsTwo-pass release planning for 'pnpm version -r' with unpublished detection +21/-13

Two-pass release planning for 'pnpm version -r' with unpublished detection

• Threads the unpublished-version probe into version planning: assemble a first-pass plan, probe current versions for publication, then re-assemble with 'unpublished_dirs' so first releases keep their manifest version.

pnpm/crates/cli/src/cli_args/version.rs

plan.rsSupport 'unpublished_dirs' and first-release version computation +20/-1

Support 'unpublished_dirs' and first-release version computation

• Extends 'AssembleReleasePlanOptions' with 'unpublished_dirs' and passes a 'first_release' flag into 'compute_new_version'. For first releases, stable versions remain unchanged and lane prereleases target the current stable part without incrementing.

pnpm/crates/versioning/src/plan.rs

index.tsProbe unpublished releases for 'pnpm change status' in TS commands +7/-3

Probe unpublished releases for 'pnpm change status' in TS commands

• Adds 'resolveUnpublishedDirs' integration to the change/status path and extends command options with unpublished-probe configuration so status output reflects first-release behavior.

pnpm11/releasing/commands/src/change/index.ts

index.tsTwo-pass version planning for TS 'version -r' with first-release detection +6/-2

Two-pass version planning for TS 'version -r' with first-release detection

• Threads 'checkVersionPublished' through version handling and performs an initial plan assembly followed by 'resolveUnpublishedDirs' and a second assembly, aligning applied versions with registry reality.

pnpm11/releasing/commands/src/version/index.ts

assembleReleasePlan.tsAdd 'unpublishedDirs' and first-release handling to TS versioning core +26/-3

Add 'unpublishedDirs' and first-release handling to TS versioning core

• Extends assemble options with 'unpublishedDirs' and updates 'computeNewVersion' to return the current version for first releases (or stable-part prerelease on lanes), preventing seeded versions from being skipped.

pnpm11/releasing/versioning/src/assembleReleasePlan.ts

Refactor (1) +1 / -4
dispatch_query.rsRun 'change' command handler asynchronously +1/-4

Run 'change' command handler asynchronously

• Updates dispatch plumbing so the 'change' subcommand returns an async future, enabling registry I/O during status rendering.

pnpm/crates/cli/src/cli_args/dispatch_query.rs

Tests (4) +233 / -1
change.rsAdd mock-registry tests for first-release probing and adjust engine tests +85/-1

Add mock-registry tests for first-release probing and adjust engine tests

• Adds end-to-end tests against the mocked registry to verify published versions bump normally and unpublished versions debut verbatim. Sets 'PACQUET_ASSUME_VERSIONS_PUBLISHED=1' for existing engine-style tests that advance manifests without publishing.

pnpm/crates/cli/tests/change.rs

tests.rsUnit tests for first-release semantics and propagation suppression +61/-0

Unit tests for first-release semantics and propagation suppression

• Adds tests asserting first releases publish the current version verbatim, second releases bump normally, dependents don’t propagate when the version doesn’t move, and lane first releases start at '<current>-tag.0'.

pnpm/crates/versioning/src/plan/tests.rs

index.test.tsTS command tests for verbatim first releases and probe error behavior +35/-0

TS command tests for verbatim first releases and probe error behavior

• Adds tests asserting unpublished packages debut at their manifest version and that probe failures reject both status and version commands rather than guessing.

pnpm11/releasing/commands/test/change/index.test.ts

assembleReleasePlan.tsTS versioning tests for 'unpublishedDirs' semantics +52/-0

TS versioning tests for 'unpublishedDirs' semantics

• Adds unit tests mirroring Rust: first release verbatim, second release bump, no dependent propagation when the version doesn’t change, and lane first-release prerelease behavior.

pnpm11/releasing/versioning/test/assembleReleasePlan.ts

Documentation (1) +8 / -0
first-release-verbatim.mdDocument first-release-at-manifest behavior across packages +8/-0

Document first-release-at-manifest behavior across packages

• Adds a changeset describing the new first-release semantics: publish the manifest version verbatim when that version is not yet on the registry, and apply pending changesets starting from the next release.

.changeset/first-release-verbatim.md

@greptile-apps

greptile-apps Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

This looks safe to merge.

  • Fixed-group synchronization and epic-band rebasing are now documented as intentional overrides.
  • The implementation follows those rules in both release engines.
  • No blocking issue remains in the updated code.

Reviews (6): Last reviewed commit: "fix(versioning): publish an unpublished ..." | Re-trigger Greptile

@qodo-code-review

qodo-code-review Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Lane prerelease gets skipped ✓ Resolved 🐞 Bug ≡ Correctness
Description
When unpublished_dirs/firstRelease is true for a lane release and the manifest already contains
an unpublished matching prerelease (e.g. 1.0.0-alpha.0), compute_new_version still increments
via next_prerelease_number, producing 1.0.0-alpha.1 and skipping the manifest version that was
detected as unpublished.
Code

pnpm/crates/versioning/src/plan.rs[R1003-1008]

+    let target = if first_release {
+        stable_part(&current_version)
+    } else if current_version.pre_release.is_empty() {
        inc_stable(&current_version, cumulative_bump)
    } else {
        escalate_stable_target(&stable_part(&current_version), cumulative_bump)
Evidence
In Rust and TypeScript, the first-release lane branch still routes through the prerelease increment
helper, which returns current_n + 1 when the current manifest is already a matching prerelease;
this makes an unpublished *-alpha.0 plan as *-alpha.1 even though the probe classified the
current version as unpublished. The PR’s own tests explicitly note manifests can advance without
being published, making this state plausible in real workflows after a failed/aborted publish cycle.

pnpm/crates/versioning/src/plan.rs[984-1012]
pnpm/crates/versioning/src/plan.rs[1053-1070]
pnpm11/releasing/versioning/src/assembleReleasePlan.ts[741-758]
pnpm11/releasing/versioning/src/assembleReleasePlan.ts[782-790]
pnpm/crates/cli/tests/change.rs[147-153]

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

### Issue description
The first-release lane path sets `target = stable_part(current)` but still calls `next_prerelease_number(current, target, lane_tag)`, which returns `current_n + 1` when the manifest already has a matching prerelease. If the registry probe marked the current manifest version as unpublished, this incorrectly plans the *next* prerelease (`alpha.1`) instead of publishing the manifest version (`alpha.0`) verbatim.

### Issue Context
This only triggers when the manifest already contains a prerelease that the registry does not have (e.g. after an aborted publish, dry-run, or any workflow that advanced manifests without publishing).

### Fix Focus Areas
- pnpm/crates/versioning/src/plan.rs[984-1012]
- pnpm11/releasing/versioning/src/assembleReleasePlan.ts[741-758]

### Suggested fix
In both Rust and TS versioning implementations, handle `first_release && lane_tag.is_some()` specially:
- If `current` is already a prerelease for the same `lane_tag` and its stable part equals the computed `target`, return `current` unchanged.
- Otherwise, return `${target}-${lane_tag}.0` (Rust: `format!("{target}-{lane_tag}.0")`).

Add regression tests for the case:
- current manifest: `1.0.0-alpha.0`
- lane tag: `alpha`
- dir in `unpublishedDirs`
Expected newVersion: `1.0.0-alpha.0` (not `alpha.1`).

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


2. 404 treated as unpublished 🐞 Bug ⛨ Security
Description
Rust is_version_published() returns false on any registry 404, but pnpm’s resolver explicitly
documents that a 404 can also mean “no permission to fetch it”, not “does not exist”. This can
produce a misleading release plan and then apply it (e.g. pnpm version -r consuming intents) based
on an ambiguous probe result.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R140-142]

+    if status.as_u16() == 404 {
+        return Ok(false);
+    }
Evidence
The new Rust probe hard-codes 404 => unpublished, but pnpm’s own registry error type says 404 also
covers “no permission”. The version command then uses this probe result to compute a plan and apply
it (non-dry-run), which can consume intents based on that ambiguous classification.

pnpm/crates/cli/src/cli_args/changelog.rs[122-151]
pnpm11/resolving/npm-resolver/src/fetch.ts[57-73]
pnpm/crates/cli/src/cli_args/version.rs[366-385]
pnpm/crates/cli/src/cli_args/version.rs[413-421]

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

### Issue description
`is_version_published()` treats HTTP 404 as a definitive “not published” signal. In pnpm semantics, 404 can also represent an authorization-masked failure ("not in registry, or no permission"). Using 404 as “unpublished” can therefore make `pnpm version -r`/`pnpm change status` proceed with a wrong plan instead of failing as designed.

### Issue Context
This PR’s stated contract is “fail on error; only definitive 404 means not published.” The codebase itself documents that 404 is ambiguous for registry metadata fetches.

### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[122-151]
- pnpm11/resolving/npm-resolver/src/fetch.ts[57-73]

### Suggested fix
- When the packument probe returns 404, add an additional auth/health disambiguation step before treating it as unpublished (e.g. a lightweight `/-/whoami` probe against the same registry origin when an auth header would be sent), and fail the command if that check indicates auth is invalid/unusable.
- Alternatively, make “treat 404 as unpublished” conditional on additional evidence from the response body/headers (if available), and otherwise error with a message explaining that 404 can also mean lack of permission.
- Ensure the same semantics are implemented in both Rust and TS stacks to keep parity.

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


3. Client-per-probe throttling bypass ✓ Resolved 🐞 Bug ➹ Performance
Description
The unpublished release directory probing fans out checks for all releases concurrently, but each
per-release check constructs a fresh registry client (Rust: a new ThrottledClient; TypeScript: a new
RegistryClient), which defeats intended global concurrency limiting, reduces connection reuse, and
adds avoidable per-release setup overhead. On large release plans this can burst far more concurrent
registry connections than intended, causing rate-limit failures and local FD/socket pressure.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R114-118]

+async fn is_version_published(config: &Config, name: &str, version: &str) -> miette::Result<bool> {
+    let client = build_registry_client(config)?;
+    let registry = registry_for(config, name);
+    let url = format!("{registry}{}", encode_package_name(name));
+    let guard = client.acquire_for_url(&url).await;
Evidence
In Rust, unpublished_release_dirs() calls is_version_published() once per release and awaits
them together via try_join_all, while is_version_published() rebuilds a new ThrottledClient
each time through build_registry_client; because ThrottledClient::for_installs creates a fresh
semaphore per instance, these concurrent probes don’t share a single global network_concurrency
limiter. In TypeScript, resolveUnpublishedDirs() probes all releases via Promise.all and
defaults to isVersionPublished(), which creates a new RegistryClient per call even though the
module comments explicitly note that the client should be created once to avoid reconstructing
underlying dispatcher/TLS setup, indicating unnecessary per-release overhead and reduced reuse
during large probes.

pnpm/crates/cli/src/cli_args/changelog.rs[87-107]
pnpm/crates/cli/src/cli_args/changelog.rs[114-138]
pnpm/crates/cli/src/cli_args/registry_client.rs[6-22]
pnpm/crates/network/src/lib.rs[431-440]
pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[31-40]
pnpm11/releasing/commands/src/publish/previousChangelog.ts[34-49]
pnpm11/releasing/commands/src/publish/previousChangelog.ts[84-94]

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

## Issue description
Unpublished-release probing currently fans out checks for every release concurrently, but the default per-release check path constructs a new registry client for each release (Rust: `ThrottledClient`; TypeScript: `RegistryClient`). This both adds avoidable setup overhead and reduces connection reuse, and in Rust it also bypasses the intended single global `network_concurrency` bound because each client instance owns its own semaphore, potentially causing excessive concurrent registry traffic (rate limits, FD/socket pressure) on large workspaces.

## Issue Context
- Rust: `unpublished_release_dirs()` is a hot path used by `pnpm change status` and `pnpm version -r`, so large workspaces can trigger many concurrent probes.
- TypeScript: `resolveUnpublishedDirs()` currently uses `Promise.all`, and the module already defines `createRegistryClient()` specifically to avoid reconstructing dispatcher/TLS setup per request, implying the client is meant to be reused.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[87-107]
- pnpm/crates/cli/src/cli_args/changelog.rs[114-138]
- pnpm/crates/cli/src/cli_args/registry_client.rs[6-22]
- pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[31-40]
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[34-49]
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[91-94]

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


View more (1)
4. Registry URL leaks creds ✓ Resolved 🐞 Bug ⛨ Security
Description
Rust is_version_published() interpolates the full registry URL into an error message; if the
configured registry URL includes embedded userinfo credentials, they can be printed to terminal/CI
logs. This is inconsistent with existing code paths that redact URL credentials before surfacing
errors.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R131-134]

+    if !status.is_success() {
+        return Err(miette::miette!(
+            "registry returned status {status} for {url} while checking whether {name}@{version} is published",
+        ));
Evidence
The new error message uses {url} directly. The network crate exports a URL redaction helper and
other CLI code uses it when reporting registry URL failures, indicating credential redaction is an
established safety requirement.

pnpm/crates/cli/src/cli_args/changelog.rs[114-138]
pnpm/crates/network/src/lib.rs[11-17]
pnpm/crates/cli/src/cli_args/audit/signatures.rs[462-479]

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

### Issue description
`is_version_published()` includes the raw `{url}` in an error string. If the registry URL contains `user:pass@...` (or similar userinfo), this can leak credentials into logs.

### Issue Context
Other registry-fetching code paths in this repo explicitly call `redact_url_credentials()` before logging/displaying URLs.

### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[131-137]

### Suggested fix
- Compute a `display_url = pacquet_network::redact_url_credentials(&url)` and use `display_url` in the `miette!` message instead of `url`.
- Keep the full URL only for internal/debug-only contexts if needed, but ensure user-facing diagnostics are redacted.

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



Remediation recommended

5. Two-pass assemble logic duplicated 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The new probe→reassemble flow is reimplemented inline in multiple command paths (both Rust and
TypeScript), increasing drift risk and maintenance cost when probe behavior/options change. This
violates the repo guidance to avoid copy-pasted non-trivial logic by extracting shared
helpers/utilities.
Code

pnpm/crates/cli/src/cli_args/version.rs[R366-382]

+        let assemble = |unpublished_dirs: HashSet<String>| {
+            assemble_release_plan(
+                &engine_projects,
+                &workspace_dir,
+                &intents,
+                &ledger,
+                Some(&config.versioning),
+                &AssembleReleasePlanOptions {
+                    filter: filter.clone(),
+                    snapshot_suffix: None,
+                    enforce_workspace_protocol: true,
+                    unpublished_dirs,
+                },
+            )
+        };
+        let unpublished_dirs = unpublished_release_dirs(config, &assemble(HashSet::new())?).await?;
+        let plan = assemble(unpublished_dirs)?;
Evidence
PR Compliance ID 2 requires avoiding duplicated non-trivial logic by reusing utilities or extracting
shared code. The same two-pass assemble→unpublished_* probe→re-assemble pattern is newly added
in multiple locations, which can drift over time and complicates future changes to probe
behavior/options.

CLAUDE.md, AGENTS.md: Avoid duplication by reusing existing repo utilities and extracting shared code
pnpm/crates/cli/src/cli_args/change.rs[290-309]
pnpm/crates/cli/src/cli_args/version.rs[366-382]
pnpm11/releasing/commands/src/change/index.ts[237-249]
pnpm11/releasing/commands/src/version/index.ts[219-249]

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

## Issue description
The registry-probe + second-pass `assemble_release_plan` logic is duplicated across multiple command implementations (Rust `change status`/`version -r` and TS `change`/`version`). This makes it easy for one call site to diverge (e.g., different options, future flags, error handling), violating the repo’s duplication-avoidance guidance.

## Issue Context
Both stacks follow the same two-pass pattern:
1) assemble a base plan (no unpublished dirs)
2) probe registry using that plan
3) re-assemble with `unpublishedDirs`/`unpublished_dirs`

This is now repeated at multiple call sites and should be centralized in a helper per stack (or otherwise reduced), so future behavioral changes remain consistent.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/change.rs[290-309]
- pnpm/crates/cli/src/cli_args/version.rs[366-382]
- pnpm11/releasing/commands/src/change/index.ts[237-249]
- pnpm11/releasing/commands/src/version/index.ts[219-249]

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


6. Repo-configured probe networking 🐞 Bug ⛨ Security ⭐ New
Description
pnpm change status (and pnpm version -r) now performs live registry HTTP probes as part of
rendering/applying the release plan, and the probe destination is derived from workspace registry
configuration plus package names. Running these commands in an untrusted repo can therefore trigger
unexpected outbound connections (and leak internal-network reachability via success vs connect/parse
failures), even though repo-controlled config is prevented from supplying/redirecting auth tokens.
Code

pnpm/crates/cli/src/cli_args/change.rs[R307-309]

+    // Probe as the release does, so the preview matches it.
+    let unpublished_dirs = unpublished_release_dirs(config, &assemble(HashSet::new())?).await?;
+    let plan = assemble(unpublished_dirs)?;
Evidence
The PR introduces a registry probe into change status and version -r, and the probe’s URL is
constructed from Config.registry/Config.registries (which can be set by repo workspace yaml).
Config tests demonstrate repo-controlled registry routes are accepted, while also showing repo
config cannot supply/redirect auth tokens—so the primary risk is unexpected outbound
networking/reachability side channels rather than straightforward token exfiltration.

pnpm/crates/cli/src/cli_args/change.rs[290-310]
pnpm/crates/cli/src/cli_args/version.rs[366-383]
pnpm/crates/cli/src/cli_args/changelog.rs[84-140]
pnpm/crates/cli/src/cli_args/changelog.rs[198-208]
pnpm/crates/config/src/tests.rs[548-577]
pnpm/crates/config/src/tests.rs[803-821]

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

### Issue description
`pnpm change status` / `pnpm version -r` now unconditionally probe the registry to resolve first-release behavior. The probe target registry URL can be set via repo-controlled workspace config (`pnpm-workspace.yaml#registries`), which means simply running these commands in an untrusted repository triggers outbound requests to attacker-chosen hosts/paths. Even though repo-controlled auth is blocked, this still expands the network attack surface and enables internal-network reachability side channels in CI.

### Issue Context
- The new flow calls `unpublished_release_dirs(...)` during `change status` rendering and during `version -r` planning.
- The probe uses registry URLs selected from `Config.registry` / `Config.registries`, which can be populated from `pnpm-workspace.yaml`.

### Fix Focus Areas
- Add an explicit opt-out/assumption mode (flag or env var) for these probes (e.g. `--assume-versions-published` or `--no-registry-probe`) so CI and security-conscious users can keep `change status` local-only.
- Ensure the same knob exists in the TypeScript command stack (`resolveUnpublishedDirs`) for parity.

- pnpm/crates/cli/src/cli_args/change.rs[290-309]
- pnpm/crates/cli/src/cli_args/version.rs[366-382]
- pnpm/crates/cli/src/cli_args/changelog.rs[84-140]
- pnpm/crates/cli/src/cli_args/changelog.rs[198-208]
- pnpm11/releasing/commands/src/change/index.ts[237-249]
- pnpm11/releasing/commands/src/version/index.ts[238-249]
- pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[16-27]

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


7. maxSockets ignored in probes 🐞 Bug ➹ Performance
Description
The new unpublished_release_dirs registry probe fans out concurrent requests using
build_registry_client(config), but that client does not apply Config.max_sockets, so a large
release plan can open up to network_concurrency concurrent connections to one registry origin even
when the user configured a lower per-origin cap. This can increase rate-limit/FD pressure and makes
maxSockets ineffective specifically for pnpm change status / pnpm version -r probing.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R111-122]

+    let client = build_registry_client(config)?;
+    let checks = plan.releases.iter().map(|release| {
+        let client = &client;
+        async move {
+            let published =
+                is_version_published(client, config, &release.name, &release.current_version)
+                    .await?;
+            Ok::<_, miette::Report>((release.dir.clone(), published))
+        }
+    });
+    let probed = futures_util::future::try_join_all(checks).await?;
+    Ok(probed.into_iter().filter_map(|(dir, published)| (!published).then_some(dir)).collect())
Evidence
unpublished_release_dirs() creates one probe future per planned release and executes them
concurrently using a shared client from build_registry_client(). That builder sets global
network_concurrency and timeouts but does not apply the per-origin max_sockets cap, while the
install client does; Config.max_sockets is explicitly intended to cap sockets per
scheme://host[:port] origin.

pnpm/crates/cli/src/cli_args/changelog.rs[93-123]
pnpm/crates/cli/src/cli_args/registry_client.rs[6-22]
pnpm/crates/cli/src/state.rs[83-100]
pnpm/crates/config/src/lib.rs[1159-1173]

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

### Issue description
`unpublished_release_dirs()` performs a concurrent registry probe across `plan.releases`. It builds its HTTP client via `build_registry_client(config)`, but that helper currently does **not** apply the per-origin socket cap (`Config.max_sockets`). As a result, a workspace with many releases can open more concurrent connections to a single registry origin than the user intended.

### Issue Context
The normal install client explicitly applies `.with_max_sockets_per_host(config.max_sockets)`, and `Config.max_sockets` is documented as a per-origin connection cap. The new probe path should respect the same setting, since it is a fan-out registry workload.

### Fix
Update `build_registry_client()` to chain `.with_max_sockets_per_host(config.max_sockets)` on the constructed `ThrottledClient`.

### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/registry_client.rs[6-22]
- pnpm/crates/cli/src/cli_args/changelog.rs[93-123]
- pnpm/crates/cli/src/state.rs[83-100]

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


View more (6)
8. Hardcoded DEFAULT_NETWORK_CONCURRENCY 16 📘 Rule violation ⚙ Maintainability
Description
resolveUnpublishedDirs() hardcodes a DEFAULT_NETWORK_CONCURRENCY value and the change command
option type does not clearly route the existing Config.networkConcurrency through to this probe.
This can ignore user config and create inconsistent probe fan-out behavior across commands.
Code

pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[R6-7]

+/** pnpm's default `network-concurrency`, the cap for the probe fan-out. */
+const DEFAULT_NETWORK_CONCURRENCY = 16
Evidence
PR Compliance ID 8 requires routing configurable values through @pnpm/config into command options
rather than hardcoding them. The new probe helper introduces a hardcoded default
(DEFAULT_NETWORK_CONCURRENCY = 16) and the change command options type does not explicitly
include Config.networkConcurrency, so the probe may not respect configured concurrency.

AGENTS.md: Configuration and layering: route configurable values through @pnpm/config and keep handlers unit-testable
pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[6-7]
pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[18-21]
pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[39-40]
pnpm11/releasing/commands/src/change/index.ts[64-74]

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

## Issue description
`resolveUnpublishedDirs()` falls back to a hardcoded `DEFAULT_NETWORK_CONCURRENCY = 16`, and the `change` command's `ChangeCommandOptions` type does not explicitly include `networkConcurrency` from `Config`. This risks ignoring user configuration and makes probe concurrency less consistent/centralized than other pnpm settings.

## Issue Context
The repo convention is that configurable values should flow through `@pnpm/config` into command options (rather than being re-defaulted locally).

## Fix Focus Areas
- pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[6-7]
- pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[18-21]
- pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[39-40]
- pnpm11/releasing/commands/src/change/index.ts[64-74]

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


9. Full packument probe fetch 🐞 Bug ➹ Performance
Description
Rust is_version_published() downloads and deserializes the entire packument into Package just to
check whether one version exists, adding avoidable network/CPU/memory cost per release and
increasing susceptibility to unusually large registry responses. Use the per-version endpoint
(/{pkg}/{version}) (or HEAD where supported) and decide based on HTTP status instead of parsing
the full versions map.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R130-153]

+    let registry = registry_for(config, name);
+    let url = format!("{registry}{}", encode_package_name(name));
+    let guard = client.acquire_for_url(&url).await;
+    let mut request = guard.get(&url).header(
+        "accept",
+        "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",
+    );
+    if let Some(value) = config.auth_headers.for_url_with_package(&url, Some(name)) {
+        request = request.header("authorization", value);
+    }
+    let response = request.send().await.into_diagnostic()?;
+    let status = response.status();
+    if status.as_u16() == 404 {
+        return Ok(false);
+    }
+    if !status.is_success() {
+        let display_url = redact_url_credentials(&url);
+        return Err(miette::miette!(
+            "registry returned status {status} for {display_url} while checking whether {name}@{version} is published",
+        ));
+    }
+    let package: Package = response.json().await.into_diagnostic()?;
+    Ok(package.versions.contains_key(version))
+}
Evidence
The new probe deserializes Package solely to check membership in versions, which implies
fetching/parsing the full packument for each release. The registry crate docs explicitly call out
packuments with many versions as expensive to hydrate/handle, supporting the performance concern.

pnpm/crates/cli/src/cli_args/changelog.rs[119-153]
pnpm/crates/registry/src/package_versions.rs[2-16]
pnpm/crates/network/src/url_encoding.rs[3-27]

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

## Issue description
`is_version_published()` currently GETs the package-level packument and deserializes it into `Package`, then checks `package.versions.contains_key(version)`. This is significantly more data and work than needed for an exact-version existence check.

## Issue Context
This probe runs once per release in `unpublished_release_dirs()`. Packuments can be large (many versions), so repeatedly downloading and parsing them increases runtime and memory pressure.

## Fix
Change the probe to request the per-version endpoint:
- Build URL as: `{registry}{encode_package_name(name)}/{encode_uri_component(version)}`
- Send request with the same Accept header and auth header logic.
- Interpret statuses:
 - `404` => `Ok(false)` (unpublished)
 - other non-success => error (preserve current “fail on error” behavior)
 - success => `Ok(true)` (no need to deserialize JSON)

If you use GET, consider consuming/discarding the body to keep connection reuse healthy; HEAD may avoid body transfer if the registry supports it.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[124-153]

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


10. Unbounded probe fan-out ✓ Resolved 🐞 Bug ➹ Performance
Description
TypeScript resolveUnpublishedDirs() uses Promise.all over every release probe with no explicit
concurrency bound, which can create large amounts of pending work and amplify retry/rate-limit
behavior on big workspaces. This is inconsistent with other registry fan-outs in-repo that use an
explicit concurrency limiter.
Code

pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[R31-38]

+export async function resolveUnpublishedDirs (plan: ReleasePlan, opts: UnpublishedProbeOptions): Promise<Set<string>> {
+  const checkVersionPublished = opts.checkVersionPublished ?? createVersionPublishedChecker(opts)
+  const probed = await Promise.all(
+    plan.releases.map(async (release) => ({
+      dir: release.dir,
+      published: await checkVersionPublished(release.name, release.currentVersion),
+    }))
+  )
Evidence
The new TS probe runs all checks at once with Promise.all and no limiter, while other
security-sensitive registry fan-outs in this repo use p-limit with a configured concurrency value to
avoid bursts.

pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[31-39]
pnpm11/deps/security/signatures/src/verifySignatures.ts[84-88]
pnpm11/network/fetch/src/dispatcher.ts[12-30]

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

### Issue description
`resolveUnpublishedDirs()` probes all releases via `Promise.all(...)` without a concurrency limit. Even if undici’s dispatcher limits active sockets, this still schedules one async probe per release and can create a large queue of pending work (plus retries) on big workspaces.

### Issue Context
Elsewhere in this repo, similar registry fan-outs use `p-limit` + `networkConcurrency` to bound concurrent work.

### Fix Focus Areas
- pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts[31-39]

### Suggested fix
- Add a concurrency limiter (e.g. `p-limit`) around `checkVersionPublished` calls.
- Choose the bound from an existing option if available (e.g. plumb `networkConcurrency` into `UnpublishedProbeOptions`), or at minimum derive a safe bound from existing dispatcher/socket settings (and default conservatively).
- Keep error propagation semantics the same (any probe failure rejects).

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


11. into_diagnostic lacks probe context 📘 Rule violation ◔ Observability
Description
Network/JSON failures in the new registry probe are converted via into_diagnostic() without adding
package/version/URL context, which can produce hard-to-diagnose user-facing errors. This violates
the requirement to provide contextual error messages for user-reachable failures.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R138-150]

+    let response = request.send().await.into_diagnostic()?;
+    let status = response.status();
+    if status.as_u16() == 404 {
+        return Ok(false);
+    }
+    if !status.is_success() {
+        let display_url = redact_url_credentials(&url);
+        return Err(miette::miette!(
+            "registry returned status {status} for {display_url} while checking whether {name}@{version} is published",
+        ));
+    }
+    let package: Package = response.json().await.into_diagnostic()?;
+    Ok(package.versions.contains_key(version))
Evidence
Compliance ID 5 requires contextual user-facing errors. The new probe uses
request.send().await.into_diagnostic()? and response.json().await.into_diagnostic()? without
wrapping, so failures may not indicate which package/version check failed.

AGENTS.md: Use PnpmError for User-Reachable Errors and Provide Contextual Error Messages
pnpm/crates/cli/src/cli_args/changelog.rs[138-150]

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

## Issue description
The new registry probe path surfaces errors without enough context (which `name@version` and which registry URL was being checked).

## Issue Context
This code runs in user commands like `pnpm version -r` / `pnpm change status`, so failures should be actionable.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[138-150]

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


12. is_version_published reimplements packument fetch 📘 Rule violation ⚙ Maintainability
Description
The new Rust registry probe manually builds a packument URL, sends the request, and deserializes
Package, duplicating existing registry-fetch utilities already used elsewhere in the CLI. This
increases divergence risk (headers/retry/auth behavior) and violates the repo guidance to reuse
existing utilities instead of reimplementing them.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R122-151]

+async fn is_version_published(
+    client: &ThrottledClient,
+    config: &Config,
+    name: &str,
+    version: &str,
+) -> miette::Result<bool> {
+    let registry = registry_for(config, name);
+    let url = format!("{registry}{}", encode_package_name(name));
+    let guard = client.acquire_for_url(&url).await;
+    let mut request = guard.get(&url).header(
+        "accept",
+        "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",
+    );
+    if let Some(value) = config.auth_headers.for_url_with_package(&url, Some(name)) {
+        request = request.header("authorization", value);
+    }
+    let response = request.send().await.into_diagnostic()?;
+    let status = response.status();
+    if status.as_u16() == 404 {
+        return Ok(false);
+    }
+    if !status.is_success() {
+        let display_url = redact_url_credentials(&url);
+        return Err(miette::miette!(
+            "registry returned status {status} for {display_url} while checking whether {name}@{version} is published",
+        ));
+    }
+    let package: Package = response.json().await.into_diagnostic()?;
+    Ok(package.versions.contains_key(version))
+}
Evidence
Compliance ID 2 requires reusing existing utilities instead of duplicating non-trivial logic.
is_version_published() performs a bespoke HTTP GET + JSON parse for packument-like data even
though the same file already uses Package::fetch_from_registry for registry metadata fetches.

AGENTS.md: Avoid Code Duplication by Reusing Existing Repo Utilities and Well-Maintained Dependencies
pnpm/crates/cli/src/cli_args/changelog.rs[122-151]
pnpm/crates/cli/src/cli_args/changelog.rs[162-167]

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

## Issue description
`is_version_published()` reimplements packument fetching/parsing instead of reusing existing repo utilities.

## Issue Context
This duplicates logic and risks behavior drift (auth handling, retries, headers, error mapping) across CLI code paths.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[122-151]

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


13. first release comment duplicated ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
New inline comments in render_status are duplicated across Rust call sites and largely restate the
probe→reassemble flow already expressed by the code and documented on unpublished_release_dirs.
This increases maintenance burden and risks comment drift across peers.
Code

pnpm/crates/cli/src/cli_args/change.rs[R307-309]

+    // First release of a never-published package publishes its manifest version
+    // verbatim, so the preview matches the release: probe the first pass's
+    // releases and re-assemble with those held at their current version.
Evidence
PR Compliance ID 5 forbids new comments that restate code or duplicate shared rationale across
peers. The same probe-and-reassemble explanation is added in both change.rs and version.rs,
while the behavior is already documented centrally on unpublished_release_dirs, making the
call-site copies redundant.

AGENTS.md: Do not add comments that restate code; comments must document non-obvious rationale or contract
pnpm/crates/cli/src/cli_args/change.rs[307-309]
pnpm/crates/cli/src/cli_args/version.rs[381-383]
pnpm/crates/cli/src/cli_args/changelog.rs[81-87]

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

## Issue description
New comments repeat the same explanation at multiple call sites and largely restate what the code already does.

## Issue Context
Rule requires comments to add non-obvious value and avoid duplicating rationale across peers/call sites.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/change.rs[307-309]
- pnpm/crates/cli/src/cli_args/version.rs[381-383]
- pnpm/crates/cli/src/cli_args/changelog.rs[81-87]

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



Informational

14. try_join_all retains futures 🐞 Bug ➹ Performance ⭐ New
Description
unpublished_release_dirs() uses try_join_all across all releases, retaining one future and one
result slot per release even though in-flight I/O is semaphore-limited. On very large release plans
this creates avoidable linear memory/polling overhead in pnpm change status / pnpm version -r.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R94-106]

+    // One client for the batch; its per-origin semaphore bounds the fan-out.
+    let client = build_registry_client(config)?;
+    let checks = plan.releases.iter().map(|release| {
+        let client = &client;
+        async move {
+            let published =
+                is_version_published(client, config, &release.name, &release.current_version)
+                    .await?;
+            Ok::<_, miette::Report>((release.dir.clone(), published))
+        }
+    });
+    let probed = futures_util::future::try_join_all(checks).await?;
+    Ok(probed.into_iter().filter_map(|(dir, published)| (!published).then_some(dir)).collect())
Evidence
The probe constructs a future per release and uses try_join_all, which retains all futures/results
until the end of the batch, independent of the request semaphore. The same code path is exercised
from change status and version -r.

pnpm/crates/cli/src/cli_args/changelog.rs[84-107]
pnpm/crates/cli/src/cli_args/change.rs[290-310]
pnpm/crates/cli/src/cli_args/version.rs[366-383]

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

### Issue description
`unpublished_release_dirs()` builds an iterator of per-release async blocks and passes it to `try_join_all`, which retains all futures/results until completion. Even with `ThrottledClient` limiting concurrent requests, this still creates linear retained state and polling overhead proportional to the number of releases.

### Issue Context
The command behavior is correct, but can be made more scalable by only keeping a bounded number of in-flight futures while collecting unpublished dirs incrementally.

### Fix Focus Areas
- Replace `try_join_all` with a streaming pattern such as `futures_util::stream::iter(...).buffer_unordered(k)` where `k` is derived from configured concurrency.
- Fold results directly into `HashSet<String>` rather than materializing `Vec<(String,bool)>`.

- pnpm/crates/cli/src/cli_args/changelog.rs[84-107]

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


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@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.05     11.5±0.17ms    32.4 MB/sec    1.00     11.0±0.05ms    33.9 MB/sec
packument/parse                1.00     37.3±0.14µs  1777.3 MB/sec    1.04     38.9±0.27µs  1703.7 MB/sec
tarball/download_dependency    1.00      2.3±0.11ms  1888.5 KB/sec    1.02      2.3±0.07ms  1851.5 KB/sec

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
pnpm/crates/cli/tests/change.rs (1)

39-87: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing Rust regression test for the "probe errors" path.

This file adds coverage for "published" (200, version present) and "unpublished-but-existing-package" (200, version absent from versions), but nothing here (or elsewhere in the provided context) exercises is_version_published's definitive-404 branch or its non-success-status error-propagation branch against the mock registry — the TS-side equivalent (a registry probe failure fails the command rather than guessing the version in pnpm11/releasing/commands/test/change/index.test.ts) has no Rust counterpart here.

As per path instructions, "Add regression tests that fail without the fix: cover both 'published' and 'not published' outcomes, plus the 'probe throws error' failure path," and pnpm/AGENTS.md's "Testing" rule requires proving "probe-error behavior via the right level." Consider adding a test that makes the mock registry return a non-200/non-404 status (or is otherwise unreachable) for a package in the plan, and asserts pnpm change status / pnpm version -r fail rather than silently guessing a version.

🤖 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/cli/tests/change.rs` around lines 39 - 87, Add a Rust regression
test alongside
first_release_probe_bumps_a_version_the_registry_reports_published and
first_release_probe_debuts_an_unpublished_version_verbatim that configures the
mocked registry to return a non-success, non-404 response or be unreachable for
the planned package, then asserts the pnpm change/version flow fails and does
not guess or apply a version.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/cli/tests/change.rs`:
- Around line 113-124: Update the comment above the pnpm helper to reference the
actual test function first_release_probe_debuts_an_unpublished_version_verbatim
instead of the stale
first_release_of_an_unpublished_version_is_published_verbatim name.

In `@pnpm11/releasing/commands/src/publish/previousChangelog.ts`:
- Around line 91-93: Update isVersionPublished and the fetchPackument flow so a
notModified response is never treated as unpublished: preserve distinct 404 and
not-modified outcomes, then retry or fail explicitly for not-modified instead of
returning undefined. Keep the existing false result for a confirmed missing
package/version, and add a regression test covering an already-published release
receiving a 304 response.

---

Nitpick comments:
In `@pnpm/crates/cli/tests/change.rs`:
- Around line 39-87: Add a Rust regression test alongside
first_release_probe_bumps_a_version_the_registry_reports_published and
first_release_probe_debuts_an_unpublished_version_verbatim that configures the
mocked registry to return a non-success, non-404 response or be unreachable for
the planned package, then asserts the pnpm change/version flow fails and does
not guess or apply a version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d976cda3-e04b-480e-bd99-f35d356a8867

📥 Commits

Reviewing files that changed from the base of the PR and between ff81510 and 4dc6527.

📒 Files selected for processing (15)
  • .changeset/first-release-verbatim.md
  • pnpm/crates/cli/src/cli_args/change.rs
  • pnpm/crates/cli/src/cli_args/changelog.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/version.rs
  • pnpm/crates/cli/tests/change.rs
  • pnpm/crates/versioning/src/plan.rs
  • pnpm/crates/versioning/src/plan/tests.rs
  • pnpm11/releasing/commands/src/change/index.ts
  • pnpm11/releasing/commands/src/publish/previousChangelog.ts
  • pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts
  • pnpm11/releasing/commands/src/version/index.ts
  • pnpm11/releasing/commands/test/change/index.test.ts
  • pnpm11/releasing/versioning/src/assembleReleasePlan.ts
  • pnpm11/releasing/versioning/test/assembleReleasePlan.ts

Comment thread pnpm/crates/cli/tests/change.rs Resolved
@codecov-commenter

codecov-commenter commented Jul 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.55319% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.90%. Comparing base (b080184) to head (707aa18).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/cli/src/cli_args/changelog.rs 87.23% 6 Missing ⚠️
pnpm/crates/versioning/src/plan.rs 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13207      +/-   ##
==========================================
+ Coverage   86.78%   86.90%   +0.11%     
==========================================
  Files         525      526       +1     
  Lines       89206    90004     +798     
==========================================
+ Hits        77421    78214     +793     
- Misses      11785    11790       +5     

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

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 01f101d27bf2

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.573 ± 0.175 2.358 2.794 1.70 ± 0.19
pacquet@main 2.519 ± 0.177 2.356 2.787 1.66 ± 0.19
pnpr@HEAD 1.608 ± 0.132 1.394 1.774 1.06 ± 0.13
pnpr@main 1.517 ± 0.139 1.370 1.730 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.57277973452,
      "stddev": 0.1746232711932148,
      "median": 2.5473582951200004,
      "user": 1.56210248,
      "system": 1.3036879000000001,
      "min": 2.35829011162,
      "max": 2.7943479896200003,
      "times": [
        2.5364756336200003,
        2.7943479896200003,
        2.55824095662,
        2.45326294862,
        2.77290503262,
        2.37073821262,
        2.40929247762,
        2.7062034176200003,
        2.76804056462,
        2.35829011162
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.5194958270200005,
      "stddev": 0.17670972227587256,
      "median": 2.43204503612,
      "user": 1.54913718,
      "system": 1.2844133999999998,
      "min": 2.35606558562,
      "max": 2.78744367862,
      "times": [
        2.46396902162,
        2.73997620862,
        2.35606558562,
        2.6401605746200003,
        2.78744367862,
        2.36996794462,
        2.36474769462,
        2.40012105062,
        2.37018233662,
        2.70232417462
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.6076327758200002,
      "stddev": 0.1320055762216753,
      "median": 1.61847188362,
      "user": 1.0865654799999998,
      "system": 1.1695411000000002,
      "min": 1.3941913026200001,
      "max": 1.7737274546200001,
      "times": [
        1.5955773446200001,
        1.58869060562,
        1.4594982126200002,
        1.7737274546200001,
        1.3941913026200001,
        1.64136642262,
        1.75495930762,
        1.7463156476200001,
        1.64705727062,
        1.4749441896200002
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.51679667232,
      "stddev": 0.13927423732482078,
      "median": 1.49335840412,
      "user": 1.06308268,
      "system": 1.1789485,
      "min": 1.3704231606200001,
      "max": 1.72993003862,
      "times": [
        1.6155138556200002,
        1.44638568362,
        1.72101558562,
        1.3704231606200001,
        1.5403311246200002,
        1.38761869862,
        1.38972054262,
        1.39487995062,
        1.57214808262,
        1.72993003862
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 262.3 ± 6.6 254.8 275.2 1.01 ± 0.03
pacquet@main 258.4 ± 5.1 249.5 264.8 1.00
pnpr@HEAD 264.3 ± 5.5 257.4 273.5 1.02 ± 0.03
pnpr@main 274.8 ± 6.1 264.4 282.1 1.06 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.26227333384,
      "stddev": 0.00658884972923332,
      "median": 0.26057491244000003,
      "user": 0.21846428,
      "system": 0.53181336,
      "min": 0.25480226744,
      "max": 0.27517922544,
      "times": [
        0.25852639544000006,
        0.26144034044000003,
        0.25480226744,
        0.26777857144000006,
        0.26706801844000005,
        0.26618395944,
        0.25640744944000005,
        0.25563762644000004,
        0.25970948444,
        0.27517922544
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.25841542614,
      "stddev": 0.005112960038691863,
      "median": 0.25868391544,
      "user": 0.20661708,
      "system": 0.5365918599999999,
      "min": 0.24950968044,
      "max": 0.26478277244000004,
      "times": [
        0.25325800144000005,
        0.25778023544,
        0.25754292044000004,
        0.26478277244000004,
        0.25376809944,
        0.24950968044,
        0.26389644944,
        0.25958759544000004,
        0.25992311544,
        0.26410539144000006
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.2643292326400001,
      "stddev": 0.005461185887189271,
      "median": 0.2652729609400001,
      "user": 0.21221498,
      "system": 0.5041998599999999,
      "min": 0.25735231244,
      "max": 0.27352091344,
      "times": [
        0.26832476644000003,
        0.27352091344,
        0.26623223044000005,
        0.25873925344000004,
        0.25735231244,
        0.26133224844,
        0.26431369144000005,
        0.26912504744000004,
        0.25753009544000005,
        0.26682176744
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.27483818204000005,
      "stddev": 0.006075076456716234,
      "median": 0.27560685144,
      "user": 0.21405557999999997,
      "system": 0.5559270599999999,
      "min": 0.26440842344000004,
      "max": 0.28205228344000005,
      "times": [
        0.27976838544000004,
        0.26508930644,
        0.27288954944000005,
        0.28003566544,
        0.27665168744,
        0.27896595944,
        0.26440842344000004,
        0.27395854444,
        0.27456201544000003,
        0.28205228344000005
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.803 ± 0.013 2.786 2.826 1.80 ± 0.15
pacquet@main 2.790 ± 0.028 2.762 2.839 1.79 ± 0.15
pnpr@HEAD 1.560 ± 0.128 1.443 1.793 1.00
pnpr@main 1.577 ± 0.148 1.433 1.830 1.01 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.8029215033999995,
      "stddev": 0.013451275772936488,
      "median": 2.8020693068,
      "user": 1.74393164,
      "system": 1.3627101799999999,
      "min": 2.7856401813,
      "max": 2.8259184782999998,
      "times": [
        2.7908815413,
        2.8097357103,
        2.7927460773,
        2.7900113393,
        2.7982831013,
        2.7856401813,
        2.8177126093,
        2.8259184782999998,
        2.8124304833,
        2.8058555123
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.7900142818,
      "stddev": 0.027804526898326618,
      "median": 2.7826959907999997,
      "user": 1.71573514,
      "system": 1.3416808799999997,
      "min": 2.7616969292999998,
      "max": 2.8393434952999996,
      "times": [
        2.7948960493,
        2.8380257032999996,
        2.7639893643,
        2.7732457293,
        2.7616969292999998,
        2.7870754013,
        2.8393434952999996,
        2.7730021962999998,
        2.7783165803,
        2.7905513693
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5596727268,
      "stddev": 0.12807804273242845,
      "median": 1.5243593523,
      "user": 1.0615969399999998,
      "system": 1.1332690799999998,
      "min": 1.4430712403000001,
      "max": 1.7925253133,
      "times": [
        1.4586356103,
        1.5750250823,
        1.7925253133,
        1.5812290143,
        1.6341360573000001,
        1.4530561403,
        1.4430712403000001,
        1.4470276173,
        1.7383275703,
        1.4736936223000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5765824828,
      "stddev": 0.14787533335509553,
      "median": 1.5179271638,
      "user": 1.0547748399999999,
      "system": 1.1621175799999999,
      "min": 1.4330105373000002,
      "max": 1.8297941853000002,
      "times": [
        1.4557971783,
        1.5394002023000002,
        1.7651760563,
        1.4512856513,
        1.6748263353,
        1.8297941853000002,
        1.6788191003,
        1.4412614563000001,
        1.4330105373000002,
        1.4964541253
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 610.6 ± 11.7 586.2 625.7 1.98 ± 0.06
pacquet@main 601.5 ± 7.1 590.7 614.8 1.95 ± 0.05
pnpr@HEAD 310.1 ± 3.7 302.1 314.0 1.01 ± 0.03
pnpr@main 307.9 ± 6.8 297.7 318.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6106210118200001,
      "stddev": 0.011741208259020494,
      "median": 0.6114937932200001,
      "user": 0.7466967,
      "system": 0.69796318,
      "min": 0.58616409422,
      "max": 0.6256930152200001,
      "times": [
        0.6241598392200001,
        0.58616409422,
        0.6201316282200001,
        0.6104109632200001,
        0.60083034022,
        0.6256930152200001,
        0.6125766232200001,
        0.6057487922200001,
        0.6072555472200001,
        0.6132392752200001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6014821920200001,
      "stddev": 0.007125988860868265,
      "median": 0.5997835182200001,
      "user": 0.7311522,
      "system": 0.6884387799999999,
      "min": 0.5907387312200001,
      "max": 0.6147700152200001,
      "times": [
        0.60260249322,
        0.6068434652200001,
        0.60066098322,
        0.5907387312200001,
        0.59829889522,
        0.6147700152200001,
        0.5989060532200001,
        0.6094284002200001,
        0.5967622642200001,
        0.5958106192200001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31010441332000005,
      "stddev": 0.0036765247096135975,
      "median": 0.31170559172,
      "user": 0.20307489999999997,
      "system": 0.54872168,
      "min": 0.30208842522,
      "max": 0.31402007522,
      "times": [
        0.30866498522,
        0.31169006722,
        0.30208842522,
        0.31261920921999997,
        0.31402007522,
        0.30581736622,
        0.30973941022,
        0.31172111622,
        0.31225342322,
        0.31243005522
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30791983742,
      "stddev": 0.0067913493241376615,
      "median": 0.30870498522,
      "user": 0.21171559999999995,
      "system": 0.5321498799999999,
      "min": 0.29770654022,
      "max": 0.31859474222,
      "times": [
        0.30244808922,
        0.30081449822,
        0.30929611821999997,
        0.29770654022,
        0.30302595222,
        0.30811385222,
        0.31859474222,
        0.31578328122,
        0.31169711122,
        0.31171818922
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.929 ± 0.015 1.903 1.955 6.48 ± 0.17
pacquet@main 1.920 ± 0.014 1.896 1.939 6.45 ± 0.17
pnpr@HEAD 0.297 ± 0.008 0.285 0.309 1.00
pnpr@main 0.311 ± 0.005 0.304 0.318 1.04 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.9289261832600002,
      "stddev": 0.014756889232085233,
      "median": 1.92879073856,
      "user": 0.94810014,
      "system": 0.7986008599999999,
      "min": 1.90308062756,
      "max": 1.95494573256,
      "times": [
        1.95494573256,
        1.90308062756,
        1.92268533556,
        1.9295234545600002,
        1.93472456856,
        1.92805802256,
        1.94255795356,
        1.9351890705600001,
        1.92727473156,
        1.91122233556
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.91961808926,
      "stddev": 0.013593166506259012,
      "median": 1.9201846955600002,
      "user": 0.97443414,
      "system": 0.75507606,
      "min": 1.8960809985600002,
      "max": 1.93878923956,
      "times": [
        1.93878923956,
        1.92935591856,
        1.8960809985600002,
        1.91739624656,
        1.92897500356,
        1.90180985356,
        1.91107877656,
        1.9211730265600002,
        1.93232546456,
        1.91919636456
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.29749084176,
      "stddev": 0.007551374424280347,
      "median": 0.29727380156000005,
      "user": 0.21763114,
      "system": 0.49526066,
      "min": 0.28487152756,
      "max": 0.30859327256,
      "times": [
        0.29710245056,
        0.30796391056000005,
        0.30068189956,
        0.30208089556,
        0.30859327256,
        0.28487152756,
        0.29198814756,
        0.29744515256000004,
        0.29138227056000005,
        0.29279889056
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.31087238936,
      "stddev": 0.0046759843094403885,
      "median": 0.31090439656,
      "user": 0.18558714000000004,
      "system": 0.5710198599999999,
      "min": 0.30413230756000004,
      "max": 0.31761568156000003,
      "times": [
        0.31002655356000003,
        0.30413230756000004,
        0.31533508956000006,
        0.30957526656,
        0.31761568156000003,
        0.31187849956,
        0.31644899156000006,
        0.30485594556,
        0.30707331856000003,
        0.31178223956
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 360.4 ± 14.4 347.1 394.0 4.15 ± 0.18
pacquet@main 362.5 ± 9.9 348.0 371.8 4.17 ± 0.14
pnpr@HEAD 86.9 ± 1.6 82.5 89.2 1.00
pnpr@main 86.9 ± 1.7 83.4 90.5 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.36038450794000004,
      "stddev": 0.014356368158867022,
      "median": 0.35403500714,
      "user": 0.35164897999999994,
      "system": 0.059914079999999995,
      "min": 0.34710853814000003,
      "max": 0.39398846114,
      "times": [
        0.35334953614000003,
        0.34848664614,
        0.35460261814000005,
        0.34710853814000003,
        0.35346739614000006,
        0.37146323314,
        0.36086003414000006,
        0.36903850114000003,
        0.35148011514000005,
        0.39398846114
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.36246485974000003,
      "stddev": 0.009941998557420608,
      "median": 0.36740640114,
      "user": 0.35922458,
      "system": 0.05276617999999998,
      "min": 0.34797473414,
      "max": 0.37183740514,
      "times": [
        0.36728631014,
        0.36752649214000005,
        0.36990145114000006,
        0.34937326014000003,
        0.36790484114000005,
        0.34814864114000005,
        0.37147022514000005,
        0.36322523714000005,
        0.34797473414,
        0.37183740514
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.08685004235212122,
      "stddev": 0.001570442602820156,
      "median": 0.08727174414000001,
      "user": 0.02128328,
      "system": 0.007932890909090912,
      "min": 0.08253464014,
      "max": 0.08922786614,
      "times": [
        0.08572440814000001,
        0.08922786614,
        0.08835285214000001,
        0.08465397914,
        0.08682152814,
        0.08834064914,
        0.08784388714000001,
        0.08806180714,
        0.08538464014000001,
        0.08757115614000001,
        0.08715622614,
        0.08891217214000001,
        0.08728686114,
        0.08391654414000001,
        0.08901288214000001,
        0.08434895614,
        0.08757290814,
        0.08716642514,
        0.08727174414000001,
        0.08787711914,
        0.08681598814000001,
        0.08637253514000001,
        0.08524759214000001,
        0.08782672514,
        0.08458722414000001,
        0.08762771114000001,
        0.08705145914000001,
        0.08767408814000001,
        0.08743346614000001,
        0.08645068214000001,
        0.08253464014,
        0.08803433414,
        0.08589034014000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.08692001726121211,
      "stddev": 0.001709073581592977,
      "median": 0.08711245414,
      "user": 0.020173098181818182,
      "system": 0.008942449696969695,
      "min": 0.08343255614,
      "max": 0.09049536514,
      "times": [
        0.08593705714000001,
        0.08732498414,
        0.08730981414000001,
        0.08892233114,
        0.08604230514000001,
        0.08715767914000001,
        0.08575833114,
        0.08617301114,
        0.08343255614,
        0.08642183714000001,
        0.08733147614,
        0.08862149714,
        0.08572946714,
        0.08847922014000001,
        0.08711245414,
        0.09049536514,
        0.08452633914,
        0.08889389814000001,
        0.08468443514000001,
        0.08786405514000001,
        0.08787007514,
        0.08691931114000001,
        0.08640451514000001,
        0.08874406614000001,
        0.08743610114000001,
        0.08601659714000001,
        0.08711691214,
        0.09034978214,
        0.08583553614,
        0.08526963414000001,
        0.08363327314,
        0.08892457614,
        0.08562207614
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.548 ± 0.146 4.424 4.884 1.29 ± 0.06
pacquet@main 4.610 ± 0.134 4.446 4.827 1.31 ± 0.05
pnpr@HEAD 3.532 ± 0.105 3.450 3.794 1.00
pnpr@main 3.606 ± 0.123 3.465 3.842 1.02 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.547777458400001,
      "stddev": 0.14637295964307528,
      "median": 4.5112010619,
      "user": 1.7523460399999997,
      "system": 1.3723758,
      "min": 4.4235498009,
      "max": 4.8840008309,
      "times": [
        4.4385894269,
        4.4942491019,
        4.4257727049,
        4.4235498009,
        4.4438825329,
        4.5281530219,
        4.8840008309,
        4.5340423499,
        4.6276621699,
        4.6778726439
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.6098880497,
      "stddev": 0.1339374476228893,
      "median": 4.6204611604,
      "user": 1.7541957399999997,
      "system": 1.3777138999999998,
      "min": 4.4464779069,
      "max": 4.8272848079,
      "times": [
        4.7866693669,
        4.6815488349,
        4.4464779069,
        4.6535657499,
        4.6241654549,
        4.5389877739,
        4.4631356209,
        4.4602881149,
        4.6167568659,
        4.8272848079
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.5321629612,
      "stddev": 0.10472188687381068,
      "median": 3.4860621729,
      "user": 1.2502124399999999,
      "system": 1.218512,
      "min": 3.4497187129,
      "max": 3.7944322609,
      "times": [
        3.4758609519,
        3.5564111559000002,
        3.7944322609,
        3.4833510849000002,
        3.4874055449,
        3.6218243509,
        3.4497187129,
        3.4881761829,
        3.4847188009,
        3.4797305659
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.6060302560999995,
      "stddev": 0.12310215051757181,
      "median": 3.5786734369,
      "user": 1.16860304,
      "system": 1.2952632999999998,
      "min": 3.4650229479,
      "max": 3.8417821719000003,
      "times": [
        3.8417821719000003,
        3.6448888279,
        3.5450161749,
        3.6584632119,
        3.4650229479,
        3.5047340209,
        3.4806370089,
        3.6011131779000003,
        3.7624113229000002,
        3.5562336959
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13207
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,785.64 ms
(-0.13%)Baseline: 2,789.15 ms
3,346.98 ms
(83.23%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,903.08 ms
(-2.43%)Baseline: 1,950.47 ms
2,340.56 ms
(81.31%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
586.16 ms
(-6.76%)Baseline: 628.63 ms
754.36 ms
(77.70%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
347.11 ms
(-7.79%)Baseline: 376.42 ms
451.70 ms
(76.84%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,358.29 ms
(-2.04%)Baseline: 2,407.44 ms
2,888.92 ms
(81.63%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,423.55 ms
(-1.02%)Baseline: 4,469.11 ms
5,362.94 ms
(82.48%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
254.80 ms
(-4.65%)Baseline: 267.22 ms
320.67 ms
(79.46%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/13207
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,443.07 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
284.87 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
302.09 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
82.53 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,394.19 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,449.72 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
257.35 ms
🐰 View full continuous benchmarking report in Bencher

- Reuse one registry client across the concurrent probes instead of building a
  fresh one per release, so the global network-concurrency bound and connection
  pool are respected (`createVersionPublishedChecker` in TS; a shared
  `ThrottledClient` in `unpublished_release_dirs` in Rust).
- Redact URL credentials in the Rust probe's error message via
  `redact_url_credentials`, matching the other registry-fetch paths.
- Document that the probe passes no cache validator, so a not-modified (304)
  response never occurs and an absent packument always means a 404 (unpublished).
- Document that fixed-group sharing and epic band re-basing supersede the
  verbatim debut (lockstep and band validity are workspace-wide invariants a
  package cannot opt out of); add an engine test that an unpublished epic member
  re-bases to the new band floor when its lead crosses a major.
- Add a Rust integration test that a probe failure fails the command, and fix a
  stale test-name reference in a comment.
Copilot AI review requested due to automatic review settings July 22, 2026 05:44

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zkochan

zkochan commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

Addressed the automated review in fcd2c38:

  • Client-per-probe (qodo) — both stacks reuse one registry client across the concurrent probes now.
  • Credential leak (qodo) — the Rust probe redacts the URL before surfacing it.
  • notModified (CodeRabbit) — unreachable: the probe passes no cache validator, so a 304 never resolves as notModified; documented the invariant.
  • Stale test-name comment (CodeRabbit) — fixed.
  • Missing Rust probe-error test (CodeRabbit) — added first_release_probe_failure_fails_the_command.

Two greptile P1 threads I've left open because they're design decisions rather than defects, and I'd like your call:

  • Fixed-group / epic override of the verbatim debut. These overrides are intentional — a fixed group must move in lockstep at one shared version, and an epic member must re-base into the new band when its lead crosses a major (holding it verbatim would land it out of band, which enforceEpicBands rejects). I documented this and added an engine test for the epic case. If you'd rather a brand-new fixed-group member pin the group to its debut version instead, that's a separate fixed-group policy change.

Written by an agent (Claude Code, claude-opus-4-8).

}
let response = request.send().await.into_diagnostic()?;
let status = response.status();
if status.as_u16() == 404 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

4. 404 treated as unpublished 🐞 Bug ⛨ Security

Rust is_version_published() returns false on any registry 404, but pnpm’s resolver explicitly
documents that a 404 can also mean “no permission to fetch it”, not “does not exist”. This can
produce a misleading release plan and then apply it (e.g. pnpm version -r consuming intents) based
on an ambiguous probe result.
Agent Prompt
### Issue description
`is_version_published()` treats HTTP 404 as a definitive “not published” signal. In pnpm semantics, 404 can also represent an authorization-masked failure ("not in registry, or no permission"). Using 404 as “unpublished” can therefore make `pnpm version -r`/`pnpm change status` proceed with a wrong plan instead of failing as designed.

### Issue Context
This PR’s stated contract is “fail on error; only definitive 404 means not published.” The codebase itself documents that 404 is ambiguous for registry metadata fetches.

### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[122-151]
- pnpm11/resolving/npm-resolver/src/fetch.ts[57-73]

### Suggested fix
- When the packument probe returns 404, add an additional auth/health disambiguation step before treating it as unpublished (e.g. a lightweight `/-/whoami` probe against the same registry origin when an auth header would be sent), and fail the command if that check indicates auth is invalid/unusable.
- Alternatively, make “treat 404 as unpublished” conditional on additional evidence from the response body/headers (if available), and otherwise error with a message explaining that 404 can also mean lack of permission.
- Ensure the same semantics are implemented in both Rust and TS stacks to keep parity.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Leaving this as a design call for now, with reasoning:

A bare 404 is genuinely ambiguous in npm (absent vs. no read permission), and it can't be disambiguated reliably — the registry conflates the two on purpose, and a /-/whoami check only tells you whether auth is valid, not whether this package is readable.

In the first-release context, though, it can't cause a bad publish. The probe sends the same auth the subsequent publish will use, so:

  • If a private package exists but is unreadable, the release can't publish it either — it fails at publish, not silently.
  • If the probe wrongly treats it as unpublished (verbatim), pnpm publish then attempts the current version and fails on the already-published version rather than corrupting anything.

It also matches how @pnpm/resolving.npm-resolver itself treats a packument 404. So the ambiguity is real but the outcome is fail-safe. Happy to add a disambiguation step if preferred — flagging it for the maintainer to decide.


Written by an agent (Claude Code, claude-opus-4-8).

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
pnpm/crates/cli/tests/change.rs (1)

97-97: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Disable retries in the intentional-failure fixture.

Both probe commands can otherwise incur registry retry/backoff before failing. Add fetch-retries=0 to this test’s .npmrc so the error-path test remains fast and deterministic.

Proposed fix
-    fs::write(workspace.join(".npmrc"), "registry=http://127.0.0.1:1/\n").expect("write npmrc");
+    fs::write(
+        workspace.join(".npmrc"),
+        "registry=http://127.0.0.1:1/\nfetch-retries=0\n",
+    )
+    .expect("write npmrc");

As per path instructions, avoid costly work on test and command paths.

🤖 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/cli/tests/change.rs` at line 97, Update the `.npmrc` content
written by the intentional-failure fixture in the change test to include
`fetch-retries=0` alongside the invalid registry setting. Keep the existing
failure setup unchanged while disabling registry retries for both probe commands
so the test fails quickly and deterministically.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm11/releasing/commands/src/publish/previousChangelog.ts`:
- Around line 85-101: Bound concurrent registry probes in
createVersionPublishedChecker by wrapping fetchPackument with a shared limiter
created once for the checker, so resolveUnpublishedDirs() can retain Promise.all
without unbounded fan-out. Use the repository’s standard limiter and an
appropriate documented concurrency limit, while preserving the existing boolean
result and error propagation behavior.

---

Nitpick comments:
In `@pnpm/crates/cli/tests/change.rs`:
- Line 97: Update the `.npmrc` content written by the intentional-failure
fixture in the change test to include `fetch-retries=0` alongside the invalid
registry setting. Keep the existing failure setup unchanged while disabling
registry retries for both probe commands so the test fails quickly and
deterministically.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 64a8c143-ca7b-4f63-a099-f31458e28c2a

📥 Commits

Reviewing files that changed from the base of the PR and between 4dc6527 and fcd2c38.

📒 Files selected for processing (8)
  • pnpm/crates/cli/src/cli_args/changelog.rs
  • pnpm/crates/cli/tests/change.rs
  • pnpm/crates/versioning/src/plan.rs
  • pnpm/crates/versioning/src/plan/tests.rs
  • pnpm11/releasing/commands/src/publish/previousChangelog.ts
  • pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts
  • pnpm11/releasing/versioning/src/assembleReleasePlan.ts
  • pnpm11/releasing/versioning/test/assembleReleasePlan.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • pnpm11/releasing/commands/src/resolveUnpublishedDirs.ts
  • pnpm11/releasing/versioning/test/assembleReleasePlan.ts
  • pnpm/crates/cli/src/cli_args/changelog.rs
  • pnpm11/releasing/versioning/src/assembleReleasePlan.ts

resolveUnpublishedDirs probed every release with an unbounded Promise.all; a
large recursive release could burst as many concurrent registry connections as
there are releases. Cap the fan-out with p-limit at networkConcurrency (default
16), matching how the rest of the commands package bounds registry work. The
Rust side was already bounded — the shared ThrottledClient's per-origin
semaphore caps concurrent probes — so only a clarifying comment is added there.
Copilot AI review requested due to automatic review settings July 22, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants