-
-
Notifications
You must be signed in to change notification settings - Fork 702
chore(release): sync changelog and version markers to main during backports #3903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rickeylev
merged 7 commits into
bazel-contrib:main
from
rickeylev:sync-main-changelog-backports
Jul 6, 2026
+1,442
−107
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a736361
chore(release): sync changelog and version markers to main during bac…
rickeylev 5a9dfa3
Merge upstream/main into sync-main-changelog-backports
rickeylev ba62655
chore(release): preserve Unreleased static text in changelog
rickeylev 21bc57c
chore(release): raise error if no smaller version in changelog
rickeylev ce58b87
chore(release): address PR comments on sync PR
rickeylev 24c1c10
refactor(release): modify reset_hard signature to enforce keyword arg…
rickeylev f6e66fe
feat(release): track Sync Changelog tasks in release issue
rickeylev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
120 changes: 120 additions & 0 deletions
120
tests/tools/private/release/complete_sync_changelog_test.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import argparse | ||
| import unittest | ||
| from unittest.mock import patch | ||
|
|
||
| from tests.tools.private.release.release_test_helper import _mock_git_and_gh | ||
| from tools.private.release.complete_sync_changelog import CompleteSyncChangelog | ||
|
|
||
|
|
||
| class CompleteSyncChangelogTest(unittest.TestCase): | ||
| def setUp(self): | ||
| _mock_git_and_gh(self) | ||
| self.addCleanup(patch.stopall) | ||
|
|
||
| # Dynamic mock for issue body | ||
| self.issue_body = "" | ||
|
|
||
| def mock_get_body(issue_num): | ||
| return self.issue_body | ||
|
|
||
| def mock_update_body(issue_num, body): | ||
| self.issue_body = body | ||
|
|
||
| self.mock_gh.get_issue_body.side_effect = mock_get_body | ||
| self.mock_gh.update_issue_body.side_effect = mock_update_body | ||
|
|
||
| def test_complete_sync_changelog_success(self): | ||
| args = argparse.Namespace(pr=999) | ||
| self.mock_gh.get_pr_info.return_value = { | ||
| "state": "MERGED", | ||
| "body": "Updates CHANGELOG.md\n\nRelease-Tracking-Issue: #123", | ||
| "mergeCommit": {"oid": "abcdef1234567890"}, | ||
| } | ||
| self.issue_body = """ | ||
| ## Checklist | ||
| - [ ] Prepare Release | ||
| - [ ] Create Release branch | ||
| - [ ] Sync Changelog #124 | status=pending pr=#999 | ||
| - [ ] Sync Changelog #125 | status=pending pr=#999 | ||
| - [ ] Sync Changelog #126 | status=pending pr=#888 | ||
| - [ ] Tag Final | ||
|
|
||
| ## Backports | ||
| """ | ||
| result = CompleteSyncChangelog(args, self.mock_gh).run() | ||
|
|
||
| self.assertEqual(result, 0) | ||
| self.mock_gh.get_pr_info.assert_called_once_with(999) | ||
| self.mock_gh.get_issue_body.assert_called_once_with(123) | ||
| self.mock_gh.update_issue_body.assert_called_once() | ||
|
|
||
| # Check that only tasks pointing to #999 were marked checked=True and status=done | ||
| self.assertIn( | ||
| "- [x] Sync Changelog #124 | status=done pr=#999 commit= abcdef12", | ||
| self.issue_body, | ||
| ) | ||
| self.assertIn( | ||
| "- [x] Sync Changelog #125 | status=done pr=#999 commit= abcdef12", | ||
| self.issue_body, | ||
| ) | ||
| # Task pointing to #888 should remain unchanged | ||
| self.assertIn( | ||
| "- [ ] Sync Changelog #126 | status=pending pr=#888", | ||
| self.issue_body, | ||
| ) | ||
|
|
||
| def test_complete_sync_changelog_not_merged(self): | ||
| args = argparse.Namespace(pr=999) | ||
| self.mock_gh.get_pr_info.return_value = { | ||
| "state": "OPEN", | ||
| "body": "Updates CHANGELOG.md\n\nRelease-Tracking-Issue: #123", | ||
| } | ||
|
|
||
| result = CompleteSyncChangelog(args, self.mock_gh).run() | ||
|
|
||
| self.assertEqual(result, 1) | ||
| self.mock_gh.get_pr_info.assert_called_once_with(999) | ||
| self.mock_gh.update_issue_body.assert_not_called() | ||
|
|
||
| def test_complete_sync_changelog_missing_tracking_issue_link(self): | ||
| args = argparse.Namespace(pr=999) | ||
| self.mock_gh.get_pr_info.return_value = { | ||
| "state": "MERGED", | ||
| "body": "Updates CHANGELOG.md without tracking issue link", | ||
| "mergeCommit": {"oid": "abcdef1234567890"}, | ||
| } | ||
|
|
||
| result = CompleteSyncChangelog(args, self.mock_gh).run() | ||
|
|
||
| self.assertEqual(result, 1) | ||
| self.mock_gh.get_pr_info.assert_called_once_with(999) | ||
| self.mock_gh.update_issue_body.assert_not_called() | ||
|
|
||
| def test_complete_sync_changelog_no_matching_tasks(self): | ||
| args = argparse.Namespace(pr=999) | ||
| self.mock_gh.get_pr_info.return_value = { | ||
| "state": "MERGED", | ||
| "body": "Updates CHANGELOG.md\n\nRelease-Tracking-Issue: #123", | ||
| "mergeCommit": {"oid": "abcdef1234567890"}, | ||
| } | ||
| # Checklist has no tasks pointing to #999 | ||
| self.issue_body = """ | ||
| ## Checklist | ||
| - [ ] Prepare Release | ||
| - [ ] Create Release branch | ||
| - [ ] Sync Changelog #124 | status=pending pr=#888 | ||
| - [ ] Tag Final | ||
|
|
||
| ## Backports | ||
| """ | ||
| result = CompleteSyncChangelog(args, self.mock_gh).run() | ||
|
|
||
| # Should log warning but return 0 (success/noop) | ||
| self.assertEqual(result, 0) | ||
| self.mock_gh.get_pr_info.assert_called_once_with(999) | ||
| self.mock_gh.get_issue_body.assert_called_once_with(123) | ||
| self.mock_gh.update_issue_body.assert_not_called() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.