Skip to content

fix(github): keep exact page-limit fetches complete instead of capped#1385

Open
Dexterity104 wants to merge 1 commit into
JSONbored:mainfrom
Dexterity104:fix/backfill-exact-limit-cap
Open

fix(github): keep exact page-limit fetches complete instead of capped#1385
Dexterity104 wants to merge 1 commit into
JSONbored:mainfrom
Dexterity104:fix/backfill-exact-limit-cap

Conversation

@Dexterity104

Copy link
Copy Markdown

Summary

The REST paginator githubPaged flagged a sync segment as capped whenever a fetch ended with items.length >= limit, even when the repository had already returned its entire set in a full final page with no rel="next" link. A repo with exactly limit open issues or pull requests was reported as truncated: the public dataQuality.capped flag was set and a wasteful resume fetch was scheduled against a fabricated cursor that pointed at an empty page.

Genuine overflow is already handled inside the pagination loop, where a real next page sets status = "capped" together with its true resume cursor, so the post-loop block could only ever fire on the false positive. The fix drops the speculative cursor on a clean, fully drained fetch so an exact-limit final page stays complete. It also prevents a later resume from starting at page two and skipping page one, because githubPaged reads the stored cursor without checking the prior status.

No issue is linked: this is a small, self-contained correctness fix confined to the backfill paginator and its tests.

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 an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • 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:

  • None skipped. The change touches only src/github/backfill.ts and its unit tests, so the UI, MCP, and OpenAPI surfaces are unaffected and their checks pass unchanged.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

Not applicable. This change is backend-only and has no visible UI, frontend, docs, or extension surface.

Notes

  • Added a regression test that a repo returning exactly the page limit with no next page stays complete rather than capped, and updated the existing cap test to model genuine overflow with a real rel="next" link.
  • Coverage on the changed lines is 100% for both lines and branches.

@Dexterity104 Dexterity104 requested a review from JSONbored as a code owner June 25, 2026 19:35
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 25, 2026
@superagent-security

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.35%. Comparing base (f160cbb) to head (5392c9e).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1385      +/-   ##
==========================================
- Coverage   95.35%   95.35%   -0.01%     
==========================================
  Files         191      191              
  Lines       20711    20709       -2     
  Branches     7488     7487       -1     
==========================================
- Hits        19750    19748       -2     
  Misses        380      380              
  Partials      581      581              
Files with missing lines Coverage Δ
src/github/backfill.ts 92.89% <100.00%> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant