Skip to content

fix(hooks-stop-tool-call-leak): emit_block serialize 失敗の stderr 診断 + E2E config 値 assert - #264

Merged
aloekun merged 1 commit into
masterfrom
stop-leak-emit-block-diagnostics
Jul 12, 2026
Merged

fix(hooks-stop-tool-call-leak): emit_block serialize 失敗の stderr 診断 + E2E config 値 assert#264
aloekun merged 1 commit into
masterfrom
stop-leak-emit-block-diagnostics

Conversation

@aloekun

@aloekun aloekun commented Jul 12, 2026

Copy link
Copy Markdown
Owner

概要

PR #261 post-merge-feedback 採用の 3 件 (順位271/273/274) を実装し、対応する todo エントリを retire。

変更内容

  • 順位271 (Tier1, fix)hooks-stop-tool-call-leakemit_blockserde_json::to_stringErr を握り潰していた (if let Ok) のを match 化し、失敗時に [stop-tool-call-leak] ... (fail-open) 形式の stderr 診断を出力。block 判定失敗の observability をゼロから確保 (ADR-053 の fail-open 設計における可視性担保手段)。
  • 順位273 (Tier2, test) — E2E (tests/e2e.rs) が実 config の section 存在しか検証していなかったのを、toml parse で enabled == true / max_consecutive_blocks == 3 を値まで assert するよう強化。config drift による cap 境界テストの silent break を防止 (ADR-041)。toml = "0.8"[dev-dependencies] に追加 (既存 serde_json 再宣言パターン踏襲)。
  • 順位274 (Tier3, docs) — 上記の一般化として「外部 fixture 参照テストは値まで assert」convention を docs/dev-conventions.md に追記 + CLAUDE.md 索引行を更新。

検証

  • cargo build / cargo test (unit 36 + e2e 7) / cargo clippy --workspace --all-targets -- -D warnings すべてパス
  • pre-push review: security / simplicity 両 APPROVE

🤖 Generated with Claude Code

Summary by CodeRabbit

  • バグ修正

    • 判定結果のJSON生成に失敗した場合、エラー内容を標準エラー出力へ表示するよう改善しました。
  • テスト

    • 外部設定ファイルを使用するE2Eテストで、セクションの存在だけでなく設定値も検証するよう強化しました。
  • ドキュメント

    • 外部fixture参照テストで具体的な値まで検証する開発規約を追加しました。
    • 開発タスク一覧および関連TODOを整理しました。

…E2E config 値 assert

- 順位271: emit_block の serde_json::to_string Err を握り潰さず stderr 診断を出力 (fail-open observability, ADR-053)
- 順位273: E2E で実 config の enabled=true / max_consecutive_blocks=3 を値まで assert し config drift の silent break を防止 (ADR-041)
- 順位274: dev-conventions に「外部 fixture 参照テストは値まで assert」convention 追記 (CLAUDE.md 索引行更新含む)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a283926e-182d-461f-a4a0-b4d2d5d7e95e

📥 Commits

Reviewing files that changed from the base of the PR and between d4efd16 and 8900f92.

📒 Files selected for processing (7)
  • CLAUDE.md
  • docs/dev-conventions.md
  • docs/todo-summary.md
  • docs/todo13.md
  • src/hooks-stop-tool-call-leak/Cargo.toml
  • src/hooks-stop-tool-call-leak/src/main.rs
  • src/hooks-stop-tool-call-leak/tests/e2e.rs
💤 Files with no reviewable changes (2)
  • docs/todo13.md
  • docs/todo-summary.md

📝 Walkthrough

Walkthrough

hooks-stop-tool-call-leak の JSON 直列化失敗時に stderr 診断を追加し、E2E テストで設定値を TOML として厳密検証するよう変更した。外部 fixture の値 assert convention と関連 TODO・索引も更新した。

Changes

hooks-stop-tool-call-leak の検証強化

