Skip to content

feat(hooks-post-tool-linter): PowerShell (?i) flag validation + §A-2 P-1/P-2 ledger (順位 7 / §A-2 P-3)#127

Merged
aloekun merged 2 commits intomasterfrom
feature/p3-powershell-i-flag-validation
May 7, 2026
Merged

feat(hooks-post-tool-linter): PowerShell (?i) flag validation + §A-2 P-1/P-2 ledger (順位 7 / §A-2 P-3)#127
aloekun merged 2 commits intomasterfrom
feature/p3-powershell-i-flag-validation

Conversation

@aloekun
Copy link
Copy Markdown
Owner

@aloekun aloekun commented May 7, 2026

Summary

Changes

src/hooks-post-tool-linter/src/main.rs

新関数 find_powershell_rules_missing_case_insensitive_flag(rules: &[CustomRule]) -> Vec<String>:

fn find_powershell_rules_missing_case_insensitive_flag(rules: &[CustomRule]) -> Vec<String> {
    rules.iter()
        .filter(|r| r.extensions.iter().any(|e| e.eq_ignore_ascii_case("ps1")))
        .filter(|r| !r.pattern.contains("(?i)"))
        .map(|r| r.id.clone())
        .collect()
}
  • load_custom_rules() から呼出し → 起動時 stderr に warn 出力 (本番運用層)
  • 8 tests 追加 (7 unit + 1 deployed-config integration):
    • flags_rule_without_case_insensitive_flag
    • passes_rule_with_case_insensitive_flag
    • ignores_non_ps1_rules
    • handles_mixed_extension_list
    • treats_extension_case_insensitively
    • returns_multiple_violators
    • deployed_custom_rules_pass_powershell_case_insensitive_validation (CARGO_MANIFEST_DIR から .claude/custom-lint-rules.toml を直読、全 rule 検証)

.claude/custom-lint-rules.toml

  • 既存 no-ephemeral-todo-reference rule の pattern に (?i) 追加 (docs/todo[0-9]*\.md(?i)docs/todo[0-9]*\.md)
    • 副次効果: Windows file path の大文字小文字混在 (Docs/Todo3.md 等) 対応
    • 必要性: extensions に ps1 を含むため deployed validation を pass させる

~/.claude/rules/common/code-review.md

### Custom lint rule patterns セクション新設:

docs/local-llm-offload-analysis.md (§A-2 計測ログ)

P-0 / P-1 / P-2 の dogfood 結果を ___ placeholder から実数値に更新:

P-N PR findings classifier 起動 agreement latency fallback
P-0 #123 (smoke test) 1/1 ✅ 妥当
P-1 #125 0 (CR APPROVE no comments) ❌ 未起動 N/A N/A N/A
P-2 #126 1 (CR Nitpick, review body 内) 手動 synthetic finding 経由 1/1 (100%) 6.4s/件 (>5s 目標) 1/1 (length contract 違反)

判明した system gap (P-2): check-ci-coderabbit が CR review body の <details> block 内 Nitpick を抽出しない → post-pr-monitor の input data 経路に欠落 → classifier が空 findings を見て enrich_with_classifier をスキップ。今後の P-N で同型再発する可能性高、follow-up task 候補。

docs/todo.md / docs/todo3.md

  • 順位 7 row + 詳細エントリを削除 (memory: feedback_todo_no_history 完了タスクは仕組み反映後削除)
  • 別 commit (docs(todo): 順位 7 ... 完了に伴い削除) で分離

グローバル設定変更ログ (§10.5 規約)

PR #123 で導入した backup 規約に従い snapshot を取得:

__backup-claude-config/20260507-234953/
├── CLAUDE.md
├── agents/
├── rules/
├── settings.json
└── skills/

変更箇所: ~/.claude/rules/common/code-review.md### Custom lint rule patterns セクション追加 (約 20 行)。

Test plan

  • cargo test -p hooks-post-tool-linter powershell — 7/7 pass
  • cargo test -p hooks-post-tool-linter deployed_custom_rules — 1/1 pass (deployed config 全 rule バリデーション)
  • cargo test -p hooks-post-tool-linter — 82/82 pass、regression なし
  • pre-push-review APPROVE (1 iter / 5m 4s)
  • release build + deploy (.claude/hooks-post-tool-linter.exe)
  • __backup-claude-config/<ts>/ snapshot 確認
  • (post-merge) classifier 起動確認 + §A-2 P-3 計測ログ記録

関連

aloekun added 2 commits May 7, 2026 23:52
…P-1/P-2 ledger 記録 (順位 7 / §A-2 P-3)

§A-2 Phase 5 dogfood P-3 (順位 7)。PR #91 で発覚した PowerShell case-insensitive
regex の構造的落とし穴 (no-empty-powershell-catch / no-silent-error-action で
(?i) 欠落 → CR Major 指摘) を機械強制で再発防止。

