Skip to content

feat(#1351): improve(release): changelog fragments instead of a shared [Unreleased] block — 121/192 main commits touch CHANGELOG.md - #1370

Draft
admarble wants to merge 5 commits into
mainfrom
feature/1351-improve-release-changelog-fragments-instead-of-a-s
Draft

admarble wants to merge 5 commits into
mainfrom
feature/1351-improve-release-changelog-fragments-instead-of-a-s

Conversation

@admarble

@admarble admarble commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PRs now add a changelog fragment under changelog.d/ instead of editing CHANGELOG.md, and /release collates the fragments at release time. (Body rebuilt from exec's transcript; the 2.19.0 server left the placeholder, #1311.)

⏸ Hold: do not merge while the plugin-directory review is open. This PR edits plugin/skills/ (the exec, qa and release mirrors), and plugin/ is frozen until the review of v2.19.0 closes (owner decision, 2026-10-08).

What changed

  • Collate script: scripts/changelog-collate.ts, run as npm run changelog:collate -- <version> [--date D] [--check].
    • A fragment is changelog.d/<issue>-<slug>.md: a kind: Added|Changed|Fixed|Removed|Security line, then the entry text.
    • It writes a version section grouped by kind and deletes the fragments.
    • It carries over any bullets still under [Unreleased], so PRs opened before this lands lose nothing.
    • A malformed fragment exits non-zero and writes and deletes nothing.
  • Skills (edited in .claude/skills, then sync:skills to templates/skills and plugin/skills):
    • /exec §3f now writes a fragment.
    • /release Step 3 runs the collate script, the feature-bullet step reads the new version's section, and git add includes changelog.d.
    • /qa §10a accepts a fragment added by the branch as the changelog entry.
  • scripts/release.sh now calls the collate script.
  • Migration: the [Unreleased] entries became 19 fragments, not the 4 the spec expected, because that block held 4 Added and 15 Fixed bullets. I also added this PR's own fragment, changelog.d/README.md, and ADR-0011 (with its README index row). .gitattributes no longer sets merge=union.
  • Release-step bug fixed: the existing head -n -1 in the feature-bullet extraction dropped the last bullet whenever Added was the final section, and BSD head doesn't support it. I replaced it.

AC verification

AC Status Evidence
AC-1 exec instructs a fragment ✅ scripts/changelog-skills.test.ts checks the §3f region in all three skill roots
AC-2 collate script ✅ scripts/changelog-collate.test.ts covers grouping, deletion, four malformed cases, and --check
AC-3 /release reads collated output ✅ scripts/changelog-skills.test.ts runs the documented extraction against a really collated file
AC-4 two branches merge cleanly ✅ the two-branch merge test in scripts/changelog-collate.test.ts, in a git init temp repo
AC-5 no entries lost ✅ scripts/changelog-collate.test.ts collates the pre-change [Unreleased] fixture and compares all bullets; I also checked the one-time migration produced 19 fragments from 19 bullets
AC-6 (derived) /qa accepts a fragment ✅ scripts/changelog-skills.test.ts runs the real detection line in a temp git repo

Checks

  • npm run build and npm run lint pass, as do lint:skill-calls and lint:skill-argument-substitution.
  • Affected tests: --changed selected all 379 files (the package.json change), so I ran a targeted set instead: 52 files, 841 tests, all pass. The set is every test that mentions SKILL_ROOTS, CHANGELOG, release/SKILL or release.sh, plus the tautology-detector test, the new tests and scripts/exec-skill-marker.test.ts.
  • I did not run the full npm test; CI does.

Each mutation made exactly the named test fail, then I restored the file.

Pre-PR confidence check

QA round 1 fixes (runner, c08409fe)

  • Entry-loss bug fixed. unreleasedBullets silently dropped a bullet sitting under [Unreleased] before any ### Kind heading (and any stray prose), then rewrote CHANGELOG.md without it. Collate now throws, naming the lines, before writing or deleting anything.
  • Migration pinned. New test: every pre-switch [Unreleased] bullet (from __tests__/fixtures/changelog-unreleased-pre-1351.md) lives in a migrated fragment or in CHANGELOG.md. Deleting a fragment fails it, and it stays true after a release collates the fragments into a released section.
  • Execution evidence for changelog-collate.ts and release.sh is posted on improve(release): changelog fragments instead of a shared [Unreleased] block — 121/192 main commits touch CHANGELOG.md #1351: real --check and full-collate runs, plus the orphan refusal (exit 1, file byte-identical).

Mutation-verified: AC-5 — removed changelog.d/1276-qa-6i-counts-changed.md; scripts/changelog-collate.test.ts > changelog collate > every pre-switch [Unreleased] bullet lives in a migrated fragment or CHANGELOG.md (AC-5) failed; restored.
Mutation-verified: AC-5 — disabled the stray-line throw in unreleasedBullets; scripts/changelog-collate.test.ts > changelog collate > refuses an [Unreleased] bullet with no ### Kind heading, writing nothing failed; restored.

Before merging (after the review): merge main in, and turn any [Unreleased] bullets that landed meanwhile into fragments (or leave them under a ### Kind heading, which collate carries over). A --check CI job for malformed fragments is a follow-up.

QA verdict (round 1): AC_MET_BUT_NOT_A_PLUS, 6/6 ACs; the fixable gaps above are fixed.

After v2.20.0 (5a7e42890, 61552d2d9)

Merged main after the 2.20.0 release. 2.20.0 shipped from [Unreleased] and already lists the 19 migrated fragments (#1245–#1352), so they are deleted; collating them would list them a second time under 2.21.0. Only the #1351 fragment remains. CHANGELOG.md takes main's version. The ADR index keeps 0011 and main's 0012–0017.

Fixed: user repos have no changelog.d/. plugin/skills and templates/skills ship /exec and /release to repos that have a CHANGELOG.md but no changelog.d/ and no changelog:collate script. As written, /exec wrote fragments that nothing collates, and /release ran a missing npm script and git add-ed a missing path. Now:

  • /exec §3f writes a fragment only when changelog.d/ exists ([ -d changelog.d ]). Otherwise it adds the bullet under ## [Unreleased] → ### <Kind>, as before.
  • /release Step 3 collates only when changelog.d/ exists. Otherwise it renames [Unreleased] to the new version heading and adds a new empty [Unreleased]. Step 6 stages changelog.d only when git tracks it.
  • /qa §10a's missing-entry note and checklist name both forms.

Mutation-verified: AC-1 — deleted the "If changelog.d/ does not exist" fallback paragraph from .claude/skills/exec/SKILL.md; scripts/changelog-skills.test.ts > changelog skills (#1351) > exec §3f in .claude/skills writes a fragment only when changelog.d/ exists failed; restored.
Mutation-verified: AC-3 — deleted the "Without changelog.d/" paragraph from release Step 3; scripts/changelog-skills.test.ts > changelog skills (#1351) > release Step 3 in .claude/skills stamps [Unreleased] when changelog.d/ is absent failed; restored.
Mutation-verified: AC-3 — replaced the Step 6 git ls-files --error-unmatch changelog.d guard with a bare git add -A changelog.d; scripts/changelog-skills.test.ts > changelog skills (#1351) > release staging of changelog.d succeeds in a repo that never had it failed; restored.
Mutation-verified: AC-5 (re-run after 2.20.0) — deleted the #1276 bullet from the ## [2.20.0] section; scripts/changelog-collate.test.ts > changelog collate > every pre-switch [Unreleased] bullet lives in a migrated fragment or CHANGELOG.md (AC-5) failed; restored.

Fixes #1351


🤖 Generated by sequant run; runner fixes after QA

…he migrated fragments to the pre-switch bullets

QA round 1: a bullet under [Unreleased] before any ### heading (or stray prose) was silently dropped and the CHANGELOG rewritten without it. Collate now throws before writing or deleting anything. New test: every pre-switch [Unreleased] bullet lives in a migrated fragment or in CHANGELOG.md, so deleting a fragment fails it, and it stays true after a release collates them.

Entire-Checkpoint: 81acd4c65887
@admarble
admarble marked this pull request as draft October 8, 2026 04:21
2.20.0 released the 19 migrated changelog.d fragments (#1245-#1352), so they are deleted; only the #1351 fragment remains. CHANGELOG.md takes main's 2.20.0 section.

Entire-Checkpoint: 5eba63e23455
…out changelog.d/

The plugin and templates install these skills into user repos that have a CHANGELOG.md but no changelog.d/ and no changelog:collate script. /exec wrote orphan fragments there, and /release ran a script that does not exist and staged a missing path. Fragments and collate now apply only when changelog.d/ exists; otherwise the old [Unreleased] entry and stamp. /qa's missing-entry advice names both.

Entire-Checkpoint: dbf48e1a97a4
@admarble
admarble marked this pull request as ready for review October 19, 2026 15:15
@admarble
admarble marked this pull request as draft October 19, 2026 15:16
@admarble

Copy link
Copy Markdown
Contributor Author

Held until the plugin-directory review closes (owner decision, 2026-10-19). Prepped on 61552d2: main merged after v2.20.0, released fragments removed, [Unreleased] fallback added for repos without changelog.d/. CI test and canary green, portal Validate matches the baseline. Before merging later: merge main again, re-run CI and Validate.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

improve(release): changelog fragments instead of a shared [Unreleased] block — 121/192 main commits touch CHANGELOG.md

1 participant