feat(post-merge-feedback): L2 recovery hook を実装 (ADR-030 Phase C)#80
feat(post-merge-feedback): L2 recovery hook を実装 (ADR-030 Phase C)#80
Conversation
…DR-030 Phase C)
`.claude/feedback-reports/*.md.failed` marker を検出した場合に additionalContext で
Claude に再実行を促す `hooks-user-prompt-feedback-recovery` exe を新規追加する。
主要変更:
- 新 crate `hooks-user-prompt-feedback-recovery` (workspace member, 11 unit tests)
- exit 0 を厳守 (UserPromptSubmit で exit 2 は prompt をブロックする)
- additionalContext は `[POST_MERGE_FEEDBACK_RECOVERY]` タグ + count + 各 marker の
絶対パスを PR 番号昇順で列挙
- `<pr>.md.failed` 形式以外のファイルは無視 (defensive)
- `package.json` の `build:all` / `scripts/deploy-hooks.ts` の `EXE_FILES` /
`.claude/settings.local.json.template` の UserPromptSubmit エントリを更新
- `cli-merge-pipeline` の `feedback::write_failed_marker` の marker 本文を更新:
- 未実装の `pnpm feedback-retry` への参照を削除
- `pnpm exec takt -w post-merge-feedback ...` の手動再実行手順 +
cross-PR overwrite 警告 (context.json の pr_number 確認) に差し替え
運用ルール (todo.md 冒頭): 完了タスクは ADR/仕組みに反映後、todo.md から削除する。 Phase C は実装され ADR-030 §L2 Recovery で記述済みのためエントリを除去する。 Phase E (旧機構廃止) と Phase F (dogfood 検証) は引き続き残す。
📝 WalkthroughWalkthrough新しい Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/cli-merge-pipeline/src/feedback.rs (1)
398-422: LGTM!復旧手順の文面更新は L2 recovery 設計と整合しています。手動再実行コマンド (
pnpm exec takt -w {TAKT_WORKFLOW} -t "{TAKT_TASK_PREFIX}{pr_number}") はrun_takt_workflow(Line 327-328) と同一パラメータで呼び出すため、再実行時に同じ run dir 命名規則が適用されます。cross-PR overwrite 警告も具体的な検証ポイント(pr_numberの一致確認)まで踏み込んでおり、運用上の落とし穴を適切にカバーしています。format! の
{}プレースホルダ 8 個と引数 8 個も一致しています。💡 任意の改善案
context.json が既に別 PR で上書きされていた場合、step 3 の手動再実行は別 PR の transcript range を使ってしまいます。「不一致を検出した場合の選択肢(context.json を当該 PR 用に書き直す or feedback を諦める)」を 1 行追記すると、運用時に迷わず判断できそうです。本 PR スコープ外でも問題ありません。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli-merge-pipeline/src/feedback.rs` around lines 398 - 422, Summary: No code change required—the formatted message uses eight `{}` placeholders matching eight arguments and the manual rerun command matches run_takt_workflow parameters. Action: Leave the block that builds body and writes the marker file as-is; verify that TAKT_WORKFLOW and TAKT_TASK_PREFIX constants and the call site run_takt_workflow still use the same parameters (see TAKT_WORKFLOW, TAKT_TASK_PREFIX, run_takt_workflow and the fs::write call) and then approve the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/cli-merge-pipeline/src/feedback.rs`:
- Around line 398-422: Summary: No code change required—the formatted message
uses eight `{}` placeholders matching eight arguments and the manual rerun
command matches run_takt_workflow parameters. Action: Leave the block that
builds body and writes the marker file as-is; verify that TAKT_WORKFLOW and
TAKT_TASK_PREFIX constants and the call site run_takt_workflow still use the
same parameters (see TAKT_WORKFLOW, TAKT_TASK_PREFIX, run_takt_workflow and the
fs::write call) and then approve the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 81650274-b8a8-49cf-9ba5-a17a953b3e49
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
.claude/settings.local.json.templateCargo.tomldocs/todo.mdpackage.jsonscripts/deploy-hooks.tssrc/cli-merge-pipeline/src/feedback.rssrc/hooks-user-prompt-feedback-recovery/Cargo.tomlsrc/hooks-user-prompt-feedback-recovery/src/main.rs
💤 Files with no reviewable changes (1)
- docs/todo.md
Summary
hooks-user-prompt-feedback-recovery) を新規追加し、.claude/feedback-reports/*.md.failedmarker を検出した場合に additionalContext で Claude に再実行を促す L2 recovery 経路 を実装主要変更
src/hooks-user-prompt-feedback-recovery/(workspace member, 11 unit tests, all green)[POST_MERGE_FEEDBACK_RECOVERY]タグ +count+ 各 marker の絶対パスを PR 番号昇順 で列挙 (Stop hook の[POST_MERGE_FEEDBACK_TRIGGER]と命名規約を統一)<pr>.md.failed形式以外のファイルは defensive に無視 (78.md成功レポート /readme.txt/not-a-pr.md.failedなどは skip)Cargo.tomlworkspace members /package.jsonbuild:all/scripts/deploy-hooks.tsEXE_FILES/.claude/settings.local.json.templateのUserPromptSubmitエントリcli-merge-pipeline::feedback::write_failed_markerの marker 本文を改修:pnpm feedback-retry参照を削除pnpm exec takt -w post-merge-feedback ...の手動再実行手順 + cross-PR overwrite 警告 (.takt/post-merge-feedback-context.jsonのpr_number一致確認) を追加docs/todo.mdの Phase C セクションを除去 (別 commit)Validation
cargo test -p hooks-user-prompt-feedback-recovery --release— 11 passed (parse / collect 4 ケース / format 3 ケース / serialize / 不正 stdin)cargo test --release -p cli-merge-pipeline— 44 passed (marker body 改修後リグレッションなし)cargo clippy -p hooks-user-prompt-feedback-recovery --release -- -D warnings— cleanpnpm build:all— 全 exe ビルド +.claude/配布成功9999.md.failed作成 → 正しい JSON (hookEventName/additionalContext/ 絶対パス) を出力 + exit 0pnpm push(pre-push-review takt workflow): security + simplicity 共に APPROVE in 1 iterationTest plan (Phase F dogfood)
<pr>.md.failed残存 → 次 prompt で UserPromptSubmit hook 発火 → additionalContext 出力 → Claude が手動再実行手順を実行できることを確認References
docs/adr/adr-030-deterministic-post-merge-feedback.md)docs/todo.md「マージ後フィードバック機構の決定論化 (ADR-030 起案 + 実装)」Summary by CodeRabbit
リリースノート
新機能
ドキュメント