Skip to content

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

Open

Description

@admarble

Summary

Each PR edits the [Unreleased] block of CHANGELOG.md, so each squash-merge into main makes the next PR conflict. Move to one changelog fragment file per PR and build CHANGELOG.md from the fragments at release time.

Current State

  • 121 of 192 first-parent commits on main since 2026-09-01 touch CHANGELOG.md.
  • .gitattributes sets CHANGELOG.md merge=union. Its own comment notes that GitHub still conflicts: the union driver only helps local merges.
  • Guard wave 1 (2026-09-20) needed a scratch resolve-changelog.py for N serial conflict rounds. PR chore(guard): post-release action items from the 2026-09-20 run #1133 shipped the union workaround.
  • /release reads [Unreleased] directly: Step 3 (stamps the version heading) and the feature-bullet extraction at ~L330 (sed -n '/^## \[Unreleased\]/,/^## \[/p').
  • Merge queue (linked issue) won't fix this: a conflicting PR is removed from the queue.

Proposed Change

Each PR adds a file under changelog.d/ (or similar), named so two PRs never collide (e.g. <issue>-<slug>.md), holding a section key (Added/Fixed/Changed) and the entry text. /release gathers the fragments into a new version section, deletes them, and commits.

Tool options:

  • changie: fragments only, does not own versioning. Standalone Go binary, so it adds a non-npm dependency to release.
  • @changesets/cli: npm-native, but it also bumps versions and writes the changelog its own way, which clashes with /release's own bump.
  • ~50-line script in scripts/: no new dependency, fits the existing scripts/ + vitest pattern.

Recommendation: the in-repo script, unless the spec finds a reason to use changie.

Exec's "add an [Unreleased] entry" instruction has to switch to "add a fragment".

Acceptance Criteria

  • AC-1: exec SKILL.md (and mirrors) instructs writing a changelog fragment, not editing CHANGELOG.md — Evidence: grep -n "changelog.d" .claude/skills/exec/SKILL.md
  • AC-2: a collate script turns fragments into a version section grouped by kind, deletes the fragments, and fails non-zero on a malformed fragment — Evidence: npx vitest run scripts/changelog-collate.test.ts
  • AC-3: /release Step 3 and the feature-bullet step read the collated output, not [Unreleased] — Evidence: grep -nE "changelog.d|collate" .claude/skills/release/SKILL.md
  • AC-4: two branches that each add a fragment merge into main without conflict — Evidence: scripted two-branch merge in a test
  • AC-5: the existing [Unreleased] entries are migrated or kept, and none are lost — Evidence: diff of the next release's section against the pre-change [Unreleased]

Context

  • Location: CHANGELOG.md, .gitattributes, .claude/skills/{exec,release}/SKILL.md, scripts/
  • Type: Infrastructure
  • Effort: Medium
  • Identified by: /improve analysis (tooling research, 2026-10-07)

Related

