feat(check-ci-coderabbit): --list-findings モード追加 (Bundle a Sub-PR 1) - #101
Conversation
PR #100 post-merge-feedback で生成された Sub-PR 2 follow-up エントリを反映: - 順位 46 を docs/todo.md 推奨実行順序に追加 (Bundle a Sub-PR 2 integration test) - docs/todo4.md に詳細エントリ追加 (cli-pr-monitor rate-limit auto-retry の test 計画) 設計根拠は ADR-034 参照。実装は Sub-PR 2 で着手予定。
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughこのPRは、CodeRabbit連携強化に関する2つの独立した変更を含みます。(1) rate-limit auto-retry統合テストの計画・ドキュメント化、(2) check-ci-coderabbit に ChangesRate-limit Auto-retry 統合テスト計画
--list-findings モード実装
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 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
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/check-ci-coderabbit/src/main.rs`:
- Around line 662-666: The comparison that computes after_push_time currently
uses created_at.as_deref().map(|t| t > push_time) which excludes commits with
created_at == push_time; change the comparison operator to >= so the boundary is
inclusive (i.e., map(|t| t >= push_time)), and update any nearby comment or
function doc that describes the boundary to reflect the inclusive behavior;
ensure this change is applied where after_push_time, created_at and push_time
are referenced together.
- Around line 1191-1197: The current .unwrap_or_else(|e| { ... "[]".to_string()
}) swallows all errors and treats failures (auth/network/API) as an empty
findings array; change this to propagate the error instead of returning "[]":
remove the unwrap_or_else and return/propagate the Err (e.g., use ? or map_err
to convert into the function's Result) so callers can retry or fail
appropriately; update the caller signatures if needed to accept a Result and
handle retry/failure logic. Ensure you modify the exact expression that contains
.unwrap_or_else(|e| ...) so errors are not converted into a "[]" success value.
🪄 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: 728eef1d-f1a8-48eb-a2b8-fe41f6ea57d2
📒 Files selected for processing (4)
.tmp-pr-body-draft.mddocs/todo.mddocs/todo4.mdsrc/check-ci-coderabbit/src/main.rs
…R 1 #D-3)
ADR-034 Bundle a Sub-PR 1 の token 削減層。CodeRabbit インラインレビュー
コメントを構造化 JSON `{"findings": [...]}` で出力する新モードを追加する。
- CliArgs に `--list-findings` フラグ + `--push-time` の epoch 0 fallback
- ListedFinding struct (severity / file / line / summary / url) + 出力 envelope
- parse_listed_findings: thread root のみ抽出 + `resolved:` reply による outdated filter
- GhPullComment に id / in_reply_to_id / html_url を拡張
- run_list_findings: CI / rate-limit / status check を skip して findings のみ取得
- 単体テスト 16 件追加 (resolve filter / push_time / 非 CR 著者 / schema 検証 等)
Sub-PR 2 (cli-pr-monitor の rate-limit auto-retry) で本 API を消費する想定。
gh CLI 規則 (#D-1) は global rule (~/.claude/rules/common/git-workflow.md) に
追記済 (リポ外)。
Resolved findings: - [Minor] src/check-ci-coderabbit/src/main.rs:666 `push_time` 境界を inclusive に揃えてください。 - [Major] src/check-ci-coderabbit/src/main.rs:1197 取得失敗を空配列に潰さないでください。
c7d69c7 to
22b354d
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…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)
* docs(todo): PR #104 post-merge-feedback の採用分 + Bundle b (CR operation 安定化) を追加 - 順位 53: rate-limit retry の CronCreate 化 (Bundle b PR-1, Tier 1) — 47 min rate-limit auto-retry 不能の致命点解消 - 順位 54: review 完了待ちの CronCreate 化 + observer 廃止 (Bundle b PR-2, Tier 2) - 順位 55: config 拡張 + SessionStart catch-up (Bundle b PR-3, Tier 3) - 順位 56: comment-lint hook test 拡充 (PR #104 T2-1+T2-2 bundle, Tier 2) — UTF-8 multi-byte + block comment boundary の回帰テスト体系化 PR #104 post-merge-feedback の Tier 2-3/4 と Tier 3 全件は採用見送り (overlap / 過剰一般化リスク / 重複ルール)。 * feat(hooks): 関数長スケーリング検出 lint 追加 (順位 48 / PR #101 T1-4) CLAUDE.md `coding-style.md` 50 行ガイドラインを決定論的に維持する PostToolUse lint を `hooks-post-tool-comment-lint-rust` に追加。touch-trigger ratchet 方式で 既存の 50 行超過関数 (40 個) は変更行に触れた瞬間にだけ flag、grandfather される。 実装: - 新 violation type `RUST_FUNCTION_TOO_LONG` (severity: error) - 閾値 `MAX_FUNCTION_LINES = 50` - `find_function_length_violations`: `compute_metrics` の関数 length を使い、 > 50 行 かつ 関数 body の行範囲が `line_filter` と overlap する関数のみ flag - 順位 50 の `compute_changed_lines` ロジックを再利用 (Edit / Write / MultiEdit の挙動と整合) - empty filter (Edit 純削除) は lint skip、None filter (Write / MultiEdit) は whole-file lint - 既存 `line_in_ranges` を削除 (`span_overlaps_ranges` で代替) - `main` を 64 行 → 39 行に refactor (`extract_file_path` / `collect_all_violations` / `emit_violations_feedback` に分割)、本 lint の 自己適用 Pivot 経緯: - 当初計画は oxlint 自作 rule + .oxlintrc.json + src/oxlint-rules/ だったが、 oxlint は JS/TS 専用 + 自作 rule 未対応のため structurally impossible - Rust 限定 + 既存 Rust hook 拡張で代替 (ユーザー承認、TS/JS は保留) - ロールアウト戦略は Ratchet (touch-trigger、既存 40 個 grandfather) を採用 検証: - cargo test: 73 passed (新 10 件: function length 系) - cargo clippy --all-targets -- -D warnings: clean - 自己適用: main.rs の 50 行超関数は `find_violations` (90 行 / 既存 / 触らず) と `function_too_long_violation` (32 行 / 新規 / OK)、main は 39 行に refactor - 統合テスト: main.rs 内 main() を Edit する hook input → RUST_FUNCTION_TOO_LONG 発火を確認 * docs(todo): 順位 48 完了に伴い削除 順位 48 (関数長スケーリング検出 lint) を実装完了 (前 commit) に伴い、todo.md 表と todo5.md 詳細エントリを削除。 * fix(review): apply CodeRabbit fixes for #105 Resolved findings: - [Major] src/hooks-post-tool-comment-lint-rust/src/main.rs:299 touch-trigger 判定が「body overlap」仕様と一致していません。 - [Minor] src/hooks-post-tool-comment-lint-rust/src/main.rs:551 統合後の違反件数に全体上限が効いていません。
…7 / §A-2 P-2) (#126) §A-2 Phase 5 dogfood P-2。PR #101 で実証された latent drift (parse_findings 系 3 関数で created_at > push_time vs >= の混在) を構造的に防止する custom lint rule を追加。Bundle Z #B-α と同じ「決定論的防止層」哲学。 ルール仕様: - pattern: \b(created_at|submitted_at|updated_at|comment_event_time| event_time|comment_created_at|published_at|posted_at|commented_at) \s*>\s*[a-zA-Z_] - direction: `>` のみ flag (`<` は is_stale 等で意図的 exclusive 境界 の正しい用途があるため scope 外) - target: .rs files only 検証: - 11 unit tests (4 detect 系 + 7 skip 系) + 1 helper 関数 で transition matrix を網羅 - 全 75 tests passed - 既存 codebase で 0 violations (created_at >= は doc コメントのみ、 is_stale の created_at < は `<` で対象外) build + deploy 済 (.claude/hooks-post-tool-linter.exe)。
…#133) * docs(todo): split summary and todo5.md tasks to keep files under 50KB Claude Code の読み取り安定性閾値 (~50KB) を超過していた docs/todo.md (68KB) と docs/todo5.md (67KB) を分割。 - docs/todo.md (68KB → 36KB): 推奨実行順序サマリー section を独立した docs/todo-summary.md (新規 33KB) に切り出し。todo.md には pointer のみ残す - docs/todo5.md (67KB → 25KB): PR #101〜#109 由来の古い半分 13 タスクを docs/todo7.md (新規 45KB) に分離。todo5.md には PR #110 以降が残存 - recommended-order-summary anchor 参照 7 箇所 (todo2-6.md / custom-lint-rules.toml) を todo-summary.md# に更新 - ADR-034 / local-llm-offload-history.md の priority table 参照 4 箇所も todo-summary.md に追従更新 - todo-summary.md table の「ファイル」列で 順位 47-67 を todo5.md → todo7.md に変更、todo7.md 内部チェックリストの「本 todoN.md エントリを削除」も整合 全 8 ファイル (todo.md / todo2-7.md / todo-summary.md) が 50KB 以下に収まる。 * docs(todo): fix CR review findings (preamble counts + broken ADR link) PR #133 で CodeRabbit が検出した 3 件 Minor finding を修正: - docs/todo6.md:5: 「六つすべてを確認すること」→「八つすべてを確認すること (todo.md / todo2-7.md / todo-summary.md)」 - docs/todo7.md:5: 「七つすべてを確認すること」→「八つすべてを確認すること (todo.md / todo2-7.md / todo-summary.md)」 (todo-summary.md カウント漏れ修正) - docs/todo7.md:103: ADR-036 link を `../docs/adr/...` → `adr/...` に修正 (todo7.md は docs/ 配下なので `../docs/` は誤り。todo5.md からの分割で表面化 した pre-existing bug) cli-finding-classifier (ADR-038) は ADR-035 docs-only filter で not_applicable 判定したが、GitHub thread state は依然 unresolved のため fold-in fix で thread を closeable な状態にする。
本 PR は以下 4 つの作業を 1 コミットに統合: ## A. PR #196 post-merge-feedback 採用 2 件 (順位 193, 194 登録) PR #196 (Bundle 195-FB) post-merge-feedback 8 件のうち 2 件採用、6 件却下/様子見。 採用 (todo10.md に entry 追加、todo-summary.md table に行追加): - 順位 193 (T2): Companion helper group 署名整合 compile-time validation test - 順位 194 (T3): development-workflow.md \"1. Plan First\" に Codification 重複確認 step 追記 却下/様子見の詳細は .claude/feedback-reports/196.md 参照。 ## B. queue 棚卸し (順位 ≤ 100 の 32 件を audit) 8 件削除 + 7 件改訂で queue の signal/noise 改善: 削除 8 件 (既存 land 確認、または動機失効): - 順位 41 (Bundle Y2 効果定量計測): 動機の主軸失効 (Bundle Z 完成 + Z2 不採用) - 順位 42, 43, 46 (rate-limit auto-retry 系): PR #97/#113/#129/#185 段階 land 完了 - 順位 45 (--list-findings Rust モード): PR #101 で land 済 - 順位 57 (Aggregation cap integration test): PR #171 で land 済 - 順位 93 (coding-style.md partial fix 例追加): ~/.claude/rules/common/ coding-style.md に既に section 存在 - 順位 97 (with_num_ctx serialization test): lib.rs:494 で mockito test 実体存在 改訂 7 件 (Status update 2026-06-06 を front-matter に追加、現状反映): - 順位 11: ADR-018 park / ADR-030 短命プロセス移行後の再現確認が前段 - 順位 19: ADR-037/043/PR #194 land 後の残余 case baseline 観測が前段 - 順位 27: Phase D-7 = PR #154 land 済を反映 - 順位 38: ADR-031 採用昇格済 (PR #192) → Bundle W/X land のみ残依存 - 順位 40: PR #175 push-runner bookmark_check 実装済 → skill 側は二重防御に縮小 - 順位 51: 採用案 C (fix.md instruction 追加) は land 済、残作業 = dogfood 観測のみ - 順位 92: ADR-038 採用昇格済 (PR #156) で Phase d 運用入り、動機書き換え cross-reference 修復: - 順位 49: 旧依存 Bundle a Sub-PR 2 (順位 42/43/46) 消滅を反映 - 順位 61: 旧依存 順位 45 land 済を反映 ## C. todo9.md → todo11.md 分割 todo9.md が 75KB / 890 行に到達し読み取り安定性閾値 (50KB) 超過のため分割: - todo9.md (37KB / 454 行): 既存ルール仕組み化バンドル (順位 146-151) + 週次 レビュー拡張 (順位 152-154) を保持 - todo11.md (41KB / 453 行、新規): PR-specific follow-up entries 10 件 (順位 157, 160, 161, 162, 163, 165, 170, 171, 172, 173) theme-based split で意味的分離 + 両ファイルとも 50KB 閾値以下に収まる。 todo-summary.md table の file 参照を Python script で一括更新 (10 件)、 todo-summary.md 冒頭の \"追加先ファイル\" 説明を todo10.md に更新。 ## D. 順位 177 優先度引上げ PostToolUse hook ファイルサイズ検出 task が 4 回目の同型観測に到達 (PR #133 + #172 + #186 + 本セッション = Very High frequency)。CLAUDE.md code-review.md \"同型 finding の閾値判定\" (3 観測 = Tier 1 昇格) を超え systemic risk 閾値到達。 3 箇所同期更新: - todo10.md entry 本体に Status update 2026-06-06 blockquote 追加、優先度を \"Tier 1\" → \"Tier 1 (優先実装)\" に格上げ - todo-summary.md table 行で Tier 列を太字 + 注記、dependency 列に urgency note - todo-summary.md 末尾の戦略 note に \"直近優先 (2026-06-06 ユーザー指示)\" 段落を新設、Bundle 195-FB-Followup (順位 193 + 194) の次の PR で消化推奨と specific call-out ## 統計 - 10 ファイル変更 (1 新規) - ~670 lines insertions, ~910 lines deletions (net ~240 行削減) - 全 todo*.md が 50KB 閾値以下に収まる (todo9: 37KB, todo10: 36KB, todo11: 41KB) ## 参照 - .claude/feedback-reports/196.md (採否確定 commit、PR #196 由来) - memory feedback_post_merge_feedback_adoption_requires_user_approval per ユーザー承認済 - memory feedback_todo_no_history (削除は痕跡なし、コメントマーカー不使用) - ADR-035 (docs-only PR 評価ポリシー) - ADR-033 (採番管理簡素化、順位 renumber は避けて semantic markers で表現)
Summary
check-ci-coderabbit.exe --list-findings --pr <N>モードを追加し、CodeRabbit インラインレビューコメントを構造化 JSON{"findings": [...]}で取得可能にした~/.claude/rules/common/git-workflow.md) に追記済 (リポ外につき本 PR には含まれない)変更内容
feat(check-ci-coderabbit): --list-findings Rust モード追加 (Bundle a Sub-PR 1 #D-3)CliArgsにlist_findings: boolフラグ +--push-timeの epoch 0 fallbackListedFinding { severity, file, line, summary, url }+ListFindingsOutput専用型 (lib_report_formatter::Finding共有型に影響なし)parse_listed_findings: thread root のみ抽出 +resolved:reply による outdated filter (HashSet<u64>で resolved_root_ids を一度構築)is_resolve_reply: trim + lowercase でresolved:prefix 判定 (memoryproject_coderabbit_auto_resolve.md仕様準拠)extract_summary:extract_issueを再利用しつつ改行を空白に正規化 + 120 chars 切り詰めGhPullCommentにid,in_reply_to_id,html_urlを拡張 (#[serde(default)]互換)run_list_findings: CI / rate-limit / status check を skip して findings のみ取得docs(todo): Bundle a Sub-PR 2 integration test entry + 順位 46 を実行順序に追加PR #100 post-merge-feedback で生成された Sub-PR 2 follow-up エントリ:
実装は Sub-PR 2 で着手予定。設計根拠は ADR-034 参照。
動作確認
cargo test -p check-ci-coderabbit: 79 passed / 0 failedcargo clippy -- -D warnings: cleanpnpm build:check-ci-coderabbit: 成功 (.claude/check-ci-coderabbit.exe配置済)--list-findings --pr 99: 空配列を返却 (= 6 thread root すべてresolved:reply 済、正解動作)--list-findings --pr 100: 空配列を返却Test plan
関連
Summary by CodeRabbit
リリースノート
New Features
--list-findingsモードを追加しました。Documentation