Layer / File(s) Summary
直列化失敗時の診断
src/hooks-stop-tool-call-leak/src/main.rs
emit_block の JSON 直列化失敗時に、stderr へ fail-open の診断を出力する。
E2E 設定値の厳密検証
src/hooks-stop-tool-call-leak/Cargo.toml, src/hooks-stop-tool-call-leak/tests/e2e.rs
TOML を解析し、enabled = truemax_consecutive_blocks = 3 を検証する関数を追加し、E2E 用の toml 依存を追加した。
Convention と TODO の反映
docs/dev-conventions.md, CLAUDE.md, docs/todo-summary.md, docs/todo13.md
外部 fixture の具体値 assert convention を追加し、完了した関連 TODO と実行順序表を更新した。

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 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 emit_block の serialize 失敗時の stderr 診断と E2E config 値の assert を要約しており、変更内容と整合しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stop-leak-emit-block-diagnostics

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.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Monitor 分析 (GitHub Actions バックストップ)

  • トリガー: issue_comment (created) / 実行 run
  • CI: CodeRabbit のみ pending("Currently processing new changes" — レビュー未完了)。他の CI check context は現時点で報告なし。mergeStateStatus: UNSTABLE(pending check 起因と推定)、mergeable: MERGEABLE
  • レビュー状況: CodeRabbit — レビュー進行中(未完了、findings 未生成)。人間レビュー・他 bot レビューともに 0 件(reviews API 応答は空配列)。インラインコメントも 0 件
  • Verdict: approved(現時点で applicable な指摘が 0 件のため。ただし CodeRabbit レビューが未完了であり、完了後に指摘が出れば次回実行時に再判定される暫定値)

Applicable Findings (Critical / High / Major)

該当なし

Applicable Findings (Medium 以下)

該当なし

Filtered (not applicable)

該当なし(レビュー指摘自体が現時点で 0 件)

変更概要(軽量サマリー)

todo13.md / todo-summary.md に登録済みだった 3 件の post-merge-feedback 採用項目(順位271/273/274、PR #261 由来)を実装し、完了に伴い該当 entry を削除する PR。

ファイル 変更 性質
src/hooks-stop-tool-call-leak/src/main.rs emit_blockserde_json::to_string を match 化し Err 時に eprintln![stop-tool-call-leak] 診断出力 順位271: fail-open (ADR-053) の observability 追加。1 arm 追加のみで小さい
src/hooks-stop-tool-call-leak/tests/e2e.rs ensure_config_beside_exe の section 存在チェックを assert_leak_config_matches_test_assumptions に置換し、enabled/max_consecutive_blocks の具体値まで assert 順位273: ADR-041 Test Isolation パターンの実例修正
src/hooks-stop-tool-call-leak/Cargo.toml dev-dependencies に toml = "0.8" 追加 順位273 の値 parse に必要な依存追加
docs/dev-conventions.md 「外部 fixture 参照テストは値まで assert」convention を新規追記(由来・理由を明記) 順位274: 順位273 の一般化・文書化
CLAUDE.md dev-conventions 索引行に新 convention 項目名(順位274)を追加 索引整合
docs/todo13.md / docs/todo-summary.md 完了した 3 entry(271/273/274)を削除 完了 todo のクリーンアップ

diff 全体はドキュメント整備 + 1 箇所の小さな fail-open observability 修正 + テストの assert 強化のみで、新規ロジック追加や外部インターフェース変更は無し。ADR との齟齬も見当たらない。

次のアクション

  • CodeRabbit のレビュー完了を待ち、指摘が出れば次回イベントで再分析(本 workflow は待機・ポーリングしない設計のため、指摘が投稿された時点の後続イベントで拾われる)
  • 現状は待機以外のアクション不要(CI/レビューともに blocking な問題なし)

@aloekun
aloekun merged commit 8f0fab1 into master Jul 12, 2026
1 check passed
@aloekun
aloekun deleted the stop-leak-emit-block-diagnostics branch July 12, 2026 14:10
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