Repository navigation
fix(changelog): keep the case of titles when reading the changelog - #2137
Open
vinilpolepalli wants to merge 1 commit into
Open
vinilpolepalli wants to merge 1 commit into
vinilpolepalli wants to merge 1 commit into
Conversation
The changelog formats read the existing changelog in lower case. A `tag_format` with an uppercase character (e.g. `Release-$version`) then does not match the latest release title. The incremental changelog does not find the latest version and writes all versions again, so the changelog gets duplicate entries. Read the titles with their original case. Only the "unreleased" check stays case-insensitive. Assisted By: AI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2137 +/- ##
=======================================
Coverage 98.29% 98.29%
=======================================
Files 61 61
Lines 2874 2874
=======================================
Hits 2825 2825
Misses 49 49 ☔ View full report in Codecov by Harness. |
This branch has not been deployed
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.
Description
The changelog formats read the existing changelog in lower case before they match titles against
tag_format. Thetag_formatregexes are case-sensitive. Whentag_formatcontains an uppercase character (for exampleRelease-$versionorV$version), the latest release title does not match. The incremental changelog then does not find the latest version and writes all versions again, so the changelog gets duplicate entries.This change keeps the original case of each line in
BaseFormat.get_metadata_from_file,BaseFormat.get_latest_full_release_from_fileandRestructuredText.get_metadata_from_file. Only the "unreleased" check stays case-insensitive.Checklist
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines
Assisted By: AI
Code Changes
uv run poe alllocally to ensure this change passes linter check and tests (ranpoe format,poe lintandpoe testseparately; only the GPG tests fail locally becausegpgis not installed, same as on master)Expected Behavior
With
tag_format = "Release-$version", eachcz bump --changelogadds only the new version at the top of the changelog. Before this fix, the second bump wroteRelease-1.1.1andRelease-1.1.0again below the existingRelease-1.1.0entry.Steps to Test This Pull Request
git inita new repository and add.cz.toml:feat: aand runcz bump --yes.fix: band runcz bump --yes.CHANGELOG.mdmust contain## Release-1.1.1then## Release-1.1.0, each one time.New tests: a
Release-${version}case intest_get_metadata_custom_tag_formatfor all four formats, andtest_changelog_incremental_with_uppercase_tag_format. They fail without the fix and pass with it.Additional Context
Open PR #1596 refactors
get_metadata_from_fileand touches the same lines. It keeps.lower(), so it does not fix this issue.🤖 Generated with Claude Code