Skip to content

Comments

Consolidate queries#28

Open
MichaelHilton wants to merge 2 commits intoChrisTimperley:mainfrom
MichaelHilton:consolidate-queries
Open

Consolidate queries#28
MichaelHilton wants to merge 2 commits intoChrisTimperley:mainfrom
MichaelHilton:consolidate-queries

Conversation

@MichaelHilton
Copy link

Summary
Update all dependencies to their latest versions
Consolidate GitHub API calls in GitHubService to eliminate N+1 query patterns and reduce total API calls by ~80% on typical repositories
What changed
Pull requests (getPullRequestsSince + analyzePullRequest → single method): the old approach used the REST API to list PRs page by page, then fired a separate GraphQL query for every individual PR to fetch reviews, CI status, and linked issues. This is replaced by a single paginated repository.pullRequests GraphQL query that retrieves all required fields inline.

Branches + commit counts (fetchBranches + getCommitCountsAcrossBranches + getRepositoryRefs → fetchBranchesAndCommitCounts): three separate methods that each independently paginated through the full branch list and re-queried per-branch commit history. These are merged into one pass. The per-branch query now also combines commit history with the ahead/behind comparison in a single call, halving per-branch round-trips.

CI status parsing: identical check-run parsing logic that existed in two places is extracted into a private parseCIStatus helper.

Repository validation: swapped the last remaining REST call (repos.get) for a minimal GraphQL query.

MichaelHilton and others added 2 commits February 21, 2026 19:39
- Replace REST+per-PR-GraphQL pattern with a single paginated
  repository.pullRequests GraphQL query (removes ~N calls for N PRs)
- Merge fetchBranches and getCommitCountsAcrossBranches into
  fetchBranchesAndCommitCounts, combining the per-branch history and
  ahead/behind compare into one query per branch (~80% fewer calls)
- Extract shared parseCIStatus helper, removing ~80 lines of duplicated
  CI check-run parsing logic
- Convert validateRepository from REST to a lightweight GraphQL query

Co-Authored-By: Claude <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