fix: handle zero PRs in release notes; extract CHANGELOG updater to script#580
fix: handle zero PRs in release notes; extract CHANGELOG updater to script#580
Conversation
- Fix sys.exit(1) when no PRs found — produce "No notable changes" entry - Fix merged:> query to merged:>= so PRs on tag date are included - Extract inline CHANGELOG heredoc from release.yml into scripts/update_changelog.py - Add unit tests for classify_pr, group_prs, generate_plain_notes, update_changelog Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9da38d9e16
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
scripts/generate_release_notes.py
Outdated
| "gh", "pr", "list", | ||
| "--state", "merged", | ||
| "--search", f"merged:>{since_date}", | ||
| "--search", f"merged:>={since_date}", |
There was a problem hiding this comment.
Keep PR search exclusive at release-date boundary
Using merged:>=... with a date-only boundary causes already-released PRs to be reselected on the next release. get_tag_date() truncates the tag timestamp to YYYY-MM-DD, so when the previous tag was created on a day that also had merged PRs, this inclusive query pulls those same-day PRs back into the next changelog/release notes and duplicates entries. Keeping the boundary exclusive (or switching to a full timestamp) avoids this regression.
Useful? React with 👍 / 👎.
📦 TestPyPI package publishedpip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.12.12.dev22371011635or with uv: uv pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.12.12.dev22371011635MCP server for Claude Codeclaude mcp add buckaroo-table -- uvx --from "buckaroo[mcp]==0.12.12.dev22371011635" --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo-table |
`get_tag_date()` was truncating the tag creation time to `YYYY-MM-DD` and `gather_prs()` used `merged:>=DATE` (inclusive). On the next release this re-selects every PR merged on that same calendar day, even if they were already in the previous release. Fix by returning the full `iso-strict` timestamp from git and switching the search qualifier back to exclusive `merged:>TIMESTAMP`. PRs merged after the tag on the same day are still captured; already-released PRs are not duplicated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
sys.exit(1)on zero PRs — a release with no merged PRs is valid; the script now produces a "No notable changes since previous release." entry and exits 0 instead of hard-failing and cascading all downstream steps to skipmerged:>=date query — the previousmerged:>DATEexcluded PRs merged on the tag's creation date; changed to>=so same-day PRs are includedscripts/update_changelog.py— replaces the fragile inlinepython3 - <<'PYEOF'block inrelease.ymlwith a testable standalone scripttests/unit/test_release_scripts.pycoversclassify_pr,group_prs,generate_plain_notes(normal + empty), andupdate_changelog; all 8 pass locallyTest plan
uv run pytest tests/unit/test_release_scripts.py -v— 8/8 passgenerate_plain_notes({}, ...)produces "No notable changes" without crashingupdate_changelog.pyinserts entry after line 1 of CHANGELOG.md🤖 Generated with Claude Code