feat(pr-monitor): scope_guard を enforce へ昇格 + PR #340 feedback 採用 2 件の todo 登録 - #341
Conversation
- observe 期間 (2026-07-12〜2026-08-01) の実績: post-pr-review 30 回中 fix step 実行 5 回、violation 観測 0 件 = 誤検知ゼロを確認 - pr-monitor-config.toml の [fix.scope_guard] mode を enforce へ変更 (templates は section コメントアウト = 派生 default OFF のため変更不要) - ADR-054 に dogfood 記録を追記 (observe 実績 / 昇格日 / violation 記録が stderr のみで永続化されない観測ギャップ) - harness-improvement-plan.md の WP-11 残作業を「enforce で 3〜5 PR 誤検知ゼロ → 本採用判定」へ更新 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
Changesscope_guard 昇格と文書運用
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
🤖 PR Monitor 分析 (GitHub Actions バックストップ)
Applicable Findings (Critical / High / Major)(該当なし) Applicable Findings (Medium 以下)(該当なし) Filtered (not applicable)(該当なし) 差分概要5 ファイル変更、docs 中心 + 設定変更 1 件:
次のアクション
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
docs/adr/adr-054-prompt-injection-trust-boundary-defense.md (1)
90-94: 🗄️ Data Integrity & Integration | 🔵 Trivial
scope_guardの判断根拠を CI artifact などへ永続化してください。
scope_guard.rsにはviolationをlog_info/ObservedViolationはdecide_violation経路のみで出しますが、ADR-054 と WP-11 は3-5 PR/誤検知ゼロを採否判定に使います。現行だと PR / fix step / mode 単位の実行結果が ephemeral な stderr に留まるため、判定根拠として保存先と retention を明記してください。ADR-054 には
観測ギャップの文言があるため、observed 0を正式根拠にするなら観測ギャップを解消しますも同時に更新します。WP-11 も判定基準・kill-switch は ADR-054 を参照とあるため、永続化方針は ADR-054 へ統一して追加してください。🤖 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 `@docs/adr/adr-054-prompt-injection-trust-boundary-defense.md` around lines 90 - 94, docs/adr/adr-054-prompt-injection-trust-boundary-defense.md の dogfood 記録と「観測ギャップ」を更新し、scope_guard の PR・fix step・mode 別判断結果と violation を CI artifact などへ永続化する保存先、形式、retention、実施方針を明記してください。永続化後に observed 0 を正式な判定根拠として扱う場合は、観測ギャップ解消の記述も更新してください。docs/harness-improvement-plan.md の該当する判定基準・kill-switch 記述は ADR-054 の統一方針を参照する内容に合わせ、直接の重複定義は追加しないでください。
🤖 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 `@docs/todo-summary2.md`:
- Line 115: Clarify the overlapping ADR index work by separating
responsibilities: in docs/todo-summary2.md at lines 115-115, limit rank 272 to
duplicate numbering and identifier consistency, and limit rank 357 to comparing
index status tags with the corresponding ADR body status (or merge both items).
Apply the same separation to the detailed plan and completion criteria in
docs/todo14.md at lines 631-650, including the appropriate scope for each item.
In `@pr-monitor-config.toml`:
- Around line 56-62: execute_repush_flow の ScopeGuardOutcome::BlockedViolation
経路をテストで固定し、mode="enforce" では run_push
が実行されないことを検証してください。併せて、PR_MONITOR_SCOPE_GUARD_DISABLE=1 の kill-switch と
mode="observe" では push が継続されることを確認し、enforce 昇格時の回帰ケースを網羅してください。
---
Nitpick comments:
In `@docs/adr/adr-054-prompt-injection-trust-boundary-defense.md`:
- Around line 90-94: docs/adr/adr-054-prompt-injection-trust-boundary-defense.md
の dogfood 記録と「観測ギャップ」を更新し、scope_guard の PR・fix step・mode 別判断結果と violation を CI
artifact などへ永続化する保存先、形式、retention、実施方針を明記してください。永続化後に observed 0
を正式な判定根拠として扱う場合は、観測ギャップ解消の記述も更新してください。docs/harness-improvement-plan.md
の該当する判定基準・kill-switch 記述は ADR-054 の統一方針を参照する内容に合わせ、直接の重複定義は追加しないでください。
🪄 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 Plus
Run ID: 61881154-d4f7-4cb7-a035-c0edb158655b
📒 Files selected for processing (5)
docs/adr/adr-054-prompt-injection-trust-boundary-defense.mddocs/harness-improvement-plan.mddocs/todo-summary2.mddocs/todo14.mdpr-monitor-config.toml
| | 354 | 💎 Tier 3 | **todo ファイル削除・更新時のチェックリストを dev-conventions.md に追加 (#332 post-merge feedback T3-8 採用)** | todo14.md | XS | なし (PR #332 で todo16.md 複数セクション削除時に lint:md を 3 回以上再実行。段階削除+都度 lint:md+順位番号本文混入注意の checklist 化、専用スクリプト化 (Tier2 様子見) と独立の即応策。順位334 と相補) | | ||
| | 355 | 💎 Tier 3 | **新規スキル作成チェックリストを dev-conventions.md に追加 (#332 post-merge feedback T3-9 採用)** | todo14.md | XS | なし (PR #332 で monthly-review skill 作成時に weekly-review を都度参照する手戻り。SKILL.md/evals.json/trigger_eval.json の 3 点セット + Phase 構成 + deploy 前 sync check を checklist 化) | | ||
| | 356 | 🔧 Tier 2 | **weekly/monthly staleness 判定の共通 fixture parametrized test を追加 (#331 post-merge feedback T2-1 採用)** | todo14.md | S | なし (monthly_review.rs の staleness 判定が weekly_review.rs と逐語重複、片方修正で挙動乖離するリスク。同一 fixture〔threshold 境界/Missing/Stale/Unreadable/未来値/main-root canonical〕で両流路を検証、inline test module に配置) | | ||
| | 357 | 🔧 Tier 2 | **CLAUDE.md の ADR index ステータスタグと ADR 本体の整合チェックを追加 (#340 post-merge feedback T1-1 採用)** | todo14.md | M | なし (ADR-047 の index タグが `試験運用` のまま本体の `却下` と乖離した実害が残存。ADR-007 の 2 層は単一ファイル起点のため独立 doc-consistency チェックとして実装、順位 272 と同居実装候補。着手時に ADR-047 タグ即修正を含む) | |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
順位 272 と順位 357 の重複を解消してください。
両項目が CLAUDE.md の ADR 索引整合を扱うため、実装責務が不明確です。
docs/todo-summary2.md#L115-L115: 順位 272 を重複採番・識別子整合に限定し、順位 357 を index status tag と ADR 本体 status の比較に限定するか、2 項目を統合してください。docs/todo14.md#L631-L650: 同じ責務分離を詳細計画と完了基準へ反映してください。
根拠: docs/todo-summary2.md の順位 272/357 と docs/todo14.md の詳細計画です。
📍 Affects 2 files
docs/todo-summary2.md#L115-L115(this comment)docs/todo14.md#L631-L650
🤖 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 `@docs/todo-summary2.md` at line 115, Clarify the overlapping ADR index work by
separating responsibilities: in docs/todo-summary2.md at lines 115-115, limit
rank 272 to duplicate numbering and identifier consistency, and limit rank 357
to comparing index status tags with the corresponding ADR body status (or merge
both items). Apply the same separation to the detailed plan and completion
criteria in docs/todo14.md at lines 631-650, including the appropriate scope for
each item.
| # bounded lifetime (ADR-054): observe 期間 (2026-07-12〜08-01、fix step 実行 5 回) で誤検知 | ||
| # ゼロを確認し、2026-08-01 に enforce へ昇格。enforce で 3-5 PR 誤検知ゼロなら本採用、 | ||
| # 誤検知頻発なら enabled = false で kill。 | ||
| # 緊急バイパス (kill-switch): 環境変数 PR_MONITOR_SCOPE_GUARD_DISABLE=1 | ||
| [fix.scope_guard] | ||
| enabled = true | ||
| mode = "observe" | ||
| mode = "enforce" |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C4 \
'PR_MONITOR_SCOPE_GUARD_DISABLE|evaluate_scope_guard|BlockedViolation|run_push|scope_guard' \
src/cli-pr-monitor .takt pr-monitor-config.toml || trueRepository: aloekun/claude-code-hook-test
Length of output: 25212
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '--- Cargo features/runners ---\n'
git ls-files 'src/cli-pr-monitor/**' | sed -n '1,120p'
printf '\n--- tests mentions ---\n'
rg -n '#\[test\]|#\[module\]|#\[cfg\(test\)\]|mod tests|fn test_|scope_guard_disabled|observe|BlockedViolation|run_push\(' src/cli-pr-monitor -C 3 || true
printf '\n--- files with test dirs ---'
git ls-files | grep -E '(^|/)(tests?|test|spec)/' | sed -n '1,200p'
printf '\n--- scope_guard key tests ---\n'
sed -n '240,370p' src/cli-pr-monitor/src/stages/scope_guard.rs
sed -n '96,135p' src/cli-pr-monitor/src/stages/repush.rs
sed -n '185,215p' src/cli-pr-monitor/src/stages/scope_guard.rsRepository: aloekun/claude-code-hook-test
Length of output: 258
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- Cargo features/runners ---'
git ls-files 'src/cli-pr-monitor/**' | sed -n '1,160p'
printf '%s\n' ''
printf '%s\n' '--- tests mentions ---'
rg -n -C3 '#\[test\]|#\[module\]|#\[cfg\(test\)\]|mod tests|fn test_|scope_guard_disabled|observe|BlockedViolation|run_push\(' src/cli-pr-monitor || true
printf '%s\n' ''
printf '%s\n' '--- test directories/files ---'
git ls-files | grep -E '(^|/)(tests?|test|spec)/' | sed -n '1,200p' || true
printf '%s\n' ''
printf '%s\n' '--- key source snippets ---'
sed -n '96,135p' src/cli-pr-monitor/src/stages/repush.rs
sed -n '185,245p' src/cli-pr-monitor/src/stages/scope_guard.rs
sed -n '240,368p' src/cli-pr-monitor/src/stages/scope_guard.rsRepository: aloekun/claude-code-hook-test
Length of output: 50386
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- scope_guard relevant tests ---'
rg -n -C 4 '#\[test\]|scope_guard|evaluate_scope_guard|scope_guard_disabled|observe|BlockedViolation|run_push\(' src/cli-pr-monitor/src/stages/scope_guard.rs src/cli-pr-monitor/src/stages/repush.rs pr-monitor-config.toml || true
printf '%s\n' ''
printf '%s\n' '--- scope_guard config fields and parse ---'
sed -n '36,56p' src/cli-pr-monitor/src/stages/scope_guard.rs
rg -n -C 3 'fix\.scope_guard|scope_guard|enabled = true|mode = "enforce"' pr-monitor-config.toml || true
printf '%s\n' ''
printf '%s\n' '--- execute_repush_flow call around scope violation and run_push ---'
sed -n '93,132p' src/cli-pr-monitor/src/stages/repush.rsRepository: aloekun/claude-code-hook-test
Length of output: 42550
scope guard の BlockedViolation 経路を統合的に固定してください。
execute_repush_flow 側では ScopeGuardOutcome::BlockedViolation が run_push 未実行になる構造です。このケースを execute_repush_flow(...) の test に固定し、kill-switch と observe での push 継続も含め、enforce 昇格の回帰網羅を補ってください。
🤖 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 `@pr-monitor-config.toml` around lines 56 - 62, execute_repush_flow の
ScopeGuardOutcome::BlockedViolation 経路をテストで固定し、mode="enforce" では run_push
が実行されないことを検証してください。併せて、PR_MONITOR_SCOPE_GUARD_DISABLE=1 の kill-switch と
mode="observe" では push が継続されることを確認し、enforce 昇格時の回帰ケースを網羅してください。
🤖 PR Monitor 分析 (GitHub Actions バックストップ)
Applicable Findings (Critical / High / Major)(該当なし) Applicable Findings (Medium 以下)
Filtered (not applicable)
次のアクション
|
… 責務分界 - 指摘 2 (BlockedViolation 経路): run_auto_push の判定を decide_auto_push (gate 遅延評価の DI) へ分離し、BlockedViolation → run_push 不到達 + 短絡順序をテスト 4 本で machine-enforce (decide_repush と同型のパターン) - ファイル長 gate (800 行) 超過に伴い auto-push 実行層を stages/auto_push.rs へ module 分割 (run_auto_push / mark_* / should_auto_push + 既存テストを移動、挙動不変) - 指摘 1 (順位 272/357 重複): 両 entry の責務分界を明文化 — 272 = 採番重複/索引存在/番号一致、357 = ステータスタグ整合のみ。summary 行・詳細エントリ・完了基準へ相互参照付きで反映 - 検証: cargo test -p cli-pr-monitor 266 pass / clippy clean / lint:docs / lint:md クリーン Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
[fix.scope_guard]の mode を observe → enforce へ変更 (config 1 行 + section コメントに observe 実績と昇格日を永続記録)Context
Validation
pnpm pushquality gate: lint / test / build / rust-lint-test (clippy + cargo test) 全 PASSpnpm lint:docs(cross-ref / preamble / priority-inversion) /pnpm lint:md: クリーンPR_MONITOR_SCOPE_GUARD_DISABLE=1References
.claude/feedback-reports/340.md(採用 2 件の出典)Summary by CodeRabbit
変更
ドキュメント