feat: git hook gates の配線 — hooksPath shim + core.hooksPath include (Closes #196) - #197
Merged
Conversation
…efs #196) commit 境界の git hook gates (agent-tools#202 で実体 merge 済み) の dotfiles 側 配線。実体 = agent-tools・配線 = dotfiles の既存分界に従う。 - 新 capability enableGitHookGates (personal=true / work=false) + 新 module git-hook-gates。dispatcher は gate 欠損時 fail-closed (exit 2) なので、 agent-tools 未配備のマシンに配ると commit が止まる → work は false。 - shim 2 本 (~/.config/git-hook-gates/hooks/{pre-commit,commit-msg}) は薄い exec のみ。~/.claude 側 deploy を指す (dotfiles 裁定・両 home 同一 byte)。 - core.hooksPath は dot_gitconfig の無条件 [include] → managed hooks.gitconfig で設定 (signing.gitconfig と同型: missing なら git が無視)。 - gate は template 自己 gate (false は空 render → prune)。requires だと fail-closed な shim が残置される (#184 教訓)。 - 置き場は ~/.config/git 配下にしない: git-signing off の profile で chezmoiignore が subtree ごと落とし gate が黙って消えるため (実測)。 - doctor: 配線 chain (shim/hooksPath/dispatcher) を report-only 監視。 「配線済み + dispatcher 不在 = commit 停止」を最も強く warn。 - preflight: apply 前に dispatcher 不在と既存 core.hooksPath を warn。 - test-git-hook-gates.sh: render exact pin + rendered ~/.gitconfig で実 commit を通す end-to-end (両 stage 到達 / fail-closed / --no-verify bypass) + cap-off の真の削除 + git-signing 独立性。CI 配線済み。 - docs: git-hook-gates.md (配線側の正本・強度ラベル・既知の限界) + config-ownership 表 + README 行。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n
Owner
Author
🔍 レビュー依頼(→ Codex)
|
…197 Codex must 対応) - must-1: 配線 render を 2 段 gate に — enableGitHookGates (intent) AND destination に agent-tools 配備 3 本が完全存在 (readiness、 .chezmoitemplates/git-hook-gates-armed が destDir を probe)。新規マシンは apply しても武装せず brick しない。sync 後の再 apply で武装、配備消失は 次の apply で可視に解除。 - must-2: doctor / preflight の readiness 判定を dispatcher 1 本から 3 本 (dispatcher + public-safety-gate + ai-trailer-gate) に拡張。partial deploy が武装しないことを test で pin。 - should-1: doctor の cap=false 分岐に残置配線 (shim / hooksPath) の検出を追加。 - should-2: preflight の core.hooksPath warn を「managed 値と一致なら ok・ 別値のみ warn」に変更 (ノイズ抑制)。 - test: bare / partial deploy の非武装 pin + full deploy fixture 化。 docs / modules / profiles コメントを 2 段 gate に追従。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n
Owner
Author
📋 レビュー結果(by Codex)+ 対応(8dd7f9a)初回判定: ⛔ 要対応(must 2 件) → 全件対応し push 済み。再レビューを依頼します。 🔴 must(2 件・対応済み)
🟡 should(2 件・対応済み)
検証
|
- must (GHG-READY-EXEC): probe が presence のみで doctor/preflight の -x 判定と 不整合 — 0644 dispatcher で「preflight は非武装と報告するのに apply が武装」 し commit が止まる。probe を「regular file かつ owner-exec bit」(stat の type/perm、owner-exec = perm/64 mod 2) に強化し、非実行 dispatcher fixture の 非武装をテストで pin。 - should (GHG-DOCTOR-PARTIAL): deploy+wiring とも不完全な分岐の断定を避け 「stage-dependent or blocked」に (partial apply の診断精度)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n
Owner
Author
📋 再レビュー結果(by Codex)+ 対応(17d11a8)再レビュー判定: ⛔ 要対応(must 1 件・新規) → 対応し push 済み。must 対応の確認再レビューを依頼します。 🔴 must(1 件・対応済み)
🟡 should(1 件・対応済み)
検証
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n
Owner
Author
📋 増分再レビュー結果(by Codex)判定: ✅ merge 可(must 0 件) — GHG-READY-EXEC(probe の -x 強化)・GHG-DOCTOR-PARTIAL とも解消確認済み。Codex は div/mod 式の 0755→真 / 0644→偽 も独立確認。 🟡 should 1 件(docs/git-hook-gates.md の readiness 表現を「3 本すべてが regular file かつ実行可能」に)→ 採用・対応済み(最新 commit)。 CI green を確認して merge します。merge 後に実機 apply + smoke(#196 のチェックリスト)を実施して issue に記録します。 |
4 tasks
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.
概要
commit 境界の git hook gates(agent-tools#202 で実体 merge・両 home 配備済み)の dotfiles 側配線(Closes #196)。実体 = agent-tools・配線 = dotfiles の既存分界に従う。契約の正本は agent-tools の
docs/git-hook-gates.md。変更内容
enableGitHookGates(personal=true / work=false)+ 新 modulegit-hook-gates。dispatcher は gate 欠損時 fail-closed(exit 2)で commit を止めるため、agent-tools 未配備のマシン(work)には配らない(issue の「配布条件に注意」への対応)。~/.config/git-hook-gates/hooks/{pre-commit,commit-msg}: 薄い exec のみ(ロジックなし)。$HOME/.claude側 deploy を指す(dotfiles 裁定。両 home 同一 byte 配備のため機能差なし・$HOMEは sh が実行時展開)。dot_gitconfig(意図的 plain・全 profile 共有)に無条件[include]を追加し、実体hooks.gitconfig(capability-gated)がcore.hooksPath = ~/.config/git-hook-gates/hooksを設定。signing.gitconfig と同型(missing include は git が無視)。requires不使用): false は空 render → chezmoi が既存 target も削除。requires だと fail-closed な shim が残置され commit が止まり続ける(codex-settings: user 層 hooks.json で personal-safe-gh-hook を Codex 活性化 (#181) #184 教訓)。docs/git-hook-gates.md(配線側の正本: 構成 / fail-closed 配布条件 / 置き場所の理由 / 強度ラベル / 既知の限界 = husky 等の repo-local hooksPath・--no-verify・別 client)+ config-ownership 表 1 行 + README 行。設計判断(レビュー観点)
~/.config/git/hooksにしなかった:.config/gitは git-signing module の宣言 path で、enableGitSigning=falseの profile では chezmoiignore が dir subtree ごと管理から外す(throwaway render で実測)。gate をその下に置くと signing off だけで commit gate が黙って消える(安全機構の silent fail-open)→ 独立 dir で交差を断ち、test で placement を pin。~は git が展開(core.hooksPath は pathname 型・実測済み)。render に実 home path を焼かない。.gitconfigも変わる(plain file 共有のため include 行が増える)が、include 先が work では管理されず missing → git が無視 = 挙動不変。会社 Mac は次回 pull + apply で無害に追従。検証
test-git-hook-gates.sh(CI 配線済み): render exact pin(shim 2 本 + hooks.gitconfig の byte 一致・実行 bit・sh -n)/ end-to-end(rendered~/.gitconfig+ fake dispatcher で実 commit → 両 stage 到達・fail-closed で block・--no-verifybypass)/ cap-off が既存配線を真に削除 /enableGitSigning=falseで gate が消えないこと残リスク
🤖 Generated with Claude Code
https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n