doc: merge news into generated changelog#3836
Conversation
Inject unreleased news entries from the 'news/' directory into the
generated CHANGELOG.md during sphinx builds. This allows previewing
unreleased changes in the documentation.
- Extract news-handling logic from release.py into a new changelog_news.py module.
- Add merge_new_into_changelog() to support merging without deleting news files.
- Create docs/merge_changelog.py to wrap the merger for docgen with a static date and 'unreleased' version.
- Update CHANGELOG.md and tests to use {#unreleased} anchors for clean HTML IDs.
- Add a placeholder 'No notable unreleased changes.' when there are no news entries.
The package already has default_visibility = ["//visibility:public"], so setting it explicitly on the :changelog_news target is redundant.
There was a problem hiding this comment.
Code Review
This pull request refactors the release tooling by extracting the changelog and news merging logic into a new module, changelog_news.py, and integrates a changelog merging tool into the documentation build process to preview unreleased changes. The review feedback identifies two issues in the new changelog_news.py file: a bug in the fallback updater where re.match fails to match version anchors starting with curly braces, and a potential crash if the news directory path is a file rather than a directory.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…lease logic
- Remove the commented-out BEGIN_UNRELEASED_TEMPLATE block from CHANGELOG.md.
- Hardcode the Unreleased section template as a constant in changelog_news.py.
- Remove the dead 'fallback' manual release code path from changelog_news.py since the project has transitioned entirely to news-file generation.
- Simplify regex patterns in changelog_news.py to match only the active {#unreleased} section.
- Add count=1 to re.sub calls to prevent accidental leaks or multiple replacements.
- Update release_test.py to match the simplified structure and add a regression test to verify no leaks occur into old releases.
- Remove the strict 'if not entries' check in _add_news_to_changelog's release creation path. - Update generate_release_block to append 'No notable changes.' if no news entries are present. - Add test_update_changelog_empty_news to release_test.py to verify this behavior.
Currently, the generated changelog has a broken link to the news
directory. Since we can process the files as part of docgen, fix the
broken link by rendering the news as one would see it for a release.
Along the way...
news file assembly instead.