Read a frozen changelog whose title is not the configured one - #18
Merged
Merged
Conversation
_readChangelogSections found the first release by stripping an exact match of template.changelogTitle. Anything else at the top of the file -- a funding banner, a title whose wording has changed since the file was written -- stayed attached to the release below it, so that release's section was keyed off the preamble's first line instead, found no version, and was dropped. The next generate then wrote the changelog without it, silently, and only when the newest release was old enough for frozenBefore to freeze it. The title is now whatever precedes the first release heading, so the sections read back depend on the configuration rather than on what the file being replaced happens to say. The heading pattern the section split already used is shared with it, so the two cannot drift. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The bug
_readChangelogSectionsfound the first release by stripping an exact match oftemplate.changelogTitlefrom the top of the file. Anything else up there — a fundingbanner added to the title, or a title whose wording changed since the file was last
written — did not match, so the preamble stayed attached to the release below it. That
release's section was then keyed off the preamble's first line, which has no version in
it, so the section was dropped from the map
frozenBeforecopies from, and the nextgren changelog --generatewrote the file without it.It fails silently, and only when the newest section in the file is old enough for
frozenBeforeto freeze it — which is exactly the case where nothing regenerates it.The fix
The title is now whatever precedes the first release heading, so what is read back
depends on the configuration rather than on what the file being replaced happens to say.
The exact-title strip stays as the fast path for a release template that is not a
heading. The heading pattern the section split already used is now shared with the
preamble scan, so the two cannot drift apart — this bug was the two disagreeing about
where a release starts.
Verification
Both tests were written first and the first one failed for the reported reason
(
expected undefined to equal '## v2.0.0 (2020-01-15)...').Run over this repository's own history — 14 releases,
dataSource: prs,frozenBefore—writing to a scratch file in a throwaway clone, never over a real
CHANGELOG.md:No banner, unchanged title: output is byte-identical before and after. No diff.
Banner in
changelogTitle, file on disk still carrying the old title (the first runafter adding a banner), with
frozenBeforeset late enough to freeze every release:masterwrote 45 release headings, this branch wrote 46. The diff is the whole ofv5.1.1, silently missing onmaster:The release list this branch writes matches the committed
CHANGELOG.mdexactly.npm test133 passing;env -u GREN_GITHUB_TOKEN npx mocha94 passing, 39 pending;npm run lintclean apart from the pre-existingmocha/no-pending-testswarning intest/Gren.spec.js.markdownlint-cli2reports the same three pre-existing errors on thegenerated file as on the committed
CHANGELOG.md, and none that are new.🤖 Generated with Claude Code