Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "1059"
goal_ref: "python-test を Python-only lane として成立させ、PR #1121 / Issue #1061 の fresh runner blocker を AC1/AC2 を破らずに解消する"
change_kind: workflowParent Issue
Parent Goal Ref
CI python-test の直列構造を解消し、test lane を分離・pytest を統合・Ruff を導入・ci-test-performance Skill を追加することで、AI エージェントが CI 高速化判断を再現可能に実行できる状態にする。
Current Validated Scope
- PR chore(ci): remove python-test pnpm bootstrap #1121 は
python-testからsetup-node-pnpmとpnpm install --frozen-lockfileを削除し、Allowed Paths 内 4 ファイルの同期まで完了している - review loop の
python-testCI failure は fresh runner 上の Node-backed hook tests がajv/ajv-formatsなどの Node dependency を解決できないことに起因している python-testは Python-only lane に寄せたい一方、現行 workflow では.claude/hooks/tests/の一部が Node-backed producer を起動しており lane contract と矛盾している- owner comment
#issuecomment-4762273843では、Node-backed hook tests の対象 nodeid、移動先 job、python-test 側の除外方法、ci_test_selection/v1整合、baseline inventory の扱いを契約へ明文化するよう求めている
Remaining Parent Gaps
- Ruff fast-static lane 導入(実装: Python fast-static lane に Ruff を fast fail-fast gate として導入する #1063)
- pytest invocation 統合と pytest-xdist 導入(実装: pytest target plan を SSOT 化し serial→xdist 段階移行と ci_test_selection fail-close 化を行う(python-test 並列化 migration) #1064)
ci_runtime_baseline_v1の before/after 定量比較
Outcome
python-testが Node/pnpm bootstrap なしの fresh runner で green になり、Node-backed hook tests は明示された nodeid 単位で Node-backed lane へ再分類され、docs / skill / baseline inventory の post-change 状態が同期された状態
In Scope
python-testから除外する Node-backed hook test の対象を、少なくとも以下の nodeid 単位で固定する.claude/hooks/tests/test_generate_session_manifest_from_hook.py::test_wrapper_stdout_is_silent_and_artifact_path_is_overridable.claude/hooks/tests/test_generate_session_manifest_from_hook.py::test_wrapper_stderr_redacts_posix_windows_and_wsl_paths
python-test側では Python-only hook tests を維持したまま、上記 nodeid だけを deselect する.github/workflows/ci.ymlに Node/pnpm が利用可能な Node-backed hook test 用 job または同等の dedicated step を追加し、上記 nodeid を継続実行するci_test_selection/v1を引き続き生成する場合は、python-test 側 deselection と Node-backed hook test 側 selection を workflow 上の evidence と整合させるdocs/dev/test-lane-policy.mdに Node-backed hook tests の分類ルールを追加する.claude/skills/ci-test-performance/SKILL.mdに同じ lane 分類ルールと reviewer / worker 向け判断基準を反映する- 新 job や新 stable phase_id を追加する場合は
docs/dev/ci-performance.mdの job inventory / phase inventory / hotspot 説明を post-change 状態へ同期する - PR chore(ci): remove python-test pnpm bootstrap #1121 の blocker 解消に必要な
BLOCKER_DECISION_V1とCI_TEST_PERFORMANCE_DECISION_V1の最小証跡を PR または Issue / PR comment に残す
Out of Scope
python-testへsetup-node-pnpmまたはpnpm install --frozen-lockfileを戻すこと.claude/hooks/tests/test_generate_session_manifest_from_hook.py、.claude/hooks/generate_session_manifest_from_hook.mjs、scripts/generate-session-manifest.mjs、scripts/lib/agent-session-manifest-validation.mjsのロジック変更package.json/pnpm-lock.yamlの依存関係変更- Ruff 導入
- pytest-xdist 導入
- CI 全体の大規模再設計
Acceptance Criteria
- AC1:
python-testjob はsetup-node-pnpmとpnpm install --frozen-lockfileを実行しないこと - AC2:
python-testは.claude/hooks/tests/の Python-only hook tests を継続実行しつつ、Node-backed hook test nodeid は実行しないこと - AC3: 以下の Node-backed hook test nodeid が
python-testから除外されていること.claude/hooks/tests/test_generate_session_manifest_from_hook.py::test_wrapper_stdout_is_silent_and_artifact_path_is_overridable.claude/hooks/tests/test_generate_session_manifest_from_hook.py::test_wrapper_stderr_redacts_posix_windows_and_wsl_paths
- AC4: Node-backed hook test nodeid は Node/pnpm が利用可能な dedicated job または同等の dedicated step で継続実行されること
- AC5:
docs/dev/test-lane-policy.mdに Node-backed hook tests の分類ルールが明記されていること - AC6:
.claude/skills/ci-test-performance/SKILL.mdに同じ判断ルールが反映されていること - AC7: 新 job または新 stable phase_id を追加する場合、
docs/dev/ci-performance.mdの job / phase inventory が同期されていること - AC8:
ci_test_selection/v1を引き続き生成する場合、python-test 側 deselection と Node-backed 側 selection が workflow 上の evidence と整合していること - AC9:
pnpm typecheckが exit 0 を返すこと - AC10:
pnpm lintが exit 0 を返すこと - AC11:
pnpm testが exit 0 を返すこと - AC12:
pnpm buildが exit 0 を返すこと - AC13: PR chore(ci): remove python-test pnpm bootstrap #1121 または follow-up PR の required CI が green であること
- AC14: PR chore(ci): remove python-test pnpm bootstrap #1121 または follow-up PR comment に
BLOCKER_DECISION_V1とCI_TEST_PERFORMANCE_DECISION_V1が記録されていること
Verification Commands
# AC1
$ rg -n -U -L 'python-test:\n(?:.*\n){0,20}setup-node-pnpm' .github/workflows/ci.yml# AC2
$ rg -n -U 'python-test:\n(?:.*\n){0,120}\.claude/hooks/tests/' .github/workflows/ci.yml# AC3
$ rg -n -U 'python-test:\n(?:.*\n){0,160}test_generate_session_manifest_from_hook\.py::test_wrapper_stdout_is_silent_and_artifact_path_is_overridable' .github/workflows/ci.yml# AC4
$ rg -n 'node-backed-hook-tests' .github/workflows/ci.yml# AC5
$ rg -n 'Node-backed hook tests' docs/dev/test-lane-policy.md# AC6
$ rg -n 'Node-backed hook tests' .claude/skills/ci-test-performance/SKILL.md# AC7
# baseline-expect: pass
$ rg -n 'python-test' docs/dev/ci-performance.md# AC8
# baseline-expect: pass
$ rg -n 'ci_test_selection' .github/workflows/ci.yml# AC9
$ pnpm typecheck# AC10
$ pnpm lint# AC11
$ pnpm test# AC12
$ pnpm build# AC13
# preflight-scope: pr_review_only
$ gh pr checks 1121# AC14
# preflight-scope: pr_review_only
$ gh pr view 1121 --json bodyAllowed Paths
.github/workflows/ci.ymldocs/dev/ci-performance.mddocs/dev/test-lane-policy.md.claude/skills/ci-test-performance/SKILL.md
Runtime Verification Applicability
decision: not_applicable
classification: not_applicable
reason: CI workflow / lane classification / docs / skill contract change であり、ブラウザやアプリ実行による runtime verification を要求しない
required_evidence: []Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
python-testに Node/pnpm bootstrap を戻さないと green にできないと判明した場合- Node-backed hook tests の分離に
.claude/hooks/**やscripts/**のロジック変更が必要になった場合 ci_test_selection/v1の整合を current Allowed Paths 内で表現できないと判明した場合- 新 job 新設に伴う baseline inventory 同期を
docs/dev/ci-performance.mdのみで完結できないと判明した場合 - 既存の
python-testから Python-only hook tests まで消えると判明した場合 - 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- GitHub Actions YAML
- CI lane classification
Delivery Rule
1 Issue = 1 PR。既存 PR #1121 の blocker 解消に必要な最小修正のみを扱う。python-test へ Node/pnpm bootstrap を戻さずに解決できる範囲を優先し、必要証跡として BLOCKER_DECISION_V1 と CI_TEST_PERFORMANCE_DECISION_V1 を PR または Issue / PR comment に残す。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jun 21, 2026
判定
#1123 は 必要な follow-up です。ただし、現状の Issue 契約のまま実装すると、PR #1121 の
python-testfailure は解消できても、ci_test_selection/v1・hook test discovery・CI runtime baseline の整合性を壊す可能性が高いです。実装前に Node-backed hook tests の対象 nodeid、移動先 job、python-test 側の除外方法、artifact/baseline の扱いを明文化した方が安全です。#1123 自体はコメント 0 件で、Issue 本文がほぼ唯一の契約です。
確認した事実
#1123 の目的は、PR #1121 / Issue #1061 で
python-testから Node/pnpm bootstrap を外した後、fresh runner 上で Node-backed hook tests がajv/ajv-formatsを解決できず落ちる問題を、python-testに Node/pnpm を戻さずに解消することです。Issue はsetup-node-pnpm/pnpm installをpython-testに戻すこと、hook producer / validator / package dependency の変更、Ruff / xdist 導入を明確に Out of Scope にしています。PR #1121 は実際に
python-testからsetup-node-pnpmとpnpm install --frozen-lockfileを削除していますが、同じ job 内で.claude/hooks/tests/全体をまだ実行しています。 PR review ではpytest hook tests (timed)が落ち、.claude/hooks/tests/test_generate_session_manifest_from_hook.py:63の artifact 未生成 assertion が blocker とされています。根本原因はかなり明確です。該当 test は
node .claude/hooks/generate_session_manifest_from_hook.mjsを起動し、artifact が生成されることを検証しています。 その wrapper はscripts/generate-session-manifest.mjsを呼び出し、さらに validator はajv/dist/2020.jsとajv-formatsを動的 import します。依存が無い場合は validator がprocess.exit(1)します。 wrapper 側は producer failure でも exit 0 にする best-effort 設計なので、returncode ではなく「artifact が無い」ことで test が落ちる構造です。また、
setup-node-pnpmcomposite action は pnpm と Node.js と pnpm cache を設定するだけで、run_install: falseです。つまり Node-backed job を新設するならpnpm install --frozen-lockfileは別途必要です。 公式actions/setup-nodeも cache は global package data であり、node_modulesは cache しないと明記しています。([GitHub]1)敵対的レビュー指摘
1. 「Node-backed hook tests」の粒度が粗い
#1123 は
.claude/hooks/tests/の一部が Node-backed と書いていますが、AC/VC では どの test nodeid を移すのかが固定されていません。最低限、以下は Node-backed として明示すべきです。pytest は
path::test_funcの nodeid 指定や-kexpression による選択が可能なので、test file を編集せずに workflow 側で対象を分離できます。([pytest]2)2.
.claude/hooks/tests/全体を移すのは過剰全部を Node-backed lane に移すと、Python-only hook tests まで
python-testから消えます。#1123 の goal は「Python-only lane を成立させる」ことであり、「hook tests を python-test から全撤去する」ことではありません。推奨は、
python-test側を次のように Node-backed test だけ deselect する構成です。uv run --locked pytest .claude/hooks/tests/ -q \ --ignore=.claude/hooks/tests/test_secret_boundary_contract.py \ -k "not (test_wrapper_stdout_is_silent_and_artifact_path_is_overridable or test_wrapper_stderr_redacts_posix_windows_and_wsl_paths)"3. hook test discovery check が false blocker になり得る
workflow には
.claude/hooks/tests/配下の test discovery を検証する step があり、test_secret_boundary_contract.py以外が collect されることを期待しています。 Node-backed tests を「実行対象から除外」するだけなら collect 自体は残せますが、.claude/hooks/tests/glob を丸ごと消す実装だとこの discovery check の意味が崩れます。#1123 の AC にはこの整合性確認が不足しています。4.
ci_test_selection/v1がまた嘘になるPR #1121 head では
ci_test_selection/v1のpytest_argsに.claude/hooks/tests/がそのまま入っています。python-test側で-k not (...)を入れるなら、artifact 生成側のpytest_argsも同じ selection を表現しないと、#1059 系で既に問題視された「実行対象と artifact の drift」が増えます。schemas/tests/drift は #1064 scope のままでよいですが、#1123 が新たに作る drift は #1123 で潰すべきです。5. docs/skill は “integration” に雑分類しない方がよい
現行
docs/dev/test-lane-policy.mdはpython_unitを外部依存なし、integrationを Node.js / browser 依存として定義しています。 Node-backed hook tests はブラウザ統合ではなく、Python pytest が Node producer を起動する contract/hook verificationです。integrationに入れるより、contract_artifactの下位分類としてnode_backed_hook_testsを定義する方が運用上明確です。6. 新 job を作るなら ci-performance inventory も更新が必要
docs/dev/ci-performance.mdの job 定義は現在typecheck / lint / test / build / e2e / python-test / actionlint前提で、phase table もpnpm_installにpython-testを含めています。 #1123 でnode-backed-hook-testsのような新 job を追加するなら、jobフィールド定義、phase_id、計測対象を更新しないと baseline artifact が stale になります。GitHub Actions では workflow に複数 job を定義でき、依存が必要な場合は
jobs.<job_id>.needsを使います。([GitHub Docs]3) GitHub-hosted runner は job を実行する machine で、標準 runner は新しい VM として提供されます。([GitHub Docs]4) したがって、別 job に分離するなら Node/pnpm と uv の setup はその job 内で自己完結させる必要があります。推奨する修正方針
#1123 は「実装可」ですが、Issue 契約を次のように補強してから走らせるべきです。
python-testはsetup-node-pnpm/pnpm installなしを維持する。python-testの hook pytest は Node-backed 2 nodeid だけ-k not (...)で除外する。node-backed-hook-testsを追加し、setup-node-pnpm、pnpm install --frozen-lockfile、setup-python-uv、uv sync --locked --group devの後に上記 2 nodeid を実行する。ci_test_selection/v1には、python-test側の deselection と Node-backed job 側の selected nodeids を表現する。docs/dev/test-lane-policy.mdと.claude/skills/ci-test-performance/SKILL.mdにnode_backed_hook_tests分類を追加する。docs/dev/ci-performance.mdに新 job / phase inventory を追加する。pytest_node_backed_hooksのような stable phase_id を切る。BLOCKER_DECISION_V1とTEST_VERDICT_MACHINE_V1を追加し、「実装: python-test lane から Node-backed hook tests を分離する #1123 follow-up で解消した blocker」として head SHA 付きで証跡を残す。追加すべき AC
結論
#1123 の方向性は正しいです。
python-testに Node/pnpm を戻すべきではありません。ただし、現契約は「Node-backed hook tests を別 lane へ移す」という意図だけで、実際に CI 証跡を壊さず分離するための粒度が足りません。実装前に、nodeid 単位の分離、
ci_test_selection/v1同期、新 job の baseline inventory、docs/skill の hybrid lane 定義を AC に追加してください。これを入れないと、PR #1121 の blocker を解消したように見えて、次の review loop で artifact drift / discovery drift / baseline stale を食らう可能性が高いです。squne121 commentedon Jun 21, 2026
Contract Review Result
fix(ci): split node-backed hook tests (#1123)
fix(ci): harden split test evidence (#1123)
fix(ci): ignore collect-only summary lines (#1123)
chore(ci): remove python-test pnpm bootstrap (#1121)