ChangeLog Generation stability #1923
Merged
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.
ChangeLog Generation stability
Summary
This pull request enhances the robustness of date parsing in the changelog generation tool and fixes a logic issue in version content generation to ensure PR syncing still happens correctly after the
--process-prsphase that incorporated the incoming ChangeLog snippets into the repo's CHANGELOG.md durring CI/CD.After this change, doing this produces an identical change log:
generate_changelog --ai-summarize > CHANGELOG.mdFiles Changed
GetVersions()function to support multiple date formats during parsing, improving compatibility with SQLite-stored dates.generateRawVersionContent()function to avoid early returns when PR numbers are available, ensuring they are outputted.Code Changes
cmd/generate_changelog/internal/cache/cache.go
The key change is in the date parsing logic within
GetVersions():This replaces the nested if-else with a loop for better maintainability and adds support for SQLite-specific formats.
cmd/generate_changelog/internal/changelog/generator.go
The change is in the early return condition in
generateRawVersionContent():This ensures the function continues processing if there are PR numbers to include, preventing incomplete changelog entries.
Reason for Changes
Impact of Changes
version.PRNumbersis populated correctly; if it's empty due to upstream issues, it might still return early unexpectedly.dateStr.Stringcould lead to panics if it's nil or malformed, though the existing error handling mitigates this.Test Plan
cache_test.go. Ensure no regressions in existing RFC3339 parsing.Additional Notes
These changes were driven by real-world issues where SQLite-stored dates caused parsing errors and PR-only versions were omitted. The code is now more resilient, but monitoring for new date formats in production is recommended. No external dependencies were added.