Activity

  1. added
    enhancement
    on Oct 7, 2026
  2. admarble commented on Oct 7, 2026

    @admarble
    ContributorAuthor

    Paired with #1350 (merge queue). Its merge_group trigger should cover the fragment-collate check too, if that becomes a CI job.

  3. admarble commented on Oct 8, 2026

    @admarble
    ContributorAuthor

    Runner note (sequant run, 2026-10-08):

    • plugin/ is frozen while the plugin-directory review is open. This issue's skill edits are its core, so do them as specified (sync the mirrors as usual); the runner will hold the PR unmerged until the review closes.
    • Don't run the full npm test; CI runs it. Use the affected-tests rules in exec's skill (improve(skills): phases run affected tests (vitest --changed) instead of the full suite; CI keeps the full run #1349): the changed and AC-named tests, the SKILL_ROOTS tests, foreground, timeout 590. Commit every ~10 minutes.
    • Put the SEQUANT_MUTATION markers and the AC table in exec's final ## Summary. The 2.19.0 server may drop it, and the runner will restore it from the transcript.
  4. admarble commented on Oct 8, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (5 ACs, 5 directories)

    AC Quality Check

    All five ACs are single-line with an Evidence: clause. I ran the command-shaped ones on main: AC-1 and AC-3 grep for changelog.d|collate and find 0 matches in the exec and release skills, and scripts/changelog-collate.test.ts does not exist, so none of them pass today.

    • AC-4 ("scripted two-branch merge in a test") names no file. Tighten it to npx vitest run scripts/changelog-collate.test.ts (a git init temp repo, two branches, each adds a fragment, git merge exits 0).
    • AC-5's evidence is a manual diff. Make it checkable: a test that the migrated fragments, collated, reproduce the pre-change [Unreleased] bullets.
    • AC-1 says "(and mirrors)". Make it explicit: .claude/skills, templates/skills, plugin/skills (SKILL_ROOTS).

    Scope Assessment

    Non-Goals: ⚠️ not in the issue. Proposed: no changie/changesets, no CI job for collation (#1350 may add one), no rewrite of released sections in CHANGELOG.md.

    Metric Value Status
    Feature count 1 ✅
    AC items 5 ✅
    Directory spread 5 (scripts/, changelog.d/, 3 skill roots, root files) ⚠️

    Verdict: ✅ SCOPE_OK

    Acceptance Criteria

    AC-1: exec instructs a fragment, not a CHANGELOG edit

    Verification: Unit Test (gate test reading the §3f region of exec SKILL.md)
    Scenario: Given exec §3f → When read → Then it names changelog.d/ and does not say to edit ## [Unreleased].

    AC-2: collate script

    Verification: Unit Test
    Scenario: Given fragments with Added/Fixed/Changed keys → When collated for version X → Then a ## [X] - date section grouped by kind is inserted, fragments deleted; a malformed fragment (no key, unknown key, empty body, bad filename) exits non-zero and deletes nothing.

    AC-3: /release reads collated output

    Verification: Unit Test (gate test on Step 3 and the feature-bullet region)
    Scenario: Given release SKILL.md → Then Step 3 runs the collate script and the bullet extraction reads the new version section, not [Unreleased].

    AC-4: no merge conflict

    Verification: Integration Test
    Scenario: Given two branches off one commit, each adding a different fragment → When merged → Then exit 0 and both files present.

    AC-5: no entries lost

    Verification: Unit Test + Manual
    Scenario: Given the current [Unreleased] (4 bullets) → When migrated → Then each bullet is one fragment, and collating them reproduces the same bullets.

    Implementation Plan

    Phase 1: Script (TDD)

    1. scripts/changelog-collate.ts plus scripts/changelog-collate.test.ts. Fragment format: changelog.d/<issue>-<slug>.md, first line kind: Added|Fixed|Changed|Removed|Security, rest is the bullet. Collation is deterministic (sort by issue number). --check validates without writing, for a possible CI job. Add an npm run changelog:collate script.
    2. Two-branch merge test with a temp git repo (hermetic git config, per the gpg pitfall).

    Phase 2: Skills (edit .claude/skills, then npm run sync:skills)

    1. exec §3f: write a fragment. Update the "CHANGELOG: N/A" wording.
    2. release Step 3 and the bullets step (L330 to L392 fallback): run collate, extract from the new section. Update the git add list at L537 to include deleted changelog.d/*.
    3. qa §10a (L3033 and L2725, 3045, 3055, 3075, 3228, 3264, 3805) also checks [Unreleased]. The issue omits it. It must check for a fragment named for the issue, or changelog_missing fires on every PR. Run the lint-skill-gates and SKILL_ROOTS tests.
    4. scripts/release.sh L62-75 stamps [Unreleased]. Switch it to collate, or the two release paths diverge.

    Phase 3: Migrate

    1. Move the 4 [Unreleased] bullets into fragments, keep an empty ## [Unreleased] heading as the insertion anchor, update .gitattributes (drop the union driver and its comment once nothing edits CHANGELOG.md in PRs), add changelog.d/README.md, add this PR's own fragment.

    Design Review

    1. Where does it belong? scripts/ (existing script plus vitest pattern), called from /release.
    2. Simplest approach? In-repo script. Rejected: changie (Go binary), changesets (clashes with /release bump).
    3. Pattern and recurrence: the shared-block conflict was patched twice: merge=union in chore(guard): post-release action items from the 2026-09-20 run #1133, and a scratch resolve-changelog.py in the 2026-09-20 wave. Both are workarounds for one cause (a shared file). Fragments fix the class, so this is not a third patch.
    4. Reviewer challenge: "why not just the merge queue?" A conflicting PR is removed from the queue, so it does not fix this (improve(ci): merge queue on main instead of strict up-to-date — 37 merge-main commits in the last 40 PRs #1350 pairs with it).
    5. Producers/consumers of [Unreleased]: producers: exec §3f, hand edits. Consumers: release Step 3 and bullets, scripts/release.sh, qa §10a (8 sites), the three skill roots. All covered by the plan. docs/features/exec-qa-phase-guards.md and the ac-linter test only mention the word, so no change.

    ADR: Q2 rejects changie and changesets, so the exec PR should include an ADR in docs/adr/ (next is 0011, per its README).

    Feature Quality Planning

    • plugin/ is frozen per the runner note, so mirror edits are the issue's core. The PR is held unmerged.
    • Rollover: PRs open when this lands still edit [Unreleased]. Keep the anchor and make collate append any remaining [Unreleased] bullets, so nothing is lost.
    • Derived AC-6 (Medium): qa §10a accepts a fragment as the changelog entry, with a gate test.

    Open Questions

    1. Should a CI job run collate --check? Recommendation: no, defer to improve(ci): merge queue on main instead of strict up-to-date — 37 merge-main commits in the last 40 PRs #1350's merge_group trigger. Impact: a malformed fragment is found at release.
    2. Does release.sh stay? Recommendation: update it in this PR. Impact: otherwise it breaks on the next release.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: the script's unit and integration ACs are covered by exec's tests. testgen is optional, as the script's behaviour is spelled out above. No UI, no security surface.

    Label Review

    Current: enhancement. Recommended: enhancement, planned. Quality loop stays off.

  5. added
    planned
    on Oct 8, 2026
  6. admarble commented on Oct 8, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 6/6 met

    Gaps:

    • Collate silently deletes [Unreleased] bullets that have no ### Kind heading, an entry-loss path for PRs opened before the switch
    • The AC-5 test covers only the [Unreleased] carry-over path; no test pins that the migrated fragments reproduce the pre-change bullets
    • Gate-test AC-5 has no SEQUANT_MUTATION marker; add the markers to exec's final ## Summary
    • Script changes have no /verify evidence (new functionality, so the no-/verify exception does not apply)
    • Required CI test check still pending at QA time; re-run QA after it reports

    Suggestions:

    • Reject a fragment body that starts with - , which would render as - - ….
    • Indent continuation lines of multi-line bodies. Markdown's lazy continuation currently covers it, but it's fragile.
    • Validate the value after --date. A bare --date produces - undefined in the heading.
  7. admarble commented on Oct 8, 2026

    @admarble
    ContributorAuthor

    Execution Verification (runner, 2026-10-08, branch head c08409fe)

    Commands run for real against the branch:

    Command Where Result
    npx tsx scripts/changelog-collate.ts 2.20.0 --check the worktree OK: 20 entries for 2.20.0, exit 0, worktree unchanged
    npx tsx scripts/changelog-collate.ts 2.20.0 --date 2026-10-08 a throwaway detached checkout Collated: 20 entries for 2.20.0, exit 0. ## [2.20.0] - 2026-10-08 has ### Added (4), ### Changed (1, #1351), ### Fixed (15). ## [Unreleased] is left empty, and changelog.d/ holds only README.md
    same, with - orphan (#9) inserted under ## [Unreleased] before any heading throwaway checkout exit 1, CHANGELOG.md has lines collate cannot place … - orphan (#9). CHANGELOG.md byte-identical, all 20 fragments kept

    scripts/release.sh now calls npm run changelog:collate -- "$VERSION" --date "$DATE" in place of the sed heading rename. It runs that same entry point under set -e (exit 1 stops the release). The release script itself wasn't run, since it publishes.

  8. added a commit that references this issue on Oct 8, 2026
  9. added 2 commits that reference this issue on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions