Skip to content

trim GraphQL queries#78

Open
skarim wants to merge 1 commit intoskarim/pr-templatefrom
skarim/graphql-optimizations
Open

trim GraphQL queries#78
skarim wants to merge 1 commit intoskarim/pr-templatefrom
skarim/graphql-optimizations

Conversation

@skarim
Copy link
Copy Markdown
Collaborator

@skarim skarim commented May 6, 2026

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 CLIGive Feedback 💬

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>
@skarim skarim marked this pull request as ready for review May 6, 2026 00:56
Copilot AI review requested due to automatic review settings May 6, 2026 00:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/PRDetails query handling and narrowed several GraphQL query/mutation selection sets.
  • Deleted the unused FindAnyPRForBranch client 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

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.

2 participants