Skip to content

feat(release): compose changelogs at publish time (registry storage) - #12971

Merged
zkochan merged 6 commits into
mainfrom
no-changelog
Jul 13, 2026
Merged

zkochan merged 6 commits into
mainfrom
no-changelog

Conversation

@zkochan

@zkochan zkochan commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements the changelog-storage design of the native monorepo versioning RFC (https://github.com/pnpm/rfcs/blob/main/text/0006-monorepo-versioning.md): a new registry changelog-storage mode, made the default.

In registry mode no CHANGELOG.md is committed to the repository. Each release's changelog section is parked under .changeset/changelogs/<pkg@version>.md at pnpm version -r time. At publish, pnpm publish / pnpm pack compose the section, fetch the previously published version's tarball (the highest published version semver-lower than the one being published), prepend the section to its CHANGELOG.md, and pack the result into the new tarball. Consumed change intents are garbage-collected by a later pnpm version -r only once the registry confirms the version is published with its composed section — so the repository is never left as the only copy of unpublished prose. versioning.changelog.storage: repository opts back into committed CHANGELOG.md files.

Landed in both the TypeScript CLI and the Rust pnpm/ (pacquet) port.

Squash Commit Body

Implement RFC 0006 `changelog.storage: registry` and make it the default: no
CHANGELOG.md is committed. A release's section is parked under
.changeset/changelogs/ at `pnpm version -r` time and composed into the
published tarball at publish, on top of the previous published version's
changelog (highest published version semver-lower than the one being
published — never a dist-tag lookup, so concurrent lines chain correctly).

Consumed intents are garbage-collected by a later `pnpm version -r` only once
the registry confirms the ledgered version is published and its tarball's
CHANGELOG.md carries the composed section; a foreign-published version keeps
the intent instead of losing it. The pure `versioning` crate/package stays
network-free: the publish check is injected (a callback in TS, a
confirmed-key set in Rust) from the command layer, which already has registry
access. The parked-section store captures dependency-update lines and exact
formatting that can't be recomposed from intents at publish time.

`versioning.changelog.storage: repository` keeps the previous committed
CHANGELOG.md behavior. Landed in both stacks.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port.
  • Added a changeset.
  • 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
    • Release changelogs now default to registry-based storage, composed into published packages at publish time.
    • Previously published changelog content is carried forward and combined into the release artifact.
    • Change-intent cleanup for registry mode is gated until the published changelog section is confirmed.
  • Bug Fixes
    • Prevented a stale on-disk CHANGELOG.md from overriding newly composed injected content.
  • Documentation
    • Updated native release management docs to reflect the new default and repository mode.
  • Tests
    • Expanded coverage for registry vs repository changelog confirmation and parked-section lifecycle.

Copilot AI review requested due to automatic review settings July 13, 2026 14:07

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 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c066e0c6-2b15-4c42-86f3-3f2f27426caf

📥 Commits

Reviewing files that changed from the base of the PR and between 6ddcc6a and 6aaf353.

📒 Files selected for processing (1)
  • pnpm11/releasing/commands/src/publish/previousChangelog.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/releasing/commands/src/publish/previousChangelog.ts

📝 Walkthrough

Walkthrough

The release system defaults to registry-backed changelog storage, parks sections until publication, composes changelogs during packing, and gates intent cleanup on published-content verification. Rust and TypeScript implementations, tarball injection, configuration, and lifecycle tests are updated.

Changes

Registry changelog storage

Layer / File(s) Summary
Versioning storage and pending sections
pnpm/crates/versioning/..., pnpm11/releasing/versioning/..., .changeset/...
Release plans support repository and registry storage, pending changelog files, publication-gated intent cleanup, centralized rendering, and lifecycle coverage.
Rust changelog composition and tar injection
pnpm/crates/cli/..., pnpm/crates/pack/..., pnpm/crates/napi/...
Rust packing and publishing compose registry changelogs and inject in-memory package/CHANGELOG.md entries into tarballs.
TypeScript publish-time composition
pnpm11/releasing/commands/..., pnpm11/releasing/versioning/...
Publishing retrieves registry changelogs, composes and injects entries, verifies published sections, and updates option contracts and integration tests.

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

Sequence Diagram(s)

sequenceDiagram
  participant VersionCommand
  participant ApplyReleasePlan
  participant PendingChangelog
  participant Registry
  participant Pack

  VersionCommand->>ApplyReleasePlan: apply release plan
  ApplyReleasePlan->>PendingChangelog: write pending changelog section
  VersionCommand->>Registry: verify published CHANGELOG.md
  Registry-->>VersionCommand: return published changelog
  VersionCommand->>ApplyReleasePlan: provide confirmed versions
  ApplyReleasePlan->>PendingChangelog: remove confirmed section
  Pack->>PendingChangelog: read pending section
  Pack->>Registry: fetch previous changelog
  Pack->>Pack: inject composed package/CHANGELOG.md
Loading

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#12953 — Changes the same release-plan application flow and registry changelog lifecycle in the Rust versioning engine.

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

Suggested reviewers: copilot, ranm8

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch no-changelog

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

feat(release): default to registry-stored changelogs composed at publish time

✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Default changelog storage to registry, parking release sections under .changeset/changelogs/.
• Compose CHANGELOG.md during pnpm publish/pnpm pack by prepending onto the previous published
 tarball.
• Gate intent/section garbage-collection on registry-confirmed publication; add Rust+TS coverage.
Diagram

graph TD
  I["Change intents\n(.changeset/*.md)"] --> V["pnpm version -r"] --> P[("Pending sections\n.changeset/changelogs")]
  V --> L[("Ledger\n(consumption map)")]
  V --> R{{"Registry"}}
  U["pnpm publish / pack"] --> P --> C["Compose CHANGELOG.md"] --> R
  C --> B["Pack builder\n(injected files)"] --> T["Published tarball\n(CHANGELOG.md)"]

  subgraph Legend
    direction LR
    _p["Command/step"] ~~~ _d[("On-disk store")] ~~~ _e{{"External system"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Compose changelog solely from intents at publish time
  • ➕ Avoids storing an additional parked-section artifact in the repo
  • ➕ Keeps a single source of truth (intents) until publish
  • ➖ Hard to preserve exact formatting and derived lines (e.g., dependency updates) without pre-rendering
  • ➖ Requires intents to remain available and stable at publish time (higher coupling)
2. Store rendered changelog sections outside the repo (e.g., registry-side metadata)
  • ➕ Removes unpublished prose from the repo entirely while still avoiding committed CHANGELOG.md
  • ➕ Publish-time composition could avoid tarball downloads
  • ➖ Requires new registry protocol/conventions; not generally supported by npm registries
  • ➖ Adds operational complexity and migration concerns across registries
3. Keep repository storage as the default
  • ➕ Simpler mental model: changelog is always present locally
  • ➕ No publish-time network dependency for changelog composition
  • ➖ Conflicts with the RFC’s goal of not committing per-package CHANGELOG.md in the repo
  • ➖ More merge conflict churn in monorepos

Recommendation: The chosen approach (park rendered sections at version time, compose into tarballs at publish/pack, and only GC after registry confirmation) is a pragmatic fit for RFC 0006: it preserves exact changelog text, avoids committed CHANGELOG.md churn, and keeps the core versioning logic network-free via command-layer injection. The main tradeoff—publish-time tarball fetch and added moving parts—is mitigated by best-effort fallbacks (treat failures as unconfirmed and retain intents/sections).

Files changed (33) +1275 / -127

Enhancement (22) +804 / -79
cli_args.rsRegister CLI changelog module +1/-0

Register CLI changelog module

• Adds the new 'cli_args::changelog' module to the Rust CLI argument module tree.

pnpm/crates/cli/src/cli_args.rs

changelog.rsImplement registry changelog composition + publish confirmation (Rust CLI) +172/-0

Implement registry changelog composition + publish confirmation (Rust CLI)

• Adds logic to compose a 'registry'-storage CHANGELOG.md by reading the parked section and prepending it onto the previous published tarball’s changelog. Also implements a registry-backed confirmation pass used to gate intent/section garbage-collection.

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

dispatch_query.rsMake 'pnpm version' dispatch async for registry confirmation +2/-2

Make 'pnpm version' dispatch async for registry confirmation

• Updates the version subcommand dispatch to run asynchronously so it can perform registry checks needed for registry-mode intent GC.

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

pack.rsInject composed CHANGELOG.md into pack options (Rust) +21/-2

Inject composed CHANGELOG.md into pack options (Rust)

• Extends packing to optionally inject an in-memory 'package/CHANGELOG.md' for registry storage, replacing any on-disk entry. Adds a helper to set injected changelog content per project before invoking the pack API.

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

publish.rsCompose/inject registry changelog during publish (Rust) +3/-1

Compose/inject registry changelog during publish (Rust)

• Updates publish packing options to include injected files and calls the changelog injection path so registry-mode tarballs contain a composed CHANGELOG.md.

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

version.rsGate intent GC on registry-confirmed publication (Rust CLI) +10/-3

Gate intent GC on registry-confirmed publication (Rust CLI)

• Makes version execution async and computes a set of registry-confirmed ledger keys before applying the release plan. Passes the confirmed set into versioning to defer garbage-collection until publication is verified.

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

pack.rsInitialize injected_files in N-API pack bridge +2/-0

Initialize injected_files in N-API pack bridge

• Ensures the N-API pack call provides an empty injected entries list; notes that Bit handles changelog injection itself.

pnpm/crates/napi/src/pack.rs

lib.rsAdd injected tar entries support to pack pipeline (Rust) +32/-2

Add injected tar entries support to pack pipeline (Rust)

• Introduces 'PackOptions.injected_files' for in-memory tar entries that supersede on-disk files. Updates packed contents/unpacked size calculations to include injected entries and removes superseded disk entries before packing.

pnpm/crates/pack/src/lib.rs

tarball.rsWrite injected entries into tarball (Rust) +19/-7

Write injected entries into tarball (Rust)

• Extends tarball construction to append injected entries after on-disk files. Refactors entry writing into a helper to reuse header setup consistently.

pnpm/crates/pack/src/tarball.rs

apply.rsImplement registry storage: park sections and defer GC until confirmed (Rust) +68/-23

Implement registry storage: park sections and defer GC until confirmed (Rust)

• Adds registry-mode behavior: write pending changelog sections instead of committing CHANGELOG.md, and only treat ledger entries as consumed once confirmed published. Removes pending sections for confirmed releases and updates apply_release_plan signature to accept the confirmed set.

pnpm/crates/versioning/src/apply.rs

error.rsRemove unsupported changelog storage error (Rust) +0/-6

Remove unsupported changelog storage error (Rust)

• Deletes the 'UnsupportedChangelogStorage' error now that 'registry' storage is implemented.

pnpm/crates/versioning/src/error.rs

lib.rsExport pending changelog APIs + changelog_storage helper (Rust) +9/-2

Export pending changelog APIs + changelog_storage helper (Rust)

• Adds the pending module to the crate, exports pending changelog helpers, exports 'render_changelog', and re-exports 'changelog_storage' for consistent defaulting behavior.

pnpm/crates/versioning/src/lib.rs

pending.rsAdd pending changelog section store (Rust) +76/-0

Add pending changelog section store (Rust)

• Implements read/write/remove helpers for parked sections under '.changeset/changelogs/', including scoped-name filename encoding. Provides filesystem-safe, idempotent deletion semantics.

pnpm/crates/versioning/src/pending.rs

settings.rsDefault changelog storage to registry (Rust settings) +13/-0

Default changelog storage to registry (Rust settings)

• Adds 'changelog_storage()' helper that defaults to 'registry' when unset, matching the new behavior and mirroring the TS logic.

pnpm/crates/versioning/src/settings.rs

pack.tsCompose and inject registry-mode CHANGELOG.md during packing (TS) +62/-5

Compose and inject registry-mode CHANGELOG.md during packing (TS)

• Adds registry-mode changelog composition to 'pack' by reading the parked section, fetching the previous published changelog, rendering the combined result, and injecting it as an in-memory tar entry. Updates packed size/content calculations to account for injected entries.

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

previousChangelog.tsFetch previous/published tarball changelog from registry (TS) +142/-0

Fetch previous/published tarball changelog from registry (TS)

• Implements packument lookup, previous-version selection (highest semver-lower), tarball download, and tar entry extraction for 'package/CHANGELOG.md'. Provides helpers for both previous-version composition and exact-version verification.

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

publish.tsThread versioning config into publish options (TS) +2/-2

Thread versioning config into publish options (TS)

• Extends handler/publish option typing to include 'versioning', enabling pack-time changelog composition decisions based on workspace versioning settings.

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

recursivePublish.tsPropagate versioning settings through recursive publish (TS) +1/-0

Propagate versioning settings through recursive publish (TS)

• Adds 'versioning' to the recursive publish options shape so registry-mode changelog behavior is preserved in recursive workflows.

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

index.tsInject registry publish verification into applyReleasePlan (TS CLI) +33/-7

Inject registry publish verification into applyReleasePlan (TS CLI)

• Builds an 'applyOpts' object including a 'verifyPublished' callback when in registry mode. Verification checks registry-published tarballs contain the parked section before allowing intent GC.

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

applyReleasePlan.tsDefault to registry storage and add publish-confirmed GC gate (TS lib) +69/-17

Default to registry storage and add publish-confirmed GC gate (TS lib)

• Implements registry storage as the default: park sections under '.changeset/changelogs/' and only consider ledger entries consumed once 'verifyPublished' confirms the tarball contains the section. Removes the previous “unsupported storage” guard.

pnpm11/releasing/versioning/src/applyReleasePlan.ts

index.tsExport changelog storage + pending changelog APIs (TS lib) +9/-0

Export changelog storage + pending changelog APIs (TS lib)

• Exports 'changelogStorage', 'renderChangelog', and the pending changelog helpers so commands can compose changelogs at publish time and manage parked sections.

pnpm11/releasing/versioning/src/index.ts

pendingChangelog.tsAdd pending changelog store implementation (TS lib) +58/-0

Add pending changelog store implementation (TS lib)

• Implements read/write/remove helpers for parked changelog sections and scoped-name filename encoding under '.changeset/changelogs/'.

pnpm11/releasing/versioning/src/pendingChangelog.ts

Refactor (2) +49 / -35
changelog.rsExtract changelog composition into reusable render function (Rust) +27/-20

Extract changelog composition into reusable render function (Rust)

• Introduces 'render_changelog()' to prepend sections under an existing '# <name>' title (or create one). Reuses it for repository-mode file writing and registry-mode tarball composition.

pnpm/crates/versioning/src/changelog.rs

changelog.tsExtract renderChangelog helper (TS lib) +22/-15

Extract renderChangelog helper (TS lib)

• Adds 'renderChangelog()' for consistent section-prepending semantics and reuses it in 'prependChangelogSection()'.

pnpm11/releasing/versioning/src/changelog.ts

Tests (4) +387 / -13
tests.rsTest injected file packing and superseding behavior (Rust) +36/-0

Test injected file packing and superseding behavior (Rust)

• Adds a helper to read tarball entry content and introduces a test verifying injected CHANGELOG.md is packed and replaces a stale on-disk changelog. Updates fixtures to include 'injected_files' defaults.

pnpm/crates/pack/src/tests.rs

tests.rsAdd registry-storage lifecycle tests (Rust versioning) +199/-9

Add registry-storage lifecycle tests (Rust versioning)

• Updates existing tests to explicitly opt into repository storage and adds new tests covering pending section parking, deferred intent GC, and GC once publication is confirmed.

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

registryChangelog.tsE2E test: publish composes changelog by chaining previous tarball (TS) +93/-0

E2E test: publish composes changelog by chaining previous tarball (TS)

• Adds a registry-mock-based test that simulates two releases by parking sections, publishing, and asserting the second tarball’s CHANGELOG.md prepends over the first’s history.

pnpm11/releasing/commands/test/publish/registryChangelog.ts

lifecycle.tsExtend lifecycle tests for registry storage default (TS lib tests) +59/-4

Extend lifecycle tests for registry storage default (TS lib tests)

• Updates existing tests to opt into repository mode and adds new tests verifying pending section parking, deferred GC without verification, and collection once 'verifyPublished' confirms publication.

pnpm11/releasing/versioning/test/lifecycle.ts

Documentation (2) +14 / -0
registry-changelog-storage.mdAdd changeset announcing registry-based changelog storage default +8/-0

Add changeset announcing registry-based changelog storage default

• Introduces a changeset documenting the new default 'registry' changelog storage mode and the publish-time composition behavior. Notes the opt-out via 'versioning.changelog.storage: repository'.

.changeset/registry-changelog-storage.md

versioning.tsDocument changelog storage behavior in versioning types +6/-0

Document changelog storage behavior in versioning types

• Adds inline documentation describing 'registry' vs 'repository' changelog storage semantics and the new default behavior.

pnpm11/core/types/src/versioning.ts

Other (3) +21 / -0
pnpm-lock.yamlWire new workspace dependencies for publish-time registry fetch +9/-0

Wire new workspace dependencies for publish-time registry fetch

• Adds workspace links for fetching/types and resolver packages needed by the releasing commands to fetch published metadata/tarballs.

pnpm-lock.yaml

package.jsonAdd resolver/fetch dependencies for previous tarball changelog fetch +3/-0

Add resolver/fetch dependencies for previous tarball changelog fetch

• Adds workspace dependencies needed to fetch packuments and tarballs and to type the registry metadata used by previous-changelog composition.

pnpm11/releasing/commands/package.json

tsconfig.jsonAdd TS project references for newly used workspace packages +9/-0

Add TS project references for newly used workspace packages

• Updates project references to include fetching/types and resolver/type packages required by the new previous-changelog fetch implementation.

pnpm11/releasing/commands/tsconfig.json

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (6) 📘 Rule violations (5) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Action required

1. Unbounded tarball gunzip ✓ Resolved 🐞 Bug ⛨ Security
Description
fetchPreviousChangelog/fetchPublishedChangelog downloads the entire tarball into memory
(arrayBuffer) and then runs gunzipSync on it with no compressed/decompressed size limits, so a
large or highly-compressible tarball can OOM or stall the process during pnpm publish/pnpm pack
(and during the publish-confirmation checks). This is attacker-influenceable via registry tarball
content/metadata and is a practical local DoS against release automation.
Code

pnpm11/releasing/commands/src/publish/previousChangelog.ts[R114-157]

+async function downloadTarballChangelog (client: RegistryClient, pkgName: string, meta: PackageMeta, version: string): Promise<string | undefined> {
+  const tarballUrl = meta.versions[version]?.dist?.tarball
+  if (tarballUrl == null) return undefined
+  const response = await client.fetch(tarballUrl, { authHeaderValue: client.getAuthHeader(tarballUrl, { pkgName }) })
+  if (!response.ok) {
+    throw new PnpmError('CHANGELOG_TARBALL_FETCH_FAILED', `Failed to download ${pkgName}@${version} tarball (${response.status}) to compose the changelog: ${tarballUrl}`)
+  }
+  return extractTarballEntry(Buffer.from(await response.arrayBuffer()), CHANGELOG_ENTRY)
+}
+
+/** Reads one entry's contents out of a (optionally gzipped) tarball buffer. */
+async function extractTarballEntry (tarballData: Buffer, entryName: string): Promise<string | undefined> {
+  const extract = tar.extract()
+  let contents: string | undefined
+  await new Promise<void>((resolve, reject) => {
+    extract.on('entry', (header, stream, next) => {
+      if (header.name !== entryName) {
+        stream.resume()
+        stream.on('end', next)
+        stream.on('error', reject)
+        return
+      }
+      const chunks: Buffer[] = []
+      stream.on('data', (chunk: Buffer) => chunks.push(Buffer.from(chunk)))
+      stream.on('error', reject)
+      stream.on('end', () => {
+        contents = Buffer.concat(chunks).toString('utf8')
+        next()
+      })
+    })
+    extract.on('error', reject)
+    extract.on('finish', resolve)
+    extract.end(maybeGunzip(tarballData))
+  })
+  return contents
+}
+
+function maybeGunzip (tarballData: Buffer): Buffer {
+  try {
+    return gunzipSync(tarballData)
+  } catch {
+    return tarballData
+  }
+}
Evidence
The new code buffers the whole tarball and synchronously gunzips it (gunzipSync), which has no
size guard; existing pnpm tarball downloading code demonstrates a safer streaming approach with
explicit size accounting and bounds checking.

pnpm11/releasing/commands/src/publish/previousChangelog.ts[114-157]
pnpm11/fetching/tarball-fetcher/src/remoteTarballFetcher.ts[119-195]

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

## Issue description
`downloadTarballChangelog()` buffers the full tarball (`response.arrayBuffer()`), then `maybeGunzip()` runs `gunzipSync()` over the full buffer. This creates a memory/CPU DoS risk (large tarballs and gzip bombs) in `pnpm publish`/`pack` and in the publication-verification path.

## Issue Context
The repo already has a tarball downloader that streams bodies and accounts for size, rather than buffering+sync-decompressing.

## Fix Focus Areas
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[114-157]
- pnpm11/fetching/tarball-fetcher/src/remoteTarballFetcher.ts[119-195]

## What to change
1. Avoid `response.arrayBuffer()` for tarballs. Prefer streaming (`response.body`) and parse as a stream.
2. Replace `gunzipSync` with streaming decompression (`zlib.createGunzip()` / `pipeline`) and enforce:
  - a maximum compressed byte limit (based on `content-length` when available, plus a hard cap when not)
  - a maximum decompressed byte limit while feeding tar parsing
3. Consider reusing existing tarball download logic/patterns (streaming, size accounting) instead of bespoke buffering.
4. If the changelog entry isn’t found within bounds, return `undefined` (best-effort behavior) rather than crashing.

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


2. pnpm bump should be major ✗ Dismissed 📘 Rule violation § Compliance
Description
The changeset marks pnpm as a minor bump even though it changes a default user-visible behavior
(default changelog storage no longer commits CHANGELOG.md), requiring user action to retain prior
behavior. This makes the bump type inconsistent with the described change.
Code

.changeset/registry-changelog-storage.md[4]

+"pnpm": minor
Evidence
Rule 713436 requires the pnpm bump type to match the change impact. The changeset text states a
default behavior change and instructs users to set versioning.changelog.storage: repository to
keep the prior behavior, indicating a breaking change; yet the front-matter lists pnpm: minor.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/registry-changelog-storage.md[4-4]
.changeset/registry-changelog-storage.md[8-8]

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 changeset’s `pnpm` bump type is `minor`, but the changeset text describes a default-behavior change that requires user action to preserve previous behavior, which is a breaking change.

## Issue Context
The changeset states that changelog storage now defaults to `registry` and `CHANGELOG.md` is no longer committed, with an opt-back setting.

## Fix Focus Areas
- .changeset/registry-changelog-storage.md[2-5]
- .changeset/registry-changelog-storage.md[8-8]

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



Remediation recommended

3. Awaited cancel can stall 🐞 Bug ⛨ Security ⭐ New
Description
readCapped() awaits reader.cancel() after exceeding the size cap; if the underlying stream’s
cancel promise never settles, the best-effort “over-cap” path can hang instead of returning
undefined. This is a conditional availability risk when composing changelogs from large/hostile
registry responses, and it also adds avoidable latency compared to the repo’s existing
fire-and-forget cancel pattern.
Code

pnpm11/releasing/commands/src/publish/previousChangelog.ts[R156-159]

+      // Best-effort cleanup: a cancel failure must not turn the over-cap path
+      // into a hard error — the caller just gets no changelog either way.
+      // eslint-disable-next-line no-await-in-loop
+      await reader.cancel().catch(() => {})
Evidence
The new code awaits cancellation in the over-cap branch, which can block if the cancel promise does
not resolve. A nearby repo helper doing bounded reads cancels without awaiting, showing the project
already treats cancel as best-effort/non-blocking cleanup.

pnpm11/releasing/commands/src/publish/previousChangelog.ts[140-165]
pnpm11/registry-access/commands/src/common.ts[37-57]

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

### Issue description
`readCapped()` awaits `reader.cancel()` on the over-cap path. Rejection is handled, but a never-settling cancel promise can stall `pnpm publish/pack` in a path intended to be best-effort.

### Issue Context
There is already a similar bounded-read helper in the repo that calls `reader.cancel().catch(() => {})` without awaiting, avoiding any chance of blocking on cleanup.

### Fix Focus Areas
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[140-165]
- pnpm11/registry-access/commands/src/common.ts[37-57]

### Suggested change
- Replace `await reader.cancel().catch(() => {})` with `void reader.cancel().catch(() => {})` (or `reader.cancel().catch(() => {})`) and return immediately.
- Remove the now-unnecessary `eslint-disable no-await-in-loop` tied to that await.

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


4. Tar extraction scans whole 🐞 Bug ➹ Performance
Description
extractTarballEntry() only resolves on the tar extractor's finish, so even after
package/CHANGELOG.md is found it continues parsing the remaining entries in the inflated tar
buffer. This adds avoidable CPU/latency on pnpm pack/publish (and publish-confirmation checks) for
large tarballs because it cannot short-circuit once the target entry is read.
Code

pnpm11/releasing/commands/src/publish/previousChangelog.ts[R175-194]

+  return new Promise<string | undefined>((resolve) => {
+    let contents: string | undefined
+    extract.on('entry', (header, stream, next) => {
+      if (header.name !== entryName) {
+        stream.resume()
+        stream.on('end', next)
+        stream.on('error', () => resolve(undefined))
+        return
+      }
+      const chunks: Buffer[] = []
+      stream.on('data', (chunk: Buffer) => chunks.push(Buffer.from(chunk)))
+      stream.on('error', () => resolve(undefined))
+      stream.on('end', () => {
+        contents = Buffer.concat(chunks).toString('utf8')
+        next()
+      })
+    })
+    extract.on('error', () => resolve(undefined))
+    extract.on('finish', () => resolve(contents))
+    extract.end(tarData)
Evidence
The Promise resolves only on extract.on('finish', ...), while the matching entry handler sets
contents and calls next(), which allows parsing to continue through subsequent tar entries
before finish can fire.

pnpm11/releasing/commands/src/publish/previousChangelog.ts[175-194]

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

## Issue description
`extractTarballEntry()` waits for the tar extractor's `finish` event to resolve, which forces parsing the entire tar archive even after the desired `package/CHANGELOG.md` entry has been fully read.

## Issue Context
This function runs on the publish/pack path and on registry-confirmation checks. The tar buffer is already inflated (bounded by `MAX_TARBALL_BYTES`), so the remaining optimization is to avoid scanning the rest of the tar entries once the target is found.

## Fix Focus Areas
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[175-194]

### Suggested fix sketch
- Resolve immediately when the target entry finishes reading (inside the matching entry's `end` handler).
- Stop further parsing by destroying/aborting the extractor (e.g., `extract.destroy()` / equivalent) and ensure the current entry stream is fully consumed.
- Guard against multiple resolve calls (boolean `resolved` flag), and ensure errors after early-resolve are ignored/cleanup-only.

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


5. Vec allocation may abort 🐞 Bug ☼ Reliability
Description
Rust fetch_changelog() buffers the tarball into a Vec<u8> up to MAX_TARBALL_BYTES but uses
infallible Vec growth (extend_from_slice) with no try_reserve/allocation-failure handling. On
memory-constrained hosts, a large-but-within-cap tarball can still trigger an allocator OOM abort
instead of the intended best-effort None behavior.
Code

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

+    let mut stream = response.bytes_stream();
+    let mut body: Vec<u8> = Vec::new();
+    while let Some(chunk) = stream.next().await {
+        let chunk = chunk.ok()?;
+        if body.len() as u64 + chunk.len() as u64 > MAX_TARBALL_BYTES {
+            return None;
+        }
+        body.extend_from_slice(&chunk);
Evidence
The current loop allocates and appends chunks directly into a Vec<u8> up to the configured cap,
but does not use fallible reservation APIs; thus allocation failure cannot be surfaced as None and
may abort the process.

pnpm/crates/cli/src/cli_args/changelog.rs[23-28]
pnpm/crates/cli/src/cli_args/changelog.rs[109-120]

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

## Issue description
`fetch_changelog()` grows a `Vec<u8>` while streaming the response body. Even though there's a byte cap, the code uses infallible allocations, so allocation failure can abort the process instead of failing best-effort.

## Issue Context
This runs against registry/proxy-provided bytes. The code explicitly intends best-effort behavior when limits are exceeded; allocation failure should follow the same pattern.

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

### Suggested fix sketch
- Before `extend_from_slice`, call `body.try_reserve(chunk.len())` (or `try_reserve_exact`) and `return None` on `Err`.
- Optionally use `response.content_length()` only as a *hint* to `Vec::with_capacity(min(len, MAX_TARBALL_BYTES))` to reduce reallocations, without trusting it for correctness.
- Keep the existing cap check as the authoritative limit.

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


View more (10)
6. Test reimplements tarball changelog fetch 📘 Rule violation ⚙ Maintainability
Description
The new registryChangelog test adds a custom fetchPublishedChangelog() that duplicates the
production fetchPublishedChangelog() behavior (download tarball + extract package/CHANGELOG.md).
This increases maintenance cost and risk of drift when changelog fetching/extraction logic changes.
Code

pnpm11/releasing/commands/test/publish/registryChangelog.ts[R45-76]

+async function fetchPublishedChangelog (version: string): Promise<string | undefined> {
+  const packumentResponse = await fetch(`${REGISTRY_URL}/${PKG_NAME.replace('/', '%2F')}`)
+  const packument = await packumentResponse.json() as { versions: Record<string, { dist: { tarball: string } }> }
+  const tarballUrl = packument.versions[version]?.dist.tarball
+  if (tarballUrl == null) return undefined
+  const tarballResponse = await fetch(tarballUrl)
+  const tarballData = Buffer.from(await tarballResponse.arrayBuffer())
+
+  const extract = tar.extract()
+  let changelog: string | undefined
+  await new Promise<void>((resolve, reject) => {
+    extract.on('entry', (header, stream, next) => {
+      if (header.name !== 'package/CHANGELOG.md') {
+        stream.resume()
+        stream.on('end', next)
+        stream.on('error', reject)
+        return
+      }
+      const chunks: Buffer[] = []
+      stream.on('data', (chunk: Buffer) => chunks.push(Buffer.from(chunk)))
+      stream.on('error', reject)
+      stream.on('end', () => {
+        changelog = Buffer.concat(chunks).toString('utf8')
+        next()
+      })
+    })
+    extract.on('error', reject)
+    extract.on('finish', resolve)
+    extract.end(gunzipSync(tarballData))
+  })
+  return changelog
+}
Evidence
Rule 713439 requires avoiding duplicate implementations when an equivalent shared module already
exists. The test’s helper repeats the same tarball-changelog retrieval functionality already
implemented in previousChangelog.ts.

Rule 713439: Avoid reimplementing existing functionality; extract and reuse shared modules
pnpm11/releasing/commands/test/publish/registryChangelog.ts[45-76]
pnpm11/releasing/commands/src/publish/previousChangelog.ts[73-83]

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 test defines its own tarball download + `package/CHANGELOG.md` extraction logic, duplicating the existing implementation in `previousChangelog.ts`.

## Issue Context
The codebase already provides `fetchPublishedChangelog()` for exactly this purpose. Keeping two implementations makes it easy for them to diverge (e.g., size limits, tar parsing edge cases, auth behavior).

## Fix Focus Areas
- pnpm11/releasing/commands/test/publish/registryChangelog.ts[45-76]
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[73-83]

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


7. Unvalidated injected tar paths 🐞 Bug ⛨ Security
Description
build_tarball() appends injected_files entries using caller-provided tar entry names with no
validation (no enforced package/ prefix, no traversal/absolute-path rejection), enabling creation
of archives with unsafe or out-of-contract paths. Since injected_files is now a public
PackOptions field, this widens the archive/path handling attack surface for this packing API.
Code

pnpm/crates/pack/src/tarball.rs[R65-67]

+    for (name, data) in injected {
+        append_entry(&mut builder, name, data, REGULAR_MODE)?;
    }
Evidence
Injected entries are appended verbatim as tar paths and there is no validation layer enforcing the
documented package/<path> namespace or blocking traversal/absolute paths. The repo’s review guide
explicitly flags archive/path traversal issues as a primary security review concern.

pnpm/crates/pack/src/tarball.rs[41-67]
pnpm/crates/pack/src/tarball.rs[73-85]
pnpm/crates/pack/src/lib.rs[103-111]
REVIEW_GUIDE.md[48-59]

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

### Issue description
`PackOptions::injected_files` allows in-memory tar entries to be appended, but `build_tarball()` passes the injected entry name directly into `tar::Builder::append_data` with no validation. This allows absolute paths, `..` traversal segments, backslashes, or reserved names (and also allows duplicate/conflicting entries) if a caller ever supplies them.

### Issue Context
Current in-repo callers inject only `package/CHANGELOG.md`, but the API is public and the implementation should enforce the documented contract (`package/<path>`).

### Fix Focus Areas
- pnpm/crates/pack/src/lib.rs[103-111]
- pnpm/crates/pack/src/tarball.rs[41-67]
- pnpm/crates/pack/src/tarball.rs[73-85]

### Suggested fix
- Add a small validator for injected entry names before appending:
 - must start with `package/`
 - must not contain `..` path components (also reject `\\` and Windows drive prefixes)
 - must not be absolute (`/`, `\\`, or `C:`-style)
 - optionally reject collisions with `package/package.json` (manifest rewrite invariant)
- If invalid, return `io::ErrorKind::InvalidInput` (or a dedicated pack error) so callers can’t generate unsafe archives inadvertently.

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


8. changelogStorage() declared too early 📘 Rule violation ⚙ Maintainability
Description
Several top-level helper functions (changelogStorage(), createRegistryClient(), and
renderChangelog()) are declared before their first in-file use, violating the convention that
function declarations must appear only after first usage. This increases top-of-file indirection and
makes the primary workflows harder to read top-down.
Code

pnpm11/releasing/versioning/src/applyReleasePlan.ts[R17-19]

+export function changelogStorage (versioning?: VersioningSettings): VersioningChangelogStorage {
+  return versioning?.changelog?.storage ?? 'registry'
+}
Evidence
The checklist requires that top-level TypeScript function declarations appear only after their first
usage within the same file. In pnpm11/releasing/versioning/src/applyReleasePlan.ts,
changelogStorage() is declared at lines 17-19 but is first used later when computing storage
inside applyReleasePlan() (line 49). In
pnpm11/releasing/commands/src/publish/previousChangelog.ts, createRegistryClient() is declared
at lines 35-40 but its first use is in fetchPreviousChangelog() at line 50. In
pnpm11/releasing/versioning/src/changelog.ts, renderChangelog() is defined at lines 63-74 and
its first in-file usage occurs later in prependChangelogSection() (line 86), demonstrating the
same ordering violation.

Rule 713432: Declare TypeScript functions only after their first usage
pnpm11/releasing/versioning/src/applyReleasePlan.ts[12-50]
pnpm11/releasing/versioning/src/changelog.ts[55-87]
pnpm11/releasing/commands/src/publish/previousChangelog.ts[35-56]

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

## Issue description
Several top-level functions are declared before their first usage in their respective files (`changelogStorage()`, `createRegistryClient()`, and `renderChangelog()`), but the project convention requires top-level function declarations to appear only after first usage to reduce indirection and keep the main workflows readable top-down.

## Issue Context
- `changelogStorage()` is first used inside `applyReleasePlan()`.
- `createRegistryClient()` is first used inside `fetchPreviousChangelog()`.
- `prependChangelogSection()` calls `renderChangelog()` later in the file.
- This rule applies to top-level TypeScript function declarations.

## Fix Focus Areas
- pnpm11/releasing/versioning/src/applyReleasePlan.ts[12-50]
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[35-56]
- pnpm11/releasing/versioning/src/changelog.ts[55-87]

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


9. downloadTarballChangelog() has 4 params 📘 Rule violation ⚙ Maintainability
Description
downloadTarballChangelog() and writePendingChangelog() each introduce four positional parameters
instead of using an options object, exceeding the 3-parameter limit. This makes the APIs easier to
misuse via argument-order mistakes and harder to evolve without signature churn.
Code

pnpm11/releasing/commands/src/publish/previousChangelog.ts[R114-122]

+async function downloadTarballChangelog (client: RegistryClient, pkgName: string, meta: PackageMeta, version: string): Promise<string | undefined> {
+  const tarballUrl = meta.versions[version]?.dist?.tarball
+  if (tarballUrl == null) return undefined
+  const response = await client.fetch(tarballUrl, { authHeaderValue: client.getAuthHeader(tarballUrl, { pkgName }) })
+  if (!response.ok) {
+    throw new PnpmError('CHANGELOG_TARBALL_FETCH_FAILED', `Failed to download ${pkgName}@${version} tarball (${response.status}) to compose the changelog: ${tarballUrl}`)
+  }
+  return extractTarballEntry(Buffer.from(await response.arrayBuffer()), CHANGELOG_ENTRY)
+}
Evidence
The checklist requires new/modified TypeScript functions to take no more than three parameters
unless they accept a single options object. The cited signatures show
downloadTarballChangelog(client, pkgName, meta, version) and `writePendingChangelog(workspaceDir,
pkgName, version, section)` each take four positional parameters, directly violating that rule and
increasing the likelihood of misuse and future breaking changes when extending the APIs.

Rule 713433: Limit TypeScript functions to three parameters or fewer
pnpm11/releasing/commands/src/publish/previousChangelog.ts[114-122]
pnpm11/releasing/versioning/src/pendingChangelog.ts[32-36]

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

## Issue description
`downloadTarballChangelog(client, pkgName, meta, version)` and `writePendingChangelog(workspaceDir, pkgName, version, section)` each have 4 positional parameters, violating the 3-parameter maximum; they should instead take a single options object to reduce argument-order mistakes and avoid future signature churn.

## Issue Context
These are helpers introduced/modified in this PR: `downloadTarballChangelog` is a new helper that can be shaped for safer call sites, while `writePendingChangelog` is part of the public versioning surface and is called by other code (and tests), so changing its signature should be coordinated with its callers.

## Fix Focus Areas
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[114-122]
- pnpm11/releasing/versioning/src/pendingChangelog.ts[28-36]

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


10. Duplicate split_ledger_key() implementations ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The PR introduces two separate implementations of split_ledger_key() with the same semantics in
different Rust modules. This duplication increases the chance of future divergence and inconsistent
edge-case handling.
Code

pnpm/crates/versioning/src/apply.rs[R155-163]

+/// Splits a `package@version` ledger key. The leading `@` of a scoped name is
+/// not a separator, so the split is on the last `@` and a key that is all name
+/// (index 0 or absent) yields `None`.
+fn split_ledger_key(key: &str) -> Option<(&str, &str)> {
+    let at = key.rfind('@')?;
+    if at == 0 {
+        return None;
    }
+    Some((&key[..at], &key[at + 1..]))
Evidence
The checklist requires avoiding reimplementation and extracting shared modules when the same logic
exists in multiple places. This PR adds split_ledger_key() in both the CLI changelog module and
the versioning apply module with effectively identical logic.

Rule 713439: Avoid reimplementing existing functionality; extract and reuse shared modules
pnpm/crates/versioning/src/apply.rs[155-163]
pnpm/crates/cli/src/cli_args/changelog.rs[164-172]

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

## Issue description
Two near-identical `split_ledger_key()` helpers were added in different Rust modules. This should be extracted into a shared module (likely in `pacquet_versioning`) and reused.

## Issue Context
Both helpers parse `package@version` keys by splitting on the last `@` and handling scoped package names.

## Fix Focus Areas
- pnpm/crates/versioning/src/apply.rs[155-163]
- pnpm/crates/cli/src/cli_args/changelog.rs[164-172]

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


11. Client rebuilt per fetch 🐞 Bug ➹ Performance
Description
fetch_changelog() constructs a new ThrottledClient every time it is called, and
confirmed_published_versions() can call it once per relevant ledger entry, repeatedly rebuilding
HTTP/TLS/proxy client state instead of reusing a single client. This adds avoidable overhead to
pnpm version -r runs that need to confirm multiple published versions.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R91-96]

+async fn fetch_changelog(config: &Config, name: &str, pick: VersionPick<'_>) -> Option<String> {
+    let client = build_registry_client(config).ok()?;
+    let registry = registry_for(config, name);
+    let package =
+        Package::fetch_from_registry(name, &client, &registry, &config.auth_headers).await.ok()?;
+    let version = match pick {
Evidence
fetch_changelog constructs a new registry client per call, while the confirmation loop may call it
repeatedly; build_registry_client shows this client construction is meaningful work
(ThrottledClient::for_installs with network settings).

pnpm/crates/cli/src/cli_args/changelog.rs[52-78]
pnpm/crates/cli/src/cli_args/changelog.rs[91-96]
pnpm/crates/cli/src/cli_args/registry_client.rs[6-22]

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

## Issue description
`fetch_changelog()` calls `build_registry_client(config)` on every invocation. In `confirmed_published_versions()` this can happen for each ledger entry being checked, repeatedly reconstructing the network client.

## Issue Context
`build_registry_client()` builds a `ThrottledClient::for_installs(...)`, which is non-trivial setup (proxy/TLS/per-registry client construction). The current structure prevents connection pool reuse across checks.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[52-80]
- pnpm/crates/cli/src/cli_args/changelog.rs[91-114]
- pnpm/crates/cli/src/cli_args/registry_client.rs[6-22]

## What to change
1. Build the registry client once per top-level operation (e.g. once in `compose_registry_changelog` and once in `confirmed_published_versions`).
2. Refactor `fetch_changelog` to accept `&ThrottledClient` (or similar) as a parameter, so callers can reuse it.
3. Keep behavior best-effort (errors => `None`) while removing repeated client construction.

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


12. Redundant composeRegistryChangelog comment 📘 Rule violation ⚙ Maintainability
Description
The call-site comment above composeRegistryChangelog() substantially restates the function’s JSDoc
contract, creating duplicated documentation that can drift. This violates the requirement to avoid
duplicating JSDoc content at call sites.
Code

pnpm11/releasing/commands/src/publish/pack.ts[R312-315]

+  // In `registry` changelog storage the package carries no committed
+  // CHANGELOG.md; its section was parked at `pnpm version -r` time and is
+  // composed here on top of the previously published version's changelog and
+  // packed in. A composed entry supersedes any stale committed CHANGELOG.md.
Evidence
Rule 713431 prohibits inline call-site comments that restate a function’s existing JSDoc. The
comment at pack.ts[312-315] repeats the same purpose/behavior already documented in the JSDoc for
composeRegistryChangelog() at pack.ts[399-405].

Rule 713431: Avoid duplicating JSDoc content in call-site comments
pnpm11/releasing/commands/src/publish/pack.ts[312-315]
pnpm11/releasing/commands/src/publish/pack.ts[399-405]

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

## Issue description
A call-site comment duplicates the callee’s JSDoc, increasing maintenance burden and drift risk.

## Issue Context
`composeRegistryChangelog()` already has a detailed JSDoc describing the same behavior.

## Fix Focus Areas
- pnpm11/releasing/commands/src/publish/pack.ts[312-315]
- pnpm11/releasing/commands/src/publish/pack.ts[399-414]

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


13. Historical "predate" test comment 📘 Rule violation ⚙ Maintainability
Description
A new test helper comment references past behavior (“predate the registry-storage default”), which
is historical phrasing rather than describing current behavior/constraints. This violates the rule
to avoid historical implementation commentary in source comments.
Code

pnpm/crates/versioning/src/apply/tests.rs[R19-20]

+/// The existing changelog assertions predate the `registry`-storage default,
+/// so they opt back into committed CHANGELOG.md files.
Evidence
Rule 772199 forbids comments that describe historical implementations using temporal phrasing. The
added comment explicitly says the assertions “predate” the new default, which is a history reference
rather than a current contract/intent description.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/versioning/src/apply/tests.rs[19-20]

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

## Issue description
A comment uses historical phrasing ("predate"), which is disallowed; comments should describe current behavior/intent.

## Issue Context
The helper exists to force `repository` storage for tests; that can be stated without referencing history.

## Fix Focus Areas
- pnpm/crates/versioning/src/apply/tests.rs[19-20]

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


14. Unbounded tarball buffering ✓ Resolved 🐞 Bug ⛨ Security
Description
Rust changelog composition buffers the entire previous-version tarball (response.bytes()) and then
decompresses/reads the changelog entry without any size cap, which can OOM or spike CPU if the
tarball is very large or highly-compressible. This bypasses the size-guarding patterns already
present in the Rust tarball downloader.
Code

pnpm/crates/cli/src/cli_args/changelog.rs[R91-114]

+async fn fetch_changelog(config: &Config, name: &str, pick: VersionPick<'_>) -> Option<String> {
+    let client = build_registry_client(config).ok()?;
+    let registry = registry_for(config, name);
+    let package =
+        Package::fetch_from_registry(name, &client, &registry, &config.auth_headers).await.ok()?;
+    let version = match pick {
+        VersionPick::Exact(version) => {
+            package.versions.contains_key(version).then(|| version.to_string())?
+        }
+        VersionPick::PreviousTo(version) => previous_version(&package, version)?,
+    };
+    let tarball_url = package.versions.get(&version)?.as_tarball_url().to_string();
+    let guard = client.acquire_for_url(&tarball_url).await;
+    let mut request = guard.get(&tarball_url);
+    if let Some(value) = config.auth_headers.for_url_with_package(&tarball_url, Some(name)) {
+        request = request.header("authorization", value);
+    }
+    let response = request.send().await.ok()?;
+    if !response.status().is_success() {
+        return None;
+    }
+    let bytes = response.bytes().await.ok()?;
+    extract_entry(&bytes, CHANGELOG_ENTRY)
+}
Evidence
The new Rust path reads the full HTTP body into memory and then inflates/parses it without any
explicit size limits, while the existing tarball module documents and implements guards against
untrusted Content-Length allocations.

pnpm/crates/cli/src/cli_args/changelog.rs[91-114]
pnpm/crates/cli/src/cli_args/changelog.rs[140-148]
pnpm/crates/tarball/src/lib.rs[333-367]

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

### Issue description
`fetch_changelog()` downloads an entire tarball into memory and `extract_entry()` reads the changelog entry into a `String` without bounding either the compressed body size, decompressed stream size, or entry size.

### Issue Context
The repo already treats `Content-Length` as untrusted and guards allocations in the tarball downloader; this new path should apply similar protections.

### Fix Focus Areas
- pnpm/crates/cli/src/cli_args/changelog.rs[91-114]
- pnpm/crates/cli/src/cli_args/changelog.rs[140-152]

### What to change
- Enforce a maximum allowed tarball download size (e.g., check `response.content_length()` and/or read with a hard cap; if exceeded, return `None`).
- Enforce a maximum allowed extracted `CHANGELOG.md` size (e.g., `entry.take(MAX_BYTES)` before `read_to_string`, and treat truncation/overflow as “no changelog”).
- Prefer reusing existing tarball download utilities/patterns that already implement safe buffering (or mirror their allocation/limit strategy) rather than raw `response.bytes()`.

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


15. Unbounded parallel publish checks 🐞 Bug ➹ Performance
Description
confirmPublishedLedger() uses Promise.all over ledger entries, which can trigger many concurrent
verifyPublished() calls; each call may fetch packuments+tarballs and do synchronous gunzipSync,
causing high peak CPU/memory and registry load during pnpm version -r. On large workspaces with
many pending sections, this can significantly slow or destabilize versioning runs.
Code

pnpm11/releasing/versioning/src/applyReleasePlan.ts[R128-146]

+async function confirmPublishedLedger (ledger: Ledger, opts: ApplyReleasePlanOptions): Promise<Ledger> {
+  const { verifyPublished } = opts
+  const confirmed: Ledger = Object.create(null) as Ledger
+  if (verifyPublished == null) return confirmed
+  const pendingIds = new Set(opts.allIntents.map((intent) => intent.id))
+  await Promise.all(Object.entries(ledger).map(async ([key, entry]) => {
+    if (!ledgerEntryIds(entry).some((id) => pendingIds.has(id))) return
+    const atIndex = key.lastIndexOf('@')
+    if (atIndex <= 0) return
+    const name = key.slice(0, atIndex)
+    const version = key.slice(atIndex + 1)
+    const section = await readPendingChangelog(opts.workspaceDir, name, version)
+    if (section == null) return
+    if (await verifyPublished(name, version, section)) {
+      confirmed[key] = entry
+      await removePendingChangelog(opts.workspaceDir, name, version)
+    }
+  }))
+  return confirmed
Evidence
The TS implementation explicitly runs all verification tasks concurrently via Promise.all, and the
verification callback fetches and extracts a tarball changelog using full buffering and synchronous
gunzip, so concurrency directly translates to bursty network + CPU work on the hot path.

pnpm11/releasing/versioning/src/applyReleasePlan.ts[128-146]
pnpm11/releasing/commands/src/version/index.ts[290-299]
pnpm11/releasing/commands/src/publish/previousChangelog.ts[97-107]
pnpm11/releasing/commands/src/publish/previousChangelog.ts[136-141]

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

### Issue description
`confirmPublishedLedger()` uses unbounded parallelism (`Promise.all`) for publication verification. The verification path downloads tarballs and inflates them synchronously, so parallel fan-out magnifies event-loop blocking and network pressure.

### Issue Context
Only entries still referenced by pending intents and with an on-disk pending section are checked, but that set can still be large in real monorepos.

### Fix Focus Areas
- pnpm11/releasing/versioning/src/applyReleasePlan.ts[128-146]
- pnpm11/releasing/commands/src/version/index.ts[290-299]
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[97-107]
- pnpm11/releasing/commands/src/publish/previousChangelog.ts[136-141]

### What to change
- Replace `Promise.all(Object.entries(...).map(...))` with a concurrency-limited worker pool (e.g., `p-limit`, `p-map`, or a simple queue) and pick a sane default (possibly tied to existing network concurrency settings).
- Consider making tarball inflation non-blocking (avoid `gunzipSync`) and/or add a hard size cap per tarball/changelog extraction so parallel checks can’t blow up memory.
- Keep current semantics: errors should still resolve to “not confirmed” so intents aren’t GC’d incorrectly.

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


Grey Divider

Qodo Logo

@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The core logic is correct and well-tested across both stacks. The only comments are minor: a redundant HTTP-client instantiation, a missing error handler in test-only tar-stream code, and a misleading error variant name in the Rust remove helper.

The registry changelog composition, intent GC gating, and dual-stack parity all look correct. No data-loss path was found: if registry confirmation fails for any reason the parked section and intent are preserved. The three findings are all style or test hygiene issues that do not affect the shipped behavior.

pnpm11/releasing/commands/src/publish/previousChangelog.ts (double HTTP client instantiation) and pnpm11/releasing/commands/test/publish/registryChangelog.ts (missing error handler in the tar-stream helper used only by the test).

Reviews (1): Last reviewed commit: "feat(release): compose changelogs at pub..." | Re-trigger Greptile

Comment thread pnpm/crates/versioning/src/pending.rs Resolved
@qodo-code-review

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

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 6aaf353

Warning

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

CategorySuggestion                                                                                                                                    Impact
Possible issue
Bound concurrent registry downloads

Replace join_all with a buffered stream to limit the number of concurrent
publication checks.

pnpm/crates/cli/src/cli_args/changelog.rs [70-76]

-let checks =
-    list_pending_changelogs(workspace_dir)?.into_iter().map(|(name, version)| async move {
+const PUBLISH_CHECK_CONCURRENCY: usize = 8;
+
+let confirmed = futures_util::stream::iter(list_pending_changelogs(workspace_dir)?)
+    .map(|(name, version)| async move {
         let section = read_pending_changelog(workspace_dir, &name, &version).ok()??;
         let changelog = fetch_changelog(config, &name, VersionPick::Exact(&version)).await?;
         changelog.contains(section.trim()).then(|| format!("{name}@{version}"))
-    });
-Ok(futures_util::future::join_all(checks).await.into_iter().flatten().collect())
+    })
+    .buffer_unordered(PUBLISH_CHECK_CONCURRENCY)
+    .filter_map(async move |confirmed| confirmed)
+    .collect()
+    .await;
+Ok(confirmed)
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: Limiting concurrent registry downloads is crucial to prevent out-of-memory errors when processing a large release backlog.

Medium
Security
Validate injected archive entry paths

Validate the names of injected entries to prevent potential malicious or
semantically invalid paths being added to the tarball.

pnpm/crates/pack/src/lib.rs [329-331]

 for (name, _) in &opts.injected_files {
+    let path = Path::new(name);
+    let valid = name.starts_with("package/")
+        && !path.is_absolute()
+        && !path.components().any(|component| {
+            matches!(component, std::path::Component::ParentDir)
+        })
+        && !is_manifest_entry(name);
+    if !valid {
+        return Err(PackError::InvalidInjectedEntry { name: name.clone() });
+    }
     files_map.shift_remove(name);
 }
  • Apply / Chat
Suggestion importance[1-10]: 4

__

Why: While the injected_files are currently hardcoded internally, validating these entries adds good defensive programming for a public API.

Low
  • More

Previous suggestions

Suggestions up to commit 6ddcc6a
CategorySuggestion                                                                                                                                    Impact
General
Bound concurrent registry checks

Limit the concurrency of registry checks by using buffer_unordered instead of
join_all.

pnpm/crates/cli/src/cli_args/changelog.rs [70-76]

-let checks =
-    list_pending_changelogs(workspace_dir)?.into_iter().map(|(name, version)| async move {
+const MAX_CONCURRENT_CHECKS: usize = 16;
+
+let checks = futures_util::stream::iter(list_pending_changelogs(workspace_dir)?)
+    .map(|(name, version)| async move {
         let section = read_pending_changelog(workspace_dir, &name, &version).ok()??;
-        let changelog = fetch_changelog(config, &name, VersionPick::Exact(&version)).await?;
+        let changelog =
+            fetch_changelog(config, &name, VersionPick::Exact(&version)).await?;
         changelog.contains(section.trim()).then(|| format!("{name}@{version}"))
-    });
-Ok(futures_util::future::join_all(checks).await.into_iter().flatten().collect())
+    })
+    .buffer_unordered(MAX_CONCURRENT_CHECKS)
+    .filter_map(futures_util::future::ready);
+Ok(checks.collect().await)
Suggestion importance[1-10]: 8

__

Why: Bounding concurrent network requests is critical to prevent socket exhaustion and registry rate-limiting when checking multiple pending changelogs simultaneously.

Medium
Suggestions up to commit 002c4e4
CategorySuggestion                                                                                                                                    Impact
Possible issue
Write parked changelogs atomically

Write the pending changelog section to a temporary file and atomically rename it
to its final path to prevent corrupted files during crashes.

pnpm11/releasing/versioning/src/pendingChangelog.ts [65-69]

 export async function writePendingChangelog (workspaceDir: string, pkgName: string, version: string, section: string): Promise<void> {
   const filePath = pendingChangelogPath(workspaceDir, pkgName, version)
+  const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`
   await fs.mkdir(path.dirname(filePath), { recursive: true })
-  await fs.writeFile(filePath, section, 'utf8')
+  try {
+    await fs.writeFile(temporaryPath, section, 'utf8')
+    await fs.rename(temporaryPath, filePath)
+  } finally {
+    await fs.rm(temporaryPath, { force: true })
+  }
 }
Suggestion importance[1-10]: 6

__

Why: Using atomic writes prevents the creation of truncated files in the event of a sudden process termination, thereby improving the reliability of the file system operations.

Low
Suggestions up to commit 0e3d2a2
CategorySuggestion                                                                                                                                    Impact
Possible issue
Avoid silently dropping changelog history

Throw an error if opts.registries is missing instead of silently skipping the
historical changelog composition.

pnpm11/releasing/commands/src/publish/pack.ts [410-413]

-const previous = opts.registries != null
-  ? await fetchPreviousChangelog(opts as PreviousChangelogOptions, pkgName, version)
-  : undefined
+if (opts.registries == null) {
+  throw new PnpmError(
+    'CHANGELOG_REGISTRY_CONFIG_MISSING',
+    `Cannot compose the changelog for ${pkgName}@${version} without registry configuration`
+  )
+}
+const previous = await fetchPreviousChangelog(opts as PreviousChangelogOptions, pkgName, version)
 return renderChangelog(previous ?? null, pkgName, section)
Suggestion importance[1-10]: 7

__

Why: Throwing an error instead of silently dropping the previous changelog history when opts.registries is missing prevents potential data loss during programmatic API calls.

Medium
Suggestions up to commit fb44b1f
CategorySuggestion                                                                                                                                    Impact
High-level
Fix concurrent OOMs and wasted requests

The suggestion highlights that verifying newly updated ledger entries
concurrently using Promise.all causes unnecessary network requests and potential
OOM errors due to buffering tarballs in memory. It recommends checking the
pre-update ledger sequentially to match the safer Rust implementation.

Examples:

pnpm11/releasing/versioning/src/applyReleasePlan.ts [97-100]
  const consumedLedger = storage === 'repository'
    ? ledger
    : await confirmPublishedLedger(ledger, opts)
  const consumptionOf = buildConsumptionIndex(consumedLedger, refs.nameToDirs)
pnpm11/releasing/versioning/src/applyReleasePlan.ts [128-140]
async function confirmPublishedLedger (ledger: Ledger, opts: ApplyReleasePlanOptions): Promise<Ledger> {
  const { verifyPublished } = opts
  const confirmed: Ledger = Object.create(null) as Ledger
  if (verifyPublished == null) return confirmed
  const pendingIds = new Set(opts.allIntents.map((intent) => intent.id))
  await Promise.all(Object.entries(ledger).map(async ([key, entry]) => {
    if (!ledgerEntryIds(entry).some((id) => pendingIds.has(id))) return
    const atIndex = key.lastIndexOf('@')
    if (atIndex <= 0) return
    const name = key.slice(0, atIndex)

 ... (clipped 3 lines)

Solution Walkthrough:

Before:

const ledger = await appendToLedger(opts.workspaceDir, newEntries)
// Checks the newly updated ledger concurrently
const consumedLedger = storage === 'repository'
  ? ledger
  : await confirmPublishedLedger(ledger, opts)

async function confirmPublishedLedger (ledger: Ledger, opts: ApplyReleasePlanOptions): Promise<Ledger> {
  // ...
  await Promise.all(Object.entries(ledger).map(async ([key, entry]) => {
    // ... buffers downloaded tarball content in memory
  }))
  // ...
}

After:

// Read the previous ledger state to avoid checking just-added releases
const oldLedger = await readLedger(opts.workspaceDir)
const confirmedOld = storage === 'repository' 
  ? oldLedger 
  : await confirmPublishedLedger(oldLedger, opts)

const ledger = await appendToLedger(opts.workspaceDir, newEntries)
// Merge confirmedOld into consumedLedger as needed...

async function confirmPublishedLedger (ledger: Ledger, opts: ApplyReleasePlanOptions): Promise<Ledger> {
  // ...
  // Execute sequentially to prevent massive memory spikes
  for (const [key, entry] of Object.entries(ledger)) {
    // ... fetch and process tarball safely (preferably streaming)
  }
  // ...
}
Suggestion importance[1-10]: 9

__

Why: The suggestion identifies a critical flaw in the TypeScript implementation where unrestrained concurrency (Promise.all) combined with evaluating just-added entries can cause severe memory spikes (OOM) and unnecessary network requests.

High
General
Trim trailing newlines

Call .trim_end() on section to prevent inserting unintended extra blank lines.

pnpm/crates/versioning/src/changelog.rs [99-102]

 pub fn render_changelog(existing: Option<&str>, pkg_name: &str, section: &str) -> String {
+    let section = section.trim_end();
     let Some(existing) = existing else {
         return format!("# {pkg_name}\n\n{section}");
     };
     // ...
 }
Suggestion importance[1-10]: 5

__

Why: Trimming trailing whitespace from section helps prevent the accumulation of extra blank lines in the changelog over time.

Low
Deduplicate split logic

Import split_ledger_key from pacquet_versioning to avoid code duplication.

pnpm/crates/cli/src/cli_args/changelog.rs [166-172]

-fn split_ledger_key(key: &str) -> Option<(&str, &str)> {
-    let at = key.rfind('@')?;
-    if at == 0 {
-        return None;
-    }
-    Some((&key[..at], &key[at + 1..]))
-}
+use pacquet_versioning::split_ledger_key;
Suggestion importance[1-10]: 4

__

Why: Deduplicating the function is a good practice, though it would also require making the original function public in the pacquet_versioning crate.

Low
Performance
Use HashSet for deduplication

Use a HashSet to deduplicate injected files instead of checking Vec::contains.

pnpm/crates/pack/src/lib.rs [743-756]

 fn packed_contents_with_injected(
     files_map: &indexmap::IndexMap<String, PathBuf>,
     injected: &[(String, Vec<u8>)],
 ) -> Vec<String> {
-    let mut contents = packed_contents(files_map);
+    let mut set: HashSet<String> = packed_contents(files_map).into_iter().collect();
     for (name, _) in injected {
         let stripped = name.strip_prefix("package/").unwrap_or(name).to_string();
-        if !contents.contains(&stripped) {
-            contents.push(stripped);
-        }
+        set.insert(stripped);
     }
+    let mut contents: Vec<String> = set.into_iter().collect();
     sort_paths_en_locale(&mut contents);
     contents
 }
Suggestion importance[1-10]: 2

__

Why: While it technically deduplicates, converting the entire Vec into a HashSet is likely less efficient than the existing Vec::contains check given the expected tiny size of injected.

Low

Copilot AI review requested due to automatic review settings July 13, 2026 14:22

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.

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

zkochan has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 0e3d2a2

@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: 3

🧹 Nitpick comments (4)
pnpm/crates/versioning/src/pending.rs (1)

19-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test for scoped package names.

pending_changelog_filename's /→! encoding is the only non-trivial logic in this new module, but nothing in this diff exercises a scoped name (e.g. @scope/name) — all tests use unscoped lib/cli. A small round-trip test would catch a regression in this encoding early.

🤖 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/versioning/src/pending.rs` around lines 19 - 26, Add a focused
test for pending_changelog_filename using a scoped package name such as
`@scope/name`, asserting that the slash is encoded as ! in the generated filename.
Include a round-trip assertion through the corresponding parsing or decoding
logic if available, while preserving the existing unscoped-name tests.
pnpm/crates/cli/src/cli_args/pack.rs (1)

258-269: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add project-path context to set_injected_changelog's error.

The sibling api() calls at all three call sites (run, run_recursive, publish.rs::pack_for_publish) wrap failures with the offending project path (.wrap_err_with(|| format!("pack {}", ...))), but this function's compose_registry_changelog(...).await? propagates bare. This is most costly in run_recursive, where a failure here won't say which of the many packed projects caused it.

Fixing it once here covers all three call sites.

♻️ Proposed fix
 pub(crate) async fn set_injected_changelog(
     options: &mut PackOptions,
     config: &Config,
     project_dir: &Path,
 ) -> miette::Result<()> {
     if let Some(changelog) =
-        crate::cli_args::changelog::compose_registry_changelog(config, project_dir).await?
+        crate::cli_args::changelog::compose_registry_changelog(config, project_dir)
+            .await
+            .wrap_err_with(|| format!("compose registry changelog for {}", project_dir.display()))?
     {
         options.injected_files = vec![("package/CHANGELOG.md".to_string(), changelog)];
     }
     Ok(())
 }
🤖 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/src/cli_args/pack.rs` around lines 258 - 269, Update
set_injected_changelog so failures from compose_registry_changelog(...).await
carry the current project_dir context, wrapping the propagated error with a
message identifying the project being packed. Keep the existing changelog
injection and successful Ok(()) behavior unchanged; this single change should
cover run, run_recursive, and publish.rs::pack_for_publish callers.
pnpm11/releasing/commands/src/publish/pack.ts (1)

116-134: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Stale comment references a non-existent function injectChangelog.

The composer in this file is composeRegistryChangelog (line 406), not injectChangelog. The comment is misleading for future readers.

✏️ Proposed fix
-  // Registry-storage changelog composition (see `injectChangelog`): the
+  // Registry-storage changelog composition (see `composeRegistryChangelog`): the
   // registry to read the previous version's tarball from, plus the network
   // config `createFetchFromRegistry` needs.
🤖 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 `@pnpm11/releasing/commands/src/publish/pack.ts` around lines 116 - 134, Update
the comment above the registry-storage changelog composition configuration to
reference the existing composeRegistryChangelog function instead of the
non-existent injectChangelog function, leaving the configuration entries
unchanged.
pnpm11/releasing/commands/src/publish/previousChangelog.ts (1)

136-142: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Broad catch in maybeGunzip masks corrupted gzip data as "not gzipped".

Any error from gunzipSync — including a genuinely corrupted/truncated download from a (potentially attacker-controlled) registry — falls through as raw tar bytes rather than being surfaced as an error, unlike fetchPackument's catch above which narrows on a specific error code.

🛡️ Proposed fix using gzip magic bytes instead of exception-driven detection
 function maybeGunzip (tarballData: Buffer): Buffer {
-  try {
-    return gunzipSync(tarballData)
-  } catch {
-    return tarballData
-  }
+  const isGzip = tarballData.length >= 2 && tarballData[0] === 0x1f && tarballData[1] === 0x8b
+  return isGzip ? gunzipSync(tarballData) : tarballData
 }
🤖 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 `@pnpm11/releasing/commands/src/publish/previousChangelog.ts` around lines 136
- 142, Update maybeGunzip to detect gzip input via the gzip magic bytes before
calling gunzipSync, rather than treating every decompression error as
uncompressed data. Return tarballData unchanged only when the magic-byte check
indicates a non-gzip payload; otherwise let gunzipSync errors, including
corrupted or truncated gzip data, propagate to the caller.

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/src/cli_args/changelog.rs`:
- Around line 52-80: Update confirmed_published_versions to perform matching
fetch_changelog checks concurrently rather than awaiting each registry lookup
serially. Build futures for eligible ledger entries, use the repository’s
available concurrency utility such as join_all, then collect keys whose fetched
changelog contains the trimmed pending section while preserving the existing
filtering and error propagation behavior.

In `@pnpm/crates/cli/src/cli_args/pack.rs`:
- Around line 258-269: Bound the registry response handled by
compose_registry_changelog before it can reach fetch_changelog’s response.bytes
and extract_entry’s String conversion. Add a defined maximum changelog/tarball
size and reject or safely abort responses exceeding it, or replace the
full-buffer path with bounded streaming extraction. Preserve successful
injection of package/CHANGELOG.md for responses within the limit.

In `@pnpm/crates/versioning/src/apply.rs`:
- Around line 62-80: Update the registry-mode changelog bookkeeping so
dependency-propagated releases with empty release.intents still receive a
package@version ledger entry. Ensure the marker is written alongside
write_pending_changelog for every ChangelogStorage::Registry release, allowing
confirmed_published_versions to remove their parked changelog sections after
publication.

---

Nitpick comments:
In `@pnpm/crates/cli/src/cli_args/pack.rs`:
- Around line 258-269: Update set_injected_changelog so failures from
compose_registry_changelog(...).await carry the current project_dir context,
wrapping the propagated error with a message identifying the project being
packed. Keep the existing changelog injection and successful Ok(()) behavior
unchanged; this single change should cover run, run_recursive, and
publish.rs::pack_for_publish callers.

In `@pnpm/crates/versioning/src/pending.rs`:
- Around line 19-26: Add a focused test for pending_changelog_filename using a
scoped package name such as `@scope/name`, asserting that the slash is encoded as
! in the generated filename. Include a round-trip assertion through the
corresponding parsing or decoding logic if available, while preserving the
existing unscoped-name tests.

In `@pnpm11/releasing/commands/src/publish/pack.ts`:
- Around line 116-134: Update the comment above the registry-storage changelog
composition configuration to reference the existing composeRegistryChangelog
function instead of the non-existent injectChangelog function, leaving the
configuration entries unchanged.

In `@pnpm11/releasing/commands/src/publish/previousChangelog.ts`:
- Around line 136-142: Update maybeGunzip to detect gzip input via the gzip
magic bytes before calling gunzipSync, rather than treating every decompression
error as uncompressed data. Return tarballData unchanged only when the
magic-byte check indicates a non-gzip payload; otherwise let gunzipSync errors,
including corrupted or truncated gzip data, propagate to the caller.
🪄 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: a0fa9142-e5c3-4f12-aca9-98c867439433

📥 Commits

Reviewing files that changed from the base of the PR and between 0cdd988 and fb44b1f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (32)
  • .changeset/registry-changelog-storage.md
  • pnpm/crates/cli/src/cli_args.rs
  • pnpm/crates/cli/src/cli_args/changelog.rs
  • pnpm/crates/cli/src/cli_args/dispatch_query.rs
  • pnpm/crates/cli/src/cli_args/pack.rs
  • pnpm/crates/cli/src/cli_args/publish.rs
  • pnpm/crates/cli/src/cli_args/version.rs
  • pnpm/crates/napi/src/pack.rs
  • pnpm/crates/pack/src/lib.rs
  • pnpm/crates/pack/src/tarball.rs
  • pnpm/crates/pack/src/tests.rs
  • pnpm/crates/versioning/src/apply.rs
  • pnpm/crates/versioning/src/apply/tests.rs
  • pnpm/crates/versioning/src/changelog.rs
  • pnpm/crates/versioning/src/error.rs
  • pnpm/crates/versioning/src/lib.rs
  • pnpm/crates/versioning/src/pending.rs
  • pnpm/crates/versioning/src/settings.rs
  • pnpm11/core/types/src/versioning.ts
  • pnpm11/releasing/commands/package.json
  • pnpm11/releasing/commands/src/publish/pack.ts
  • pnpm11/releasing/commands/src/publish/previousChangelog.ts
  • pnpm11/releasing/commands/src/publish/publish.ts
  • pnpm11/releasing/commands/src/publish/recursivePublish.ts
  • pnpm11/releasing/commands/src/version/index.ts
  • pnpm11/releasing/commands/test/publish/registryChangelog.ts
  • pnpm11/releasing/commands/tsconfig.json
  • pnpm11/releasing/versioning/src/applyReleasePlan.ts
  • pnpm11/releasing/versioning/src/changelog.ts
  • pnpm11/releasing/versioning/src/index.ts
  • pnpm11/releasing/versioning/src/pendingChangelog.ts
  • pnpm11/releasing/versioning/test/lifecycle.ts
💤 Files with no reviewable changes (1)
  • pnpm/crates/versioning/src/error.rs

Comment thread pnpm/crates/cli/src/cli_args/pack.rs Resolved
Comment thread pnpm/crates/versioning/src/apply.rs Resolved
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

Copilot AI review requested due to automatic review settings July 13, 2026 14:49

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.

Copilot AI review requested due to automatic review settings July 13, 2026 14:54

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.

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

zkochan has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

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

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 9f8f4de

@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

🤖 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 155-158: Update the size-cap branch in the previous changelog
download flow to wrap reader.cancel() in try/catch, ignoring any cancellation
failure, and always return undefined once total exceeds maxBytes.
🪄 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: b260b451-1589-461d-b0a8-9847613444b5

📥 Commits

Reviewing files that changed from the base of the PR and between 002c4e4 and 6ddcc6a.

📒 Files selected for processing (2)
  • pnpm/crates/cli/src/cli_args/changelog.rs
  • pnpm11/releasing/commands/src/publish/previousChangelog.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/cli/src/cli_args/changelog.rs

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 6ddcc6a

…path

Once the tarball exceeds the size cap the read is best-effort, so a failing
stream cancellation must not turn it into a hard error — swallow it and return
undefined.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 13, 2026 15:39

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.

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

zkochan has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 6aaf353

@zkochan
zkochan merged commit 0dfce95 into main Jul 13, 2026
27 of 31 checks passed
@zkochan
zkochan deleted the no-changelog branch July 13, 2026 15:46
zkochan added a commit that referenced this pull request Jul 13, 2026
…storage (#12977)

`compose changelogs at publish time (registry storage)` (#12971) made
`changelog.storage: registry` the default, so `pnpm version -r` no longer writes
a committed CHANGELOG.md — it parks each release's section under
`.changeset/changelogs/` for publish-time composition. The `change` command
integration tests (added in #12953) still assert committed CHANGELOG.md files,
so they broke on `main`. #12971 gave the versioning unit tests the same
treatment (a `repository()` settings helper); this does the equivalent for the
CLI integration tests by opting their workspace into `repository` storage.

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
}

async function fetchPublishedChangelog (version: string): Promise<string | undefined> {
const packumentResponse = await fetch(`${REGISTRY_URL}/${PKG_NAME.replace('/', '%2F')}`)
@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.00     23.7±0.42ms    15.8 MB/sec    1.00     23.7±0.44ms    15.8 MB/sec
packument/parse                1.00     78.6±1.21µs   844.3 MB/sec    1.01     79.5±1.58µs   834.1 MB/sec
tarball/download_dependency    1.02      6.9±0.42ms   631.4 KB/sec    1.00      6.8±0.20ms   642.6 KB/sec

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

Labels

product: pacquet 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