feat(migrations): GraphQL fast path for GitHub migration + rate-limit resilience - #38694
Open
davidlovas wants to merge 4 commits into
Open
feat(migrations): GraphQL fast path for GitHub migration + rate-limit resilience#38694davidlovas wants to merge 4 commits into
davidlovas wants to merge 4 commits into
Conversation
… resilience Adds a batched GraphQL downloader for GitHub migrations, sharply reducing API rate-limit pressure on large repositories by collapsing the N+1 REST call pattern (issues + comments + reactions per-issue) into single GraphQL requests. - github_graphql.go: issue stream with comments + reactions in one request - github_graphql_pr.go: PR stream with reviews + review comments, DESC order with early-exit at the watermark for efficient incremental syncs - github_graphql_timeline.go: timeline events (15 types, issue/PR union split) - http_client.go: retry transport with exponential backoff for transient errors - Progress logging: each sync phase logs what it's fetching and how many items - UseGraphQL migrate option + USE_GRAPHQL_FOR_MIRROR site setting - SkipReactions + SYNC_REACTIONS_FOR_MIRROR (opt-in, off by default) - SyncIssues/SyncPullRequests on MigrateOptions for mirror metadata sync Addresses go-gitea#13243 (migration exceeds API rate limit). Standalone — works for one-time migrations with no mirror dependency. Signed-off-by: David E. Lovas <david@rexovas.com>
- Replace encoding/json with gitea.dev/modules/json (depguard) - sort.Slice/sort.Strings → slices.Sort (modernize) - Rename base_ → baseBranch (revive: no underscores) - Add missing test fixture for issues listing without page= param Signed-off-by: David E. Lovas <david@rexovas.com>
davidlovas
force-pushed
the
mirror/01-downloader-interface
branch
from
July 29, 2026 04:06
1f727b1 to
76bb6df
Compare
- Fix import ordering (gci) - Fix gofumpt formatting - atomic.Int32 modernize - Replace nil,nil return with empty map (nilnil) - maps.Copy instead of manual loop (modernize) - Fix useless-assert (store value before comparing) - encoding/json → modules/json in timeline test Signed-off-by: David E. Lovas <david@rexovas.com>
davidlovas
force-pushed
the
mirror/01-downloader-interface
branch
from
July 29, 2026 04:09
76bb6df to
3a8f150
Compare
Signed-off-by: David E. Lovas <david@rexovas.com>
This was referenced Jul 29, 2026
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.
Adds a batched GraphQL downloader for GitHub migrations, sharply reducing API rate-limit pressure on large repositories by collapsing the N+1 REST call pattern into single GraphQL requests. Default for all GitHub migrations — no opt-in needed.
What's in this PR
github_graphql.go: issue stream — fetches issues + comments in one request (100/page); issue-level reactions included inline when enabledgithub_graphql_pr.go: PR stream — PRs + reviews + review comments, DESC order with early-exit at the watermark for efficient incremental syncsgithub_graphql_timeline.go: timeline events (15 types, issue/PR union split)http_client.go: retry transport with exponential backoff for transient errors and secondary rate limitsSkipReactions+SYNC_REACTIONS_FOR_MIRROR: controls whether reactions are fetched. Issue-level and PR-level reactions are nested inline in the GraphQL query (no extra API call). Comment-level reactions are NOT included — nestingreactionsundercommentsunderissues(100×100×100 = 1M nodes) exceeds GitHub'sMAX_NODE_LIMIT_EXCEEDEDceiling. Off by default.SyncIssues/SyncPullRequestsonMigrateOptionsfor mirror metadata syncWhy
Addresses #13243 (migration exceeds API rate limit). The GraphQL path collapses dozens of REST calls into one, billed on a separate points budget. Single-token benchmark on go-gitea/gitea (~38k issues): ~4.5h (GraphQL) vs ~45h (REST). Multi-token composes with it (the real win is the N+1 collapse, not just budget pooling).
Standalone — works for one-time migrations with no mirror dependency. No impact on non-GitHub migration sources (GitLab, Gitea, Codebase, OneDev).
This is also the foundation for the read-only metadata-mirror feature proposed in #18369 (continuing #20311).
Test plan
maingofmtcleanDeveloped with AI assistance (Anthropic Claude), per the AI contribution policy. I reviewed every line, understand and can defend it, and tested it end-to-end.