Skip to content

Speed up release preparation by listing merged pull requests - #9855

Open
hsbt wants to merge 6 commits into
masterfrom
release-tool-fast-pr-discovery
Open

Speed up release preparation by listing merged pull requests#9855
hsbt wants to merge 6 commits into
masterfrom
release-tool-fast-pr-discovery

Conversation

@hsbt

@hsbt hsbt commented Sep 4, 2026

Copy link
Copy Markdown
Member

Preparing a release now takes seconds instead of minutes.

Mapping commits back to pull requests used about 570 requests: 102 gh search prs calls with a forced sleep every 28, then one REST fetch per pull request found. mergeCommit.oid names the commit a pull request leaves on its base branch under every merge strategy, so one gh pr list call intersected with the local history answers the same question exactly.

For 4.1.0.beta1 the old scan and the new listing find the same set of pull requests, and the listing takes six seconds instead of eight to ten minutes. A full DRYRUN=1 rake prepare_release[4.1.0.beta1] now finishes in 39 seconds and produces the same changelog section.

This also drops the workaround for force-pushed commits that gh search prs could still associate with a pull request, since reachability answers that directly.

One narrowing worth naming: the listing asks for --base master, so a pull request that targeted an intermediate branch which was later merged into master no longer shows up, where the commit scan found it through its commits. Nothing in the last nine months hits that, and this repository merges into master directly.

Generated with Claude Code

Mapping each commit since the previous release back to a pull request took
102 `gh search prs` calls with a forced sleep every 28 of them, plus one REST
fetch per pull request found, about 570 requests and eight to ten minutes for
a minor release.

`mergeCommit.oid` names the commit a pull request leaves on its base branch
under every merge strategy, so one listing call intersected with the local
history answers the same question exactly, and without depending on the commit
search index. For 4.1.0.beta1 both find the same 466 pull requests, the listing
in six seconds.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hsbt
hsbt force-pushed the release-tool-fast-pr-discovery branch from b3540e5 to d4affe2 Compare September 4, 2026 06:56
@hsbt hsbt changed the title Speed up release preparation and stop relisting released entries Speed up release preparation by listing merged pull requests Sep 4, 2026
hsbt and others added 5 commits September 4, 2026 16:44
GitHub reports `mergeCommit` as null for a merged pull request whose merge
commit no longer exists, and 190 of the 876 pull requests this repository
merged before 2019 are in that state. Reading `["oid"]` off it raised a bare
NoMethodError in the middle of a release.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The reachability test stubbed every backticked command with one canned SHA, so
it passed no matter what range `pull_requests_merged_into` asked git for, a
reversed one included. It now builds a two commit repository and asserts that
only the pull request whose merge commit is inside the range survives. CI
checks out with no history, so the range cannot come from this repository.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Only the `gh pr list` call checked its exit status. A range git cannot resolve
left an empty reachable set that filtered out every pull request, and since
nothing raises for a minor release, one would have cut a changelog section
with no entries. A tag git cannot resolve surfaced as `invalid xmlschema
format: ""` from the date arithmetic instead of naming the ref.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`relevant_pull_requests`, the only caller, already sorts by merge date.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The reason a truncated listing is refused was stated on the constant and again
above the method that refuses it, and two comments restated their own method
signature. The header also claimed the new lookup does not ask the search
index, which is wrong: `gh pr list --search` is the same backend as the commit
search it replaces, so it inherits the same indexing lag.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant