fix: paginate bulk-scan organization selection - #148
Conversation
rajpratham1
left a comment
There was a problem hiding this comment.
This pull request improves bulk scan organization selection by replacing the single-page organization lookup with paginated retrieval, ensuring users with more than 100 GitHub organizations can discover all available accounts. The implementation also deduplicates organization names across pages while preserving the original casing, and checks for cancellation during pagination so aborted operations terminate cleanly before repository discovery begins. The accompanying tests verify multi-page retrieval, deduplication, pagination behavior, and cancellation handling. Based on the visible changes, the implementation addresses the stated limitation without introducing any apparent blocking issues.
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Security review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Summary
Fixes #135.
The interactive bulk-scan wizard now loads every page returned by
GET /user/orgsbefore asking which account to scan. Previously it requested onlyper_page: 100, so organization memberships after the first page were silently absent from the selector.Changes
REST pagination
Organization discovery now follows GitHub REST pagination one page at a time:
Linkheader forrel="next";This works through the same Octokit request boundary for GitHub.com and configured GitHub Enterprise hosts.
Cancellation
The campaign abort signal is forwarded to every organization-page request. It is also checked:
Cancellation therefore stops pagination without requesting another page, opening the selector, or starting repository discovery.
Account normalization
The combined personal-account and organization list is deduplicated case-insensitively before sorting. This prevents duplicate selector entries if repeated organization memberships appear across pages while preserving the login spelling returned by GitHub.
The authenticated personal account remains available alongside all organizations.
Tests
Added a paginated REST fixture and regression coverage that verifies:
Existing single-page organization selection, GitHub Enterprise, repository pagination, authentication, and cancellation tests continue to pass.
Verification
pnpm run typespnpm run formatpnpm run buildPATH="/opt/homebrew/bin:$PATH" pnpm run testFull suite: 472 passed, 6 expected platform/integration skips, 0 failed.