Repository navigation
feat(release): compose changelogs at publish time (registry storage) - #12971
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe 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. ChangesRegistry changelog storage
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
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by Qodofeat(release): default to registry-stored changelogs composed at publish time
AI Description
Diagram
High-Level Assessment
Files changed (33)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1.
|
Confidence Score: 4/5The 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.
Reviews (1): Last reviewed commit: "feat(release): compose changelogs at pub..." | Re-trigger Greptile |
PR Code Suggestions ✨Latest suggestions up to 6aaf353 Warning
Previous suggestionsSuggestions up to commit 6ddcc6a
Suggestions up to commit 002c4e4
Suggestions up to commit 0e3d2a2
Suggestions up to commit fb44b1f
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
zkochan has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Code review by qodo was updated up to the latest commit 0e3d2a2 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (4)
pnpm/crates/versioning/src/pending.rs (1)
19-26: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd 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 unscopedlib/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 winAdd 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'scompose_registry_changelog(...).await?propagates bare. This is most costly inrun_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 winStale comment references a non-existent function
injectChangelog.The composer in this file is
composeRegistryChangelog(line 406), notinjectChangelog. 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 winBroad catch in
maybeGunzipmasks 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, unlikefetchPackument'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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!pnpm-lock.yaml
📒 Files selected for processing (32)
.changeset/registry-changelog-storage.mdpnpm/crates/cli/src/cli_args.rspnpm/crates/cli/src/cli_args/changelog.rspnpm/crates/cli/src/cli_args/dispatch_query.rspnpm/crates/cli/src/cli_args/pack.rspnpm/crates/cli/src/cli_args/publish.rspnpm/crates/cli/src/cli_args/version.rspnpm/crates/napi/src/pack.rspnpm/crates/pack/src/lib.rspnpm/crates/pack/src/tarball.rspnpm/crates/pack/src/tests.rspnpm/crates/versioning/src/apply.rspnpm/crates/versioning/src/apply/tests.rspnpm/crates/versioning/src/changelog.rspnpm/crates/versioning/src/error.rspnpm/crates/versioning/src/lib.rspnpm/crates/versioning/src/pending.rspnpm/crates/versioning/src/settings.rspnpm11/core/types/src/versioning.tspnpm11/releasing/commands/package.jsonpnpm11/releasing/commands/src/publish/pack.tspnpm11/releasing/commands/src/publish/previousChangelog.tspnpm11/releasing/commands/src/publish/publish.tspnpm11/releasing/commands/src/publish/recursivePublish.tspnpm11/releasing/commands/src/version/index.tspnpm11/releasing/commands/test/publish/registryChangelog.tspnpm11/releasing/commands/tsconfig.jsonpnpm11/releasing/versioning/src/applyReleasePlan.tspnpm11/releasing/versioning/src/changelog.tspnpm11/releasing/versioning/src/index.tspnpm11/releasing/versioning/src/pendingChangelog.tspnpm11/releasing/versioning/test/lifecycle.ts
💤 Files with no reviewable changes (1)
- pnpm/crates/versioning/src/error.rs
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
zkochan has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
|
Code review by qodo was updated up to the latest commit 9f8f4de |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
pnpm/crates/cli/src/cli_args/changelog.rspnpm11/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
|
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]>
There was a problem hiding this comment.
zkochan has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
Code review by qodo was updated up to the latest commit 6aaf353 |
…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')}`) |
Micro-Benchmark ResultsLinux |
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
registrychangelog-storage mode, made the default.In
registrymode noCHANGELOG.mdis committed to the repository. Each release's changelog section is parked under.changeset/changelogs/<pkg@version>.mdatpnpm version -rtime. At publish,pnpm publish/pnpm packcompose the section, fetch the previously published version's tarball (the highest published version semver-lower than the one being published), prepend the section to itsCHANGELOG.md, and pack the result into the new tarball. Consumed change intents are garbage-collected by a laterpnpm version -ronly 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: repositoryopts back into committedCHANGELOG.mdfiles.Landed in both the TypeScript CLI and the Rust
pnpm/(pacquet) port.Squash Commit Body
Checklist
pnpm/port.Written by an agent (Claude Code, claude-opus-4-8).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
CHANGELOG.mdfrom overriding newly composed injected content.