refactor: テスト基盤の fixture 集約 — render/flip/repo-copy/fake-status を test-lib.sh へ (PR-2/4, Refs #189) - #191
Merged
Merged
Conversation
…t-lib.sh へ (Refs #189) ultracode 監査の CONFIRMED 所見 4 件 (test-infra 系) を実施。テストの assert 対象・出力・exit code は不変 (検証は PR 本文)。 - render_personal_into を test-lib.sh へ集約 (6 本に複製されていた throwaway chezmoi apply ヘルパ)。caller-creates-root 契約 (#150) に 統一したことで、claude/codex/git-signing の 3 本に残っていた command-substitution 起因の render root leak も解消 (helper 内の tmp_roots+= がサブシェルに閉じ cleanup trap から漏れていた) - make_flipped_source / flip_personal_capability を追加し「source copy + .git 除去 + personal capability flip」fixture x9 を置換 (yq の env(V) 代入はリテラル式と byte-identical を検証済み。boolean 専用と 明記。all-profile 版 set_capability_all とは契約が違うため統合しない) - copy_repo_fixture を追加し「scripts + .chezmoidata/*.yaml の最小 repo copy」fixture x8 を置換 (test-doctor 6 / test-preflight 1 / test-policy make_fixture は thin wrapper 化) - test-doctor.sh 内で 2 回逐語複製されていた root-pinning 契約付き fake status.sh を write_root_pinned_status_sh に集約 (JSON payload は逐語 移送・生成される status.sh の実行意味は不変) 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 側検証: 全 16 suite green / 影響 8 suite の旧新出力(rc+stdout+stderr)が timestamp 正規化後 byte-identical / render-root leak 修正を実測(新=追加ゼロ・旧=残留)。 |
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-2/4。ultracode 監査の CONFIRMED 所見のうちテスト基盤系 4 件を実施する。テストの assert 対象・出力・exit code は不変。
変更内容
render_personal_into SOURCE_DIR ROOTを test-lib.sh へ集約(6 本に複製されていた throwaway chezmoi apply ヘルパ)x="$(helper)"の command substitution 内でtmp_roots+=していたため cleanup trap から漏れ、実行のたびに render root が TMPDIR に残っていた(テストカバレッジ補強: npmrc rendered content / doctor npm・Corepack / preflight / zsh -n #150 と同一欠陥のコピー残存)。pass/fail には無影響。make_flipped_source/flip_personal_capabilityを追加し、「source 丸ごと copy + .git 除去 + personal 限定 capability flip」fixture ×9 を置換yqのenv(V)代入が現行リテラル式と profiles.yaml byte-identical であることは監査の検証フェーズで実測済み(true / false / 複合 flip の 3 ケース)。boolean 専用と明記。all-profile 版set_capability_allとは統合しない(fail-closed guard 込みの別契約で、test-policy.sh がその契約自体を pin している)。copy_repo_fixture DESTを追加し、「scripts + .chezmoidata/*.yaml の最小 repo copy」fixture ×8 を置換(機械置換でちょうど 8 hit を確認)。test-policy のmake_fixtureは名前・グローバル変数・cleanup 登録の契約を維持した thin wrapper に。write_root_pinned_status_sh DEST JSONに集約(payload は逐語移送・printf '%s\n'で quoted heredoc 内へ挿入・agent-tools の health 監視(doctor ↔ status.sh)を実運用で有効化する #73/agent-tools の presence/health を report-only で表示する check を追加する #71 の regression 説明は helper と call site のコメントに保持)挙動不変の検証(実施済み)
bash -n/shellcheck -S warning: 完全 cleanレビュー観点(お願いしたいこと)
$home等を参照)が EXIT まで維持されているかflip_personal_capabilityの yq 式(env(V))が boolean flip でリテラル式と等価であることwrite_root_pinned_status_shが生成する status.sh の実行意味(exit 1/3・ran-marker・JSON 1 行)が旧 heredoc と同一か🤖 Generated with Claude Code
https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n