fix(pr-monitor): CR check flow defects (Bundle CR-CHECK 順位 208/209/210) - #212
Conversation
PR #210/#211 セッションで実観測した cli-pr-monitor の CR check flow 不具合 3 件を バンドル修正: 順位 208 (CR walkthrough body parse): - check-ci-coderabbit に WALKTHROUGH_CLEAN_MARKER / WALKTHROUGH_HEADER_MARKER 定数 + parse_walkthrough_clean_marker + is_clean_walkthrough_comment helper を追加 - CodeRabbitStatus に walkthrough_clean: bool フィールド追加 - decide() に 'walkthrough_clean && !has_unresolved → complete' 分岐追加 - formal Review object が無くても walkthrough body の clean marker を信頼して recheck loop を構造的に終了。memory feedback_coderabbit_no_actionable_merge_signal の手動 workaround を機械化 - 7 fixture test (header あり / rate-limit overlay / marker なし / CR 以外 / push_time 前 / decide 2 経路) 順位 209 (PARK signal output round-UP): - cli-pr-monitor/stages/poll.rs に round_up_to_next_minute pure helper + compute_safe_minute_for_park_signal helper 追加 - ReviewParkSignalFields に safe_minute_unix / safe_minute_iso_utc 追加 - format_review_park_signal template に新 field 出力 + ACTION REQUIRED block で 2 制約 (秒→分 round-UP + :00/:30 minute 衝突回避) を sequential check として明示 - AI agent consumer が round-DOWN 罠を踏まない構造的防御 - 10 test (round-UP 5 件 / compute 4 件 / signal 1 件) 順位 210 (rule codify): - ~/.claude/rules/common/development-workflow.md に 'Cron スケジューリングの秒 → 分 round-UP' section 追加、analyzer 観点の '30s jitter vs 90s 前倒し制約' 混在を 2 直交制約として別個に明示 (Constraint 1 = scheduling minimum lead time / Constraint 2 = execution jitter ≤90s pre-fire) - feedback_cron_round_up_for_second_timestamps.md 新規 memory + MEMORY.md pointer - feedback_coderabbit_no_actionable_merge_signal.md に '順位 208 で機械化済' 追記 検証: - cargo build --release clean (30.72s) - cargo test -p check-ci-coderabbit: 89 passed (82 既存 + 7 新規) - cargo test -p cli-pr-monitor: 203 passed (193 既存 + 10 新規) - cargo clippy ... -D warnings clean - markdownlint clean scope 外 (別 PR で対応): - poll.rs (1988→2090 lines) / check-ci-coderabbit/main.rs (2143→2356 lines) / run_check (147 lines) の file/function-length lint 違反は touch-trigger ratchet 情報 (block されない soft-feedback) として残置、ファイル責務分割 refactor で対応 global 編集 (jj 管理外): - ~/.claude/rules/common/development-workflow.md - ~/.claude/projects/.../memory/feedback_cron_round_up_for_second_timestamps.md - ~/.claude/projects/.../memory/MEMORY.md - ~/.claude/projects/.../memory/feedback_coderabbit_no_actionable_merge_signal.md
|
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)
📝 Walkthroughウォークスルー
変更内容CodeRabbit walkthrough clean 検出
PARK signal 秒→分 round-up
完了 TODO の削除
推定コードレビュー工数🎯 4 (Complex) | ⏱️ ~50 minutes 関連する可能性のある PR
🚥 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/check-ci-coderabbit/src/main.rs (1)
1674-1685: 💤 Low valueテストケースの補足を検討してください。
このテストは
humanreviewerユーザーを使用しているため、ユーザーフィルタとヘッダー欠落の両方を同時にテストしています。ヘッダー要件を単独で検証するには、coderabbitai[bot]ユーザーでクリーンマーカーは含むがヘッダーマーカーが欠落しているケースを追加することを推奨します。#[test] fn walkthrough_clean_skipped_when_coderabbit_post_lacks_header() { let json = r#"[ {"user": {"login": "coderabbitai[bot]"}, "body": "No actionable comments were generated in the recent review.", "created_at": "2026-04-01T12:30:00Z"} ]"#; assert!(!parse_walkthrough_clean_marker(json, "2026-04-01T12:00:00Z")); }🤖 Prompt for 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. In `@src/check-ci-coderabbit/src/main.rs` around lines 1674 - 1685, The current test function `walkthrough_clean_skipped_when_header_missing_to_avoid_user_post_false_positive` conflates two separate concerns by testing both the user filter (via humanreviewer user) and the header requirement simultaneously. Add a new separate test function `walkthrough_clean_skipped_when_coderabbit_post_lacks_header` that uses the coderabbitai[bot] user (to pass the user filter check) with a body containing the clean marker text but without the required header marker, ensuring that the header requirement is validated independently from the user filter logic.
🤖 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.
Nitpick comments:
In `@src/check-ci-coderabbit/src/main.rs`:
- Around line 1674-1685: The current test function
`walkthrough_clean_skipped_when_header_missing_to_avoid_user_post_false_positive`
conflates two separate concerns by testing both the user filter (via
humanreviewer user) and the header requirement simultaneously. Add a new
separate test function
`walkthrough_clean_skipped_when_coderabbit_post_lacks_header` that uses the
coderabbitai[bot] user (to pass the user filter check) with a body containing
the clean marker text but without the required header marker, ensuring that the
header requirement is validated independently from the user filter logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 27aef292-df30-4f41-8efc-d2439827de03
📒 Files selected for processing (4)
docs/todo-summary.mddocs/todo10.mdsrc/check-ci-coderabbit/src/main.rssrc/cli-pr-monitor/src/stages/poll.rs
💤 Files with no reviewable changes (2)
- docs/todo10.md
- docs/todo-summary.md
…212 CR Nitpick 採用) CR Nitpick 指摘 (PR #212 review 1 件) を採用。既存 test walkthrough_clean_skipped_when_header_missing_to_avoid_user_post_false_positive が humanreviewer ユーザーで user filter + header check の 2 責務を同時テストして いたため、header marker 単独の検証を coderabbitai[bot] + clean marker + header 欠落 の独立 test として補完。 追加: walkthrough_clean_skipped_when_coderabbitai_post_lacks_header_marker 検証: - cargo test -p check-ci-coderabbit: 90 passed (89 既存 + 1 新規) - memory feedback_test_dry_antipattern.md と整合 (テスト独立性を優先、新規 test は fixture を inline で独立 setup) CR 評価: 🧹 Nitpick / Low value / Effort XS / Risk None。memory feedback_test_dry_antipattern の精神と一致する提案 (DRY ではなく test responsibility 分離) のため採用。
* refactor(check-ci-coderabbit): main.rs を 7 module に分割 (PR A、file/function length 解消) PR #212 で残置した touch-trigger ratchet 違反 (file_length / function-too-long) を解消するため check-ci-coderabbit/src/main.rs (2369 行) を 7 module に分割し、 run_check (147 行) を 8 helper 関数に decompose。 分割後: - models.rs (118): CheckResult / RateLimitInfo / CiStatus / CodeRabbitStatus / Gh* / Listed* models 集約 - markers.rs (60): RATE_LIMIT_MARKERS / WALKTHROUGH_* + 3 判定 helper - decide.rs (412): decide + build_summary + 16 tests、build_summary を 2 helper (build_summary_ci_part / build_summary_cr_part) に分解 - parsers.rs (532): parse_ci_runs / parse_coderabbit_status / parse_new_comments / parse_walkthrough_clean_marker / parse_actionable_comments / extract_actionable_count / parse_unresolved_threads + 32 tests、 parse_ci_runs 内の classification を classify_ci_overall / is_pending_run / is_failure_run に分解 - rate_limit.rs (365): parse_rate_limit + extract_*_format_wait_time + parse_iso8601_to_unix + 21 tests - findings.rs (381): parse_findings / parse_listed_findings + 抽出 helper + 16 tests、各 parse 関数を candidate/transform 2 関数に分解 - main.rs (483): entry, parse_args, run_check (37 行) + 8 fetch helper, run_list_findings, auto_detect_*, is_valid_*, parse_args test run_check decomposition (147→37 行) で抽出した helper: - resolve_repo_and_pr (Box<CheckResult> で result_large_err 回避) - build_init_error_result - fetch_ci / fetch_coderabbit_commit_state / fetch_issue_comments_json / fetch_actionable_count / fetch_unresolved_threads / fetch_findings 合計行数: 2351 (元 2369、わずかに減少)。 全ファイル 800 行以下 (file_length lint 解消)。 全関数 50 行以下 (function_length lint 解消)。 検証: - cargo build --release: clean (18.22s) - cargo test -p check-ci-coderabbit: 90 passed (refactor 前後で同数、test 同一性確認) - cargo clippy -p check-ci-coderabbit --tests -- -D warnings: clean - Box<CheckResult> で clippy::result_large_err warning 解消 scope 外 (PR B で対応): - cli-pr-monitor/src/stages/poll.rs (2090 行) の分割 途中事故: - PowerShell スクリプトで main.rs を 0 行に誤削除 → jj op restore で復旧 → module ファイル再 Write で継続 → 以降 PowerShell の in-file 編集を回避し Edit/Bash sed のみ使用 * fix(review): apply CodeRabbit fixes for #213 Resolved findings: - [Major] src/check-ci-coderabbit/src/parsers.rs:93 CodeRabbitステータスの取得順序が誤っています。 - [Major] src/check-ci-coderabbit/src/parsers.rs:175 `push_time` の境界条件が1件取りこぼします。
Summary
PR #210/#211 セッションで実観測した cli-pr-monitor の CodeRabbit check flow 不具合 3 件をバンドル修正します。
"No actionable comments were generated in the recent review."を機械検出し、formal Review object が無くても recheck loop を終了させるsafe_minute_at_unix/safe_minute_at_iso_utcfield 追加 + ACTION REQUIRED block で 2 制約 (round-UP +:00/:30回避) を sequential check として明示~/.claude/rules/common/development-workflow.md+ memory に「Cron 秒 → 分 round-UP」rule を 2 直交制約として codify設計判断
順位 208 (CR walkthrough body parse)
WALKTHROUGH_HEADER_MARKER(=<!-- This is an auto-generated comment: summarize by coderabbit.ai -->) で auto-generated 由来であることを確認 → ユーザー手動投稿の引用文を誤検出しないis_rate_limit_comment(c)先行チェック → rate-limit overlay 中 (memoryproject_coderabbit_rate_limit_overlay) は body が書き換わるため clean 判定を skipunresolved_threads > 0のときは過去 review 由来の未対応事項のため walkthrough_clean を上書きせず action_required を維持順位 209 (PARK signal output)
:00/:30minute 衝突回避) は fractional-hour TZ (IST +5:30 等) で正しく適用するには local TZ awareness が必要なため、PARK signal 内の ACTION REQUIRED block に Step 2 として明示し AI agent consumer 側で処理chronocrate を追加せず pure arithmetic で実装 (既存lib-pending-file::epoch_secs_to_iso8601と同方針)順位 210 (rule codify)
副次更新
feedback_coderabbit_no_actionable_merge_signal.md(memory) に「順位 208 で機械化済」記述追加。machine-enforce の補完層として、(1) 機械検出が disable された場合の AI fallback、(2) walkthrough body 以外 (review object body 等) で同 marker が観測された場合の手動判定の 2 用途で残置。global 編集 (jj 管理外)
~/.claude/rules/common/development-workflow.md(新 sub-section)~/.claude/projects/.../memory/feedback_cron_round_up_for_second_timestamps.md(新規)~/.claude/projects/.../memory/MEMORY.md(pointer 追加)~/.claude/projects/.../memory/feedback_coderabbit_no_actionable_merge_signal.md(Status 追記)snapshot は
~/.claude/__backup-20260617-...-bundle-cr-check/に保存済 (feedback_global_config_backup適用)。Out of scope (別 PR で対応)
hooks-post-tool-comment-lint-rust(soft-feedback) が以下 3 件を info 出力 (block されない nag):cli-pr-monitor/src/stages/poll.rs: 2090 行 > 800 行check-ci-coderabbit/src/main.rs: 2356 行 > 800 行check-ci-coderabbit/main.rs::run_check: 147 行 > 50 行いずれも本 PR で 1 行追加した結果 touch-trigger ratchet が触発された既存超過。ファイル責務分割 refactor の別 PR で対応します (ユーザー合意済 2026-06-17)。
順位 211 (T3-2、testing.md N=0/1/2 単複境界 guideline) は本バンドル対象外で docs/todo10.md に残置。
Test plan
cargo build --releasecleancargo test -p check-ci-coderabbit: 89 passed (82 既存 + 7 新規 = walkthrough header あり / rate-limit overlay / marker なし / CR 以外 / push_time 前 / decide 2 経路)cargo test -p cli-pr-monitor: 203 passed (193 既存 + 10 新規 = round-UP 5 件 / compute 4 件 / signal 1 件)cargo clippy ... -D warningsclean関連
.claude/feedback-reports/210.mdTier 1 feat(hooks): 設定駆動型アーキテクチャに移行し配布自動化を実装 #1 / Tier 2 feat(hooks): 設定駆動型アーキテクチャに移行し配布自動化を実装 #1 / Tier 3 feat(hooks): 設定駆動型アーキテクチャに移行し配布自動化を実装 #1feedback_coderabbit_no_actionable_merge_signal.md(機械化済として記述更新)feedback_cron_round_up_for_second_timestamps.md(新規)Summary by CodeRabbit
リリースノート