Skip to content

Diff a -pre.1 changelog entry against the previous tag, not the stable release after it [patch] - #180

Merged
matt-edmondson merged 2 commits into
mainfrom
fix/156-prerelease-changelog-range
Sep 28, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
fix/156-prerelease-changelog-range

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #156

What was wrong

To resolve the range for a vX.Y.Z-pre.1 entry, ChangelogGenerator.FindSearchTag looked for "prerelease 0", the key X.Y.Z.0. A stable vX.Y.Z tag parses to that same key. Once the stable release is tagged, the -pre.1 entry was diffed against it, the range vX.Y.Z..vX.Y.Z-pre.1 came out empty, and the entry read "No significant changes detected since vX.Y.Z".

Change

When toPrerelease == 1, FindSearchTag now returns fromTag, the adjacent earlier tag. With that path gone, the prerelease search only ever looks for N-1 >= 1, so it can no longer match a stable tag. -pre.2 and later still diff against the previous prerelease.

As the maintainer decision on the issue says, the wrong entries in existing committed CHANGELOG.md files need no hand cleanup.

Tests

  • GenerateAsync_FirstPrereleaseListsCommitsSinceThePreviousTagOnceItsStableTagExists covers the acceptance-criteria history: v1.0.0, then "Add feature A" tagged v1.0.1-pre.1, then "Fix bug B" tagged v1.0.1. The v1.0.1-pre.1 entry must list "Add feature A" since v1.0.0. With the fix reverted, this test fails.
  • GenerateAsync_LaterPrereleaseDiffsAgainstThePreviousPrerelease is a regression guard: v1.0.1-pre.2 still diffs against v1.0.1-pre.1.
  • dotnet test: 762/762 passed. The Sonar-local build reports no new warnings in ChangelogGenerator.cs.

This PR and #179 (for #157) both touch ChangelogGenerator.cs and ChangelogGeneratorTests.cs, but in different places. They should merge in either order without conflicts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KV83HNRiTm3h4n1KgMkdqX


Generated by Claude Code

…e release after it [patch]

FindSearchTag looked for "prerelease 0" when resolving the range for vX.Y.Z-pre.1.
A stable vX.Y.Z tag parses to the same key, so once the stable release was tagged
the -pre.1 entry was diffed against it, got an empty range, and read "No
significant changes detected since vX.Y.Z". The first prerelease of a series now
diffs against the adjacent earlier tag.

Fixes #156

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KV83HNRiTm3h4n1KgMkdqX
Comment thread KtsuBuild.Tests/Metadata/ChangelogGeneratorTests.cs Fixed
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit dcb2da6 into main Sep 28, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the fix/156-prerelease-changelog-range branch September 28, 2026 12:31
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.

Once the stable release is tagged, every -pre.1 changelog entry is empty and says "No significant changes detected since <its own stable release>"

2 participants