refactor: fetcher のページネーションを paginateGraphQL ヘルパーに統一する#269
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 36 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughbatch/github/fetcher.ts の複数の GraphQL ページネーションループを汎用ヘルパー Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
babb623 to
5b71104
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@batch/github/fetcher.ts`:
- Around line 1209-1218: The paginateGraphQL call that invokes
graphqlWithTimeout mixes two paginated connections by repeatedly passing
reviewThreadsCursor: null when fetching issueComments (and vice versa), and also
hardcodes reviewThreads.comments to first: 100 without requesting
pageInfo/endCursor, causing repeated re-fetch of page 1 and silent truncation of
long threads; fix by splitting the concerns into two separate paginated queries
(one for issue comments and one for reviewThreads) or use GraphQL `@include` to
omit the unused connection per loop, and implement cursor-based pagination for
reviewThreads.comments (request pageInfo/endCursor and use that cursor rather
than fixed first:100); update calls to paginateGraphQL/graphqlWithTimeout to
stop passing the other side’s cursor as null and ensure both connections
paginate to completion.
- Around line 819-825: In the minPageSize check (the block referencing
minPageSize, logger.warn, label, pageSizeRef.value and cursor) do not use break;
instead throw an Error that includes the label and cursor (and optionally
current pageSize/pageSizeRef.value and any partial nodes count) so callers can
detect an incomplete crawl; replace the break with a thrown error from the same
location and ensure the thrown message clearly identifies label and cursor (and
include symbols like nodes if available) so the caller can handle the failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1ca35886-8d21-4961-b2b3-4cef184a9356
📒 Files selected for processing (1)
batch/github/fetcher.ts
5b71104 to
83b7be7
Compare
6箇所のページネーションループを共通ヘルパーに統合。 pullrequestsWithDetails の PR 基本フィールド変換を shapePullRequestNode に統一。 - paginateGraphQL<TResult, TNode, TItem>: カーソルベースページネーション共通ヘルパー - handleGraphQLError 付きパターン(minPageSize 指定時) - シンプルパターン(minPageSize なし) - shouldStop による早期打ち切り - pullrequests, pullrequestList, commits, reviews, tags を paginateGraphQL で書き直し - pullrequestsWithDetails 内の PR 変換を shapePullRequestNode に統一 - codegen 由来の型(CommitNode, ReviewNode 等)でノード型を導出 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
83b7be7 to
76855a8
Compare
Summary
paginateGraphQL共通ヘルパーに統合(-78行)pullrequestsWithDetails内の PR 基本フィールド変換をshapePullRequestNodeに統一CommitNode,ReviewNode等)でノード型を導出し、手書き型を削減paginateGraphQLは2つのパターンを統一:minPageSize指定): pullrequests, pullrequestList, pullrequestsWithDetailsCloses #266
Test plan
pnpm validateが通る(41 test files, 294 tests)crawl --repo falcon9 --pr 8945が動作する🤖 Generated with Claude Code
Summary by CodeRabbit
リリースノート