diff --git a/docs/claude-code-web-tasks.md b/docs/claude-code-web-tasks.md index 28694008..4661a28d 100644 --- a/docs/claude-code-web-tasks.md +++ b/docs/claude-code-web-tasks.md @@ -151,7 +151,6 @@ close は「この成果物は採らない」という判断であって、「 | 383 | T2 | — | `is_separator_row` にパイプ検証 guard を追加し、bare `---` がセパレータ行として通らないことの回帰テストを足す | `src/lib-ledger/src/lib.rs` | S | **欠陥は 2026-08-07 に実コードで確認済み**(`is_table_row` は行頭 `\|` を要求するが `is_separator_row` は `split_cells` の結果しか見ない)。対処は guard 1 つとテスト。ADR-072 決定 2 の fail-closed の coverage hole。**2026-08-23 auto → human へ変更**: 成果物 `src/lib-ledger/src/lib.rs` が [ADR-072](adr/adr-072-nightly-todo-loop.md) 決定 6 の Guard 禁止パス `src/lib-ledger/` に当たり、夜間ループでは実装しても push が拒否される([ADR-074](adr/adr-074-auto-lane-screening-criteria.md) 決定 2 クラス 3)。2026-08-20 の run 87837551740 で実際に `[NIGHTLY_DENY]` 停止した。機械検査は順位 486 | fix(ledger): is_separator_row のパイプ検証欠落を塞ぐ | | 162 | T2 | — | fail-closed error path(`Option::None`)の個別テストを追加(`check_todo_staleness` / `build_todo_staleness_message` の None ケース独立検証) | `src/hooks-pre-tool-validate/src/todo_staleness.rs` | S | PR #177 の `behind.unwrap_or(0)` fail-closed 漏れ修正の回帰テスト。純関数。**2026-08-23 auto → human へ変更**: 本ファイル [§ 対象外](#対象外web-では完了不能--残価値枯渇) が本順位を「着手前に『残りは 1 件のみ』である点をユーザーに確認」と記録しており、`✅` と矛盾していた (PR #441 CodeRabbit 指摘)。対象外側の記述は 2026-08-23 の実測で 3 点とも裏が取れた — (a) `behind.is_none_or(...)` の fix は適用済み (todo_staleness.rs:136,189)、(b) `build_todo_staleness_message` の None ケースは 3 テストで既存、(c) 残るのは `check_todo_staleness` の early-return 以降で、同関数は DI 口を持たないため DI refactor が要る。着手前のユーザー確認と DI refactor の要否判断は [ADR-074](adr/adr-074-auto-lane-screening-criteria.md) 決定 2 クラス 5 に当たるため human lane とする。**2026-08-23 宣言パス修正**: 旧記載 `main.rs` は漂流していた — 対象 2 関数 `check_todo_staleness` / `build_todo_staleness_message` は `todo_staleness.rs` にあり `main.rs` には 1 度も現れない (module 分割で移動したまま台帳が追随していなかった)。2026-08-23 の dry_run で `[LEDGER_CLEANUP_BLOCK]` により実際に停止した。順位 176 / 145 と同型 | test(pre-tool-validate): fail-closed の None ケースをテストで固定する | | 199 | T2 | ✅ | multi-byte 文字を含む string window test を標準 coverage requirement 化(境界テストの追加) | `src/cli-docs-lint/src/priority_inversion.rs` | S | 既存の `RESOLUTION_WINDOW_CHARS` は文字数基準。multi-byte で境界が崩れないことを固定する | test(docs-lint): multi-byte 文字を含む window の境界をテストで固定する | -| 193 | T2 | ✅ | Companion helper group の署名整合を compile-time で検証するテスト(関数ポインタ cast による witness)を追加 | `src/cli-pr-monitor/src/fix_commit/sweep.rs`(`mod tests` 内の companion helper group) | S | **2026-08-17 パス修正**: 旧記載の `fix_commit.rs` は module 分割で消滅。実体は `fix_commit/sweep.rs`(`count_empty_in_pr_range` 等)。signature drift を test 不通過にする構造 | test(pr-monitor): companion helper の署名整合を compile-time で固定する | | 143 | T2 | — | 複言語 fixture helper(日本語 / emoji / combining chars の 3 関数)を標準化して string-processing の境界テストを書きやすくする | `src/hooks-post-tool-linter/src/main.rs` | S | helper の追加のみ。既存テストの書き換えは範囲外。**2026-08-23 auto → human へ変更**: 宣言先 `main.rs` は 73 行の起点のみでテスト 0 件、string 処理のテストは `utf8_integrity.rs` 等の別モジュールにある (漂流)。ただし「複数モジュールが使う共有 fixture helper をどこに置くか」は台帳から一意に決まらず ([ADR-074](adr/adr-074-auto-lane-screening-criteria.md) 決定 2 クラス 5)、パスの機械的な差し替えでは塞げないため人間が実装先を決める | test(post-tool-linter): 複言語 fixture helper を標準化する | | 356 | T2 | ✅ | weekly / monthly staleness 判定の共通 fixture を parametrized test 化する | `src/hooks-session-start/src/monthly_review.rs` | S | 両者は同じ閾値判定パターン。`temp_dir()` fixture で Linux CI pass 済み | test(session-start): staleness 判定の共通 fixture を parametrized 化する | | 412 | T3 | ✅ | `resolve_main_workspace_root` の colocated 経路と file 経路で正規化の粒度が違う点を揃える | `src/lib-jj-helpers/src/workspace.rs` | S | **2026-08-17 パス確認**: 実体は `lib-jj-helpers/src/workspace.rs`。両経路の戻り値を同じ正規化にし、差を回帰テストで固定する | fix(jj-helpers): workspace root 解決の正規化粒度を揃える | diff --git a/docs/todo-summary.md b/docs/todo-summary.md index a24531a4..197551de 100644 --- a/docs/todo-summary.md +++ b/docs/todo-summary.md @@ -65,7 +65,6 @@ | 179 | 🔧 Tier 2 | **rate-limit retry decision boundary test を rstest parameterized で追加 (週次レビュー 2026-05-30 S03 採用)** | todo12.md | S | なし (Phase D dogfood で発見、`src/cli-pr-monitor/src/config.rs:94-122` + `stages/poll.rs` の `max_retries=3` 固定 test のみで boundary (0/1/3/off-by-one) 未検証、rstest parameterized で 3-4 case 追加 ~15 行、rstest 既存使用 + Bundle CR-RL = 順位 167-169 隣接領域 follow-up、off-by-one regression が test で検出可能化) | | 180 | 🔧 Tier 2 | **`lib-report-formatter` に markdown pipe / newline escape を追加 (週次レビュー 2026-05-30 C01 採用)** | todo12.md | S | なし (Phase D dogfood で発見、`src/lib-report-formatter/src/lib.rs:51-79` の `format_table()` が PR title / commit message の `|` / `\n`を escape せず markdown table 構造を破壊 → downstream AI facet で prompt injection リスク、`escape_markdown_pipe()` 5 行 utility + call site escape + 5 variant test で defense-in-depth 確立、本セッション 5 PR chain で AI facet 連鎖が systemic 化したため継続価値高) | | 182 | 🔧 Tier 2 | **`/weekly-review` skill に重複検出 (簡易 grep) を Phase 4 で追加 (Phase D dogfood D-B 採用)** | todo12.md | XS-S | なし (本セッション 2026-05-30 Phase D dogfood で WR-2026-05-30-S05 と既存 順位 173 が完全重複していた実観測、ADR-031 § Phase 4 「重複検出は MVP では実装しない」を「MVP+1 (簡易 grep + 3 択 AskUserQuestion: augment/新規/skip)」相当に格上げ、自動 merge なし原則は維持、description 先頭 40 chars の grep ヒット警告 → user 判断、`feedback_global_config_backup` 適用必須 (~/.claude/skills/ 編集前 snapshot)) | -| 193 | 🔧 Tier 2 | **Companion helper group 署名整合 compile-time validation test (PR #196 T2-1 採用) ★ Bundle 195-FB follow-up** | todo12.md | S | なし (Bundle 195-FB で 3 関数目の signature drift が CR Major + pre-push F-1 で systemic 観測、rule⑫ は literal hardcode 層、本タスクは API signature 整合性層、関数ポインタ cast による compile-time witness で signature drift を test 不通過に。`code-review.md` § Review Checklist に reviewer 注意 1 項目追加で 3 層防御 = rule⑫ + compile-time test + reviewer 注意、`feedback_global_config_backup` 適用必須) | | 194 | 💎 Tier 3 | **`development-workflow.md` 「1. Plan First」に「task 着手前に grep で既存 section 確認」step 追記 (PR #196 T3-5 採用)** | todo12.md | XS | なし (PR #123 + #196 で「既実装 section の重複計画」事象を Frequency Medium で観測、`~/.claude/rules/common/development-workflow.md` "1. Plan First" に Codification 重複確認 step を 1-2 行追記、`grep -rn` 手順 + 由来 cite (PR #123, #196)、派生プロジェクト (techbook-ledger / auto-review-fix-vc) に global rule として自動波及、`feedback_global_config_backup` 適用必須) | | 198 | 💎 Tier 3 | **ADR-NNN (採番未確定、land 時に確定): Timestamp invariant safety — 時刻計算 silent failure class の codify (PR #199 post-merge-feedback T3-2 採用、PR #203 T3-1 で 3 観測目に昇格)** | todo10.md | M | なし (PR #96 Finding D + PR #199 Bundle W + PR #203 hooks-session-start port で同型 bug class **3 件観測 = Frequency High**、PastTime newtype + proptest が実証した型層防御原則を ADR で永続化、派生プロジェクト (techbook-ledger / auto-review-fix-vc) への transferability 確保、順位 135 placeholder policy 適用、CLAUDE.md ADR list 追記) | | 199 | 🔧 Tier 2 | **multi-byte 文字を含む string window test の標準 coverage requirement 化 (PR #200 post-merge-feedback T2-1 採用)** | todo10.md | S | なし (PR #199 byte 計算混乱 + PR #200 priority_inversion char window bug の 2 観測 = Frequency Medium、`is_resolved_detects_marker_across_multibyte_gap` style を testing.md に標準化、新 validator 追加時に CJK 40 文字 (= 120 bytes) gap 含む multi-byte test を必須化、MVP は docs/checklist、3-5 validator land 後に lint rule 化を再評価) | diff --git a/docs/todo12.md b/docs/todo12.md index 4e305d9d..0b570208 100644 --- a/docs/todo12.md +++ b/docs/todo12.md @@ -257,57 +257,6 @@ regex 拡張アプローチ (#1) vs fixture のみ追加 (#2) の選択。本タ --- -### 順位 193: Companion helper group 署名整合 compile-time validation test (PR #196 T2-1 採用) - -> **動機**: Bundle 195-FB (PR #196) で `count_empty_in_pr_range` だけ `default_branch` 引数化が漏れていた問題 (CR Major + pre-push F-1) を rule⑫ で **literal hardcode 層** では機械検出するようになったが、companion helper group (`assert_descriptions_absent/present_in_pr_range` / `count_empty_in_pr_range` / 将来追加される helper) の **API signature 整合性** は lint rule では catch できない (= AST レベル complexity)。4 番目以降の helper 追加時に signature drift が発生しても rule⑫ は fire しない silent regression リスク。 -> -> **本タスクの位置づけ**: PR #196 post-merge-feedback Tier 2 #2 採用 (Severity Medium / Frequency Medium / Effort S / Adoption Risk None、2026-06-05 ユーザー承認)。test-level validation で構造強制、Bundle 195-FB Layer 1 (rule⑫) + Layer 2 (parameterize) の seal 層として位置付け。analyzer は Tier 1 lint rule (item 1) を ROI 不釣合いとして却下推奨済、本 test approach は Tier 2 内 alternative。 -> -> **参照**: `.claude/feedback-reports/196.md` Tier 2 #2、`src/cli-pr-monitor/src/fix_commit.rs` (test module 内 companion helper group)、PR #195 commit `9663dd68` (前 2 関数の修正)、PR #196 commit `qntnzyxt` (Layer 2 = 3 関数目の整合) -> -> **実行優先度**: 🔧 **Tier 2** — Effort S。compile-time witness (関数ポインタキャスト) で signature drift を test 不通過にする構造。 - -#### 設計決定 (案) - -Rust の compile-time check で signature drift を検出する pattern: - -```rust -#[test] -fn companion_helpers_share_default_branch_signature() { - // Compile-time witness: 各 helper が (&Path, &str, ...) signature を取ることを強制。 - // 新 helper を group に追加した際は本 test の末尾に同型 cast を追加して compile-time - // 整合性を seal する。signature が drift すると本 test が compile error で落ちる。 - let _: fn(&std::path::Path, &str, &[&str]) = assert_descriptions_absent_in_pr_range; - let _: fn(&std::path::Path, &str, &[&str]) = assert_descriptions_present_in_pr_range; - let _: fn(&std::path::Path, &str) -> usize = count_empty_in_pr_range; -} -``` - -- 関数ポインタへの cast は compile-time check (= test 関数 body 内の statement だが実行時 cost ≒ 0) -- signature drift → compile error → cargo test 不通過 -- 新 helper 追加時の運用: companion group の prefix (`*_in_pr_range` 等) で命名一致するなら本 test に 1 行追加を **`code-review.md` § Review Checklist** で reviewer 注意喚起 (rule⑫ + 本 test + Reviewer 注意の 3 層防御) - -#### 作業計画 - -- [ ] `src/cli-pr-monitor/src/fix_commit.rs` の `#[cfg(test)] mod tests` 内に `companion_helpers_share_default_branch_signature` test を追加 -- [ ] `cargo test --bin cli-pr-monitor fix_commit::tests::companion_helpers_share_default_branch_signature` で pass 確認 -- [ ] mutation regression check: 意図的に 1 関数の signature を変更 (例: `count_empty_in_pr_range(&Path) -> usize`) して compile error で落ちることを手動確認 -- [ ] `~/.claude/rules/common/code-review.md` § Review Checklist の末尾に「companion helper group の signature 整合は compile-time witness test で seal、新 helper 追加時は test に 1 行追加」を 1 項目追加 (3 層防御の reviewer 喚起層) -- [ ] cargo clippy clean -- [ ] 本エントリ削除 + todo-summary.md 行削除 - -#### 完了基準 - -- compile-time witness test が `fix_commit.rs` test module に追加され pass -- signature 意図変更で compile error 観測 (dogfood) -- code-review.md § Review Checklist に reviewer 注意項目追加 (global rule、派生プロジェクト波及) - -#### 詰まっている箇所 - -なし。Effort S、3-5 行 test 追加 + code-review.md 1 行追加で完結。 - ---- - ### 順位 194: development-workflow.md 「1. Plan First」に「task 着手前に grep で既存 section 確認」step 追記 (PR #196 T3-5 採用) > **動機**: PR #196 pre-push reviewer OBS-1 で「tasks 191/192 が既実装 sections を再度計画対象としていた」と指摘 (実態は cleanup diff の誤読だが、similar pattern は PR #123 でも観測済で Frequency Medium)。task 計画段階で「対象 section が既に global rules / ADR に存在するか `grep` で確認する」step を `~/.claude/rules/common/development-workflow.md` "1. Plan First" に追記し、後続 task 計画時の redundant 提案を構造的に予防する。 diff --git a/src/cli-pr-monitor/src/fix_commit/sweep.rs b/src/cli-pr-monitor/src/fix_commit/sweep.rs index 560cbb34..d2a4d485 100644 --- a/src/cli-pr-monitor/src/fix_commit/sweep.rs +++ b/src/cli-pr-monitor/src/fix_commit/sweep.rs @@ -346,6 +346,19 @@ mod tests { .count() } + /// Companion helper group (`assert_descriptions_absent/present_in_pr_range` / + /// `count_empty_in_pr_range`) の signature 整合を compile-time で強制する + /// witness test (順位 193、PR #196 T2-1)。関数ポインタへの cast は型検査のみで + /// 実行時コストは無いが、signature drift が起きると本 test が compile error で + /// 落ちる。新しい `*_in_pr_range` helper を group に追加する際は、ここに同型の + /// cast を 1 行追加すること。 + #[test] + fn companion_helpers_share_pr_range_signature() { + let _: fn(&std::path::Path, &str, &[&str]) = assert_descriptions_absent_in_pr_range; + let _: fn(&std::path::Path, &str, &[&str]) = assert_descriptions_present_in_pr_range; + let _: fn(&std::path::Path, &str) -> usize = count_empty_in_pr_range; + } + /// 統合: PR 範囲 (`..@`) に空 commit が無いとき sweep は no-op (非空 commit を保持)。 #[test] #[ignore = "integration: requires jj in PATH; run via `cargo test -- --ignored --test-threads=1`"]