refactor: template 層の集約 — require-profile guard 統一 + safe-gh hook JSON の partial 化 (PR-4/4, Refs #189) - #193
Merged
Merged
Conversation
…rd 統一 + safe-gh hook JSON の partial 化 (Refs #189) ultracode 監査の CONFIRMED 所見 2 件 (template)。render 出力は両 profile とも byte-identical (検証は PR 本文)。 - capability-lookup 前文の綴りを正規化: 二重 index (index (index .profiles .profile) "capabilities") を単一 index に 統一 (3 template)。guard 無しだった 4 template の先頭に require-profile include を追加 (unknown profile の nil-index panic を可読 fail に。 require-profile は全 action trim 付き fail-only で出力 0 byte)。 private_dot_ssh/config.tmpl のみ左 trim 無しの {{ template }} 形 (直前がリテラルのコメント行で {{- だと改行を食い 1 byte 変わる) - safe-gh PreToolUse hook の JSON block (#137/#181 parity 対) を .chezmoitemplates/safe-gh-hook-json の dict 引数 partial に集約。 差分 3 点 (agentDir path / timeout 有無 / 末尾カンマ) は dict 引数と caller 側で表現し、片側だけ直す事故の温床を解消。partial は末尾 改行なし・末尾カンマなしで出力し caller が所有 (byte-identity の要) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n
Owner
Author
Codex 相互レビュー結果(author=Claude → reviewer=Codex)
判定: ✅ merge 可(must 0 件) — should 0 / nit 0 重点観点の検証結果(Codex 出力より):
author 側検証: 両 profile 全 managed target の baseline diff -r 一致 / 全 16 suite green(hook exact pin・#185 parse-safety 含む)。 |
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.
Refs #189 の PR-4/4(最終)。ultracode 監査 CONFIRMED 所見(template ×2)。
変更内容(render byte-identical)
index (index .profiles .profile) "capabilities")を単一 index に正規化(dot_claude/settings.json.tmpl / dot_codex/hooks.json.tmpl / dot_codex/rules/default.rules.tmpl)require-profileinclude を追加(unknown profile 時の nil-index panic → 可読 fail。到達可能なのは template 単独評価時のみで、通常経路は .chezmoiignore の require-profile が先に fail するため実挙動不変){{ template ... -}}(左 trim 無し)。直前がリテラルのコメント行で、{{-だと直前の改行を食って 1 byte 変わる(監査の検証フェーズで実在確認済みの落とし穴).chezmoitemplates/safe-gh-hook-json)挙動不変の検証(実施済み)
diff -r→ 完全一致(hooks block は personal の committed render に含まれるため partial 経路も byte 検証済み)レビュー観点
{{ "" }}アンカー / 末尾 trim comment / timeout の{{- if hasKey }})が byte-identity を壊さないか{{ template ... -}}(左 trim 無し)になっているか🤖 Generated with Claude Code
https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n