test(hooks): Bundle k-2 — TOML positive/negative test + extensions reminder#163
Merged
Conversation
…時 test 追加 reminder comment (順位 124 + 127) ## 順位 124 (Tier 1): TOML positive + negative test 追加 PR #151 T1-#1 採用、PR #152 で再観測 (Frequency Medium)。 既存 `no_ephemeral_todo_self_exclusion_invariant_holds_on_deployed_toml` は self-exclusion 不変条件のみ確認、TOML での検出力 test が不在だった gap を 構造的に塞ぐ: - `no_ephemeral_todo_detects_toml_ephemeral_reference`: TOML + ephemeral 参照 → 1 violation 検出 (positive) - `no_ephemeral_todo_toml_skips_permanent_adr_reference`: TOML + ADR 参照 → 0 violation (negative、pattern 正確性も seal) self-trigger 回避: fixture content は既存 `build_concrete_digit_fixture(3)` (format! interpolation) を再利用。 ## 順位 127 (Tier 3): extensions 拡張時 test 追加義務の comment 明文化 PR #151 T3-#2 採用、PR #152 で再観測。 `.claude/custom-lint-rules.toml` の `no-ephemeral-todo-reference` rule 上に 9 行のコメントブロックを追加: extensions 変更時は同 PR で positive/negative test を追加することを次回 rule 編集者の目に入る位置に置く。 `feedback_no_unenforced_rules.md` 例外 = 既存実践の明文化 + guide 効果 (機械強制ではなく point-of-edit reminder)。 ## 検証 - cargo test -p hooks-post-tool-linter: 121 passed / 0 failed - 新規 2 test (positive / negative) を含む 8 tests (no_ephemeral_todo 系列) 全通過 ## Net 差分 - `.claude/custom-lint-rules.toml`: +9 lines (reminder comment) - `docs/todo-summary.md`: -2 lines (順位 124 + 127 削除) - `docs/todo8.md`: -44 lines (詳細 entries 削除) - `src/hooks-post-tool-linter/src/main.rs`: +41 lines (2 test + doc comment) production code path 変更なし。exe rebuild 不要。
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughPR ChangesTOML カスタムルール拡張テストと規約
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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 |
3 tasks
aloekun
added a commit
that referenced
this pull request
May 19, 2026
…ule-test coverage check + global testing.md 明文化) PR #163 (Bundle k-2) merge 後の post-merge-feedback で 2 件採用された follow-up task を todo 系列に登録。 ## 順位 137 (Tier 1, M, Frequency High) Rule-Test Coverage Check Cargo test。 `.claude/custom-lint-rules.toml` の各 rule の extensions ⇔ `src/hooks-post-tool-linter/src/main.rs` の test 関数名を mechanical に検証 する Cargo test step を追加する。 由来: PR #110/#151/#152/#155 の 4 PR 観測 (Frequency High)、PR #163 で順位 127 として passive reminder comment を追加したが、analyzer が「passive reminder では PR #152 同根再発を防止できなかった実証ベース → mechanical enforcement が必要」と判定。 必須カバレッジ scope (CodeRabbit Minor 指摘で確定): 主要 ext rs/toml/yaml/yml × 全 rule に対応 test 必須、その他 ext (jsonc/json/ts/tsx/js/jsx/py/ps1) は rule あたり positive single test 1 件以上で代替。完了基準と詰まっている箇所 の scope drift を fix。 ## 順位 138 (Tier 3, XS, Frequency High) Rule Extension Test Pattern を `~/.claude/rules/common/testing.md` に明文化。 順位 137 (mechanical Cargo test) と 2 層構成。`~/.claude/` global 配下のため 派生プロジェクト (techbook-ledger / auto-review-fix-vc) へ自動波及。 ## land 順序の推奨 順位 137 + 138 は同 PR で land 推奨 (命名規約 + 必須 ext scope 決定が atomic に整う、cross-reference が同 commit で完結)。 ## 補正事項 analyzer report は target を `src/cli-custom-linter/src/main.rs` と記載 していたが、実際の crate 名は `hooks-post-tool-linter` のため詳細 entry で補正済。 ## CodeRabbit review 反映 PR review (PR #164 round 1) で順位 137 の「完了基準」(全 (rule, ext) ペア必須) と「詰まっている箇所」(主要 ext に絞った coverage 推奨) の scope drift を 🟡 Minor で指摘。修正方針: - 完了基準を 主要 ext (rs/toml/yaml/yml) × 全 rule 必須 + その他 ext は rule あたり single positive test で代替、と明示 - 設計決定 section に必須カバレッジ scope を追加 (順位 138 testing.md と 同一 commit で codify することで cross-reference の atomicity 確保) - 詰まっている箇所 から該当議論を削除、TOML meta field vs 命名規約方式の trade-off のみ残す (= 順位 138 実装時に確定する補助 design 議論) ## docs only 実装は別 PR で着手予定。
aloekun
added a commit
that referenced
this pull request
May 19, 2026
…ule-test coverage check + global testing.md 明文化) (#164) PR #163 (Bundle k-2) merge 後の post-merge-feedback で 2 件採用された follow-up task を todo 系列に登録。 ## 順位 137 (Tier 1, M, Frequency High) Rule-Test Coverage Check Cargo test。 `.claude/custom-lint-rules.toml` の各 rule の extensions ⇔ `src/hooks-post-tool-linter/src/main.rs` の test 関数名を mechanical に検証 する Cargo test step を追加する。 由来: PR #110/#151/#152/#155 の 4 PR 観測 (Frequency High)、PR #163 で順位 127 として passive reminder comment を追加したが、analyzer が「passive reminder では PR #152 同根再発を防止できなかった実証ベース → mechanical enforcement が必要」と判定。 必須カバレッジ scope (CodeRabbit Minor 指摘で確定): 主要 ext rs/toml/yaml/yml × 全 rule に対応 test 必須、その他 ext (jsonc/json/ts/tsx/js/jsx/py/ps1) は rule あたり positive single test 1 件以上で代替。完了基準と詰まっている箇所 の scope drift を fix。 ## 順位 138 (Tier 3, XS, Frequency High) Rule Extension Test Pattern を `~/.claude/rules/common/testing.md` に明文化。 順位 137 (mechanical Cargo test) と 2 層構成。`~/.claude/` global 配下のため 派生プロジェクト (techbook-ledger / auto-review-fix-vc) へ自動波及。 ## land 順序の推奨 順位 137 + 138 は同 PR で land 推奨 (命名規約 + 必須 ext scope 決定が atomic に整う、cross-reference が同 commit で完結)。 ## 補正事項 analyzer report は target を `src/cli-custom-linter/src/main.rs` と記載 していたが、実際の crate 名は `hooks-post-tool-linter` のため詳細 entry で補正済。 ## CodeRabbit review 反映 PR review (PR #164 round 1) で順位 137 の「完了基準」(全 (rule, ext) ペア必須) と「詰まっている箇所」(主要 ext に絞った coverage 推奨) の scope drift を 🟡 Minor で指摘。修正方針: - 完了基準を 主要 ext (rs/toml/yaml/yml) × 全 rule 必須 + その他 ext は rule あたり single positive test で代替、と明示 - 設計決定 section に必須カバレッジ scope を追加 (順位 138 testing.md と 同一 commit で codify することで cross-reference の atomicity 確保) - 詰まっている箇所 から該当議論を削除、TOML meta field vs 命名規約方式の trade-off のみ残す (= 順位 138 実装時に確定する補助 design 議論) ## docs only 実装は別 PR で着手予定。
6 tasks
aloekun
added a commit
that referenced
this pull request
May 19, 2026
…le 137+138) (#165) * feat(lint): rule-test coverage check cargo test + global testing.md codify (Bundle 137+138, TOML meta field 方式) - src/hooks-post-tool-linter/src/main.rs: - CustomRule に test_coverage: Option<CustomRuleTestCoverage> field 追加 - rule_test_coverage_check cargo test 新規 (helper 4 関数に分割) - load_deployed_custom_rules / extract_existing_test_fn_names - classify_rule_extensions / check_main_ext_coverage / check_other_ext_coverage / check_main_ext_keys_sanity - collect_rule_coverage_gaps - test gap 補填 (合計 +7 tests, 121 → 128): - rule② (no-personal-paths): positive×2 + negative×1 (元 0 tests, 配布後初の検証) - rule⑥ (no-ephemeral-todo-reference) yaml: positive×1 + negative×1 - rule⑥ (no-ephemeral-todo-reference) yml: positive×1 - .claude/custom-lint-rules.toml: - 全 10 rule に [rules.test_coverage] meta field を宣言 - 主要拡張子 (rs/toml/yaml/yml) を targets する rule は main_ext_tests.<ext> で各 ext に 1+ test を明示 - 非主要専用 rule は other_ext_tests でカバレッジ宣言 - ~/.claude/rules/common/testing.md (グローバル): - 新 section 'Custom Lint Rule Test Coverage' を追加 - 命名規約 vs TOML meta field の trade-off と採用根拠 (案 b) を codify - 派生プロジェクト (techbook-ledger / auto-review-fix-vc) へ自動波及 順位 137 + 138 (PR #163 post-merge-feedback T1-#1 + T3-#1 採用)。命名規約に依存しない明示的 mapping を採用したのは AI 生成の揺らぎを構造的に抑止する意図 (ユーザー指示)。 * docs(todo): 順位 137 + 138 完了に伴い削除 (Bundle 137+138 land) - docs/todo-summary.md: 行 137 + 138 を削除 (table) - docs/todo8.md: 順位 137/138 entry block を削除 (合計 90 行 -) PR 本作業 (@-: feat(lint) commit) で実装 + ドキュメント codify が land したため、todo entries を片付け。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bundle k-2: PR #155 (Bundle k-1) の続編として、
no-ephemeral-todo-referencerule の test gap 補強 + extensions 変更時 reminder の 2 タスクを bundled で land。.claude/custom-lint-rules.tomlの rule 上に reminder comment として明文化 — point-of-edit reminder背景
no-ephemeral-todo-referencerule の extensions に対する test gap が複数 PR で反復観測 されてきた pattern (Frequency Medium / 4 PR 観測):yaml/yml追加時に対応 test 不在toml拡張子で検出力 test 不在 (latent).mdへの FP が再現 — 同根 root cause本 Bundle k-2 は test gap を closing。Bundle k-1 (実装層) + k-2 (test 層) + k-3 (UTF-8 横展開、todo 順位 125、別 PR 予定) の 3 層分割の中段。
変更内容
.claude/custom-lint-rules.tomlsrc/hooks-post-tool-linter/src/main.rsno_ephemeral_todo_detects_toml_ephemeral_reference+no_ephemeral_todo_toml_skips_permanent_adr_referencedocs/todo-summary.mddocs/todo8.mdNet: +4 lines (test code 41 増、docs 46 減、TOML 9 増)
検証
cargo test -p hooks-post-tool-linter→ 121 passed / 0 failedno_ephemeral_todo系列 8 tests 全通過:no_ephemeral_todo_detects_toml_ephemeral_reference(positive)no_ephemeral_todo_toml_skips_permanent_adr_reference(negative)設計判断
Test fixture の self-trigger 回避
最初 positive test の fixture に literal
docs/todo3.mdを書いて、まさに rule が想定する meta-case (永続成果物 = Rust source → ephemeral 参照) を踏んだ。解決: 既存 helper
build_concrete_digit_fixture(3)を再利用 —format!interpolation で literal pattern が source に出現しない設計。本リポジトリの self-exclusion 標準パターン (.claude/custom-lint-rules.tomlrule⑥ 冒頭コメントに記載)。build_concrete_digit_fixture(3)の3は digit 番号 (=docs/todo3.mdの 3) であって violation count ではない。violations.len() == 1のアサートは 1 件の ephemeral 参照から 1 violation が返ることを check する意図で整合。Positive と Negative の fixture 構築非対称性
positive test は ephemeral 参照生成 helper を使い、negative test (
docs/adr/...) はインライン構築。意図的に非対称:memory rule
feedback_test_dry_antipattern.md(テストの DRY は適用しない、独立性優先) に沿った判断。Non-doc comment 削除
Bundle Z #B-α (非 doc コメント禁止) の lint 層により、test 内の
//comment は block される。最終的に既存 test と同じ「コメントなし、build_*helper 名で意図を表現」スタイルに収束。takt pre-push-review
build_concrete_digit_fixture(3)の digit 解釈、todo cleanup の atomicity を独立 validateTest plan
Summary by CodeRabbit
Documentation
Tests
Chores