trim GraphQL queries#78
Open
skarim wants to merge 1 commit intoskarim/pr-templatefrom
Open
Conversation
Audit all 7 GraphQL operations and remove fields that are fetched but
never used in Go code:
- Remove FindAnyPRForBranch: entire function is dead code (zero call sites)
- FindPRForBranch: remove title, state, headRefName, merged (4 fields)
- CreatePR: remove title, state, headRefName, baseRefName, isDraft (5 fields)
- FindPRDetailsForBranch: remove id, title, headRefName, baseRefName,
comments { totalCount } (4 fields + 1 nested object)
- FindPRByNumber: remove title (1 field)
Also remove Title from PullRequest struct, and Title + CommentsCount
from PRDetails struct since they are no longer populated or read.
Total: ~15 unused fields removed across 5 queries, 1 dead query deleted,
and 1 unnecessary nested object (comments) eliminated.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR trims unused GraphQL fields from the internal GitHub client so stack operations and TUI PR lookups consume less API payload while keeping existing behavior unchanged.
Changes:
- Removed unused fields from
PullRequest/PRDetailsquery handling and narrowed several GraphQL query/mutation selection sets. - Deleted the unused
FindAnyPRForBranchclient method from the client, interface, and mock. - Updated TUI tests to stop constructing removed PR detail fields.
Show a summary per file
| File | Description |
|---|---|
internal/tui/stackview/data_test.go |
Adjusts stackview test fixtures to match the slimmer PRDetails shape. |
internal/github/mock_client.go |
Removes mock support for the deleted unused client method. |
internal/github/github.go |
Trims GraphQL selections/return mapping and removes the dead branch-lookup query. |
internal/github/client_interface.go |
Drops the unused method from the GitHub client abstraction. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
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.
Remove unused GraphQL fields to reduce API rate limit consumption.
Audited all GraphQL operations and removed fields that are fetched but never used.
Total: ~15 unused fields removed across 5 queries, 1 dead query deleted, and 1 unnecessary nested object (comments) eliminated.
Stack created with GitHub Stacks CLI • Give Feedback 💬