Repository navigation
perf(pr)!: batch prune's merged-PR lookup into one gh call - #110
Merged
Merged
Conversation
lettertwo
force-pushed
the
perf/prune-batch-pr-lookup
branch
from
October 7, 2026 18:29
6f26c44 to
f45bfaf
Compare
lettertwo
force-pushed
the
perf/prune-batch-pr-lookup
branch
from
October 8, 2026 02:12
f45bfaf to
f9eb194
Compare
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
workon prunespawned onegh pr list --head <branch> --state mergedper signal-less row to find thePrMergedsignal. Since #99 added no-worktree branches to prune's scope, that cost scales with local branch count: on a repo with 80 local branches, a dry run made 79 sequentialghcalls at ~0.4s each and took ~32s.This PR replaces the per-branch lookup with one
gh api graphqlrequest that carries an alias per branch (up to 100 per request). The same dry run now takes 1.73s and makes oneapi graphqlcall, with identical output.find_merged_prin theworkonlib becomesfind_merged_prs(&[&str]) -> Result<HashMap<String, MergedPr>>, which is why the commit is marked breaking.pullRequests(headRefName:, states:MERGED, first:1)ordered byCREATED_AT DESC, matching the newest-first PRgh pr listreturned. Branch names go in as-fvariables, never into the query text.ghresolves{owner}/{repo}the same waygh pr listresolves its repo.api graphqlinstead ofpr list. The consecutive-failure tests are replaced by a test asserting one call covers every worktree and branch row, and a test asserting a failed call degrades quietly.