test(cli-pr-monitor): cross-module overflow safety + 2100 baseline (順位 76+77 / §A-2 P-4)#128
Conversation
…§A-2 P-3 ledger (順位 76+77 / §A-2 P-4) §A-2 Phase 5 dogfood P-4 (Bb-3 follow-up)。PR #115 で実証された unit test isolation 起因の cross-module overflow 自己矛盾 (config layer の sanitize テストが downstream poll arithmetic の overflow safety を verify していなかった) を統合テストで machine-enforce。 順位 76 (Tier 2, T2-1): - 4 cross-module integration tests を config.rs test module に追加 - cross_module_overflow_safety_at_max_boundary (sanitize 後の MAX_SAFE_WAIT_SECS が finalize_initial_review_park / schedule_next_* 両経路で overflow しないことを assert) - cross_module_overflow_safety_with_zero_input_uses_default (0 → default 300s) - cross_module_overflow_safety_with_u64_max_input_uses_default (u64::MAX → default 300s) - cross_module_overflow_safety_negative_test_large_unsanitized_value_overflows (i64::MAX as u64 を直接 cast すると positive overflow、sanitize の必要性裏付け) - cross_module_overflow_safety_negative_test_u64_max_wraps_to_minus_one (u64::MAX as i64 = -1 で silent corruption (過去時刻)、sanitize で防止) 順位 77 (Tier 2, T2-2): - 既存 review_recheck_sanitize_max_safe_boundary テストを year 2100 baseline (now_unix = 4.1e9) でも overflow しないことを assert する形に拡張 - MAX_SAFE_WAIT_SECS 定数 doc に future-proof 根拠を追記 (year 2100 baseline で safety margin が 9 桁残ることを明文化) §A-2 計測ログ P-3 結果記録: - P-3 (PR #127): rate-limit blocked (CR が 27 min wait の rate-limit overlay で formal review 投稿不可)、classifier 未起動、計測 N/A — dogfood 不発。但し CR rate-limit 経路が dogfood の阻害要因として観測 (§A-2 §6 注意事項 #1 を実証)。 テスト 168 active passed (順位 76 系 5 件追加)、regression なし。 deployed exe には影響なし (test only + doc コメント)。
📝 WalkthroughWalkthrough本 PR は、Ollama を活用したローカル LLM オフロード領域の構想から Phase 5 dogfood 検証まで、統合された検証フレームワークを定義します。3 層アーキテクチャの分析、ADR-038 統合状況、測定基準、運用手順、タイムスタンプ安全性の強化検証、および follow-up タスク整理を含みます。 ChangesローカルLLMオフロード検証統合
🎯 2 (Simple) | ⏱️ ~12 分 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/cli-pr-monitor/src/config.rs (1)
600-629: 💤 Low value
cross_module_*という命名は誤誘導 — 実体は sanitize 後の i64 加算 invariant の単体テスト。このテスト群は名前と doc コメントで
finalize_initial_review_park/schedule_next_review_recheck_parkを参照していますが、実際には poll.rs の関数を invoke しておらず、now_unix + cfg.*_wait_secs as i64という算術を config.rs 側で再現しているだけです。poll.rs 側の cast 箇所が将来的にリファクタされても、このテストは検知できません。加えて、
cross_module_overflow_safety_at_max_boundaryは直前のreview_recheck_sanitize_max_safe_boundary(586-598 拡張後) とセットアップ・境界値・加算チェックがほぼ重複しており、唯一の固有資産は「両 park フィールドを個別に assert」「> now_unixで過去巻き戻り防止を assert」の 2 点です。提案 (任意): いずれか一方が望ましい:
- A) 名称を
sanitize_park_arithmetic_invariant_*等の実態に合わせたものに改め、review_recheck_sanitize_max_safe_boundaryと統合 or 後者に> now_unixinvariant を取り込む。- B) 真に cross-module を担保するなら、poll.rs の
finalize_initial_review_park/schedule_next_review_recheck_park由来のヘルパ (cast 部分) を pub(crate) で抽出し、ここからそれを呼ぶ形にする。🤖 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/cli-pr-monitor/src/config.rs` around lines 600 - 629, The test cross_module_overflow_safety_at_max_boundary in config.rs is misnamed and duplicates logic from review_recheck_sanitize_max_safe_boundary while not actually exercising poll.rs (functions finalize_initial_review_park / schedule_next_review_recheck_park); fix by either: A) rename the test to reflect it only validates sanitize-time arithmetic (e.g., sanitize_park_arithmetic_invariant_*) and merge its unique > now_unix assertions into review_recheck_sanitize_max_safe_boundary to remove duplication, or B) make it genuinely cross-module by extracting the cast/arithmetic helper from poll.rs (the code paths used by finalize_initial_review_park and schedule_next_review_recheck_park) as a pub(crate) helper and call that helper from this test so the test exercises the same logic as poll.rs; update test name accordingly and keep/assert both park fields and the > now_unix invariants.
🤖 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/cli-pr-monitor/src/config.rs`:
- Around line 600-629: The test cross_module_overflow_safety_at_max_boundary in
config.rs is misnamed and duplicates logic from
review_recheck_sanitize_max_safe_boundary while not actually exercising poll.rs
(functions finalize_initial_review_park / schedule_next_review_recheck_park);
fix by either: A) rename the test to reflect it only validates sanitize-time
arithmetic (e.g., sanitize_park_arithmetic_invariant_*) and merge its unique >
now_unix assertions into review_recheck_sanitize_max_safe_boundary to remove
duplication, or B) make it genuinely cross-module by extracting the
cast/arithmetic helper from poll.rs (the code paths used by
finalize_initial_review_park and schedule_next_review_recheck_park) as a
pub(crate) helper and call that helper from this test so the test exercises the
same logic as poll.rs; update test name accordingly and keep/assert both park
fields and the > now_unix invariants.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a8c2e540-a313-43f5-b069-2c1f47bd642d
📒 Files selected for processing (4)
docs/local-llm-offload-analysis.mddocs/todo.mddocs/todo5.mdsrc/cli-pr-monitor/src/config.rs
💤 Files with no reviewable changes (2)
- docs/todo.md
- docs/todo5.md
…ailure 明文化 (順位 80+82 / §A-2 P-5) (#129) * feat(cli-pr-monitor): rate-limit Posted 経路で park 予約 (順位 80) + ADR-018 transient failure 明文化 (順位 82) + §A-2 P-4 ledger (§A-2 P-5) §A-2 Phase 5 dogfood P-5 (Bundle f-1 partial)。PR #120 で観測された rate-limit auto-retry の silent exit (RateLimitOutcome::Posted → polling 継続 → max_duration timeout) を構造的に解消。 順位 80 (Tier 1, T1-1) — finalize_posted_retrigger に park 予約を追加: - Before: 投稿後 write_state → None 返し → polling 継続 → timeout で silent exit - After: 投稿後 state.action = parked_review_recheck + next_wakeup_at_unix = now + review_recheck_wait_secs を設定 + format_park_signal で PARK 出力 → Some(park_poll_result) で必ず terminal を返す - handle_rate_limit_branch / dispatch_rate_limit_outcome / finalize_posted_retrigger 各関数に review_recheck_wait_secs 引数を thread - 2 unit tests 追加 (success 経路 + write_state 失敗 action_required 経路) 順位 82 (Tier 3, T3-2) — ADR-018 に追記: - 対象 transient failure pattern を表形式で 4 種列挙 (rate-limit 待機型/即時型 + CR 投稿エラー + wakeup 未予約 fallback) - 順位 80 fix の実装ポイント (Before/After) を明文化 - 順位 81 (CR 投稿エラー) を defer した理由を 3 観測閾値ルールで説明 順位 81 (Bundle f-1 残部、Tier 1 T1-2): - 1 観測のみ (PR #120) で systemic 性未確認のため defer - 同型 error が 2 件以上観測されたら再活性化 (re-trigger 条件を ADR-018 で規定) - 本セッションのユーザー方針 feedback_no_unenforced_rules と整合 §A-2 計測ログ P-4 結果記録: - P-4 (PR #128): 1 finding (CR Nitpick: cross_module_* 命名 misleading) - classifier: action=human_review / confidence=0.9 (P-2 の 0.0 から大幅改善) - normalized_issue: Japanese 50 chars (length contract pass) - latency: 6.6s/件、fallback: 0/1 (P-2 の 1/1 から改善) - agreement: 1/1 (100%、私評価=human_review と一致) 170 active tests pass (新 2 件追加)、regression なし。 build + deploy 済 (.claude/cli-pr-monitor.exe)。 * docs(todo): 順位 80 + 82 (rate-limit park 予約 + ADR-018 update) 完了に伴い削除 + 順位 81 defer 注記
Summary
review_recheck_sanitize_max_safe_boundaryを year 2100 baseline に拡張 +MAX_SAFE_WAIT_SECS定数 doc に future-proof 根拠追記Changes
src/cli-pr-monitor/src/config.rs順位 76: 4 新 cross-module integration tests + 1 negative test:
cross_module_overflow_safety_at_max_boundaryMAX_SAFE_WAIT_SECSがfinalize_initial_review_park/schedule_next_review_recheck_park両 cast point で overflow しないcross_module_overflow_safety_with_zero_input_uses_defaultcross_module_overflow_safety_with_u64_max_input_uses_defaultcross_module_overflow_safety_negative_test_large_unsanitized_value_overflowsi64::MAX as u64を直接 cast すると positive overflow (sanitize の必要性裏付け、PR #115 CR Major #2 再現)cross_module_overflow_safety_negative_test_u64_max_wraps_to_minus_oneu64::MAX as i64 = -1で silent corruption (過去時刻にずれる、sanitize で防止)順位 77: 既存
review_recheck_sanitize_max_safe_boundarytest を year 2100 baseline (now_unix = 4.1e9) で extend:MAX_SAFE_WAIT_SECS定数 doc 追記:docs/local-llm-offload-analysis.md(§A-2 計測ログ)P-3 (PR #127) outcome 記録:
docs/todo.md/docs/todo5.md順位 76 + 77 の row + 詳細エントリを削除 (memory:
feedback_todo_no_history)。別 commit (docs(todo): 順位 76 + 77 ... 完了に伴い削除) で分離。§A-2 dogfood 進捗 (P-1〜P-3 集計)
観察: 3 PR 中 1 PR のみで classifier データ取得 (P-2)。dogfood 阻害要因が複数 (findings ゼロ / review body 抽出漏れ / rate-limit) で、§A-2 設計時の想定 (各 PR で中 3-5 件 findings) と乖離。残り P-4 (本 PR) / P-5 で classifier データ追加取得を試みるが、N=5 PR で agreement rate / latency の統計的有意性は限定的。
Test plan
cargo test -p cli-pr-monitor cross_module_overflow_safety— 5/5 passcargo test -p cli-pr-monitor review_recheck_sanitize_max_safe_boundary— 1/1 pass (extended)cargo test -p cli-pr-monitor— 168 active passed (regression なし)関連
docs/todo5.md詳細エントリ (本 PR で削除)docs/local-llm-offload-analysis.mdSummary by CodeRabbit
Documentation
Tests