Skip to content

Fix: paginate gist search to handle 100+ gists - #197

Merged
tylergraydev merged 1 commit into
tylergraydev:mainfrom
prefrontalsys:fix/gist-pagination
Apr 14, 2026
Merged

tylergraydev merged 1 commit into
tylergraydev:mainfrom
prefrontalsys:fix/gist-pagination

Conversation

@prefrontalsys

Copy link
Copy Markdown
Contributor

Summary

  • find_or_create_gist only fetched the first 100 gists (GitHub API cap per page)
  • Users with 100+ gists would never find their existing sync gist
  • This caused a new gist to be created on every connect, with pushes going to ephemeral gists
  • Adds page iteration so all gists are searched

Test plan

  • User with <100 gists: verify existing sync gist is found (no regression)
  • User with 100+ gists: verify sync gist is found across pages
  • New user: verify gist creation still works when no sync gist exists

Relates to #195

🤖 Generated with Claude Code

GitHub's Gist list API caps at per_page=100. Users with more than
100 gists would never find their existing sync gist, causing a new
one to be created on every connect. This led to push/pull targeting
different gists across sessions.

Add page iteration to find_or_create_gist so it searches all gists.

Relates to tylergraydev#195

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@tylergraydev tylergraydev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Pagination loop is well-structured — breaks on non-success, breaks on empty page, increments correctly. Handles the GitHub 100-per-page cap properly.

Minor optional suggestion: a safety cap like page < 50 would be cheap insurance against infinite loops if the API misbehaves, but not a blocker.

LGTM, merging.

@tylergraydev
tylergraydev merged commit e04b5a7 into tylergraydev:main Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants