Skip to content

Parked changelog sections are never garbage-collected for renamed or unpublished packages #38

Open

Description

@zkochan

.changeset/changelogs/ parked sections are never garbage-collected for packages whose in-repo name is not their published name, or that are never published. 36 sections have accumulated, the oldest going back to [email protected], and the consumed intents they were composed from linger with them.

Mechanism

In registry changelog storage a release's changelog section is parked at .changeset/changelogs/<package>@<version>.md and consumed at publish. Collection is gated on the registry confirming that the published tarball's changelog contains that section — confirmed_published_versions in pnpm/crates/cli/src/cli_args/changelog.rs:

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}"))

fetch_changelog resolves name against the registry as-is:

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())?,

name is the in-repo package name. When that is not the published name, or the package is not published at all, this resolves to None and the release can never be confirmed.

Verified against the live registry

  • pacquet (11 sections, alpha.11 → alpha.21). pacquet publishes as pnpm / @pnpm/exe under next-12 and is private: true in-repo. The name pacquet does resolve on npm — to an unrelated package with 54 versions, all 0.x, latest 0.11.12. So fetch_from_registry succeeds, versions.contains_key("12.0.0-alpha.17") is false, and the lookup returns None. The real artifact is [email protected], which exists (next-12 is currently 12.0.0-alpha.21).
  • pd (4 sections, 1100.0.19 → 1100.0.22). Same shape: pd on npm is an unrelated package, 28 versions, latest 0.8.1.
  • Never-published packages (20 sections). @pnpm/scripts, @pnpm-private/updater, @pnpm/get-release-text, @pnpm/jest-config, @pnpm/testing.registry-mock, @pnpm/testing.mock-agent, @pnpm/testing.command-defaults — all 404 on npm. They get parked sections that can never be confirmed.

Impact

  1. The stated invariant does not hold. The doc comment on confirmed_published_versions says "Every parked file belongs to an as-yet-unpublished release, so the cost is bounded by the release backlog, not by history." It is currently bounded by history: every release of an affected package adds a file that is never removed, and each one costs a registry round-trip on every pnpm version -r.

  2. Consumed intents linger, which misleads readers about what has shipped. Parked sections are collected "together with the intents [they were] composed from, under the same registry-confirmed gate", so the intents are stranded too. Concretely: .changeset/pacquet-edge-aware-engine-strict.md is recorded in .changeset/ledger.yaml as consumed by [email protected], has been published for several alphas, and is still sitting in .changeset/. A file in .changeset/ therefore stops being a signal that a change is unreleased, and editing one silently rewrites published release notes.

Notes toward a fix

Deliberately not prescribing one, but the cases look distinct:

  • Renamed at publish (pacquet, pd) needs the published name to probe with. Worth being careful here: because both names resolve to unrelated real packages, a wrong-name probe fails quietly rather than erroring, and could in principle produce a false confirmation if an unrelated package's changelog happened to contain the section text.
  • Never published (private packages) may not warrant a parked section at all — there is no tarball changelog to prepend to — so the fix might belong at parking time rather than collection time.
  • It may also be worth distinguishing "this package/version is absent from the registry" from "it is published but the changelog lacks the section", since only the second is the not-yet-published state the gate is designed for.

The TypeScript side takes the gate as an injected predicate (verifyPublished?: (name, version, section) => Promise<boolean> in pnpm11/releasing/versioning/src/applyReleasePlan.ts), so it is name-based by contract too and whatever supplies it has the same trap.

Found while looking into whether an already-released parked section could be corrected in place (it cannot, and should not be edited — the collection gate matches it verbatim against the published changelog). Context in pnpm/pnpm#13286.


Written by an agent (Claude Code, claude-opus-5[1m]).

Activity

  1. github-actions commented on Jul 25, 2026

    @github-actions

    Oz triage is running now and will classify this issue and apply one pnpm state: label.

    Follow along in Oz: https://app.warp.dev/run/019f9956-9d96-7171-bc4d-0987bd87ca61

  2. github-actions commented on Jul 25, 2026

    @github-actions

    Triage result

    • Issue: pnpm/tasks#38 — Parked changelog sections are never garbage-collected for renamed or unpublished packages
    • State: Ready to spec
    • Applied label: state: needs design
    • Product / parity: pacquet (Rust, pnpm/crates/cli/src/cli_args/changelog.rs) and pnpm11 (TypeScript, pnpm11/releasing/versioning/src/applyReleasePlan.ts + previousChangelog.ts) — both stacks need matching fixes
    • Rationale: The bug is real and verified: 36 parked sections have accumulated in .changeset/changelogs/ in the current checkout, exactly matching the reported counts (11 for pacquet, 4 for pd, 20+ for never-published packages). The mechanism is fully understood: confirmed_published_versions uses the in-repo package name for registry probes, which silently fails for packages renamed at publish (pacquet→pnpm) and can never succeed for packages that are never published. However, the fix is non-trivial: for renamed packages, naively using publishConfig.name risks a false confirmation (an unrelated npm package with that name could satisfy the probe), and for never-published packages the right fix may belong at parking time rather than collection time. The issue author deliberately did not prescribe an approach, signalling that design work is needed before implementation. Multi-stack parity (Rust + TypeScript) amplifies the scope.
    • Next step: Design the garbage-collection fix — specifically: (1) how to safely resolve the published name for renamed packages without false-confirmation risk, (2) whether to suppress parking for private/never-published packages at pnpm version -r time, and (3) whether to distinguish "absent from registry" from "published but changelog section missing". Once the approach is chosen, coordinate the implementation across both stacks.

    Written by an agent (Oz, auto).

  3. zkochan commented on Jul 25, 2026

    @zkochan
    MemberAuthor

    Investigated properly on a fresh worktree. Two corrections to the report above, one of which makes this considerably more serious than a GC leak.

    The Rust CLI has been publishing without a changelog

    [email protected] and @pnpm/[email protected] contain no CHANGELOG.md at all. For comparison, [email protected] (TypeScript CLI) and @pnpm/[email protected] both do. So the parked sections for pacquet are not merely uncollected — the prose they hold has never reached users. Eleven alphas' worth of release notes are sitting in .changeset/changelogs/ and have never been published anywhere.

    Mechanism: pnpm/npm/pnpm/scripts/generate-packages.mjs:96 rewrites the manifest name before publish —

    rootManifest["name"] = "pnpm";

    — and compose_registry_changelog then reads the name back off that rewritten manifest:

    let Some((name, version)) = read_name_version(project_dir) else { return Ok(None) };
    let Some(section) = read_pending_changelog(workspace_dir, &name, &version)? else { return Ok(None) };

    So it looks for .changeset/changelogs/[email protected] while the section was parked as [email protected], gets None, and packs no changelog. The same name mismatch then makes confirmed_published_versions probe pacquet on npm, which is an unrelated 0.x package, so the section is never confirmed and never collected. One root cause, two symptoms.

    "Private" is not the criterion

    @pnpm/napi is private: true in-repo and publishes correctly, with a properly composed changelog:

    package/CHANGELOG.md
    # @pnpm/napi
    ## 12.0.0-alpha.21
    ## 12.0.0-alpha.20
    

    Its single parked section is legitimately pending the next pnpm version -r, not leaked. The generator strips private for packages that ship, so the flag says nothing about whether a package reaches the registry.

    The two classes that actually break are:

    1. Renamed at publish — pacquet (11 sections, alpha.11 → alpha.21) and pd (4 sections). Compose and confirm both look up a name the registry does not have under that identity.
    2. Genuinely never published — @pnpm/scripts, @pnpm-private/updater, @pnpm/get-release-text, @pnpm/jest-config, @pnpm/testing.registry-mock, @pnpm/testing.mock-agent, @pnpm/testing.command-defaults (20 sections, all 404 on npm). There is no destination for their prose, so the gate can never pass by construction.

    Class 2 is the awkward one to fix on its own, because the repo cannot currently tell "not published yet" from "never will be" — private: true does not distinguish them, as @pnpm/napi shows.

    Why this is not a one-line fix

    The in-repo name is deliberately pacquet so it cannot collide with the TypeScript CLI's pnpm package, and the versioning system keys intents, the ledger, and parked sections by that in-repo name. The published identity is pnpm. Nothing currently declares that mapping: publishConfig does not accept name (it is absent from PUBLISH_CONFIG_WHITELIST in pnpm11/releasing/exportable-manifest/src/overridePublishConfig.ts), so the rename only exists inside a CI shell step, where the versioning layer cannot see it.

    Any fix therefore has to give compose-time and confirm-time a shared, declared notion of the published identity — or decide that these packages should not park sections at all.


    Written by an agent (Claude Code, claude-opus-5[1m]).

  4. transferred this issue frompnpm/pnpmon Sep 26, 2026
  5. zkochan commented on Sep 28, 2026

    @zkochan
    MemberAuthor

    A related regression reached the 11.28.1 / pacquet 12.8.0 / pnpr 0.1.0-alpha.14 release PR (pnpm/pnpm#16312).

    pnpm/pnpm#14934 (shipped in pnpm 12.7.0) routes every private: true project to repository changelog storage (ReleaseStorage::of in pnpm/crates/versioning/src/apply.rs). pacquet, @pnpm/napi and @pnpm/pnpr are private in-repo but published through their generators. Since the repo now pins pnpm 12.7.0, the release bump wrote their sections to newly committed pnpm/npm/pnpm/CHANGELOG.md, pnpm/npm/napi/CHANGELOG.md and pnpr/npm/pnpr/CHANGELOG.md and parked nothing. That breaks both consumers of the parked section:

    • release.yml reads .changeset/changelogs/pacquet@<version>.md and @pnpm!pnpr@<version>.md for the GitHub release body, and would draft both releases with empty descriptions.
    • compose_registry_changelog injects the npm tarball's CHANGELOG.md only from a parked section, so [email protected] would have shipped without its composed changelog history.

    For this release, the three sections were moved back to parked files by hand on the release branch. The parked files will be confirmed and collected normally by the next bump. The next release PR will hit the same problem until the storage decision stops treating "private" as "never published". Given the earlier finding here that private does not identify unpublished packages, a declared marker (or excluding projects that set publishConfig.name, or a versioning setting listing the packages that keep registry storage) is probably needed. The TypeScript side mirrors this in privateProjectDirs.


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

  6. zkochan commented on Nov 8, 2026

    @zkochan
    MemberAuthor

    Status check against main (2026-11-08).

    Renamed packages are now probed under their published name (pnpm/pnpm#13353, published_names in changelog.rs).

    Left: 11 [email protected].* and 4 pd sections, and never-published sections (@pnpm/scripts, @pnpm-private/updater, …) remain in .changeset/changelogs/, and ReleaseStorage::of still sends every private directory to repository storage.

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions