Skip to content

Fix github team checking for pagination#669

Merged
devksingh4 merged 3 commits into
mainfrom
fix-id-tracking
Apr 14, 2026
Merged

Fix github team checking for pagination#669
devksingh4 merged 3 commits into
mainfrom
fix-id-tracking

Conversation

@devksingh4
Copy link
Copy Markdown
Contributor

@devksingh4 devksingh4 commented Apr 14, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved GitHub team detection to reliably handle large team lists during team existence checks.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

Warning

Rate limit exceeded

@devksingh4 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 38 minutes and 13 seconds before requesting another review.

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 38 minutes and 13 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 78dc87a2-0612-463f-8dfd-021f2a874763

📥 Commits

Reviewing files that changed from the base of the PR and between 74f9938 and e5fe0b5.

📒 Files selected for processing (2)
  • tests/e2e/orgInfo.spec.ts
  • tests/unit/functions/github.test.ts

Walkthrough

This pull request bumps the package version to 4.9.3 and modifies the GitHub team lookup functionality. The team existence check in src/api/functions/github.ts is changed from a single paginated GET request to an async paginated iterator with per_page: 100, enabling iteration through all team pages until a match is found. Corresponding test mocks in tests/unit/functions/github.test.ts are updated to use mockOctokit.paginate.iterator() instead of direct request mocks, with assertions adjusted to reflect that team listing now occurs through the paginator rather than direct requests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix github team checking for pagination' directly and accurately describes the main change: the PR modifies github.ts to use pagination when checking for existing teams, replacing a single GET request with a paginated iterator.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-id-tracking

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
tests/unit/functions/github.test.ts (1)

64-84: Add a cross-page existence test to lock in the pagination fix.

Current “team already exists” test only covers a single page. Please add a case where page 1 has no match and page 2 has the target team.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unit/functions/github.test.ts` around lines 64 - 84, Add a new unit
test for createGithubTeam that verifies pagination: mock
mockOctokit.paginate.iterator (used in the existing test) to return an async
iterator representing two pages where the first page's data array does not
contain "Test Team" and the second page does contain it (use createAsyncIterator
to build the sequence), then assert the function returns { updated: false, id:
<existingTeamId> }, that mockLogger.info was called with the same "Team \"Test
Team\" already exists with id: ..." message, and that mockOctokit.request was
not called; mirror assertions from the single-page test but use the two-page
iterator to lock in the pagination fix.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/unit/functions/github.test.ts`:
- Line 74: Prettier is failing due to missing trailing commas in several
array/object literals (you can spot them where lines end with "])"); update each
affected test array/object so the last element has a trailing comma before the
closing bracket/paren (e.g., change "])" to " ,])" or add a trailing comma
inside object literals), then run prettier --write (or your repo's formatter) to
reformat; search the test file for occurrences of "])" and similar closing
tokens in test data to locate and fix the instances.
- Around line 186-188: Replace the throw-only async generator expressions like
"(async function* () { throw baseError; })()" used as mocks with simple mock
implementations that throw, e.g. use mockImplementation(() => { throw baseError;
}) or mockImplementation(async () => { throw baseError; }) depending on whether
the mocked function is async; locate the offending expressions in
tests/unit/functions/github.test.ts (the occurrences of "(async function* () {
throw baseError; })()") and update both instances accordingly.
- Around line 55-57: Replace the function-expression callbacks passed to
(Octokit as any).mockImplementation and the other mockImplementation call in
tests/unit/functions/github.test.ts with arrow-function callbacks to satisfy the
prefer-arrow-callback ESLint rule; specifically, update the mockImplementation
usages that return mockOctokit (and the second occurrence returning its mock) to
use () => mockOctokit (or appropriate arrow form) so the tests keep the same
behavior but conform to the lint configuration.

---

Nitpick comments:
In `@tests/unit/functions/github.test.ts`:
- Around line 64-84: Add a new unit test for createGithubTeam that verifies
pagination: mock mockOctokit.paginate.iterator (used in the existing test) to
return an async iterator representing two pages where the first page's data
array does not contain "Test Team" and the second page does contain it (use
createAsyncIterator to build the sequence), then assert the function returns {
updated: false, id: <existingTeamId> }, that mockLogger.info was called with the
same "Team \"Test Team\" already exists with id: ..." message, and that
mockOctokit.request was not called; mirror assertions from the single-page test
but use the two-page iterator to lock in the pagination fix.
🪄 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: 0d887ce3-0c02-4c21-ae06-a305d57dfd1e

📥 Commits

Reviewing files that changed from the base of the PR and between e555016 and 74f9938.

📒 Files selected for processing (3)
  • package.json
  • src/api/functions/github.ts
  • tests/unit/functions/github.test.ts

Comment thread tests/unit/functions/github.test.ts
Comment thread tests/unit/functions/github.test.ts
Comment thread tests/unit/functions/github.test.ts
@devksingh4 devksingh4 merged commit d1e739f into main Apr 14, 2026
6 of 9 checks passed
@devksingh4 devksingh4 deleted the fix-id-tracking branch April 14, 2026 23:51
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant