refactor: runtime scripts の重複集約 + dead code 除去 (PR-1/4, Refs #189) - #190
Merged
Conversation
ultracode 監査 (5 レンズ + 敵対検証) の CONFIRMED 所見のうち runtime 系 5 件を実施。挙動不変が不変条件 (検証は PR 本文)。 - file_mode() を lib-policy.sh へ集約: private-backup.sh の定義 / preflight.sh のインライン再実装 / test-private-backup.sh の mode_of() の 3 重複を解消 (stderr 抑止と unknown fallback は call site に残し 出力 byte 不変) - doctor.sh / preflight.sh で byte-identical だった policy ゲートと standard project roots ループを run_policy_validation / report_standard_project_roots として lib-policy.sh へ (section 見出し と exit path は call site に残す) - validate-policy.sh の sort|uniq -d 重複検出ループ x5 を fail_duplicates ヘルパへ (メッセージ prefix は逐語維持・status の 立ち方も同値) - manager_present() を install-packages.sh から lib-policy.sh へ移動し、 report_catalog_drift の have_* 判定と一本化 (source→manager 対応表の 単一 source 化。probe の実行コマンド・回数・順序は不変) - dead 関数 catalog_source_preference() を削除 (全 git リビジョンで 呼び出しゼロ。packages.yaml の source_preference キーは human-facing advisory として残置) 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 出力より):
補足: Codex 環境は read-only sandbox のため実テスト再実行は不可(bash -n と diff/参照解析は実施)。author 側で全テスト green・render byte-identical・旧新実出力 diff 一致を検証済み。 |
…r の shellcheck 更新で顕在化 main にも存在した既存警告 (backup-paths 行の field 分割 placeholder が 未使用) だが、runner 側 shellcheck の更新で validate job が新規 push を 一律 fail するようになったため本 PR で解消する。underscore prefix は SC2034 の intentionally-unused 慣用形で、read の field 分割位置は不変 (挙動不変)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n
Owner
Author
Codex 増分レビュー(SC2034 修正 commit)CI runner の shellcheck 更新で main 由来の既存 SC2034 が validate job を fail させるようになったため、 判定: merge 可 — 「変数名変更のみ。 CI: validate / render とも green。 |
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-1/4。ultracode 監査(5 レンズ Find → 敵対 Verify、REFUTED 0)の CONFIRMED 所見のうち runtime scripts 系 5 件を実施する。
変更内容(すべて挙動不変)
file_mode()を lib-policy.sh へ集約(3 重複解消)mode_of()を単一定義に。preflight は2>/dev/null || echo unknownを call site に残すので出力 byte 不変。run_policy_validation(section "policy"と|| exit 1は call site に残す = report-only 契約の唯一の非 zero path を関数に吸わせない)report_standard_project_roots(directory convention(~/src/agent)と実 checkout(~/dev)の乖離を解消する #134 の「missing root は neutral」の正本が 1 箇所に)sort | uniq -d重複検出ループ ×5 をfail_duplicatesに集約"duplicate capability in $profile: "等)。helper || status=1形で status の単調更新も同値。manager_present()を install-packages.sh → lib-policy.sh へ移動し、report_catalog_driftのhave_*判定と一本化command -v)の実行コマンド・回数・順序は不変。移動と置換は同一 commit で原子的に実施(test-policy の drift harness は lib 単独 source のため)。catalog_source_preference()を削除git grepを全リビジョンに対して実行し、導入 commit 以来呼び出しゼロを確認済み。repo 現在形でも参照は定義行のみ。packages.yamlのsource_preferenceキーは「advisory only(人間向け)」のコメント付き意図的データなので残置。挙動不変の検証(実施済み)
bash -n/shellcheck -S warning: green(validate-policy.sh の SC2034 1 件は main でも出る既存件 = ローカル shellcheck 0.11.0 と CI の版差。本 PR では増減なし)diff -r→ 一致(scripts/ は .chezmoiignore 対象なので構造的にも不変)doctor.sh/preflight.sh× personal / work を実行し stdout+stderr を diff → 環境由来の差分(worktree path 表示・npm probe の実行時刻)以外は byte-identical。exit code も全一致(rc=0)レビュー観点(お願いしたいこと)
set -e/|| status=1/ condition 文脈)で旧コードと等価か🤖 Generated with Claude Code
https://claude.ai/code/session_016qw8BkUDu5WdwhYfiFFX5n