feat(pipeline): PR 1 即時 skip バンドル (#C-3 + #A-2)#102
Conversation
…ip (#C-3) CR rate-limit が active な状態で polling を抜けた場合、stale な findings に対する takt 分析は空打ちになるため (1-2 分の浪費)、PR #97 で追加した検出機構を流用して takt invoke を skip する。 - PollResult に rate_limit: Option<RateLimitState> field を追加 - 8 つの PollResult 終了点すべてで state.rate_limit を伝播 - monitor.rs で has_coderabbit_findings + collect_findings 成功後、 rate_limit.is_some() を check して takt branch を skip + log 参照: docs/pipeline-token-efficiency.md PR 1
doc-only PR や 1-commit fix PR では post-merge-feedback の ROI が低いため、 gh pr view で取得した diff summary を判定して skip する。 判定条件 (3 つすべて満たす場合のみ skip): - changed files が全て .md - かつ commit 数 = 1 - かつ +/- 合計 < TRIVIAL_PR_LINE_LIMIT (50) 実装: - feedback.rs に PrDiffSummary / fetch_pr_diff_summary / parse_pr_diff_summary を追加 - main.rs run_ai_step で feedback::run 前に skip 判定 - 判定失敗時は WARN log を残して通常 flow に fallback (誤 skip による学習機会損失を最小化) unit test 9 件追加: - 境界 (TRIVIAL_PR_LINE_LIMIT 直前 / 上限と一致) - multi-commit / non-md 混在 / 空 files の non-trivial 判定 - 大文字 .MD 拡張子の認識 - 必須 field 欠損時の Err 返却 参照: docs/pipeline-token-efficiency.md PR 1
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughPR は 3 つの独立した機能を導入します:ドキュメント化されたパイプライン改善計画、CLI マージパイプラインの trivial PR 検出ロジック、PR モニター内のレート制限状態追跡と自動リトライ機構です。 ChangesTrivial PR Detection in Merge Pipeline
Rate-Limit State Tracking & Auto-Retry in PR Monitor
Pipeline Improvement Documentation
Sequence Diagram(s)sequenceDiagram
participant main as run_ai_step
participant feedback as feedback module
participant gh as GitHub CLI
participant parser as JSON Parser
participant checker as post-merge workflow
main->>feedback: fetch_pr_diff_summary(pr_number)
feedback->>gh: gh pr view [pr_number]
gh-->>feedback: JSON (commit_count, total_lines, files)
feedback->>parser: parse_pr_diff_summary(JSON)
parser-->>feedback: PrDiffSummary
feedback-->>main: PrDiffSummary
alt is_trivial() == true
main->>main: log SKIP (trivial PR detected)
main-->>main: return early
else is_trivial() == false
main->>checker: run post-merge-feedback
checker-->>main: feedback result
end
sequenceDiagram
participant poll_loop as run_poll_loop
participant state as PollState
participant gh_api as GitHub API
participant monitor as start_monitoring
participant takt as takt workflow
poll_loop->>state: check rate_limit_last_retriggered_at
alt rate_limit.is_some() && not_already_retriggered
poll_loop->>gh_api: post `@coderabbitai` review comment
gh_api-->>poll_loop: comment success
state->>state: increment rate_limit_retries
state->>state: update rate_limit_last_retriggered_at
poll_loop->>poll_loop: continue polling
else max_retries exceeded or state persist fails
poll_loop-->>monitor: PollResult { rate_limit: Some(...) }
end
monitor->>monitor: check poll_result.rate_limit.is_some()
alt rate_limit is active
monitor->>monitor: log rate-limit skip message
monitor-->>monitor: skip takt invocation
else rate_limit is None
monitor->>takt: invoke takt workflow
takt-->>monitor: takt result
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 複数の独立した機能実装(trivial PR 検出、レート制限自動リトライ)、ロジック密度の高い状態管理(重複排除、スリープ予算チェック)、3 つの異なるシステムにまたがる変更(ドキュメント、マージパイプライン、モニター)、新規パブリック API の導入が混在しているため。 Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
…do follow-ups (#103) * docs(todo): PR #101 post-merge-feedback の Tier 1/2 finding を採用 (順位 47-49) + todo5.md 新設 - 順位 47 (Tier 1): `>` vs `>=` boundary inconsistency lint rule - 順位 48 (Tier 1): 関数長スケーリング検出 oxlint rule - 順位 49 (Tier 2): `parse_findings` 系の error-path test infrastructure (Bundle a Sub-PR 2) - todo5.md を新設 (todo4.md が 50KB 到達のため、新規エントリ移行先) - todo.md ヘッダを todo5.md 言及に更新 * docs(todo): PR #102 post-merge-feedback Tier 1 #1 を採用 (順位 50) PR #102 post-merge-feedback で提案された 4 件のうち Tier 1 #1 のみ user 判断で採用: - comment-lint hook の scope を「変更行のみ」に限定する設計修正 - PR #102 セッション中に観測した 'pre-existing 20 violations が edit のたびに flag される' 問題への対応 (hook の file-level scan の設計問題) todo.md の推奨実行順序サマリーに 順位 50 (Tier 1, Effort M) として追加し、 todo5.md に詳細エントリ (動機・設計決定 2 案・作業計画・完了基準・詰まっている箇所) を記載。 Bundle Z Phase 2 (#B-β) 着手前に解消することを推奨 (Phase 2 で fix.md / helper script を 編集する際に同じ block 問題が再発するため)。 参照: .claude/feedback-reports/102.md Tier 1 #1 * feat(takt+hooks): Bundle Z Phase 2 - 制約付き fix instruction (#B-β) fix step の self-check を LLM 判断ではなく機械的指標の diff 比較に置き換える決定論層を実装。 fix が introduce した新規 violation (nesting / function 長 / non-doc comment 数の増加) を 構造的に検出し、LLM に override / refactor 判断を促す。 実装要素: - hooks-post-tool-comment-lint-rust crate に '--metrics <file>' モード追加 - tree-sitter で function_item を walk、name / line range / max nesting depth を抽出 - non-doc comment count は既存 ALLOWED_*_PREFIXES (PR #99) を流用 (single source of truth) - JSON 出力で scripts/fix-metrics-check.ps1 が消費 - 13 件の新規 unit test (空 file / 単純 / nested / match / closure / trait / 関数長 等) - scripts/fix-metrics-check.ps1 新規追加 - jj file show -r @- で pre-state 取得、temp file 経由で metrics 算出 - 関数を name で突き合わせ、length / max_nesting_depth の増加を検出 - file-level non_doc_comment_count の増加も検出 - PASS / FAIL (exit 1, JSON violations) / SKIPPED (新規 file) / infrastructure error (exit 2) - Windows + 日本語ロケールで jj UTF-8 stdout が Shift-JIS 解釈される問題を回避するため [Console]::OutputEncoding = UTF8 を明示設定 (実装中に発覚した mojibake → tree-sitter 早期失敗) - .takt/facets/instructions/fix.md に Pre-completion deterministic check セクション追加 - 各 .rs 修正 file で helper 起動を指示 - exit 1 時は refactor 優先、override は Metrics override 見出しで根拠記載 - exit 2 (infra error) は fix 完了を block しない (環境問題なので surface のみ) v1 (PoC) の意図的な scope 外 (docs/pipeline-token-efficiency.md PR 2 参照): - change-site 周辺への scope 絞り込み (file 全体 + 関数単位の比較で代用) - Rust 限定 (将来言語拡張で別 metric tool 評価) - 関数 rename 時の追跡 (name match のみ、rename は新規扱い) 参照: docs/pipeline-token-efficiency.md PR 2 (Bundle Z Phase 2)、PR #99 (Phase 1)
…-ups) (#104) * docs(todo): PR #103 セッション知見から順位 51 を追加 — review-diff.txt iter 間 refresh PR #103 push の実観測で takt pre-push-review が 6-iter outlier (22m 50s) を発生させ、 うち iter 3+4 の ~10 分が wasted (stale review-diff.txt による false positive 'persists')。 supervisor の live Read で打開されたが、構造的制約として残存。 post-merge-feedback の Tier 3 #1 (snapshot semantics の ADR 化) は順位 51 land で obsolete になるため skip、Tier 3 #2 (fix scope clarity) は coding-style.md 既存ルールと 重複のため skip。機構で塞ぐ実装層対策のみ採用 (Tier 1, Effort M)。 todo.md table に順位 51 を追加し、todo5.md に詳細エントリ (動機・設計決定 2 案・ 作業計画・完了基準) を記載。 * feat(hooks): comment-lint hook scope を変更行に限定 (順位 50 / PR #102 T1-1) Edit tool の new_string 出現位置から変更行 range を導出し、その範囲外の pre-existing violations を flag しないよう scope を絞る。 変更前は `hooks-post-tool-comment-lint-rust` がファイル全体を scan する 設計のため、PR #102 セッション中に poll.rs / monitor.rs / feedback.rs / main.rs への 1 行追加レベルの edit でも pre-existing 20 violations が 毎回 flag され、hook 出力 12.6KB の繰り返しで token 浪費 + scope creep への暗黙圧力が発生していた (Tier 1 #1)。 実装方針 (Approach 3 / advisor 推奨): - Edit (non-empty new_string): post-edit source 内で new_string の出現を 全件検索 → 各 match の行 range の union を filter として使用 - Edit (empty new_string): 純削除につき lint skip - Write / MultiEdit / 不明 tool: フィルタなし (whole-file lint) - new_string が見つからない (line ending mismatch 等): 安全側に倒し whole-file lint にフォールバック MultiEdit は v1 では未対応 (whole-file lint にフォールバック)。利用頻度 が低く no-regression な現状維持で十分なため、follow-up とする。 検証: - 60 unit tests pass (cargo test) - cargo clippy -- -D warnings clean - 手動統合テスト: pre-existing comments を含むファイルへの Edit (line 3 のみ変更) → line 3 のみ flag、line 1/4 の pre-existing は除外 ✓ - 純削除 (new_string="") → 出力なし (lint skip) ✓ - Write tool → whole-file (3 violations) ✓ - 多行 new_string → 範囲が複数行に展開され正しく filter ✓ * docs(todo): 順位 50 完了に伴い削除 + 順位 52 (MultiEdit follow-up) 追加 順位 50 (comment-lint hook の scope を変更行に限定) を実装完了 (前 commit) に 伴い、todo.md 表と todo5.md 詳細エントリを削除。v1 では MultiEdit が whole-file fallback (no-regression) で残るため、Tier 3 follow-up として 順位 52 を新規登録。 * fix(review): apply CodeRabbit fixes for #104 Resolved findings: - [Critical] src/hooks-post-tool-comment-lint-rust/src/main.rs:152 `locate_string_line_ranges` 関数が UTF-8 文字境界を破壊し、パニックを引き起こす可能性があります - [Minor] src/hooks-post-tool-comment-lint-rust/src/main.rs:221 複数行 block comment が変更範囲内でも検出漏れします
Summary
docs/pipeline-token-efficiency.md の「PR 1: 即時 skip バンドル」を実装。条件検出 → パイプライン skip の単純 guard を 2 crate に追加し、rate-limit 中・doc-only PR での takt 空打ちを削減する。
cli-pr-monitor: rate-limit 検出時にpost-pr-reviewtakt invoke を skip (PR feat(cli-pr-monitor): rate-limit 自動検出 + 再トリガー (Phase 4 / 順位 13) #97 のstate.rate_limitを流用)cli-merge-pipeline: trivial PR (doc-only + 1 commit + <50 行) でpost-merge-feedbackを skippipeline-token-efficiency.md: 完了済 Bundle (Y2 / Z Phase 1 / a) を履歴化 + 残作業を 3 PR 計画に再編Commits
b58153f043959d46162f786d注: docs commit と実装 commits は本来別 PR が望ましいが、ユーザー判断 (PR が混ざることを許容、暫定処置) で 1 PR にまとめている。
期待効果
実装の要点
#C-3 (cli-pr-monitor)
PollResultにrate_limit: Option<RateLimitState>field を追加state.rate_limitを伝播 (struct literal なので型レベルで漏れなし)monitor.rsでhas_coderabbit_findings + collect_findings成功後、rate_limit.is_some()判定で takt branch を skip + log#A-2 (cli-merge-pipeline)
feedback.rsにPrDiffSummary/fetch_pr_diff_summary/parse_pr_diff_summaryを追加commit_count == 1 && total_lines_changed < TRIVIAL_PR_LINE_LIMIT (=50) && all_files_are_markdownmain.rsrun_ai_stepでfeedback::run前に skip 判定Test plan
参照
Summary by CodeRabbit
リリースノート
新機能
ドキュメント