Skip to content

Bundle l: Custom lint rule test gap closure (PR #150 + #166 post-merge-feedback 3 件統合)#167

Merged
aloekun merged 5 commits into
masterfrom
bundle-l-lint-rule-test-gap
May 21, 2026
Merged

Bundle l: Custom lint rule test gap closure (PR #150 + #166 post-merge-feedback 3 件統合)#167
aloekun merged 5 commits into
masterfrom
bundle-l-lint-rule-test-gap

Conversation

@aloekun
Copy link
Copy Markdown
Owner

@aloekun aloekun commented May 21, 2026

Summary

Bundle l: Custom lint rule test gap closure — PR #150 + #166 post-merge-feedback 採用 3 件を 1 PR で統合 land する。

共通テーマは「custom lint rule (preset / .claude/custom-lint-rules.toml rule⑨) の test gap 補強 + 設計判断の codify」。挙動変更ゼロ、すべて test 追加 + 既存 ADR/comment への追記のみで副作用最小。

採用タスク

  • 順位 139 (PR feat(hooks): Bundle c c-2 — exe-help-block preset + pipe truncate ガイド (順位 65 + 66) #166 post-merge-feedback Tier 2、systemic = 3 観測): exe-help-block preset に system exe (cargo / python / node / notepad) の negative test を追加。現行 regex (?:cli-[\w-]+|hooks-[\w-]+|check-ci-[\w-]+)\.exe の scope を test 層で明示し、将来 broad pattern に戻した場合の silent regression を検出可能化。
  • 順位 121 (PR feat(hooks): takt persona-without-model lint rule (順位 39 / D-4) #150 post-merge-feedback Tier 2): takt_workflow_persona_detects_required_permission_mode_violation の doc を実態に合わせて修正 + 残り 3 fields (pass_previous_response / output_contracts / parallel) の個別 fixture test を追加。.claude/custom-lint-rules.toml[rules.test_coverage.main_ext_tests.yaml] に test 名を登録 (rule test coverage check で機械強制)。
  • 順位 120 (PR feat(hooks): takt persona-without-model lint rule (順位 39 / D-4) #150 post-merge-feedback Tier 1 → ユーザー判断で Tier 3 reclassify): rule⑨ コメントに「Field 拡張手順」4 ステップを追記 + docs/adr/adr-007-custom-linter-layer-boundary.md に enumeration-based pattern の Case study section を追加。Rust regex の lookahead 非対応制約から enumeration による negation を採用した判断経緯 + 列挙漏れリスクへの多層防御 (TOML コメント + 個別 fixture test + clean baseline test) + 同型 rule 設計時の checklist を codify。

Commit 分割

5 commits で「宣言 → 実装 → 削除」の流れに整理:

Commit 内容
docs(todo): 順位 139 新規追加 PR #166 post-merge-feedback 採用宣言
test(hooks-pre-tool-validate): 順位 139 exe-help-block negative test 4 件追加
test(hooks-post-tool-linter): 順位 121 takt_workflow_persona 3 fields fixture test 追加 + doc 修正 + TOML test_coverage 更新
docs(adr): 順位 120 rule⑨ コメント拡張 + ADR-007 case study 追記
docs(todo): 順位 120 / 121 / 139 完了に伴い削除 todo-summary.md / todo8.md から該当 entry 削除

Test plan

  • cargo test -p hooks-pre-tool-validate → 144 passed (新規 4 件含む)
  • cargo test -p hooks-post-tool-linter → 131 passed (新規 3 件含む)
  • rule_test_coverage_check → ok (TOML meta field と実 test 名の整合性 機械検証 pass)
  • markdownlint → 0 errors
  • pre-push review (security + simplicity) → APPROVE
  • CI green
  • CodeRabbit review pass

Summary by CodeRabbit

  • Documentation

    • 追加の設計ドキュメント(ADR)により、カスタムリンターのルール設計判断とベストプラクティスを明記しました。
  • Tests

    • 複数の検証ルールについて、テストケースカバレッジを拡張しました。
  • Chores

    • 内部タスク管理情報の整理を行いました。

Review Change Stack

aloekun added 5 commits May 21, 2026 11:33
…ative test 追加

PR #166 post-merge-feedback で 3 独立ソース (PR diff / Session / Pre-push:simplicity)
で同時指摘された systemic pattern への対策。takt-fix で regex は
`(?:cli-[\w-]+|hooks-[\w-]+|check-ci-[\w-]+)\.exe` に narrowed 済だが、
既存 `exe_help_block_allows_unrelated_exe` は `foo.exe` の架空名のみで実在
system exe を未検証。将来 regex を broad pattern に戻した場合の silent regression を
test 層で明示的に検出する目的で、cargo/python/node/notepad の 4 件 negative test を追加。
… 個別 fixture test 追加 + doc 修正

PR #150 CR Major fix で persona: alternation に追加された 4 fields のうち、
従来 regression test は `required_permission_mode` の 1 case のみで、
doc comment は「4 fields regression test」と主張しつつ実態と乖離していた。

本 commit で:
- 既存 `takt_workflow_persona_detects_required_permission_mode_violation` の doc を
  実態に合わせて「代表 case」表現に修正、残り 3 fields は個別 test で検証する旨を明記
- `pass_previous_response` / `output_contracts` / `parallel` の個別 fixture test を追加
- `.claude/custom-lint-rules.toml` の `[rules.test_coverage.main_ext_tests.yaml]` に
  3 件の新 test 名を登録 (rule test coverage check で機械強制される宣言)

将来 alternation から個別 field を誤って削除した場合に test fail で検出される
safety net を確保。

(順位 121、PR #150 T2-#1 採用)
…n case study 追記

PR #150 CR Major fix で「persona: alternation の列挙漏れ」が発生した経験を踏まえ、
takt yaml schema 拡張時の rule 更新フローを 2 箇所に codify:

(1) `.claude/custom-lint-rules.toml` rule⑨ 上部に「Field 拡張手順」4 ステップを追記
    (grep で sibling field を抽出 → alternation 追加 → test helper 追加 → fixture test +
     [rules.test_coverage] 宣言追加 → cargo test 確認)
(2) `docs/adr/adr-007-custom-linter-layer-boundary.md` に Case study section を追加
    (Rust regex の lookahead 非対応 → enumeration-based negation 採用の判断経緯 +
     列挙漏れリスクへの多層防御 + 同型 rule 設計時の checklist)

順位 121 (個別 fixture test) と 順位 120 (本 commit) で「規約 → test → 保守手順」の
3 層が完成し、次回 takt yaml schema 拡張時の rule 更新フローが文書化される。

(順位 120、PR #150 T1-#1 採用、analyzer Tier 1 → ユーザー判断で Tier 3 reclassify)
PR #150 + #166 post-merge-feedback 採用 3 件 (Bundle l: Custom lint rule test gap closure)
が同 PR で land 完了したため、対応する todo entry を削除:

- 順位 139 (exe-help-block system exe negative test): commit 3049f56 で 4 件 negative test 追加
- 順位 121 (takt_workflow_persona 3 fields fixture test): commit bfab173 で 3 件 fixture test 追加 +
  doc 修正 + .claude/custom-lint-rules.toml の [rules.test_coverage.main_ext_tests.yaml] 宣言更新
- 順位 120 (rule⑨ コメント拡張 + ADR-007 case study): commit a2df865 で field 拡張手順 4 ステップ追記 +
  ADR-007 に enumeration-based pattern case study section 追加

todo-summary.md / todo8.md から該当 entry を一括削除。残存 task の優先順位に影響なし。
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9224172b-cd2f-4b6b-9ccc-d14a1b2058d9

📥 Commits

Reviewing files that changed from the base of the PR and between 768712c and 2ffd3dc.

📒 Files selected for processing (6)
  • .claude/custom-lint-rules.toml
  • docs/adr/adr-007-custom-linter-layer-boundary.md
  • docs/todo-summary.md
  • docs/todo8.md
  • src/hooks-post-tool-linter/src/main.rs
  • src/hooks-pre-tool-validate/src/main.rs
💤 Files with no reviewable changes (2)
  • docs/todo-summary.md
  • docs/todo8.md

📝 Walkthrough

Walkthrough

takt-workflow-persona-without-model ルール(ルール⑨)の正規表現層での設計判断を ADR で詳細化し、対応するテストカバレッジ定義と実装を拡張しました。列挙による否定と多層防御戦略を確立し、テストを細分化して個別ケース検証を追加しています。

Changes

ルール⑨の設計決定文書化とテスト拡張

Layer / File(s) Summary
ルール定義とテストカバレッジ登録の更新
.claude/custom-lint-rules.toml
ルール⑨の説明に takt YAML スキーマ拡張時の保守手順(抽出→パターン更新→テスト追加→実行確認)を追記し、3 件のテスト名(pass_previous_response/output_contracts/parallel 違反検出)で main_ext_tests.yaml を拡張しました。
ADR-007 への設計決定と検証戦略の詳細化
docs/adr/adr-007-custom-linter-layer-boundary.md
ルール⑨のケーススタディを追加し、Rust regex の lookahead/lookbehind 非対応下での列挙ベース negation 採用判断を比較検証、採用した multiline regex のセマンティクスを明確化、列挙漏れリスクの多層防御(TOML コメント手順・テスト連携・baseline 継続)と checklist を追記しました。
テスト実装の細分化と個別ケース拡張
src/hooks-post-tool-linter/src/main.rs
takt_workflow_persona_detects_required_permission_mode_violationpass_previous_response 削除により絞り込み、pass_previous_response/output_contracts/parallel の 3 件を個別の fixture と assert で新規テストとして追加し、各フィールドの違反検出を独立検証するようにしました。

検証プリセットテストの強化

Layer / File(s) Summary
exe-help-block 許可ケーステストの追加
src/hooks-pre-tool-validate/src/main.rs
cargo.exepython.exenode.exenotepad.exe--help オプション実行がブロックされないことを検証する 4 つのテストケースを追加しました。

完了タスク記録の整理

Layer / File(s) Summary
完了タスク行の削除
docs/todo-summary.md, docs/todo8.md
優先順序表から 2 件のタスク行(順位 120-121)を削除し、「現在進行中」セクションから 2 件の TODO エントリを削除しました。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • aloekun/claude-code-hook-test#150: メイン PR が takt-workflow-persona-without-model ルール⑨のテストカバレッジを pass_previous_response/output_contracts/parallel で拡張しており、同じルールと sibling-field 列挙パターンを直接扱っています。
  • aloekun/claude-code-hook-test#165: メイン PR が rules.test_coverage.main_ext_tests テスト名を拡張するのに対し、取得 PR は rules.test_coverage 機械検証と全ルール分のテストカバレッジ宣言を実装しており、同じテストカバレッジ連携を直接拡張しています。
  • aloekun/claude-code-hook-test#161: メイン PR が ADR-007 にルール⑨のケーススタディと多層防御手順を追記するのに対し、取得 PR も ADR-007 に semantic self-limitation の安全条件と最小テストチェックリストを追記しており、同じ ADR の観点(境界判断+検証戦略)を直接拡張しています。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Pull request title clearly specifies the main objective: consolidating three test gap closure items for custom lint rules (exe-help-block preset and takt-workflow-persona tests) with documentation updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aloekun aloekun merged commit 4fad2be into master May 21, 2026
1 check passed
@aloekun aloekun deleted the bundle-l-lint-rule-test-gap branch May 21, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant