Skip to content

fix(github): cap unbounded backfill list pagination at 10 pages (#8890) - #8963

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
andriypolanski:fix/8890-backfill-pagination-caps
Jul 26, 2026
Merged

fix(github): cap unbounded backfill list pagination at 10 pages (#8890)#8963
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
andriypolanski:fix/8890-backfill-pagination-caps

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npx vitest run test/unit/backfill.test.ts -t "#8890" — 2 passed
  • Related existing tests (late pagination, endCursor, unauthenticated labels fallback) — passed
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

Narrow pagination-bound fix in src/github/backfill.ts; full test:ci left for the opener before push.

Notes for reviewers / gate

  • No secrets, wallets, hotkeys, trust scores, or reward values.
  • Does not touch site/, CNAME, **/lovable/**, or CHANGELOG.md.
  • No UI Evidence (backend-only).

…bored#8890)

Bound syncLabels and both GraphQL open-issue/PR undercount supplements so a
pathological repo cannot turn one sync into an unbounded fetch loop.

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.86%. Comparing base (401caef) to head (add8bda).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8963      +/-   ##
==========================================
+ Coverage   90.56%   90.86%   +0.30%     
==========================================
  Files          96       97       +1     
  Lines       22490    23861    +1371     
  Branches     3884     4415     +531     
==========================================
+ Hits        20367    21681    +1314     
- Misses       1945     1952       +7     
- Partials      178      228      +50     
Flag Coverage Δ
backend 95.84% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/github/backfill.ts 95.84% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-26 14:47:50 UTC

2 files · 1 AI reviewer · no blockers · readiness 95/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR closes #8890 by capping three previously-unbounded pagination loops (syncLabels, supplementOpenIssuesFromGraphQl, supplementOpenPullRequestsFromGraphQl) at GITHUB_LIST_MAX_PAGES=10, matching the file's existing 10-page convention (e.g. PR_DETAIL_MAX_PAGES, SEGMENT_PAGE_BUDGET). Cap hits correctly surface as a `capped` segment status for labels (with pageCount/nextCursor wired into completeSegment) and as push-to-`warnings` messages for the GraphQL supplements, and the two new regression tests actually drive the loop to page 10 via real hasNextPage:true responses rather than mocking termination — a legitimate real-path test, not a fabricated one. The change is narrow, well-scoped to the issue, and the wiring (supplementOnUnderCount now threading a shared `warnings` array through to the two supplement functions) is consistent end-to-end.

Nits — 5 non-blocking
  • src/github/backfill.ts:4436-4470 (syncLabels): unlike githubPaged's `nextCursor = undefined` reset when status is complete, here `nextCursor` is only ever set on the capped branch, which is correct, but consider a comment noting parity with githubPaged's page-cap-vs-item-cap distinction for future maintainers touching this function.
  • The removed `/* v8 ignore start/stop */` blocks around supplementOpenIssuesFromGraphQl/supplementOpenPullRequestsFromGraphQl (src/github/backfill.ts:1791-1794, 1845ish) are appropriate now that real tests exercise these paths, but double check the remaining defensive-normalization branches inside those functions (malformed node shapes) still have coverage since the ignore pragma removal expands what coverage now expects.
  • Nice touch that the test at test/unit/backfill.test.ts uses a real Link-header-driven pagination loop for syncLabels instead of asserting call count only, matching the trace-to-source review guidance for this repo.
  • Consider extracting the repeated 'reached local page cap of N' warning-push pattern (labels, open-issues, open-pull-requests) into a small shared helper to avoid drift if the message format needs to change again across all three sites.
  • Verify with `npm run test:coverage` (marked unchecked in the PR) that the new capped branches hit the ~97% patch coverage bar, particularly the `status === "capped"` vs `"complete"` expectedCount ternary in syncLabels.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8890
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 200 registered-repo PR(s), 126 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 200 PR(s), 22 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff adds a shared GITHUB_LIST_MAX_PAGES = 10 constant and applies it to all three previously unbounded loops (syncLabels, supplementOpenIssuesFromGraphQl, supplementOpenPullRequestsFromGraphQl), each surfacing a capped status/warning consistent with the file's existing convention, and includes regression tests asserting the loops stop at page 10 with capped signals rather than relying on mock

Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 200 PR(s), 22 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit ba596a5 into JSONbored:main Jul 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(github): three GitHub list-pagination loops in backfill.ts have no page cap, unlike every sibling loop in the same file

2 participants