fix(cli-pr-monitor): 既レビュー済み HEAD への Add head review deduplication for Prevent duplicate @coderabbitai review posts for same HEAD review review 再トリガーを抑止 (WP-05 follow-up) - #247
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough同一 HEAD への Changes再トリガー抑止ガード
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Trigger as trigger_coderabbit_review
participant GhCli as gh CLI
participant GhApi as gh api
Trigger->>GhCli: gh pr view (headRefOid取得)
GhCli-->>Trigger: headRefOid
Trigger->>GhApi: gh api (coderabbitai[bot]のcommit_id一覧取得)
GhApi-->>Trigger: commit_id集合
Trigger->>Trigger: is_head_in_reviewed(headRefOid, commit_id集合)
alt 既にレビュー済み
Trigger->>Trigger: 投稿をskip
else 未レビューまたは照会失敗
Trigger->>GhCli: `@coderabbitai` review を投稿
end
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/cli-pr-monitor/src/stages/review_trigger.rs`:
- Around line 83-89: The review lookup in review_trigger.rs only queries the
first page of the GitHub reviews API, so it can miss older CodeRabbit reviews on
busy PRs. Update the gh api call in the logic that builds reviewed commit IDs to
include --paginate, keeping the existing jq filter and is_head_in_reviewed check
so all review pages are scanned.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 014b3b86-f3e2-439b-9db3-83459f95228d
📒 Files selected for processing (2)
docs/adr/adr-019-coderabbit-review-hybrid-policy.mdsrc/cli-pr-monitor/src/stages/review_trigger.rs
…P-05 follow-up, ADR-019 amendment)
be34097 to
fa5010c
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
…順位258) (#249) CodeRabbit は指摘ゼロで完了した (再) レビューでは formal review object を提出せず commit status のみで完了通知する。reviews API 単独では拾えず 2 つの gap があった: 1. 助言層 (review_trigger): head_already_reviewed が reviews API のみで判定し、 指摘ゼロでレビュー済みの HEAD へ @coderabbitai review を再投稿しレート枠を浪費し得た。 reviews API + commit status の 2 系統を combine_reviewed で fail-open 合成する。 純関数 parse_commit_status_reviewed / combine_reviewed に分離し三値テスト (None→投稿の 反転テスト含む) を追加。 2. 決定論層 (check-ci-coderabbit): 完了検知は元々 commit status を照会していたが、head SHA を無指定 gh pr view (cwd auto-detection) で取得しており jj workspace 等で SHA 取得に失敗 → not_found に倒れ指摘ゼロ完了の park ループが終了しなかった (PR #247 実測)。get_head_sha を monitor が渡す解決済み repo/PR での repos/{repo}/pulls/{pr} 照会に変更。真因は parse で なく SHA 取得経路のため parse_coderabbit_status は不変、PR #247 実測 status を回帰テスト化。 ADR-019 § 再トリガー抑止ガードを amendment。todo 順位258 を消化。
…s 化 (順位259) (#251) 現行 `cargo clippy --workspace -- -D warnings` は lib/bin ターゲットのみを検査し、 #[cfg(test)] ユニットテスト・integration test のコードが lint されない gap があった。 PR #247 で useless_format が cargo test 段階まで顕在化して手戻りが発生したことを受け、 rust-lint-test group の clippy を --all-targets --all-features 化する。 - push-runner-config.toml + templates/push-runner-config.toml を同スコープに更新 - 既存違反 1 件 (cli-merge-pipeline takt.rs の ORPHAN_THRESHOLD_SECS 不変条件 runtime test の clippy::assertions_on_constants) を const _: () = assert!(...) のコンパイル時 検証へ移行 (定数条件は test 実行時 assert より compile-time assert の方が強い保証) - cargo clippy --workspace --all-targets --all-features -- -D warnings が workspace 全体 PASS - ADR-015 § clippy の lint スコープ を amendment。todo 順位259 を消化。
概要
WP-05 の follow-up。CodeRabbit の既レビュー済み HEAD への
@coderabbitai review再トリガーを抑止し、無駄なレート枠消費を防ぐ。ADR-019 amendment。背景
CodeRabbit は「既にレビュー済みのコミットは再レビューしない」incremental 仕様のため、同一 HEAD への
@coderabbitai review再投稿は「already reviewed, nothing to do」を返すだけでレート枠を消費する無駄になる(2026-07-05 セッションで、手動 fix push 後に同一 HEAD へ複数回投稿しレート枠を無駄消費した実例)。OSS/public リポのレビュー枠は有償 Pro(5 レビュー/時)より低くプロジェクト人気度依存のため、構造的に避ける。変更内容
review_trigger.rsのtrigger_coderabbit_reviewに、投稿前ガードを追加。head_already_reviewed(pr, repo)で「現 HEAD がいずれかの CodeRabbit review のcommit_idと一致するか」を gh 照会し、一致(レビュー済み)なら@coderabbitai reviewを skip。判定不能(gh 照会失敗 / repo 未確定)は fail-open(投稿)で再レビュー欠落を防ぐ。is_head_in_reviewed純粋判定 + 単体テスト追加。新規コミット(別 SHA)への 1 回の明示トリガーは意図した消費であり抑止対象外(新しい修正はレビューされるべき)。ガードは「同一 HEAD への再トリガー」のみ抑止する。
テスト
cargo test -p cli-pr-monitor: 233 passed +--ignored統合 13 passed / clippy clean参照
.coderabbit.yaml auto_incremental_review:false+ 明示トリガー)の consumption 削減を補完🤖 Generated with Claude Code
Summary by CodeRabbit