Open
Conversation
GitHub's GraphQL API caps the `first` argument at 100, so queries that can return more than 100 nodes must follow `pageInfo.endCursor` / `hasNextPage` to retrieve every result. This adds cursor-based pagination to the two queries where the cap is reachable in practice: - `get_github_issue_project_statuses` (project items, can grow with every data request issue). - `GithubLabelManager.get_labels` (repository labels). Other `first: N` usages (per-issue label and project field subqueries) have small bounded N and are left as-is. Closes #675 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
GitHub's GraphQL API caps the
firstargument at 100, so any query that may return more than 100 nodes needs cursor-based pagination viapageInfo { endCursor hasNextPage }and anafter:cursor on subsequent calls.This PR adds that pagination to the two queries where the 100-node cap is reachable in practice:
get_github_issue_project_statusesinmiddleware/third_party_interaction_logic/github/helpers.py(project items grow with every data request issue).GithubLabelManager.get_labelsinmiddleware/third_party_interaction_logic/github/label_manager.py(repository labels).Other
first: Nusages have small bounded N (labels(first: 10)per issue,fields(first: 20)for project fields) and are intentionally left as-is.convert_graph_ql_result_to_issue_infonow accepts either a single response dict or a list of page dicts so callers can hand in all paginated responses at once.Closes #675
Test plan
tests/middleware/test_github_graphql_pagination.pycover:endCursorinto the nextafter:argument and merges nodes.convert_graph_ql_result_to_issue_infocorrectly merges multiple page payloads.GithubLabelManagerpaginates label results across pages.uv run ruff check .passes.uv run basedpyright --level errorpasses (0 errors).uv run pytest testsshould be run in CI (local DB unavailable in this environment, so only the four new unit tests were executed locally via--noconftest).Notes for reviewers
dict | list[dict]union onconvert_graph_ql_result_to_issue_infois purely forward-compatible.after:cursor is interpolated as a string literal into the query rather than being passed as a GraphQL variable, matching the existing string-templated style in this module. Could be migrated to$variableslater if desired.