Skip to content

fix: remove ghost reviewer records when reviewers are removed#211

Merged
coji merged 1 commit intomainfrom
fix/ghost-reviewer-records
Mar 18, 2026
Merged

fix: remove ghost reviewer records when reviewers are removed#211
coji merged 1 commit intomainfrom
fix/ghost-reviewer-records

Conversation

@coji
Copy link
Owner

@coji coji commented Mar 18, 2026

Summary

  • reviewer が全員 approve 済み等で reviewRequests から外れた場合、pull_request_reviewers テーブルの古いレコードが削除されずに残り続けるバグを修正
  • buildPullRequests で reviewer が 0 人でも常にエントリを emit し、batchReplacePullRequestReviewers の DELETE が走るようにした

Background

全員 APPROVED 済みで GitHub API の reviewRequests が空なのに、DB にゴーストレコードが残っているケースを発見。表示上は requested_at IS NOT NULL フィルタで影響なかったが、データの正確性を担保するために修正。

Test plan

  • 既存テスト 208 件通過
  • reviewer 0 人のケースのテスト追加
  • recalculate 実行後にゴーストレコードが消えることを確認

🤖 Generated with Claude Code

When all reviewers were removed from a PR (e.g. after approving),
buildPullRequests did not emit a reviewers entry for that PR, so
batchReplacePullRequestReviewers never ran DELETE and stale records
remained in the database.

Always emit a reviewers entry regardless of reviewer count so the
replace function properly cleans up removed reviewers.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

Warning

Rate limit exceeded

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

⌛ 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: 95d6e81b-bba4-4443-809a-1a68430c7427

📥 Commits

Reviewing files that changed from the base of the PR and between 988f80f and caed4e8.

📒 Files selected for processing (2)
  • batch/github/__tests__/buildPullRequests-filter.test.ts
  • batch/github/pullrequest.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ghost-reviewer-records
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@coji coji merged commit ee7b9e7 into main Mar 18, 2026
6 checks passed
@coji coji deleted the fix/ghost-reviewer-records branch March 18, 2026 11:32
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