Repository navigation
fix(release): the stable cut folds each prerelease section into the stable section instead of copying it - #26156
Merged
Conversation
…table section instead of copying it Leaving pre mode re-applies every changeset the cycle's prereleases consumed, so the stable `## X.Y.Z` section repeated each `## X.Y.Z-next.N` section below it. The changelog generator now arms a fold on an exit-mode cut: when `changeset version` exits 0, each CHANGELOG whose top was a prerelease before the cut drops the cycle's prerelease sections whose every entry the new stable section reproduces. Stable sections and older cycles stay byte for byte. Claude-Session: https://claude.ai/code/session_01PbYqgMPfuTjR2CMEqrjHVL Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
席位核对 · ACCEPT · devx seat 2 · 2026-10-26T14:08ZSeat
Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #26079
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6417011624 (batch #397 item 3, letter A′, maintainer 「同意」)
What this does
On the stable cut out of pre mode (
changeset pre exit, thenpnpm run version), the changelog generator now folds everyX.Y.Z-next.Nsection of the cycle into theX.Y.Zsection instead of leaving it as a second copy below it. Today that cut re-applies every changeset the prereleases consumed, so the stable section repeats each prerelease section verbatim (18.0.0 leftpackages/spec/CHANGELOG.mdwith about 4,076 duplicated long lines).Ruled scope, kept: only
scripts/changeset-changelog.mjschanges behaviour; its pins go into the self-test CI already runs for it (node scripts/release-pending-publish.mjs --self-test, lint.yml), the file surface the seat widened on the claim. ⛔ Nofileschange in anypackage.json—CHANGELOG.mdkeeps shipping (AGENTS.md, Documentation Guardrails). ⛔ No existing CHANGELOG text is rewritten by this PR, and the generator never touches an older cycle (#25919 A 「存量不横扫」). No workflow change, no new gate.Timing — when the fold runs, and on what
The generator API (
getReleaseLine/getDependencyReleaseLine) hands out one line at a time and is told neither the package nor the version, and@changesets/apply-release-planwrites everyCHANGELOG.mdonly after all lines are generated. So:.changeset/pre.jsonsays"mode": "exit"(the stable cut; the version pass itself deletes that file later). An rc cut (mode: "pre") and a normal cut (nopre.json) arm nothing.*CHANGELOG.mdwhose top## VERSIONis a prerelease (read from the first 64 KiB only).changeset versionprocess exits 0 (aprocess.once('exit')handler; a failed version pass folds nothing). For each snapshotted file whose top is now a new stable section sitting directly above the old top, the prerelease sections between that stable section and the next stable one below are dropped — each one only if every changeset entry it carries is found in the new stable section (compared without the commit prefix). Dependency-bump entries (Updated dependencies,pkg@X.Y.Z-next.N) are superseded by the stable section's own. A section holding an entry the stable section does not reproduce (amended in place by a docs PR, say) stays, with a::warning::naming it.What may fold is fixed by the file as it stood before the cut, never by a version guess, so every stable section and every older cycle's prerelease sections are kept byte for byte. One plain line reports the count:
changeset-changelog: the stable cut folded N prerelease section(s) in M CHANGELOG(s) into their stable section.Evidence
node scripts/release-pending-publish.mjs --self-testat2f44043a:✓ release-pending-publish self-test: 136 cases across 34 batteries pass.Three new batteries (floor 31 → 34): a prerelease section folds (4 cases); the stable section is kept whole, and so is every older cycle, and a section with an entry the stable section lacks stays (5 cases); armed only on an exit-mode cut, for the files whose top was a prerelease, folded after the write (3 cases).@changesets/cli3.0.3, throwaway repo, two fixed packages, this generator):pre enter next→ version (1.2.0-next.0) → version (1.2.0-next.1) →pre exit→ version (1.2.0). Result:## 1.2.0(all three entries, each naming the commit that added its changeset), then the untouched## 1.1.0/## 1.1.0-next.0; the run printedfolded 4 prerelease section(s) in 2 CHANGELOG(s). The rc cuts in between folded nothing.origin/main95294be3: the stable cut leaves 5 sections (1.2.0,1.2.0-next.1,1.2.0-next.0,1.1.0,1.1.0-next.0), 37 + 36 lines, against 3 sections and 23 + 22 lines with this change.Confidence gap from the card
No downstream tooling reads an installed CHANGELOG's prerelease section:
check:release-notes,check:release-page-status,check-release-section-coverage.mjs) read## N.x.yheadings for majors / GA versions; the stable heading the fold keeps is what they count.objectstack-ai/hotcrmat9464673: no script readsnode_modules/@objectstack/*/CHANGELOG.md; one code comment cites the17.0.0heading of installed CHANGELOGs, a stable heading.objectstack-ai/cloud: NOT MEASURED — not readable from this session.Gates
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat2f44043aderives 33 commands; all 33 exit 0, and--ranreconciles33 derived, 33 run, 0 NOT-MEASURED, 0 UNRUN. CI families outside the derivation are read from this PR's check-runs.Acceptance notes
skip-changeset: the diff is repository tooling underscripts/, which no package'sfilesships.Generated by Claude Code