diff --git a/docs/local-llm-offload-analysis.md b/docs/local-llm-offload-analysis.md index e76013a..9393e0f 100644 --- a/docs/local-llm-offload-analysis.md +++ b/docs/local-llm-offload-analysis.md @@ -189,14 +189,25 @@ PR #120 の dogfood で post-pr-monitor の wakeup state 遷移と auto-retry pa 詳細エントリは [docs/todo5.md](todo5.md) 末尾。Bundle f land は本 doc の retirement に必須ではない。本セッション 1 回限りの観測で頻度が未確定のため、**優先度は再観測を経て判断**する (新規フィードバックは頻度が確認できるまで優先しない方針)。 +#### 2026-05-07: §8.C land (PR #121) — ADR-038 textual fix + Bundle f task registration + +- **§8.C 実施**: ADR-038 line 61 の `confidence=0.0` → `action_confidence=0.0` に統一 (実装 schema 名称との整合) +- **Bundle f 登録**: 順位 80-84 を `docs/todo.md` priority table + `docs/todo5.md` 詳細エントリに記録 (頻度確認後に優先度判断する方針を明記) +- **PR #121**: docs-only PR → CR 「No actionable comments」 → squash merge `6640dc7b` (2026-05-07T04:47:56Z、master) +- **post-merge-feedback (PR #121)** で Bundle g (順位 85-88) を新規追加: `(review_state, findings) → verdict` 評価ロジックの edge case を 3 PR (#119/#120/#121) 連続観測で頻度確認 → Tier 1 妥当性確定。詳細は [docs/todo5.md](todo5.md) 順位 85-88、bundle commentary は [docs/todo.md](todo.md) Bundle g 段落 + ### 効果実測の現状 -未測定。次回 Claude Code session で: +**未測定** (PR #120 で統合は完了したが、`ClassifierConfig::default().enabled = false` のため classifier は実 review サイクルで一度も起動していない)。 + +計測計画は **§8.A-2 (Phase 5 dogfood 計測)** に集約。P-0 (config opt-in) → P-1〜P-5 (5 PR dogfood) の流れで以下を計測予定: -1. cli-finding-classifier を post-pr-review フローに統合した後の token 消費を比較 -2. CodeRabbit triage タスクが Claude を経由しなくなった分の体感計測 +1. classifier の classification 妥当性 (agreement rate) +2. Claude session の入力 token 削減効果 +3. classifier latency / fallback rate +4. `normalized_issue` 言語制約違反率 (§8.D 着手判断材料) -統合 (Phase 5) 完了までは「効果見込み 15-25%」は推定値のまま。 +dogfood 完了までは「効果見込み 15-25%」は推定値のまま。 ## 8. 次の作業候補 (Phase 5 + 残作業) @@ -212,13 +223,206 @@ PR #120 の dogfood で post-pr-monitor の wakeup state 遷移と auto-retry pa `from_llm_output` で `normalized_issue` の改行・80 chars 超を検出して fallback。`NORMALIZED_ISSUE_MAX_CHARS=80` const 化。回帰テスト 3 件追加。 -### C. Finding D: ADR-038 line 61 textual fix (low priority) +### C. ✅ Finding D: ADR-038 line 61 textual fix (LANDED in PR #121, 2026-05-07) -- **目的**: ADR-038 line 61 の `confidence=0.0` を `action_confidence=0.0` に統一 (実装の schema 名称と整合) -- **作業**: 1 単語修正 -- **依存**: なし -- **見積**: 5 分 (他の Phase 5 PR に bundle 可) -- **ROI**: ★ (永続 doc の整合は重要だが単独 PR を立てるほどではない) +ADR-038 line 61 の `confidence=0.0` を `action_confidence=0.0` に修正、実装の `ClassifiedFinding.action_confidence` schema 名称と整合。同 PR で Bundle f task registration (順位 80-84) も land。詳細は §7 実装進捗ログ参照。 + +### A-2. ★ Phase 5 dogfood 計測 (E/F 着手前の必須前提) + +> **状態**: **未着手** (本計画は 2026-05-07 セッションで策定、別セッションで実施想定) +> +> **位置づけ**: §8.A (Phase 5 統合) は完了したが、ADR-038 §試験運用→本採用の昇格条件のうち **条件 1 (5 PR 以上 dogfood)** と **条件 3 (token 削減効果体感)** は未達。§8.E (lint screen facet) の「実効果見極め後」依存を満たすため、本計画で実 dogfood を行う。 + +#### 目的 + +ADR-038 試験運用 → 本採用の **未達 2 条件** を充足: + +1. **条件 1**: 5 PR 以上の実 review サイクルで dogfood、classification 妥当性目視確認 +2. **条件 3**: Claude session の入力 token 削減効果が体感で確認できる + +#### 構成: P-0 (前提セットアップ) + 5 PR + +##### P-0: classifier opt-in (config 1 行変更、独立 PR) + +**変更内容**: `pr-monitor-config.toml` に classifier section を追加 (現状ファイルに section 不在の場合は新規追記、存在する場合は `enabled = true` に変更) + +```toml +[classifier] +enabled = true +# 以下は default 値、明示しなくてもよいが、config の意図を残すなら明示推奨 +model = "mistral:7b" +endpoint = "http://localhost:11434" +timeout_secs = 30 +``` + +**確認方法**: + +```bash +grep -A5 "^\[classifier\]" pr-monitor-config.toml +``` + +**意義**: P-0 land 後、後続 5 PR で `cli-pr-monitor` の poll stage が自動的に `cli-finding-classifier.exe` を invoke する。 + +##### P-1〜P-5: dogfood 本体 (頻度確認済 Tier 1 を優先、findings 多様性確保) + +| PR | タスク | 順位 | Effort | 期待 findings | 選定理由 | +|---|---|---|---|---|---| +| P-1 | Bundle g-1 (monitor state guard + test) | 85 + 86 | S+S | 中 (3-5 件) | 頻度確認済 Tier 1 (3 PR 観測)、ユーザー方針 (頻度確認後優先) と整合、Rust 実装層 | +| P-2 | `> vs >=` boundary inconsistency lint rule | 47 | S | 中 (3-5 件) | Tier 1、独立、Rust + lint rule (異種 PR で多様性) | +| P-3 | PowerShell `(?i)` フラグ自動検証 lint rule | 7 | S | 中 (3-5 件) | Tier 1、独立、別言語 lint で多様性 | +| P-4 | overflow 統合テスト + 境界値 matrix (Bb-3) | 76 + 77 | M+S | 中 (3-5 件) | Tier 2、Rust test 集中、test カバレッジ系の findings | +| P-5 | Bundle f-1 (retry logic + ADR) | 80+81+82 | M+M+S | 高 (5-10 件) | P-1〜P-4 中の dogfood で順位 80 が再観測されれば頻度確認達成、最終 PR で大規模 finding 負荷確認 | + +**Bundle g-2** (順位 87+88、global rule codify、XS+XS) は docs-only で classifier dogfood 対象外。Phase 5 dogfood と並列で別 PR (例: P-2.5 として挟む) に land 可。 + +#### Setup 手順 (別セッション開始時の確認チェックリスト) + +```bash +# 1. Ollama 起動確認 +curl -s http://localhost:11434/api/tags | jq '.models | map({name, size})' +# 期待: mistral:7b が含まれる + +# 2. classifier exe deploy 確認 +ls -la .claude/cli-finding-classifier.exe +# 期待: ファイル存在、~2.2MB + +# 3. config opt-in 確認 +grep -A5 "^\[classifier\]" pr-monitor-config.toml +# 期待: enabled = true + +# 4. 過去 dogfood 実行 (PR #119) 動作確認 +echo '[{"severity":"Major","file":"f.rs","line":"1","issue":"test","suggestion":"fix","source":"CodeRabbit"}]' | \ + .claude/cli-finding-classifier.exe --timeout-secs 30 +# 期待: action / action_confidence / normalized_issue を含む JSON +``` + +#### 計測手順 (各 PR で実施) + +**1. classifier 出力の取得** (post-pr-monitor 実行後): + +```bash +jq '.classified_findings // []' .claude/pr-monitor-state.json +``` + +各 finding は以下の field を持つ: + +```json +{ + "severity": "Major", + "file": "src/...", + "line": "42", + "issue": "...", + "suggestion": "...", + "source": "CodeRabbit", + "action": "auto_fix | human_review | false_positive_likely | informational", + "action_confidence": 0.0-1.0, + "normalized_issue": "..." | null, + "fallback_reason": "..." | null +} +``` + +**2. classification 妥当性 (agreement rate) 評価**: + +各 finding に対して、私 (Claude) が action/confidence を独立評価し一致率を測定。記録形式: + +```text +P-1: 4/5 agreement (80%)、disagree 1 件は <理由> +``` + +**3. session token 集計**: + +Claude Code 側で session statistics を `/cost` 等で取得可能なら、各 PR session 開始 → merge までの input token を記録。比較対象は本セッションの PR #119/#120/#121 (classifier OFF)。 + +**4. classifier latency**: + +`cli-pr-monitor` の log で「classifier: N findings を分類完了」の前後で経過秒数を測定。本 doc §1 dogfood 実測 (PR #119) では **3.6s/件**。 + +**5. fallback rate**: + +```bash +jq '[.classified_findings[] | select(.fallback_reason != null)] | length' .claude/pr-monitor-state.json +# / +jq '.classified_findings | length' .claude/pr-monitor-state.json +``` + +**6. `normalized_issue` 言語制約違反率** (§8.D 着手判断材料): + +```bash +jq '[.classified_findings[] | select(.normalized_issue) | .normalized_issue | test("[a-zA-Z]{8,}"))]' .claude/pr-monitor-state.json +``` + +英単語が 8 文字以上連続する箇所を検知 (簡易ベンチ、誤検出許容)。 + +#### 判定基準 + +各 PR 完了後に追記、5 PR 終了で集計。本採用昇格条件への対応: + +| 指標 | 目標 | ADR-038 昇格条件 | +|---|---|---| +| **agreement rate** | ≥80% (action 一致) | 条件 1 (5 PR dogfood + 妥当性確認) | +| **session token 削減** | ≥10% (見込み 15-25%) | 条件 3 (体感確認) | +| **classifier latency** | ≤5s/件 | (補助指標、運用許容ライン) | +| **fallback rate** | ≤20% | (Ollama 安定性、運用許容ライン) | +| **言語制約違反率** | ≤10% | §8.D 着手判断 (>10% なら D 先行) | + +#### 既知の注意事項 (本セッションで観測した dogfood 阻害要因) + +1. **CR rate-limit 再発リスク**: 本セッション PR #120 / #121 で観測 (1 hour あたり commits 制限)。5 PR 連続作成は無料枠を圧迫。Bundle g-2 (XS docs) を間に挟む等で stretch すれば緩和。`comment_created_at` から 41 分待つと clear +2. **post-pr-monitor wakeup edge case** (Bundle f #80 / Bundle g #85): 本 dogfood 中に再観測された場合、Bundle f / g の頻度カウントを進める副次目的にもなる。手動 `@coderabbitai review` 投入や CronCreate 手動予約で迂回可 +3. **Ollama 不安定**: 落ちた場合 fallback で human_review に倒れて block しないが計測 noise になる。各 PR 着手前に `curl /api/tags` で確認推奨 +4. **Windows shell の CP932 漏れ**: 日本語 finding が含まれる場合、cli-pr-monitor → classifier の subprocess は Rust 実装で UTF-8 安全 (PR #119 で検証済)。bash 経由のデバッグでは `--data-binary @file.json` 形式必須 (§6 注意点参照) +5. **takt 600s timeout**: 本セッション PR #120 で observed、auto-fix iteration 中に timeout。dogfood 中に再観測される可能性あり、その場合 takt の fix step が不完全終了するため `state.classified_findings` の最終形を確認 + +#### session 跨ぎ運用ガイド + +**dogfood 中断・再開時**: +- `pr-monitor-config.toml` の `[classifier] enabled` 状態は repo に commit されているため再 clone でも引き継がれる +- 各 PR 完了後に `state.classified_findings` を export してテキスト保存しておくと session 跨ぎでも参照可: + ```bash + jq '.classified_findings' .claude/pr-monitor-state.json > .takt/dogfood-pr-NNN-classified.json + ``` +- 計測 log は本 doc の §A-2.x に追記して history 化 (例: §A-2.measurements として後続セッションで埋める) + +**dogfood 完了 → 本採用判断時**: +- §7 § 効果実測の現状 を「測定済」に更新 (具体値を記載) +- ADR-038 §試験運用→本採用の昇格条件 1 / 3 を達成した旨を ADR 本体に追記 (試験運用 flag を外す) +- §8.A-2 を「✅ LANDED」にマーク、§8.E (lint screen facet) の依存条件解除 + +**dogfood 完了 → 却下判断時** (基準未達): +- agreement rate <80% → §8.D (prompt v2) 先行で再 dogfood +- session token 削減 <10% → 提案 1 / 3 の ROI 再評価、本 doc retirement の引退条件「却下」経路を検討 +- 却下時は ADR-038 を **「却下」ステータス** に更新、`lib-ollama-client` / `cli-finding-classifier` 両 crate の削除可否判断 + +#### 完了基準 + +- [ ] P-0 land (config opt-in) +- [ ] P-1〜P-5 land (5 PR で classifier 実起動経験) +- [ ] 各 PR で `state.classified_findings` を保存 +- [ ] 5 PR 集計で agreement rate / token / latency / fallback / 言語制約違反率 を本 §A-2 内に記録 +- [ ] 判定基準 4/5 以上達成 → §7 効果実測の現状を「測定済」に更新、ADR-038 昇格条件 1/3 達成を明記 +- [ ] §8.A-2 を ✅ LANDED にマーク、§8.E の dependency 解除 + +#### 計測ログ (実施時に追記) + +(別セッションで P-0 着手時、各 PR 完了ごとに以下を埋める) + +```text +P-0 (config opt-in): PR #___, merged ___ +P-1 (Bundle g-1): PR #___, merged ___, findings: __, agreement: __/__, token Δ: __, latency: __s/件, fallback: __/__ +P-2 (順位 47): PR #___, merged ___, findings: __, agreement: __/__, token Δ: __, latency: __s/件, fallback: __/__ +P-3 (順位 7): PR #___, merged ___, findings: __, agreement: __/__, token Δ: __, latency: __s/件, fallback: __/__ +P-4 (順位 76+77): PR #___, merged ___, findings: __, agreement: __/__, token Δ: __, latency: __s/件, fallback: __/__ +P-5 (Bundle f-1): PR #___, merged ___, findings: __, agreement: __/__, token Δ: __, latency: __s/件, fallback: __/__ + +集計: +- 総 findings: __ +- 総 agreement rate: __/__ = __% +- 平均 session token Δ: __% +- 平均 classifier latency: __s/件 +- 総 fallback rate: __/__ = __% +- 言語制約違反率: __/__ = __% +- 判定: ✅ 本採用 / 🔄 §8.D 先行 / ❌ 却下 +``` ### D. プロンプト v2: `normalized_issue` 言語制約強化 (low priority) @@ -228,12 +432,12 @@ PR #120 の dogfood で post-pr-monitor の wakeup state 遷移と auto-retry pa - **見積**: 半日 (prompt 変更 + 簡易ベンチで安定性検証) - **ROI**: ★ (実害は小、UX 微改善) -### E. 提案 1 (lint screen facet) — 実効果見極め後 +### E. 提案 1 (lint screen facet) — §8.A-2 dogfood 完了後 - **目的**: takt の新 facet `ollama-lint-screen` で pre-push 時に diff の lint 一次フィルタを mistral:7b に逃す -- **依存**: Phase 5 で classifier の実効果が確認できた後 +- **依存**: **§8.A-2 (Phase 5 dogfood 計測) 完了 + 判定基準達成** (agreement rate ≥80% かつ session token 削減 ≥10%) - **見積**: 1〜2 日 -- **ROI**: 提案 1 として中程度。Phase 5 の効果次第で優先度が変動 +- **ROI**: 提案 1 として中程度。§8.A-2 の集計結果次第で優先度が変動 (基準未達なら §8.D prompt v2 先行 → 再 dogfood の経路あり) ### F. 提案 3 (PR body draft) — 提案 1 採用後 diff --git a/docs/todo.md b/docs/todo.md index b89c1dc..34217fa 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -74,6 +74,10 @@ | 82 | 💎 Tier 3 | **ADR-018 update: rate-limit 以外の transient failure auto-retry 設計の明文化 (PR #120 T3-2 採用) ★ Bundle f** | todo5.md | S | 順位 80 / 81 と同 PR (実装と仕様の整合確保、Bundle f) | | 83 | 🔧 Tier 2 | **cli-pr-monitor: 複合 AND guard の各条件を独立テストで検証 (PR #120 T2-1 採用)** | todo5.md | S | なし (PR #120 W-001、`enrich_with_classifier_skips_when_disabled` の test setup で複合条件分離不全) | | 84 | 💎 Tier 3 | **グローバルルール: code-review.md に「early-return guard テスト分離」チェックリスト追記 (PR #120 T3-1 採用)** | todo5.md | XS | なし (順位 83 の知見を global rule に codify、`~/.claude/rules/common/code-review.md`、独立並列実施可) | +| 85 | 🚀 Tier 1 | **cli-pr-monitor: monitor state machine guard 強化 (`review_state: not_found && findings: []` を pending 据置) (PR #121 T1-1 採用) ★ Bundle g** | todo5.md | S | なし (PR #119/#120/#121 で 3 PR 連続観測、Frequency Medium 閾値到達済み、Severity High = 誤 approved リスク、Bundle f #80 と関連だが verdict logic 側) | +| 86 | 🔧 Tier 2 | **cli-pr-monitor: state transition test の網羅追加 (順位 85 の回帰テスト) (PR #121 T2-4 採用) ★ Bundle g** | todo5.md | S | 順位 85 と同 PR (Bundle g、`(review_state, findings) → verdict` transition matrix を表形式テストで定義、`src/cli-pr-monitor/tests/` 新規作成) | +| 87 | 💎 Tier 3 | **グローバルルール: Multi-PR chaining ベストプラクティスを codify (PR #121 T3-7 採用)** | todo5.md | XS | なし (PR #119→#120→#121 連鎖の dogfood 知見を `~/.claude/rules/common/git-workflow.md` に codify、独立並列実施可、順位 88 と同 PR で land 推奨) | +| 88 | 💎 Tier 3 | **グローバルルール: edge case 観測頻度 3 = Tier 1 昇格基準を codify (PR #121 T3-8 採用)** | todo5.md | XS | なし (post-merge-feedback workflow の暗黙ルール明文化 + ユーザー方針との収束、`~/.claude/rules/common/development-workflow.md` 等、順位 87 と同 PR で land 推奨) | **戦略**: Tier 1 を 2〜3 セッションで片付け → Tier 2 で ADR-032 の前提 + rate-limit + convergence cost 削減を進める → Tier 3 で ADR-032 を land + ドキュメント整備。Tier 4-5 は cleanup / 外部展開で daily efficiency への直接効果は小さい。 @@ -97,6 +101,8 @@ **PR #101 (Bundle a Sub-PR 1) post-merge-feedback 反映 (2026-05-03)**: 9 件の finding を頻度評価 (過去 report 横断 + 同一 PR latent 件数) して **3 件を採用**。**順位 47 (`>` vs `>=` boundary lint)** は同一ファイル内 3 関数 (parse_listed_findings / parse_new_comments / parse_findings) で同 drift が実証済 = latent 高頻度。**順位 48 (関数長 oxlint)** は #96 / #101 で繰り返し言及 = explicit 高頻度。両者とも Bundle Z #B-α と同じ「決定論的防止層」哲学で、Bundle Z Phase 1 (Rust comment lint) の land 後に並列 deploy 可能。**順位 49 (error-path test infra)** は #99 / #101 で同型 silent fallback anti-pattern が再発、Bundle a Sub-PR 2 (順位 42 / 43 / 46) と **同一 PR で land** 推奨 (cli-pr-monitor の mock infrastructure を再利用、test 二重投資なし)。残り 6 件 (Tier 1 #1, #3, #5、Tier 2 #2、Tier 3 #1, #2) は session 1 回限りの low-frequency events として不採用。 +**Bundle g (PR #121 post-merge-feedback、monitor verdict logic + session pattern codify、2026-05-07)**: PR #121 (ADR-038 textual fix + Bundle f registration) の dogfood で post-pr-monitor の **verdict 評価ロジック** に edge case を再観測 (PR #119/#120/#121 で計 3 PR 連続)。**4 件採用** (Tier 1 #85、Tier 2 #86、Tier 3 #87/#88) で **2 軸対策**: (1) **monitor verdict guard 層** = 順位 85 (`review_state: not_found && findings: []` を pending 据置) + 順位 86 (state transition matrix の表形式テスト)、(2) **session pattern codify 層** = 順位 87 (Multi-PR chaining ベストプラクティス) + 順位 88 (edge case 3 観測 = Tier 1 昇格基準)。**Sub-PR 分割推奨**: g-1 (順位 85 + 86、Rust 実装 + test、Effort S+S、`src/cli-pr-monitor/tests/` 新規作成) / g-2 (順位 87 + 88、global rule 追記、Effort XS+XS、独立並列可)。**Bundle f との関係**: Bundle f は retry logic (rate-limit + 投稿エラー)、Bundle g は verdict logic (review_state 評価) で別軸。両者を land すると post-pr-monitor の robustness が retry/verdict/state 全方向で堅牢化。**頻度評価**: 順位 85 は 3 PR 観測済で Tier 1 妥当性確認済、順位 86 は 85 の dependent、順位 87/88 は global rule 追記で副作用最小なので並列実施可。 + **Bundle f (PR #120 post-merge-feedback、cli-pr-monitor robustness、2026-05-07)**: PR #120 (ADR-038 Phase 5: cli-finding-classifier 統合) の dogfood で post-pr-monitor の wakeup state 遷移に複数の edge case を観測。**5 件採用** (Tier 1 #80/#81、Tier 3 #82、Tier 2 #83、Tier 3 #84) で **3 層対策**: (1) 実装層 = 順位 80 / 81 (rate-limit + CR 投稿エラーの auto-retry path 整理) + 順位 82 (ADR-018 設計明文化、同 PR 推奨)、(2) test 層 = 順位 83 (複合 guard の独立 variant test)、(3) ガイド層 = 順位 84 (code-review.md checklist 追記、独立並列可)。**Sub-PR 分割推奨**: f-1 (順位 80 + 81 + 82、cli-pr-monitor + ADR、Effort M+M+S、Bundle f コア) / f-2 (順位 83、test 拡充、Effort S、独立) / f-3 (順位 84、global rule、Effort XS、独立)。Bundle f はローカル LLM dogfood (ADR-038) の副産物として cli-pr-monitor の堅牢化を進める位置づけで、`docs/local-llm-offload-analysis.md` §7 (実装進捗ログ) に dogfood signal として記録。 **Bundle c (PR #109 post-merge-feedback 堅牢化、2026-05-04)**: PR #109 で post-merge-feedback workflow が SIGPIPE で silent 中断され `.failed` marker 未生成という ADR-030 仕様違反が実証された。5 件採用 (Tier 1 #63/#64/#65 + Tier 3 #66/#67) で **3 層防御** を構築: (1) 事前防止 = 順位 65 (exe + `--help` を PreToolUse block) + 順位 66 (グローバルルールの subprocess pipe truncate 禁止)、(2) in-process recovery = 順位 63 (Drop guard / signal trap で abrupt 終了時の `.failed` marker 保証)、(3) out-of-process backstop = 順位 64 (`meta.json status=running` 5-15 分放置 reaper)。順位 67 (ADR-030 spec 拡張) は実装と同 PR で仕様/実装の整合性確保。**Sub-PR 分割推奨**: c-1 (順位 63 + 64 + 67、Rust 実装 + ADR、Effort M+M+XS、コア層) / c-2 (順位 65 + 66、hook + global rule、Effort S+XS、trigger 防止層)。c-1 と c-2 は独立に land 可能だが c-1 land 後の dogfood で recovery 機構を実証してから c-2 を入れると順位の合理性が見える順序になる。 diff --git a/docs/todo5.md b/docs/todo5.md index e66243c..73aca62 100644 --- a/docs/todo5.md +++ b/docs/todo5.md @@ -927,3 +927,91 @@ - code-review.md にチェックリスト項目が追加される - 次回複合 guard を持つ関数を含む PR でレビュー時に参照可能になる +--- + +### cli-pr-monitor: monitor state machine guard 強化 (`review_state: not_found && findings: []` を pending 据置) (PR #121 T1-1 採用) ★ Bundle g + +> **動機**: PR #119 / #120 / #121 で **3 PR 連続観測**: `review_state: "not_found"` (CR 未投稿) + `findings: []` のとき、monitor が "no findings = approved" と同一視して誤 approved 判定を出す。CodeRabbit review が後から到着しても見逃される潜在 risk。Frequency Medium 閾値到達済み (`.claude/feedback-reports/121.md` Tier 1 #1)。 +> +> **参照**: PR #119 round 3 / PR #120 multiple wakeups / PR #121 multiple wakeups の dogfood 観測、`.claude/feedback-reports/121.md` Tier 1 #1 +> +> **実行優先度**: 🚀 **Tier 1** — Severity High (誤 approved リスク)、Effort S (state machine に条件分岐追加)、Adoption Risk なし (additive guard)。Bundle f #80 と関連するが別側面 (Bundle f は retry logic、本件は verdict logic)。 + +#### 作業計画 + +- [ ] `cli-pr-monitor/src/stages/monitor.rs` (or 関連 verdict 評価箇所) に `(review_state == "not_found", findings.is_empty())` を pending 据置にするガードを追加 +- [ ] 順位 86 と同 PR で land (回帰テスト同時整備) + +#### 完了基準 + +- `review_state: "not_found" + findings: []` のケースで verdict が "approved" にならず "pending" 据置になる +- 順位 86 の state transition test で本動作が machine-enforce される + +--- + +### cli-pr-monitor: state transition test の網羅追加 (順位 85 の回帰テスト) (PR #121 T2-4 採用) ★ Bundle g + +> **動機**: 順位 85 の修正に対する regression 防止網。`(review_state, findings) → verdict` の transition matrix を表形式で定義。現状 `src/cli-pr-monitor/tests/` が 0 件なので新規作成。 +> +> **参照**: `.claude/feedback-reports/121.md` Tier 2 #4 +> +> **実行優先度**: 🔧 **Tier 2** — Severity Medium、Effort S、Frequency Medium (monitor edge case は複数 PR で再観測)。 + +#### 作業計画 + +- [ ] `src/cli-pr-monitor/tests/pr_monitor_state_test.rs` を新規作成 +- [ ] `(not_found, empty)` / `(not_found, populated)` / `(success, empty)` / `(success, populated)` 等の transition matrix を表形式テストで定義 +- [ ] 順位 85 と同 PR で land + +#### 完了基準 + +- transition matrix 全 cell に対する verdict の expected/actual が assertion で検証される +- 順位 85 のガード追加が test の 1 cell で fix されることを確認 + +--- + +### グローバルルール: Multi-PR chaining ベストプラクティスを codify (PR #121 T3-7 採用) + +> **動機**: PR #119 (init) → #120 (integrate) → #121 (organize) の 3 連鎖が dogfood で有効に機能。「各 PR は論理的ユニット (init/integrate/organize) を担当し、diff サイズは 250–800 lines を推奨」を再利用可能なガイドラインとして codify。 +> +> **参照**: PR #119 / #120 / #121 セッション、`.claude/feedback-reports/121.md` Tier 3 #7 +> +> **実行優先度**: 💎 **Tier 3** — Effort XS、Frequency Medium (3 PR で実証)、Adoption Risk なし。 + +#### 作業計画 + +- [ ] `~/.claude/rules/common/git-workflow.md` の PR Workflow セクションに 3-5 行追記: + - 「複数 PR 連鎖時は init / integrate / organize 等の論理ユニットで分割」 + - 「1 PR あたり diff size 目安: 250-800 lines」 + - 「(参照) PR #119/#120/#121 で実証された 3 連鎖パターン」 +- [ ] 順位 88 と同 PR で land 可能 (どちらも XS、独立性高) + +#### 完了基準 + +- git-workflow.md にガイドラインが記載される +- 次回複数 PR 連鎖時にレビュー基準として参照可能になる + +--- + +### グローバルルール: edge case 観測頻度 3 = Tier 1 昇格基準を codify (PR #121 T3-8 採用) + +> **動機**: post-merge-feedback workflow が暗黙的に適用している「同じ edge case が 3 PR 観測されたら Tier 1 に昇格」基準を明文化。ユーザーが直前で示した「新規フィードバックは頻度が確認できるまで優先しない」方針と同根、両者の収束で frequency 判定の再現性が向上。 +> +> **参照**: 本セッション (PR #119/#120/#121) で発生した Bundle f #80 の 3 観測昇格判定、`.claude/feedback-reports/121.md` Tier 3 #8 +> +> **実行優先度**: 💎 **Tier 3** — Effort XS、Frequency Medium (繰り返し適用される暗黙ルール)、Adoption Risk なし。 + +#### 作業計画 + +- [ ] `~/.claude/rules/common/development-workflow.md` または `docs-governance.md` 等に 3-5 行追記: + - 「edge case が 3 観測に達したらタスクを Tier 1 に昇格して優先実装」 + - 「観測カウントは feedback report で `Frequency Medium 閾値到達` と明示」 + - (参照) Bundle f 順位 80 の昇格事例 +- [ ] 順位 87 と同 PR で land 可能 + +#### 完了基準 + +- 該当 rule に頻度閾値が明記される +- 次回 post-merge-feedback workflow が報告した「Frequency Medium 到達」が rule 側から逆引き可能になる + +