順位 7 (Tier 1, T1-1):
- find_powershell_rules_missing_case_insensitive_flag() 関数追加: extensions に
  ps1 を含む rule で pattern に (?i) が無いものを ID リストで返す
- load_custom_rules() で起動時 warn (本番運用層)
- 7 unit tests (異種 violator / valid / mixed-ext / case-insensitive ext /
  multi-violator / non-ps1 ignore) + 1 deployed-config 全 rule 検証 test (CI 検出層)
- 既存 no-ephemeral-todo-reference rule の pattern に (?i) を追加 (deployed
  validation を pass、Windows file path 大文字小文字混在対応の副次効果あり)
- ~/.claude/rules/common/code-review.md § Custom lint rule patterns 追加
  (PR #91 a15b263 fix の経緯 + 順位 7 機械強制の事後参照)

§A-2 計測ログ (P-1/P-2) 記録:
- P-1 (PR #125): findings: 0 (CR APPROVE no comments)、classifier 未起動 →
  dogfood 不発
- P-2 (PR #126): findings: 1 (CR Nitpick、review body <details> block 内、
  check-ci-coderabbit 抽出漏れ)、手動 synthetic finding で classifier 実行 →
  action=human_review / action_confidence=0.0 / fallback=length_contract、
  agreement: 1/1 (100%)、latency: 6.4s/件 (>5s 目標)、fallback: 1/1
- 既知 system gap: check-ci-coderabbit が review body の <details> Nitpick を
  抽出しない (post-pr-monitor が classifier に渡す入力経路に欠落)

build + deploy 済 (.claude/hooks-post-tool-linter.exe)。
全 82 tests pass、regression なし。
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Warning

Rate limit exceeded

@aloekun has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 43 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 05c3f089-31e1-4a21-8d5f-ed349d3a78c2

📥 Commits

Reviewing files that changed from the base of the PR and between b677b9d and 87e8d3d.

📒 Files selected for processing (6)
  • .claude/custom-lint-rules.toml
  • .markdownlint-cli2.jsonc
  • docs/local-llm-offload-analysis.md
  • docs/todo.md
  • docs/todo3.md
  • src/hooks-post-tool-linter/src/main.rs

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 205a689 into master May 7, 2026
1 check passed
@aloekun aloekun deleted the feature/p3-powershell-i-flag-validation branch May 7, 2026 15:14
aloekun added a commit that referenced this pull request May 7, 2026
…位 76+77 / §A-2 P-4) (#128)

* test(cli-pr-monitor): cross-module overflow safety + 2100 baseline + §A-2 P-3 ledger (順位 76+77 / §A-2 P-4)

§A-2 Phase 5 dogfood P-4 (Bb-3 follow-up)。PR #115 で実証された
unit test isolation 起因の cross-module overflow 自己矛盾 (config layer の
sanitize テストが downstream poll arithmetic の overflow safety を verify
していなかった) を統合テストで machine-enforce。

順位 76 (Tier 2, T2-1):
- 4 cross-module integration tests を config.rs test module に追加
  - cross_module_overflow_safety_at_max_boundary (sanitize 後の
    MAX_SAFE_WAIT_SECS が finalize_initial_review_park / schedule_next_*
    両経路で overflow しないことを assert)
  - cross_module_overflow_safety_with_zero_input_uses_default (0 → default 300s)
  - cross_module_overflow_safety_with_u64_max_input_uses_default (u64::MAX → default 300s)
  - cross_module_overflow_safety_negative_test_large_unsanitized_value_overflows
    (i64::MAX as u64 を直接 cast すると positive overflow、sanitize の必要性裏付け)
  - cross_module_overflow_safety_negative_test_u64_max_wraps_to_minus_one
    (u64::MAX as i64 = -1 で silent corruption (過去時刻)、sanitize で防止)

順位 77 (Tier 2, T2-2):
- 既存 review_recheck_sanitize_max_safe_boundary テストを year 2100 baseline
  (now_unix = 4.1e9) でも overflow しないことを assert する形に拡張
- MAX_SAFE_WAIT_SECS 定数 doc に future-proof 根拠を追記
  (year 2100 baseline で safety margin が 9 桁残ることを明文化)

§A-2 計測ログ P-3 結果記録:
- P-3 (PR #127): rate-limit blocked (CR が 27 min wait の rate-limit overlay で
  formal review 投稿不可)、classifier 未起動、計測 N/A — dogfood 不発。但し
  CR rate-limit 経路が dogfood の阻害要因として観測 (§A-2 §6 注意事項 #1 を実証)。

テスト 168 active passed (順位 76 系 5 件追加)、regression なし。
deployed exe には影響なし (test only + doc コメント)。

* docs(todo): 順位 76 + 77 (cross-module overflow + 境界値 matrix) 完了に伴い削除
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