From 95d4c7decedab3d32247d2b42cde2ea428e646bb Mon Sep 17 00:00:00 2001 From: aloekun Date: Fri, 22 May 2026 12:42:28 +0900 Subject: [PATCH 1/3] =?UTF-8?q?docs(todo):=20PR=20#168=20post-merge-feedba?= =?UTF-8?q?ck=20=E5=8F=8D=E6=98=A0=20=E2=80=94=20=E9=A0=86=E4=BD=8D=20139?= =?UTF-8?q?=20(ADR-NNN=20Test=20Isolation=20Patterns=20for=20Multi-Conditi?= =?UTF-8?q?on=20Guards)=20=E6=96=B0=E8=A6=8F=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #168 post-merge-feedback の Tier 3 #2 採用結果として、複合 guard test の test isolation pattern を project-level ADR で codify する task を順位 139 として登録。ADR 番号は順位 135 codified placeholder policy に従い land 時 PR で確定する運用 (現状 ADR-NNN placeholder、PR #120 W-001 + PR #168 の 2 PR 横断 Frequency Medium で採用判断)。 --- docs/todo-summary.md | 3 +++ docs/todo8.md | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/docs/todo-summary.md b/docs/todo-summary.md index 06a78769..950b221a 100644 --- a/docs/todo-summary.md +++ b/docs/todo-summary.md @@ -70,6 +70,7 @@ | 134 | 💎 Tier 3 | **ADR-035 に docs-only PR 評価の適用外基準リスト追加 (mutation / error handling / DRY / YAGNI / function length / test coverage / magic-number 等) (PR #156 T3 #2 採用)** | todo8.md | S | なし (Severity Medium = reviewer の criteria 誤適用による unnecessary review overhead / 開発体験劣化、ADR-035 は分類基準のみ定義済で適用外基準が未明示、`feedback_no_unenforced_rules.md` 例外 = ADR への追加で機械強制ではなく reviewer / Claude の judgment 補助) | | 135 | 💎 Tier 3 | **todo entry の ADR 番号 hardcode 撤廃 — 「ADR-NNN (採番未確定、land 時に確定)」placeholder 採用 (順位 78 番号 conflict 2026-05-16 観測由来)** | todo8.md | XS | なし (順位 78 (旧 ADR-038 → ADR-041) で番号 conflict が顕在化、queue 滞留 entry の hardcode が後発 PR の採番と衝突する構造リスクを convention で予防、`~/.claude/rules/common/docs-governance.md` に 2-3 行追記。採番予約簿は管理コスト過剰のため見送り、land 時 PR で空き番号確定の軽量運用に統一) | | 136 | 🚀 Tier 1 | **working copy staleness 検出 hook 2 段構え: SessionStart (jj git fetch + lineage 報告) + PreToolUse (stale 時 docs/todo*.md edit block) — 本セッション cleanup-stale-rank-39 由来** | todo8.md | M | なし (本セッションで実証された「stale parent で docs/todo*.md 読込 → 既削除 entry を再度削除提案」failure mode の structural enforcement。Claude Code Web 並列セッション運用前提下で再発確実。`feedback_no_unenforced_rules.md` 例外 = 2 つの hook で機械強制可能、案 A 予防層 + 案 B 最終 backstop の二段構え、ADR-039 experimental pattern 適用) | +| 139 | 💎 Tier 3 | **ADR-NNN (採番未確定、land 時に確定): Test Isolation Patterns for Multi-Condition Guards (PR #168 T3-#2 採用)** | todo8.md | M | なし (PR #120 W-001 初発見 + PR #168 sentinel pattern 実装の 2 PR 横断で Frequency Medium、`feedback_no_unenforced_rules.md` 例外 = 既存実践の明文化 + project-specific 実装例 (poll.rs) + PR #120 W-001 history codify、順位 84 = code-review.md global checklist の補完 layer、順位 135 codified placeholder 番号 policy 適用) | **戦略**: Tier 1 を 2〜3 セッションで片付け → Tier 2 で ADR-032 の前提 + rate-limit + convergence cost 削減を進める → Tier 3 で ADR-032 を land + ドキュメント整備。Tier 4-5 は cleanup / 外部展開で daily efficiency への直接効果は小さい。 @@ -116,3 +117,5 @@ **Bundle k 補強 (PR #152 post-merge-feedback、D-6 docs-only PR、2026-05-13)**: PR #152 (Phase D D-6 = fix.md instruction-level review-diff refresh + Bundle k 順位 123-127 entry 登録) merge 後の post-merge-feedback で 8 findings 中 4 件採用 (Tier 1 #1 / Tier 2 #1 / Tier 3 #1, #2)。**全 4 件が Bundle k 既存エントリ (順位 123/124/126/127) と完全重複** = post-merge-feedback analyzer 自身が「Bundle k 優先度 X で既に roadmap 済」と明記。新規順位を追加せず、**既存 4 entries (順位 123/124/126/127) に PR #152 を追加観測として追記** (frequency 観測: 3 PR → **4 PR** に更新、Bundle k の優先度 / Sub-PR 分割推奨は不変)。**注**: 順位 126 (ADR-038 hallucinate codify) は Phase E 採用昇格 PR で ADR-038 へフォルドイン land 済 (2026-05-15)、現 table には不在。**含意**: PR #152 (docs-only) でも `.md` への `unused-import` FP が同根 root cause で再現したことが「lint_screen FP は diff 内容ではなく hook source 周辺 context を見て hallucinate している」仮説を 4th observation として裏付け = 順位 123 拡張子フィルター実装の confidence 向上。**様子見** (2 件): PostToolUse hook 自動化 (案 D、Frequency Low) / fix.md 自己参照 ambiguity (1 PR 観測のみ、次回 fix.md 編集機会に opportunistic 適用)。**却下** (2 件): 機械検知不可な `~/.claude/rules/*` 追加 (memory `feedback_no_unenforced_rules.md` 適用)。 **Bundle k 補強 (PR #153 post-merge-feedback、analysis.md 軽量化 PR、2026-05-13)**: PR #153 (D-6 post-merge follow-up + analysis.md 49KB→26KB split) merge 後の post-merge-feedback で 6 findings 中 **2 件採用** (Tier 3 #1, #2)。**T3 #1 = 順位 126 (ADR-038 hallucinate codify、Phase E でフォルドイン land 済) と完全重複** → 順位 126 entry を「**5 PR 連続観測** (#148/#150/#151/#152/#153)」+ root cause / structural fix の明示記載要件追加で更新 → 最終的に Phase E 採用昇格 PR (2026-05-15) で ADR-038 § Known failure modes に migrate。**T3 #2 = 新規採用** → **順位 128 (CLAUDE.md § Cross-File Reference Lifecycle に多ファイル同時削除 retirement condition checklist 追加)** として登録、PR #133 (todo.md 分割) + PR #153 (analysis.md 分割) の successful pattern を明文化。**様子見** (2 件): CLAUDE.md → docs-governance.md cross-link / docs-only PR template の Retired sections list (どちらも Frequency Low)。**却下** (2 件): cross-reference lifecycle 自動 lint rule (NLP 必要) / file role scope exceptions guidance (1 観測のみ、過剰一般化リスク)。**含意**: docs-only PR でも mistral:7b の FP が 5 観測目として再現、Bundle k 順位 126 の優先度を High freq として確定。多ファイル分割の retirement workflow を順位 128 で global rule 化することで、今後の docs/* 50KB 分割 (history.md 等) で同 pattern を mechanical に reproducible 化。 + +**PR #168 post-merge-feedback (Bundle B follow-up、2026-05-21)**: PR #168 (Bundle B = 順位 83 cli-pr-monitor 複合 AND guard test 単独検証 + 順位 84 code-review.md checklist 追記) merge 後の post-merge-feedback で 6 findings 中 **1 件採用** (Tier 3 #2) を 順位 139 として登録。**順位 139 = ADR-NNN (採番未確定): Test Isolation Patterns for Multi-Condition Guards** — PR #120 W-001 初発見 + PR #168 sentinel pattern 実装の **2 PR 横断で Frequency Medium** に達したため、code-review.md global checklist (順位 84 land 済) に加えて project-level ADR で rationale・実装例 (poll.rs `enrich_with_classifier_skips_when_disabled` / `_skips_when_findings_empty`)・PR #120 W-001 history を codify する方針が成立。番号は順位 135 codified placeholder policy に従い `ADR-NNN` で保留、land 時 PR で確定 (ADR-041 は順位 78 で予約中)。**様子見** (1 件): T2 #1 (guard isolation test 用 precondition assert helper macro 抽出、複合 guard test 再登場時に再評価)。**却下** (4 件): T1 #1 (NLP 必要 + L effort lint rule) / T1 #2 (Bundle Z #B-α safe-list exception、Frequency Low + 代替策で十分) / T2 #2 (CI coverage section、Very Low freq + ROI 不見合い) / T3 #1 (`~/.claude/rules/rust.md` rule 追加、`feedback_no_unenforced_rules.md` 適用)。**recovery 含意**: 本 PR の post-merge-feedback は cli-merge-pipeline 経由で起動した workflow が PC crash で abrupt 終了し、ADR-030 §L1 の pre-emptive `.failed` marker (`168.md.failed`) が UserPromptSubmit hook (`hooks-user-prompt-feedback-recovery`) によって次セッションで検出 → `pnpm exec takt -w post-merge-feedback` 直接再起動で aggregation 完了 → manual cleanup (report copy + marker 削除) で復旧。**gap 観測**: 復旧手順 (`168.md.failed` の文書) は takt 再起動コマンドのみ codify されており、`.takt/runs//reports/feedback-report.md` → `.claude/feedback-reports/.md` への copy + marker 削除という artifact relocation step が未文書化。次回類似復旧時の摩擦軽減 follow-up 候補。 diff --git a/docs/todo8.md b/docs/todo8.md index f1fc5903..3dc0df08 100644 --- a/docs/todo8.md +++ b/docs/todo8.md @@ -339,6 +339,46 @@ - `jj git fetch` の timeout が低速 network で頻発した場合の UX → 案 A は fail-open で warning なし pass-through、案 B は fail-closed (lineage 不能 = stale 扱い) で安全側に倒す trade-off - master 判定ロジック: 現状 trunk-based 前提で master を正と扱う。feature branch 運用が始まると assumption が破綻するが、本リポジトリは当面 trunk-based のため問題なし。trunk 名 (master / main) は config 可能にしておく +--- + +### ADR-NNN (採番未確定、land 時に確定): Test Isolation Patterns for Multi-Condition Guards (PR #168 T3-#2 採用) + +> **動機**: PR #120 W-001 で `enrich_with_classifier_skips_when_disabled` テストが OR-guard `if !config.enabled || state.findings.is_empty() { return; }` の責務混在 (vacuous assertion: 空 `classified_findings` → 空 `classified_findings` で早期 return 由来か他経路由来か判別不能) で書かれていた問題、および PR #168 で sentinel pattern + 直交 precondition setup により構造的解決した実装を、project-level ADR として永続化する。`~/.claude/rules/common/code-review.md` (global rule、順位 84 で追加済) の checklist entry を補完する形で、project ADR には rationale・具体実装例 (poll.rs)・PR #120 W-001 history を codify し、将来の複合 guard テスト実装者が独立して参照できるようにする。 +> +> **本タスクの位置づけ**: PR #168 post-merge-feedback Tier 3 #2 採用。`feedback_no_unenforced_rules.md` の例外 = 既存実践 (PR #168 で実装済) の明文化 + project-specific context の補完。Severity Low / **Frequency Medium (PR #120 W-001 初発見 + PR #168 sentinel pattern 実装の 2 PR 横断)** / Effort M / Adoption Risk None。 +> +> **参照**: `.claude/feedback-reports/168.md` Tier 3 #2、`src/cli-pr-monitor/src/stages/poll.rs` (`enrich_with_classifier_skips_when_disabled` / `enrich_with_classifier_skips_when_findings_empty`)、`~/.claude/rules/common/code-review.md` (順位 84 land 済 checklist entry)、PR #120 W-001 / PR #168 history +> +> **実行優先度**: 💎 **Tier 3** — Effort M。新規 ADR 1 件作成 (記述のみ、コード変更なし)。 + +#### ADR 番号 + +順位 135 codified policy (`~/.claude/rules/common/docs-governance.md`) に従い、本 entry では番号を `ADR-NNN (採番未確定)` placeholder とする。**land 時 PR で空き番号を確定**する (現時点既存: ADR-040 まで確定、ADR-041 は順位 78 で「Rust timestamp arithmetic safety」用に予約中)。本 entry が順位 78 より先に land する場合は ADR-041 を本件に割り当て、順位 78 を ADR-042 candidate に振り直す。逆に順位 78 が先に land する場合は本件を ADR-042 候補とする。 + +#### 作業計画 + +- [ ] `docs/adr/adr-NNN-test-isolation-patterns.md` を新規作成 (番号は land 時確定) +- [ ] 内容構成: + - **問題**: PR #120 W-001 の vacuous assertion (検証対象 field が空のまま → 早期 return 由来か他経路由来か判別不能) で OR-guard test の責務混在が顕在化した経緯 + - **設計原則**: sentinel pattern (検証対象 field を pre-populate → survival assert で mutation 不発を明示) + OR-guard precondition assertion (短絡発火条件を test 内で明示し直交性を保証) + - **実装例**: `enrich_with_classifier_skips_when_disabled` (左 arm = `!enabled` 単独) / `enrich_with_classifier_skips_when_findings_empty` (右 arm = `findings.is_empty()` 単独) の 2 variant 抜粋コード + - **適用範囲**: 2+ 条件の OR/AND 早期 return を持つ pure function 系 test (副作用検証は別パターン、本 ADR の scope 外) + - **既存資料との関係**: `~/.claude/rules/common/code-review.md` checklist entry (順位 84 land 済) を project-level rationale + 具体実装例で補完する layer +- [ ] `CLAUDE.md` の ADR リストに 1 行追加 (番号確定時) +- [ ] PR description で `docs/adr/adr-NNN-test-isolation-patterns.md` への link と「sentinel pattern + OR-guard test orthogonality を project codify」要約を明記 + +#### 完了基準 + +- ADR ファイルが新規作成され、PR #120 W-001 history + sentinel pattern + 2 variant 実装例が記述される +- CLAUDE.md の ADR リストに該当 entry が追加される +- 次回複合 guard test を含む PR を書く際の reference として poll.rs の doc comment などから ADR へリンク可能になる + +#### 詰まっている箇所 + +なし。記述のみで実装変更不要。 + +--- + ## 既知課題 (記録のみ、本セッションで未対応) ### post-merge-feedback workflow が長時間 stale marker を残す問題 (PR #119 marker observed 2026-05-15) From 67a514e8ee7a2e0d98a91fd14b7187f9cd326778 Mon Sep 17 00:00:00 2001 From: aloekun Date: Fri, 22 May 2026 14:04:52 +0900 Subject: [PATCH 2/3] =?UTF-8?q?docs(adr):=20ADR-041=20Test=20Isolation=20P?= =?UTF-8?q?atterns=20for=20Multi-Condition=20Guards=20(=E9=A0=86=E4=BD=8D?= =?UTF-8?q?=20139=20land)=20=E2=80=94=20=E9=A0=86=E4=BD=8D=2078=20?= =?UTF-8?q?=E7=95=AA=E5=8F=B7=20placeholder=20=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CLAUDE.md | 1 + docs/adr/adr-041-test-isolation-patterns.md | 137 ++++++++++++++++++++ docs/todo-summary.md | 6 +- docs/todo5.md | 23 ++-- docs/todo8.md | 28 ++-- 5 files changed, 170 insertions(+), 25 deletions(-) create mode 100644 docs/adr/adr-041-test-isolation-patterns.md diff --git a/CLAUDE.md b/CLAUDE.md index bdfcef32..1c818088 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,6 +41,7 @@ - [ADR-038: ローカル LLM による CodeRabbit findings classification](docs/adr/adr-038-local-llm-finding-classification.md) *(試験運用)* - [ADR-039: Experimental feature 標準パターン (config opt-in + kill-switch + bounded lifetime)](docs/adr/adr-039-experimental-feature-standard-pattern.md) *(試験運用)* - [ADR-040: Local LLM Context Size と Resource Trade-off](docs/adr/adr-040-local-llm-context-size.md) *(試験運用)* +- [ADR-041: Test Isolation Patterns for Multi-Condition Guards](docs/adr/adr-041-test-isolation-patterns.md) *(試験運用)* ## Build diff --git a/docs/adr/adr-041-test-isolation-patterns.md b/docs/adr/adr-041-test-isolation-patterns.md new file mode 100644 index 00000000..50397daf --- /dev/null +++ b/docs/adr/adr-041-test-isolation-patterns.md @@ -0,0 +1,137 @@ +# ADR-041: Test Isolation Patterns for Multi-Condition Guards + +## ステータス + +試験運用 (2026-05-22) + +> 本 ADR は `~/.claude/rules/common/code-review.md` checklist (順位 84 land 済) を **project-level rationale + 具体実装例 + history** で補完する layer。global checklist は「複合 AND (OR) の early-return guard を持つ関数のテストは、各条件を独立 variant で検証している (1 guard だけ壊したとき 1 テストだけ落ちる構造)」と要件を 1 行で示すが、本 ADR は PR #120 W-001 の vacuous assertion 失敗事例と、PR #168 で sentinel pattern により構造的に解決した実装例を記録する。 + +## コンテキスト + +`src/cli-pr-monitor/src/stages/poll.rs` の `enrich_with_classifier(state, config)` は OR-guard による早期 return を持つ: + +```rust +fn enrich_with_classifier(state: &mut PrMonitorState, config: &ClassifierConfig) { + if !config.enabled || state.findings.is_empty() { + return; + } + // ... mutate state.classified_findings ... +} +``` + +PR #120 W-001 で初発見された問題: 当初のテスト `enrich_with_classifier_skips_when_disabled` は `enabled = false` + `findings` 空 (= `ClassifierConfig::default()` + `PrMonitorState::new()` の素直な組み合わせ) で `assert!(state.classified_findings.is_empty())` を assert していた。これは **責務混在の vacuous assertion**: + +- 2 つの OR guard が同時発火しても test は pass +- 検証対象 field `classified_findings` を空のまま渡しているため、「早期 return 由来で空のまま」か「mutation 経路を通過したが結果として空」か判別不能 +- 片方の guard を消した mutation テスト (`!config.enabled` だけ削除) を入れても、`findings.is_empty()` が代替発火して test は依然 pass = guard が壊れても落ちない + +同型の責務混在は今後も 2+ 条件の OR/AND 早期 return を持つ pure function 系 test で再発しうるため、PR #168 で実装した sentinel pattern + 直交 precondition setup を project ADR として codify する。 + +## 決定 + +複合 AND/OR の early-return guard を持つ関数のテストは、以下 2 原則を満たす形で実装する。 + +### 原則 1: Sentinel pattern (検証対象 field の pre-populate) + +検証対象 field を test setup 段階で `sentinel` 値で pre-populate し、「mutation 経路を通過した場合は sentinel が上書きされて消える」構造にする。assertion は `assert_eq!(field, vec![sentinel])` (生存確認) で行う。 + +空のまま渡す anti-pattern では、「不変=空」が早期 return 由来か他経路由来か判別不能。sentinel pattern により「早期 return が発火した → mutation が起きなかった → sentinel が survive した」と一意に推論可能になる。 + +### 原則 2: OR-guard precondition assertion (直交 setup) + +`if !A || B { return; }` 形式の OR guard を test する場合、各 variant で **片方の guard だけが発火する直交 precondition** を組む: + +- Variant 1 (左 arm): `A` を偽にする (= `!A` 発火) + `B` を偽にする (= `B` 不発) +- Variant 2 (右 arm): `A` を真にする (= `!A` 不発) + `B` を真にする (= `B` 発火) + +片方が不発になる条件を test 内で **明示的に assert** または **コメント** で記述すると、将来 guard 順序が変わったり追加 guard が増えたりした場合に「test の前提が崩れた」ことを早期検出できる。 + +### 実装例 (poll.rs の `enrich_with_classifier` 2 variants) + +`enrich_with_classifier_skips_when_disabled` (左 arm = `!enabled` 単独発火): + +```rust +#[test] +fn enrich_with_classifier_skips_when_disabled() { + let mut state = PrMonitorState::new(Some(1), Some("o/r".into()), "t".into()); + // 右 arm 不発条件: findings 非空 (= findings.is_empty() guard が偽) + state.findings = vec![Finding { /* ... */ }]; + // sentinel pattern: mutation 経路を通過すれば上書きされて消える + let sentinel = ClassifiedFinding { /* ... */ }; + state.classified_findings = vec![sentinel.clone()]; + // 左 arm 発火条件: enabled = false + let disabled = ClassifierConfig { enabled: false, ..ClassifierConfig::default() }; + + enrich_with_classifier(&mut state, &disabled); + + assert_eq!( + state.classified_findings, + vec![sentinel], + "!config.enabled guard should early return before any mutation" + ); +} +``` + +`enrich_with_classifier_skips_when_findings_empty` (右 arm = `findings.is_empty()` 単独発火): + +```rust +#[test] +fn enrich_with_classifier_skips_when_findings_empty() { + let mut state = PrMonitorState::new(Some(1), Some("o/r".into()), "t".into()); + // 左 arm 不発条件: 明示 assert で precondition を文書化 + 機械検証 + assert!( + state.findings.is_empty(), + "test precondition: findings must be empty so `!enabled` guard stays unfired" + ); + // sentinel pattern (同上) + let sentinel = ClassifiedFinding { /* ... */ }; + state.classified_findings = vec![sentinel.clone()]; + // 右 arm 発火条件: enabled = true (= !enabled 不発) + let enabled = ClassifierConfig { enabled: true, ..ClassifierConfig::default() }; + + enrich_with_classifier(&mut state, &enabled); + + assert_eq!( + state.classified_findings, + vec![sentinel], + "findings.is_empty() guard should early return before any mutation" + ); +} +``` + +注目点: + +- **左 arm test**: `findings` を 1 件で pre-populate して右 arm の発火条件 (`is_empty()`) を偽にする +- **右 arm test**: `PrMonitorState::new()` の自然な初期値 (`findings` 空) を使うが、**precondition assert** で「左 arm が確実に不発になる」ことを test 内で文書化 + 機械検証 +- 両 variant とも `classified_findings` を sentinel で pre-populate し、mutation 不発を survival assert で検出 + +## 帰結 + +### Pros + +- guard 順序が変わっても test は依然有効 (各 variant が独立に短絡 path を検証) +- mutation testing (cargo-mutants 等) で片方の guard を `true` にした mutant が確実に 1 つの test を落とす = test 救命率が上がる +- 将来複合 guard 関数を実装する際の reference として poll.rs テストを直接 cite できる +- `~/.claude/rules/common/code-review.md` checklist (順位 84) を project context (poll.rs 実装 + PR #120 W-001 history) で補完し、checklist 項目の意図が新規実装者に伝わる + +### Cons / リスク + +- test 関数が 1 → 2 に増える (boilerplate 増加) +- sentinel 用 dummy 値 (`ClassifiedFinding` の field を埋める) を毎回作る必要があるため、helper macro / fixture が将来必要になる可能性 (PR #168 post-merge-feedback Tier 2 #1 で「複合 guard test 再登場時に precondition assert helper 抽出を再評価」と 様子見扱い) +- 副作用検証を伴う test (write_state / println / file IO 等) には本 pattern は適用外で、別途副作用観測の test pattern が必要 (本 ADR の scope 外) + +### 適用範囲 + +- ✅ **対象**: 2+ 条件の OR/AND 早期 return を持つ pure function 系 test (返り値または引数 mutation で結果を観測するもの) +- ❌ **対象外**: 副作用 (file IO / network / println) で結果を観測する test、単一 guard の test (1 条件のみの場合は vacuous 化リスクが本質的に存在しない) + +### 既存資料との関係 + +- `~/.claude/rules/common/code-review.md` checklist (順位 84 land 済): global rule として「複合 guard の独立 variant 検証」要件を 1 行で codify。本 ADR は project-level の rationale + 実装例 + history で補完する layer +- PR #120 W-001 (cli-pr-monitor `enrich_with_classifier` 初期テスト): 本 ADR の動機事例 +- PR #168 (順位 83 = sentinel pattern + 直交 precondition 実装): 本 ADR の reference 実装 +- `src/cli-pr-monitor/src/stages/poll.rs` (`enrich_with_classifier_skips_when_disabled` / `_skips_when_findings_empty`): canonical 実装例 (関数 doc-comment から本 ADR へリンク可能) + +## 改訂履歴 + +- 2026-05-22: 初版 (順位 139 採用 PR で land、PR #120 W-001 + PR #168 の 2 PR 横断観測ベース) diff --git a/docs/todo-summary.md b/docs/todo-summary.md index 950b221a..89bba9b2 100644 --- a/docs/todo-summary.md +++ b/docs/todo-summary.md @@ -45,7 +45,7 @@ | 57 | 🔧 Tier 2 | **Aggregation cap integration test (PR #105 T2-1 採用)** | todo7.md | S | なし (`collect_all_violations` の MAX_VIOLATIONS contract を test 化、将来の lint 追加時に `truncate(MAX)` 削除 regression を防止する explicit 安全網) | | 60 | 💎 Tier 3 | **analyze-session の transcript filter 絞り込み (旧 #A-3)** | todo7.md | M | なし (旧 docs/pipeline-token-efficiency.md #A-3、ADR-036/037 化に伴い計画書削除、本 task のみ todo に移管。analyze-session の input range を PR 作成 commit〜merge に限定して input token 30-50% 削減見込み、dogfood で実測必要) | | 61 | 🔧 Tier 2 | **post-PR 検証フローに CR review.body 手動スキャン step 追加 (PR #108 T2-1 採用)** | todo7.md | XS | なし (PR #108 で analyze-coderabbit が review body の outside diff range comment を検出漏れし line 371/378 の修正が後追い、blind spot の暫定緩和策として手動 checklist を整備) | -| 78 | 💎 Tier 3 | **ADR-041 (Rust timestamp arithmetic safety) + CLAUDE.md security 拡充 (PR #115 T3-1 採用) ★ Bb-3 follow-up** | todo5.md | S | なし (config が user-editable system boundary のとき `sanitize()` 値域検証を必須化し dependent arithmetic に `// SAFETY: により上限保証` コメントを要求するパターンを ADR + CLAUDE.md に codify、Rust 固有の checked_add + MAX_SAFE capping + time-dependent test の 3 層を明文化。2026-05-16 に entry 登録時の旧予約番号 ADR-038 が Local LLM finding classification で占有済と判明し ADR-041 に振り直し) | +| 78 | 💎 Tier 3 | **ADR-NNN (採番未確定、land 時に確定): Rust timestamp arithmetic safety + CLAUDE.md security 拡充 (PR #115 T3-1 採用) ★ Bb-3 follow-up** | todo5.md | S | なし (config が user-editable system boundary のとき `sanitize()` 値域検証を必須化し dependent arithmetic に `// SAFETY: により上限保証` コメントを要求するパターンを ADR + CLAUDE.md に codify、Rust 固有の checked_add + MAX_SAFE capping + time-dependent test の 3 層を明文化。2026-05-16 entry 登録時の旧予約 ADR-038 → ADR-041 振り直し → 順位 139 (PR #168 follow-up) ADR-041 取得に伴い 2026-05-22 再 placeholder 化、land 時 PR で空き番号確定 — 順位 135 codified placeholder policy の実例運用) | | 79 | 💎 Tier 3 | **`docs-governance.md` § Retirement Workflow に「残タスクの lifecycle 整合」要件明記 (PR #117 T3-1 採用)** | todo5.md | XS | なし (PR #117 で順位 15 を Bb-3 で吸収済として削除した際、現 Step 2「残タスクを priority table に登録」が priority table から除外するケース = 完了/deprioritize/defer を未定義だった実証。除外時の commit/PR で 3 値のいずれかを明示する要件を追加して将来の同型 ambiguity を構造的に防ぐ) | | 81 | 🚀 Tier 1 | **cli-pr-monitor: CR 投稿エラー (`Failed to post review comments`) auto-retry 拡張 (PR #120 T1-2 採用) ★ Bundle f (defer)** | todo5.md | M | 1 観測のみで systemic 性未確認 (§A-2 P-5 PR で defer 判断、ADR-018 §追記 2026-05-08 で re-trigger 条件 = 2 件以上の同型観測を規定) | | 91 | 🔧 Tier 2 | **`[lint_screen]` config parse テスト (PR #132 T2-#4 採用) ★ Bundle i** | todo6.md | S | なし (PR #132 で追加した push-runner-config.toml の `[lint_screen]` section に対する toml::from_str テスト、CodeRabbit nitpick 起点、silent field rename 防止) | @@ -70,7 +70,7 @@ | 134 | 💎 Tier 3 | **ADR-035 に docs-only PR 評価の適用外基準リスト追加 (mutation / error handling / DRY / YAGNI / function length / test coverage / magic-number 等) (PR #156 T3 #2 採用)** | todo8.md | S | なし (Severity Medium = reviewer の criteria 誤適用による unnecessary review overhead / 開発体験劣化、ADR-035 は分類基準のみ定義済で適用外基準が未明示、`feedback_no_unenforced_rules.md` 例外 = ADR への追加で機械強制ではなく reviewer / Claude の judgment 補助) | | 135 | 💎 Tier 3 | **todo entry の ADR 番号 hardcode 撤廃 — 「ADR-NNN (採番未確定、land 時に確定)」placeholder 採用 (順位 78 番号 conflict 2026-05-16 観測由来)** | todo8.md | XS | なし (順位 78 (旧 ADR-038 → ADR-041) で番号 conflict が顕在化、queue 滞留 entry の hardcode が後発 PR の採番と衝突する構造リスクを convention で予防、`~/.claude/rules/common/docs-governance.md` に 2-3 行追記。採番予約簿は管理コスト過剰のため見送り、land 時 PR で空き番号確定の軽量運用に統一) | | 136 | 🚀 Tier 1 | **working copy staleness 検出 hook 2 段構え: SessionStart (jj git fetch + lineage 報告) + PreToolUse (stale 時 docs/todo*.md edit block) — 本セッション cleanup-stale-rank-39 由来** | todo8.md | M | なし (本セッションで実証された「stale parent で docs/todo*.md 読込 → 既削除 entry を再度削除提案」failure mode の structural enforcement。Claude Code Web 並列セッション運用前提下で再発確実。`feedback_no_unenforced_rules.md` 例外 = 2 つの hook で機械強制可能、案 A 予防層 + 案 B 最終 backstop の二段構え、ADR-039 experimental pattern 適用) | -| 139 | 💎 Tier 3 | **ADR-NNN (採番未確定、land 時に確定): Test Isolation Patterns for Multi-Condition Guards (PR #168 T3-#2 採用)** | todo8.md | M | なし (PR #120 W-001 初発見 + PR #168 sentinel pattern 実装の 2 PR 横断で Frequency Medium、`feedback_no_unenforced_rules.md` 例外 = 既存実践の明文化 + project-specific 実装例 (poll.rs) + PR #120 W-001 history codify、順位 84 = code-review.md global checklist の補完 layer、順位 135 codified placeholder 番号 policy 適用) | +| 139 | 💎 Tier 3 | **ADR-041: Test Isolation Patterns for Multi-Condition Guards (PR #168 T3-#2 採用) — 本 PR で land** | todo8.md | M | なし (PR #120 W-001 初発見 + PR #168 sentinel pattern 実装の 2 PR 横断で Frequency Medium、`feedback_no_unenforced_rules.md` 例外 = 既存実践の明文化 + project-specific 実装例 (poll.rs) + PR #120 W-001 history codify、順位 84 = code-review.md global checklist の補完 layer、順位 135 codified placeholder 番号 policy 適用 — 当初 ADR-NNN placeholder で entry 登録 → land 時 PR で ADR-041 確定取得、順位 78 を ADR-NNN に再 placeholder 化) | **戦略**: Tier 1 を 2〜3 セッションで片付け → Tier 2 で ADR-032 の前提 + rate-limit + convergence cost 削減を進める → Tier 3 で ADR-032 を land + ドキュメント整備。Tier 4-5 は cleanup / 外部展開で daily efficiency への直接効果は小さい。 @@ -118,4 +118,4 @@ **Bundle k 補強 (PR #153 post-merge-feedback、analysis.md 軽量化 PR、2026-05-13)**: PR #153 (D-6 post-merge follow-up + analysis.md 49KB→26KB split) merge 後の post-merge-feedback で 6 findings 中 **2 件採用** (Tier 3 #1, #2)。**T3 #1 = 順位 126 (ADR-038 hallucinate codify、Phase E でフォルドイン land 済) と完全重複** → 順位 126 entry を「**5 PR 連続観測** (#148/#150/#151/#152/#153)」+ root cause / structural fix の明示記載要件追加で更新 → 最終的に Phase E 採用昇格 PR (2026-05-15) で ADR-038 § Known failure modes に migrate。**T3 #2 = 新規採用** → **順位 128 (CLAUDE.md § Cross-File Reference Lifecycle に多ファイル同時削除 retirement condition checklist 追加)** として登録、PR #133 (todo.md 分割) + PR #153 (analysis.md 分割) の successful pattern を明文化。**様子見** (2 件): CLAUDE.md → docs-governance.md cross-link / docs-only PR template の Retired sections list (どちらも Frequency Low)。**却下** (2 件): cross-reference lifecycle 自動 lint rule (NLP 必要) / file role scope exceptions guidance (1 観測のみ、過剰一般化リスク)。**含意**: docs-only PR でも mistral:7b の FP が 5 観測目として再現、Bundle k 順位 126 の優先度を High freq として確定。多ファイル分割の retirement workflow を順位 128 で global rule 化することで、今後の docs/* 50KB 分割 (history.md 等) で同 pattern を mechanical に reproducible 化。 -**PR #168 post-merge-feedback (Bundle B follow-up、2026-05-21)**: PR #168 (Bundle B = 順位 83 cli-pr-monitor 複合 AND guard test 単独検証 + 順位 84 code-review.md checklist 追記) merge 後の post-merge-feedback で 6 findings 中 **1 件採用** (Tier 3 #2) を 順位 139 として登録。**順位 139 = ADR-NNN (採番未確定): Test Isolation Patterns for Multi-Condition Guards** — PR #120 W-001 初発見 + PR #168 sentinel pattern 実装の **2 PR 横断で Frequency Medium** に達したため、code-review.md global checklist (順位 84 land 済) に加えて project-level ADR で rationale・実装例 (poll.rs `enrich_with_classifier_skips_when_disabled` / `_skips_when_findings_empty`)・PR #120 W-001 history を codify する方針が成立。番号は順位 135 codified placeholder policy に従い `ADR-NNN` で保留、land 時 PR で確定 (ADR-041 は順位 78 で予約中)。**様子見** (1 件): T2 #1 (guard isolation test 用 precondition assert helper macro 抽出、複合 guard test 再登場時に再評価)。**却下** (4 件): T1 #1 (NLP 必要 + L effort lint rule) / T1 #2 (Bundle Z #B-α safe-list exception、Frequency Low + 代替策で十分) / T2 #2 (CI coverage section、Very Low freq + ROI 不見合い) / T3 #1 (`~/.claude/rules/rust.md` rule 追加、`feedback_no_unenforced_rules.md` 適用)。**recovery 含意**: 本 PR の post-merge-feedback は cli-merge-pipeline 経由で起動した workflow が PC crash で abrupt 終了し、ADR-030 §L1 の pre-emptive `.failed` marker (`168.md.failed`) が UserPromptSubmit hook (`hooks-user-prompt-feedback-recovery`) によって次セッションで検出 → `pnpm exec takt -w post-merge-feedback` 直接再起動で aggregation 完了 → manual cleanup (report copy + marker 削除) で復旧。**gap 観測**: 復旧手順 (`168.md.failed` の文書) は takt 再起動コマンドのみ codify されており、`.takt/runs//reports/feedback-report.md` → `.claude/feedback-reports/.md` への copy + marker 削除という artifact relocation step が未文書化。次回類似復旧時の摩擦軽減 follow-up 候補。 +**PR #168 post-merge-feedback (Bundle B follow-up、2026-05-21)**: PR #168 (Bundle B = 順位 83 cli-pr-monitor 複合 AND guard test 単独検証 + 順位 84 code-review.md checklist 追記) merge 後の post-merge-feedback で 6 findings 中 **1 件採用** (Tier 3 #2) を 順位 139 として登録。**順位 139 = ADR-041: Test Isolation Patterns for Multi-Condition Guards** — PR #120 W-001 初発見 + PR #168 sentinel pattern 実装の **2 PR 横断で Frequency Medium** に達したため、code-review.md global checklist (順位 84 land 済) に加えて project-level ADR で rationale・実装例 (poll.rs `enrich_with_classifier_skips_when_disabled` / `_skips_when_findings_empty`)・PR #120 W-001 history を codify する方針が成立。番号は順位 135 codified placeholder policy に従い当初 `ADR-NNN` で entry 登録 → **本 PR (順位 139 land) で `ADR-041` 確定取得**、順位 78 (旧 ADR-041 予約) を再 placeholder 化。**様子見** (1 件): T2 #1 (guard isolation test 用 precondition assert helper macro 抽出、複合 guard test 再登場時に再評価)。**却下** (4 件): T1 #1 (NLP 必要 + L effort lint rule) / T1 #2 (Bundle Z #B-α safe-list exception、Frequency Low + 代替策で十分) / T2 #2 (CI coverage section、Very Low freq + ROI 不見合い) / T3 #1 (`~/.claude/rules/rust.md` rule 追加、`feedback_no_unenforced_rules.md` 適用)。**recovery 含意**: 本 PR の post-merge-feedback は cli-merge-pipeline 経由で起動した workflow が PC crash で abrupt 終了し、ADR-030 §L1 の pre-emptive `.failed` marker (`168.md.failed`) が UserPromptSubmit hook (`hooks-user-prompt-feedback-recovery`) によって次セッションで検出 → `pnpm exec takt -w post-merge-feedback` 直接再起動で aggregation 完了 → manual cleanup (report copy + marker 削除) で復旧。**gap 観測**: 復旧手順 (`168.md.failed` の文書) は takt 再起動コマンドのみ codify されており、`.takt/runs//reports/feedback-report.md` → `.claude/feedback-reports/.md` への copy + marker 削除という artifact relocation step が未文書化。次回類似復旧時の摩擦軽減 follow-up 候補。 diff --git a/docs/todo5.md b/docs/todo5.md index e731c9aa..e4f2f8f6 100644 --- a/docs/todo5.md +++ b/docs/todo5.md @@ -10,7 +10,14 @@ ## 現在進行中 -### ADR-041 (Rust timestamp arithmetic safety) + CLAUDE.md security 拡充 (PR #115 T3-1 採用) ★ Bb-3 follow-up +### ADR-NNN (採番未確定、land 時に確定): Rust timestamp arithmetic safety + CLAUDE.md security 拡充 (PR #115 T3-1 採用) ★ Bb-3 follow-up + + > **動機**: PR #115 で「config が user-editable system boundary のとき、sanitize() で値域検証 + 下流 arithmetic で安全範囲保証」というパターンが実証された (CR Major #1 + #2 が両方とも同型の「config 値→arithmetic 入力」cross-layer integrity 問題)。同型の bug class は今後も Rust + config 駆動の component で発生しうるため、組織的 learning として codify。 > @@ -22,7 +29,7 @@ #### 設計決定 (案) -- **ADR-041 (新規)**: `docs/adr/adr-041-timestamp-arithmetic-safety.md` を作成 +- **ADR-NNN (新規)**: `docs/adr/adr-NNN-timestamp-arithmetic-safety.md` を作成 (番号は land 時 PR で確定) - **タイトル**: Rust timestamp arithmetic の overflow safety pattern - **Context**: PR #115 で sanitize() が `i64::MAX as u64` を valid として通したが downstream の `now_unix + wait as i64` で overflow した CR Major #2 を引用 - **Decision**: 以下 3 層で overflow を構造的に防ぐ @@ -31,12 +38,12 @@ 3. **Test layer**: `now + sanitize 後の値 < i64::MAX` invariant を `checked_add` で machine-enforce (順位 76/77 で実装) - **Consequences**: cross-module overflow を test layer で構造的に検知。`MAX_SAFE_WAIT_SECS` の根拠が future-proof (2100 年でも safe) - **CLAUDE.md `security.md` (`~/.claude/rules/common/security.md`) 拡充**: 「config は user-editable system boundary、必ず sanitize() で値域検証」+ 「Rust の `as` cast は overflow check しない、`checked_add` を併用」を追加。global rule なので全 Rust project に適用される -- **本 PR の効果**: ADR + CLAUDE.md で codified 後、将来同型 bug が発生したら「ADR-041 違反」として一発で指摘可能 +- **本 PR の効果**: ADR + CLAUDE.md で codified 後、将来同型 bug が発生したら「本 ADR (採番後の実番号) 違反」として一発で指摘可能 #### 作業計画 -- [ ] `docs/adr/adr-041-timestamp-arithmetic-safety.md` を新規作成 (Context / Decision / Consequences) -- [ ] CLAUDE.md (project) Architecture Decisions リストに ADR-041 を追加 +- [ ] `docs/adr/adr-NNN-timestamp-arithmetic-safety.md` を新規作成 (Context / Decision / Consequences、番号は land 時 PR で確定) +- [ ] CLAUDE.md (project) Architecture Decisions リストに該当 ADR を追加 - [ ] `~/.claude/rules/common/security.md` に「config sanitize + Rust arithmetic safety」セクション追加 - [ ] (任意) `~/.claude/rules/rust/coding-style.md` に `// SAFETY:` コメント pattern を補足 - [ ] 順位 76/77 が land 済の前提で「Test layer で検証する」を ADR で言及 (前後関係を明示) @@ -45,13 +52,13 @@ #### 完了基準 -- ADR-041 が land し、CLAUDE.md からリンクされる +- 該当 ADR (land 時 PR で番号確定) が land し、CLAUDE.md からリンクされる - `~/.claude/rules/common/security.md` に Rust arithmetic safety pattern が追加される -- 将来「config 値が arithmetic で overflow」という形の bug が出たら、ADR-041 を引用して一発で指摘できる +- 将来「config 値が arithmetic で overflow」という形の bug が出たら、本 ADR (採番後の実番号) を引用して一発で指摘できる #### 詰まっている箇所 -- 順位 76/77 land 前後の順番: ADR で test layer に言及するため、test 実装が先のほうが自然。ただし ADR を先 land して「test を ADR-041 に従って実装する」流れも可能。実装時に ROI で判断 (test PR と ADR PR を分けるか、まとめるか) +- 順位 76/77 land 前後の順番: ADR で test layer に言及するため、test 実装が先のほうが自然。ただし ADR を先 land して「test を本 ADR (採番後の実番号) に従って実装する」流れも可能。実装時に ROI で判断 (test PR と ADR PR を分けるか、まとめるか) - `~/.claude/` 配下の global rule 編集は本 repo 外への影響あり、慎重に (memory `feedback_no_unenforced_rules.md` 「強制力のないルール追加は却下」原則を踏まえる必要あり = 機械検知できないルールは却下されうる)。本 task は ADR + 既存 rule 拡充で「機械検知の根拠」を提供する形なので OK だが、CLAUDE.md security.md の追記内容が「ルールだけ増やす」と評価されないよう、順位 76/77 の test との連携を明示する --- diff --git a/docs/todo8.md b/docs/todo8.md index 3dc0df08..2bc6ed4d 100644 --- a/docs/todo8.md +++ b/docs/todo8.md @@ -237,11 +237,11 @@ ### todo entry の ADR 番号 hardcode 撤廃 — 「ADR-NNN (採番未確定、land 時に確定)」placeholder 採用 (順位 78 番号 conflict 2026-05-16 観測由来) -> **動機**: 順位 78 (旧 ADR-038 Rust timestamp arithmetic safety、PR #115 T3-1) は entry 登録時 (2026 年序盤) に新規 ADR として ADR-038 を予約のつもりで hardcode していたが、queue 滞留中に Bundle Z 系列の連続採用で `ADR-037 / 038 / 039 / 040` がすべて占有され、2026-05-16 セッションで番号 conflict が顕在化。順位 78 は ADR-041 への振り直しで個別対応済だが、queue 深度と滞留期間の積に比例して同型 conflict が再発する構造リスクが残る。 +> **動機**: 順位 78 (旧 ADR-038 Rust timestamp arithmetic safety、PR #115 T3-1) は entry 登録時 (2026 年序盤) に新規 ADR として ADR-038 を予約のつもりで hardcode していたが、queue 滞留中に Bundle Z 系列の連続採用で `ADR-037 / 038 / 039 / 040` がすべて占有され、2026-05-16 セッションで番号 conflict が顕在化 (ADR-041 へ振り直し)。さらに 2026-05-22 に順位 139 (PR #168 follow-up) が ADR-041 を取得したため順位 78 を再 placeholder 化 = **同一 entry が 3 回 (038 → 041 → NNN) 番号変更を経た実証ベース**で、queue 深度と滞留期間の積に比例して同型 conflict が再発する構造リスクを convention で予防する必要がある。 > > **本タスクの位置づけ**: 順位 78 振り直し対応の **再発防止 convention**。採番予約簿 (`docs/adr/RESERVED.md` 等) は管理コストが過剰なため見送り、entry 登録時は placeholder で済ませて land 時の PR で空き番号を確定する運用に統一する (作業着手時に採番するだけの軽量運用、ユーザー判断 2026-05-16)。 > -> **参照**: 順位 78 entry ([docs/todo5.md](todo5.md) § ADR-041 Rust timestamp arithmetic safety + CLAUDE.md security 拡充)、`~/.claude/rules/common/docs-governance.md` +> **参照**: 順位 78 entry ([docs/todo5.md](todo5.md) § ADR-NNN Rust timestamp arithmetic safety + CLAUDE.md security 拡充)、`~/.claude/rules/common/docs-governance.md` > > **実行優先度**: 💎 **Tier 3** — Effort XS。global rule に 2-3 行追記。 @@ -341,7 +341,7 @@ --- -### ADR-NNN (採番未確定、land 時に確定): Test Isolation Patterns for Multi-Condition Guards (PR #168 T3-#2 採用) +### ADR-041: Test Isolation Patterns for Multi-Condition Guards (PR #168 T3-#2 採用) — 本 PR で land > **動機**: PR #120 W-001 で `enrich_with_classifier_skips_when_disabled` テストが OR-guard `if !config.enabled || state.findings.is_empty() { return; }` の責務混在 (vacuous assertion: 空 `classified_findings` → 空 `classified_findings` で早期 return 由来か他経路由来か判別不能) で書かれていた問題、および PR #168 で sentinel pattern + 直交 precondition setup により構造的解決した実装を、project-level ADR として永続化する。`~/.claude/rules/common/code-review.md` (global rule、順位 84 で追加済) の checklist entry を補完する形で、project ADR には rationale・具体実装例 (poll.rs)・PR #120 W-001 history を codify し、将来の複合 guard テスト実装者が独立して参照できるようにする。 > @@ -351,27 +351,27 @@ > > **実行優先度**: 💎 **Tier 3** — Effort M。新規 ADR 1 件作成 (記述のみ、コード変更なし)。 -#### ADR 番号 +#### ADR 番号 (本 PR で確定) -順位 135 codified policy (`~/.claude/rules/common/docs-governance.md`) に従い、本 entry では番号を `ADR-NNN (採番未確定)` placeholder とする。**land 時 PR で空き番号を確定**する (現時点既存: ADR-040 まで確定、ADR-041 は順位 78 で「Rust timestamp arithmetic safety」用に予約中)。本 entry が順位 78 より先に land する場合は ADR-041 を本件に割り当て、順位 78 を ADR-042 candidate に振り直す。逆に順位 78 が先に land する場合は本件を ADR-042 候補とする。 +順位 135 codified policy (`~/.claude/rules/common/docs-governance.md`) に従い、本 entry は当初 `ADR-NNN (採番未確定)` placeholder で登録した。**本 PR で `ADR-041` を本件に確定取得**し、順位 78 (旧 ADR-041 予約 = Rust timestamp arithmetic safety) を `ADR-NNN` に再 placeholder 化した (順位 78 は今後 land 時 PR で空き番号を取得する運用)。本 entry は本 PR land 後に post-merge-feedback サイクルで削除される予定 (memory: feedback_todo_no_history)。 -#### 作業計画 +#### 作業計画 (本 PR で完了) -- [ ] `docs/adr/adr-NNN-test-isolation-patterns.md` を新規作成 (番号は land 時確定) -- [ ] 内容構成: +- [x] `docs/adr/adr-041-test-isolation-patterns.md` を新規作成 +- [x] 内容構成: - **問題**: PR #120 W-001 の vacuous assertion (検証対象 field が空のまま → 早期 return 由来か他経路由来か判別不能) で OR-guard test の責務混在が顕在化した経緯 - **設計原則**: sentinel pattern (検証対象 field を pre-populate → survival assert で mutation 不発を明示) + OR-guard precondition assertion (短絡発火条件を test 内で明示し直交性を保証) - **実装例**: `enrich_with_classifier_skips_when_disabled` (左 arm = `!enabled` 単独) / `enrich_with_classifier_skips_when_findings_empty` (右 arm = `findings.is_empty()` 単独) の 2 variant 抜粋コード - **適用範囲**: 2+ 条件の OR/AND 早期 return を持つ pure function 系 test (副作用検証は別パターン、本 ADR の scope 外) - **既存資料との関係**: `~/.claude/rules/common/code-review.md` checklist entry (順位 84 land 済) を project-level rationale + 具体実装例で補完する layer -- [ ] `CLAUDE.md` の ADR リストに 1 行追加 (番号確定時) -- [ ] PR description で `docs/adr/adr-NNN-test-isolation-patterns.md` への link と「sentinel pattern + OR-guard test orthogonality を project codify」要約を明記 +- [x] `CLAUDE.md` の ADR リストに 1 行追加 +- [ ] PR description で `docs/adr/adr-041-test-isolation-patterns.md` への link と「sentinel pattern + OR-guard test orthogonality を project codify」要約を明記 (PR 作成時) -#### 完了基準 +#### 完了基準 (本 PR で達成) -- ADR ファイルが新規作成され、PR #120 W-001 history + sentinel pattern + 2 variant 実装例が記述される -- CLAUDE.md の ADR リストに該当 entry が追加される -- 次回複合 guard test を含む PR を書く際の reference として poll.rs の doc comment などから ADR へリンク可能になる +- ADR-041 ファイルが新規作成され、PR #120 W-001 history + sentinel pattern + 2 variant 実装例が記述される ✅ +- CLAUDE.md の ADR リストに ADR-041 entry が追加される ✅ +- 次回複合 guard test を含む PR を書く際の reference として poll.rs の doc comment などから ADR-041 へリンク可能になる ✅ #### 詰まっている箇所 From 35b610944c16fe9af4cdf1e44b3002df53038166 Mon Sep 17 00:00:00 2001 From: aloekun Date: Fri, 22 May 2026 14:59:42 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix(docs):=20CR=20finding=20=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=20=E2=80=94=20=E9=A0=86=E4=BD=8D=20139=20=E4=BD=9C?= =?UTF-8?q?=E6=A5=AD=E8=A8=88=E7=94=BB=20checklist=20=E6=95=B4=E5=90=88=20?= =?UTF-8?q?(PR=20description=20link/=E8=A6=81=E7=B4=84=20=E5=AE=8C?= =?UTF-8?q?=E4=BA=86=E3=83=9E=E3=83=BC=E3=82=AF)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/todo8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/todo8.md b/docs/todo8.md index 2bc6ed4d..4f15f00d 100644 --- a/docs/todo8.md +++ b/docs/todo8.md @@ -365,7 +365,7 @@ - **適用範囲**: 2+ 条件の OR/AND 早期 return を持つ pure function 系 test (副作用検証は別パターン、本 ADR の scope 外) - **既存資料との関係**: `~/.claude/rules/common/code-review.md` checklist entry (順位 84 land 済) を project-level rationale + 具体実装例で補完する layer - [x] `CLAUDE.md` の ADR リストに 1 行追加 -- [ ] PR description で `docs/adr/adr-041-test-isolation-patterns.md` への link と「sentinel pattern + OR-guard test orthogonality を project codify」要約を明記 (PR 作成時) +- [x] PR description で `docs/adr/adr-041-test-isolation-patterns.md` への link と「sentinel pattern + OR-guard test orthogonality を project codify」要約を明記 (PR #169 description に反映済 = "Summary" / "Background" / "Files changed" 3 箇所で言及) #### 完了基準 (本 PR で達成)