Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: parent
goal_ref: "CI python-test の直列構造を解消し、test lane を分離・pytest を統合・Ruff を導入・ci-test-performance Skill を追加することで、AI エージェントが CI 高速化判断を再現可能に実行できる状態にする"
change_kind: ci-optimization
parent_mode: delivery-rollup
closure_mode: child-completeSummary
CI の python-test job が直列構造で遅い。pytest を何度も起動し pnpm を不要にセットアップしている問題を解消する。また、テスト高速化の判断をエージェントスキルとして永続化し、今後の AI エージェント運用でも同じ判断を再現可能にする。
Goal
docs/dev/test-lane-policy.md と .claude/skills/ci-test-performance/SKILL.md が追加され、python-test job に 4 レーン分類ポリシー(fast-static / python-unit / contract-artifact / integration)が導入され、CI の Python test の wall-clock が短縮したことが ci_runtime_baseline_v1 artifact の比較で確認できる状態になること。
Outcome
全 child issue (#1060/#1061/#1063/#1064) がマージ済みとなり、python-test CI job が pnpm セットアップ不要・Ruff fast-static 検査付き・pytest 統合 invocation(pytest-xdist)で動作し、ci_runtime_baseline_v1 の before/after 比較で python-test job 内の pytest 実行 phase(pytest_parallel_ms + pytest_serial_ms) の wall-clock 短縮が確認できる状態になること。
- 本 Outcome は 実装: pytest target plan を SSOT 化し serial→xdist 段階移行と ci_test_selection fail-close 化を行う(python-test 並列化 migration) #1064 の既存実装(pytest 部分時間のみ計測)と整合させるため、pytest 実行 phase のスコープに明確化する(OWNER anchor comment P0-2 の案A採用)。
python-testjob 全体(Node.js セットアップ / Codex CLI 導入 / Codex 実行 / 別 pytest invocation 等を含む区間)の wall-clock 短縮は本 Outcome のスコープ外であり、Remaining Parent Gaps に follow-up 候補として記録する。- タイトルは pytest 実行 phase のスコープを厳密に反映していないが、title の変更は edit-issue の
title_update(別 routing、本更新のスコープ外)で扱う。
Desired Destination
docs/dev/test-lane-policy.md: 4 lane 分類ポリシーと lane 判断マトリクスが docs 化される.claude/skills/ci-test-performance/SKILL.md: AI エージェントが CI runtime artifact を読んで hotspot 分類・高速化判断を再現可能に実行できる.github/workflows/ci.yml:python-testが pnpm セットアップ不要・pytest 統合・Ruff fast-static lane 付きの構造になるpyproject.toml/uv.lock:ruffとpytest-xdistが dev dependency に追加される.github/ci/python-test-plan.json: pytest 実行対象・--ignore/--deselect・worker 数・scheduler を集約する SSOT として存在するci_test_selection/v1artifact: 実際の pytest 実行対象と artifact のpytest_argsが一致する(schemas/tests/の artifact 登録漏れ解消)
Current Validated Scope
ChatGPT による事前分析(2026-06-21)で確認済みの問題点:
python-testはsetup-node-pnpm+pnpm installを実行するが Python test lane では pnpm 不使用- pytest が 10 回以上の step に分割され uv run / collection の固定費を毎回払っている
ci_test_selection/v1のpytest_argsと実際の pytest 実行対象がズレている(schemas/tests/は既に CI で実行されているが artifact 登録が漏れている)pytest-xdistは未導入- Python 静的検査に Ruff(Rust 製、10〜100倍高速)を使っていない
Decisions Fixed
- 2026-06-21: pytest の全面置換はしない。pytest に載せる必要がない静的チェックを分離するアプローチを採用
- 2026-06-21:
python-testから pnpm セットアップを削除する(Python test lane では pnpm 不使用のため) - 2026-06-21: Ruff を pytest 前段の fast fail-fast gate として導入する
- 2026-06-21: テスト高速化判断を
.claude/skills/ci-test-performance/SKILL.mdとしてエージェントスキル化する - 2026-06-21: 「4 lane 設計」は物理 job/step 分離ではなく分類ポリシー導入。workflow 上では Ruff fast-static step と pytest unified step に反映する
- 2026-07-25: OWNER anchor comment(REQUEST_CHANGES、下記参照)を受け、AC2 のスコープを「pytest 実行 phase」に限定する案A を採用する(既存実装 実装: pytest target plan を SSOT 化し serial→xdist 段階移行と ci_test_selection fail-close 化を行う(python-test 並列化 migration) #1064/PR 実装: python-test を pytest-xdist 並列化(plan SSOT / serial 統合 / generator fail-close)(#1064) #1151 が pytest 部分時間のみ実装しているため、案B の job 全体計測は follow-up 候補として別途記録する)
- 2026-07-25: 親 AC1 の Closure Rule を、child issue の
state/closedAtのみの検証から「merged PR / merge commit ancestry / required paths 存在」を組み合わせた検証へ強化する
Quality Decision Record
Status: N/ADecision Date: 未記録Does this prove the parent goal complete?: N/AReason: delivery-rollup parent のため quality-gate 判定不要Evidence: N/ANext Action: OWNER anchor comment(https://github.com/squne121/loop-protocol/issues/1059#issuecomment-5078655505)の P0 blocker 解消状況を確認してから close 判定を再実施する
Parent Closure Rule
delivery-rollup: 以下の全 child issue が、単なるstate: CLOSEDではなく次の 5 条件をすべて満たしたとき close する(child issue のstate/closedAtのみによる判定は不可)- Issue を close した PR が
merged == trueであること - その PR の merge commit が現行
mainの ancestor であること - child ごとの required paths が現行
mainに存在すること - 可能な範囲で child の最終 AC を現行
mainに対して再検証し、drift がないこと - Issue の close reason が
completedであること(not_planned等は false positive として除外する。系譜内の実例: 実装: .claude/agents/implementation-worker.md / pr-reviewer.md / test-runner.md に ci-test-performance routing 契約を追記する #1097 はnot_plannedでクローズされている)
- Issue を close した PR が
child_delivery:
- issue: 1060
merged_pr: 1078
required_paths:
- docs/dev/test-lane-policy.md
- .claude/skills/ci-test-performance/SKILL.md
- issue: 1061
merged_pr: 1121
required_paths:
- .github/workflows/ci.yml
- docs/dev/ci-performance.md
- issue: 1063
merged_pr: 1129
required_paths:
- pyproject.toml
- issue: 1064
merged_pr: 1151
required_paths:
- .github/ci/python-test-plan.json
- .github/workflows/ci.ymlChild Issues
- 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060 実装: CI test lane policy docs と ci-test-performance skill を追加する
- 実装: python-test から setup-node-pnpm と pnpm install を削除する #1061 実装: python-test から setup-node-pnpm と pnpm install を削除する
- 実装: Python fast-static lane に Ruff を fast fail-fast gate として導入する #1063 実装: Python fast-static lane に Ruff を fast fail-fast gate として導入する
- 実装: pytest target plan を SSOT 化し serial→xdist 段階移行と ci_test_selection fail-close 化を行う(python-test 並列化 migration) #1064 実装: pytest invocation を統合し pytest-xdist を導入、ci_test_selection に schemas/tests/ を追加する
Remaining Parent Gaps
- CI runtime baseline の定量比較(wall-clock before/after)は最終 child PR 時点で実施
ci_runtime_baseline_v1artifact の集約方式変更(並列化対応)は child 4 の scope に含める- 将来的な
ripgrepprefilter + Python verifier 分離は本 parent の scope 外 - [follow-up 候補・未起票]
python_test_job_total_ms(Node.js セットアップ〜Codex CLI 導入〜Codex 実行〜追加 pytest invocation を含む区間の wall-clock、同一 runner cohort で base/head 各20 run 比較)の計測・比較は本 parent の AC2 スコープ外。OWNER anchor comment の案B相当。別 Issue 化を検討する - OWNER anchor comment(https://github.com/squne121/loop-protocol/issues/1059#issuecomment-5078655505)に記載された non-blocking hardening 項目(P1/P2、いずれも本 parent の AC 化は不要だが記録として残す):
python-testjob への Node/Codex 関連ステップ再混入により「Python-only lane」設計境界が事実上崩れている可能性(P0-3 相当、hardening 扱い)- 全 Python test file を漏れなく分類する inventory gate の欠如(新規 test file が plan 未登録のまま長期間 CI 対象外になり得る)
ignore/deselectが Issue 番号・owner・期限なしの恒久 quarantine になり得るpython_test_planの一部フィールド(secondary_coverage等)が fail-closed 検証対象外- Ruff 設定が
pyproject.tomlと workflow CLI オプションに分散し SSOT でない ci_runtime_baseline_v1artifact の upload がif-no-files-found: warn(親 AC2 必須証跡としては fail-open)- pytest scheduler(
loadscope)選定根拠のベンチマーク cohort が GitHub-hosted runner 上で完結していない - benchmark-sensitive workflow の Action 参照が major tag 固定であり、full commit SHA pinning ではない(fact-check 済み: SHA pinning は GitHub が repository 単位で任意に有効化できる推奨設定であり、全リポジトリへの全面的な強制ポリシーではない)
- 実装: python-test を pytest-xdist 並列化(plan SSOT / serial 統合 / generator fail-close)(#1064) #1151(self-authored PR、review subagent 不使用)の独立レビュー証跡が相対的に弱い
Phase Handoff Contract
Desired Destination: 上記参照Current Validated Scope: 上記参照Remaining Parent Gaps: 上記参照Allowed Paths: child issue ごとに個別指定(本 parent は paths を持たない)Required Skills: GitHub Actions YAML / Python packaging (pyproject.toml / uv) / Ruff / pytest-xdistStop Conditions: 標準 6 項目(各 child に記載)Next Action: OWNER anchor comment の P0 blocker(Closure Rule 強化・AC2 スコープ明確化)解消状況を確認してから close 判定を再実施する
Allowed Paths
本 parent issue は Allowed Paths を持たない。各 child issue ごとに個別指定する。
Acceptance Criteria
- AC1: 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060/実装: python-test から setup-node-pnpm と pnpm install を削除する #1061/実装: Python fast-static lane に Ruff を fast fail-fast gate として導入する #1063/実装: pytest target plan を SSOT 化し serial→xdist 段階移行と ci_test_selection fail-close 化を行う(python-test 並列化 migration) #1064 の全 child issue について、(a) close した PR が
merged == trueであること (b) その merge commit が現行mainの ancestor であること (c) child ごとの required paths(Parent Closure Rule のchild_delivery参照)が現行mainに存在すること (d) close reason がcompletedであることを組み合わせて検証すること - AC2:
ci_runtime_baseline_v1で python-test job 内の pytest 実行 phase(pytest_parallel_ms + pytest_serial_ms)の wall-clock が短縮していること(child 4 PR に添付)。python-test job 全体の wall-clock 短縮は本 AC のスコープ外(Remaining Parent Gaps の follow-up 候補を参照) - AC3:
pnpm typecheck/pnpm test/pnpm buildが通ること(2026-07-26 aa07986 で再検証済み。closure verification comment 参照)
Verification Commands
AC1 の検証は (a)(b)(d) 「merged / merge commit ancestry / close reason」と (c) 「required paths 存在」の 2 グループに分け、各コマンドは単一 shell 呼び出しに限定する(&& 等の compound shell operator は使わない)。
# AC1
# baseline-expect: pass
$ gh api graphql -F n=1060 -f query='query($n:Int!){repository(owner:"squne121",name:"loop-protocol"){issue(number:$n){stateReason closedByPullRequestsReferences(first:5){nodes{number merged mergeCommit{oid}}}}}}'
# baseline-expect: pass
$ gh api graphql -F n=1061 -f query='query($n:Int!){repository(owner:"squne121",name:"loop-protocol"){issue(number:$n){stateReason closedByPullRequestsReferences(first:5){nodes{number merged mergeCommit{oid}}}}}}'
# baseline-expect: pass
$ gh api graphql -F n=1063 -f query='query($n:Int!){repository(owner:"squne121",name:"loop-protocol"){issue(number:$n){stateReason closedByPullRequestsReferences(first:5){nodes{number merged mergeCommit{oid}}}}}}'
# baseline-expect: pass
$ gh api graphql -F n=1064 -f query='query($n:Int!){repository(owner:"squne121",name:"loop-protocol"){issue(number:$n){stateReason closedByPullRequestsReferences(first:5){nodes{number merged mergeCommit{oid}}}}}}'
# baseline-expect: pass
$ git merge-base --is-ancestor 7b8167774a16d5506dbb88670f3b68b75b22053a HEAD
# baseline-expect: pass
$ git merge-base --is-ancestor db86c058f2c18d4c9abeb06f074ed814fcfc44ec HEAD
# baseline-expect: pass
$ git merge-base --is-ancestor f2ee8f662add514fe531fcc1a2bad81405c62f97 HEAD
# baseline-expect: pass
$ git merge-base --is-ancestor 54858e277144d670eb2b24a1f96d82515f295c87 HEAD
# baseline-expect: pass
$ test -f docs/dev/test-lane-policy.md
# baseline-expect: pass
$ test -f .claude/skills/ci-test-performance/SKILL.md
# baseline-expect: pass
$ test -f .github/workflows/ci.yml
# baseline-expect: pass
$ test -f docs/dev/ci-performance.md
# baseline-expect: pass
$ test -f pyproject.toml
# baseline-expect: pass
$ test -f .github/ci/python-test-plan.json
# AC2
# baseline-expect: pass
$ gh issue view 1064 --repo squne121/loop-protocol --json closedAt --jq '.closedAt'
# AC3
# baseline-expect: pass
$ pnpm typecheck
# baseline-expect: pass
$ pnpm test
# baseline-expect: pass
$ pnpm buildNotes
schemas/tests/は現行python-testで既に実行済み。問題は「実行漏れ」ではなく「ci_test_selection/v1artifact のpytest_argsから欠落しているズレ」であること(実装: pytest target plan を SSOT 化し serial→xdist 段階移行と ci_test_selection fail-close 化を行う(python-test 並列化 migration) #1064 scope)。pnpm_installphase を python-test から削除する場合はdocs/dev/ci-performance.mdの stable phase_id inventory も更新が必要(実装: python-test から setup-node-pnpm と pnpm install を削除する #1061 scope に含む)。- 本更新は OWNER anchor comment(https://github.com/squne121/loop-protocol/issues/1059#issuecomment-5078655505)の REQUEST_CHANGES 判定を受けたもの。P0-1(Closure Rule の false positive)と P0-2(AC2 のスコープ不一致)を本文へ反映した。P0-3/P0-4 および P1/P2 の hardening 項目は Remaining Parent Gaps に要約のみ記載し、AC 化は行っていない。個別対応が必要な場合は本 Issue の再レビュー時または follow-up Issue で扱う。
- 新規 Issue の起票は本更新では行っていない(follow-up 候補は Remaining Parent Gaps に記録のみ)。
- merge commit SHA の妥当性(40 hex 文字か)は再検証時に
git rev-parse --verify <sha>^{commit}等で個別に確認すること。
Activity
squne121 commentedon Jun 20, 2026
結論
#1059 は方向性としては妥当です。
python-testの Node/pnpm セットアップ削除、Ruff の fast-fail 導入、pytest 起動回数削減、ci_test_selectionの証跡整合は、いずれも CI 高速化として筋が通っています。ただし、このまま Claude Code / Codex CLI に実装させるのは危険です。Issue 本文と child issue の検証コマンド・Allowed Paths・既存 docs が食い違っており、実装後に「CI は変わったが baseline 証跡・artifact 契約・docs が嘘になる」リスクが高いです。
#1059 は open の parent tracker で、コメントは空です。materialize 済みの child は #1060 / #1061 / #1063 / #1064 の 4 件で、いずれも parent_issue
"1059"を持つ implementation issue です。#1059 系および child issue 側のコメントも空でした。敵対的レビュー指摘
1.
schemas/tests/は「実行漏れ」ではなく「artifact 登録漏れ」#1059/#1064 は
ci_test_selection/v1のpytest_argsにschemas/tests/が未登録だと述べています。これは正しいです。ただし、現行python-testは既にpytest schemas (timed)としてuv run --locked pytest schemas/tests/ -qを実行しています。つまり問題は「CI が schemas/tests を実行していない」ではなく、実行対象とci_test_selectionartifact の target list がズレていることです。この誤記を放置すると、#1064 の実装で
schemas/tests/を二重に実行する、または「実行対象追加」と「artifact 追記」を混同する可能性があります。#1064 は「実行対象へ追加」ではなく、ci_test_selection/v1生成ロジックを実行済み pytest target と一致させると書き換えるべきです。2. #1061 の Verification Commands は現状だと壊れています
#1061 は
python-testからsetup-node-pnpmとpnpm install --frozen-lockfileを削除する issue ですが、検証コマンドがrg -c "setup-node-pnpm" .github/workflows/ci.ymlとrg -c "pnpm install --frozen-lockfile" .github/workflows/ci.ymlになっています。これは python-test に scope されていないため、他 job のsetup-node-pnpm/pnpm installに反応します。現行 workflow では typecheck/test/build/e2e などが同じ文字列を使っており、global grep では AC を証明できません。検証は
python-testjob の YAML subtree だけを parse する必要があります。単純 grep を使うなら、少なくともpython-test:から次 job までを切り出して確認してください。より堅いのは PyYAML で.github/workflows/ci.yml["jobs"]["python-test"]["steps"]を検査する専用 one-liner です。3.
pnpm_installphase を消すならdocs/dev/ci-performance.mdも更新対象です#1061 は Allowed Paths を
.github/workflows/ci.ymlだけに限定しています。しかしdocs/dev/ci-performance.mdは stable phase_id としてpnpm_installをpython-test対象に含めています。python-testから pnpm install を削除すると、この docs は即座に stale になります。これは軽微なドキュメント漏れではありません。#1059 の parent goal は
ci_runtime_baseline_v1による before/after 比較なので、phase inventory が嘘になると高速化証跡の比較軸が壊れます。#1061 の Allowed Paths にdocs/dev/ci-performance.mdを追加するか、別 child issue を先に切って「python-test からpnpm_installphase を除外する migration」を明示すべきです。4. 「4 lane 設計」と child issue の実装範囲が一致していません
#1059 は
python-testを fast-static / python-unit / contract-artifact / integration の 4 lane 設計へ移行すると書いています。ところが child issues の実体は、#1060 が docs/skill 追加、#1061 が pnpm 削除、#1063 が Ruff 追加、#1064 が pytest 統合 + xdist + artifact target 修正です。これは 4 lane を物理的に job/step 分離する計画ではなく、分類ポリシーを導入する計画に見えます。ここは wording を直すべきです。物理分離するなら workflow design が不足しています。概念分類なら、#1059 の Goal は「4 lane policy / classification matrix」に落とし、「4 lane 設計へ移行」という表現を避けるべきです。
5.
ci_test_selectionは required evidence と optional evidence が矛盾していますdocs/dev/ci-operations.mdはpython-testをrequired + evidenceと分類し、agent merge-ready 条件としてe2e/python-testの required artifact availability を要求しています。一方、現行 workflow のci_test_selectionupload はif-no-files-found: ignoreです。docs 側の missing policy でもpython-testのci_test_selectionは optional evidence 扱いになっています。#1059 は
ci_test_selectionの正確性を改善対象に含めるなら、missing policy も決めるべきです。最低限、#1064 の PR 本文で「今回は target list の整合だけ。artifact missing を CI failure にするかは別 issue」と明記しないと、required/evidence の意味が曖昧なまま残ります。6. pytest-xdist は速くなる可能性があるが、無条件
-n autoは危険ですpytest-xdist 公式 docs は
pytest -n autoにより物理 CPU core 数ぶんの worker を使い、顕著な速度改善があり得ると説明しています。一方で、デフォルトの--dist loadは順序保証なしで worker に配布します。module/class 単位でまとめたい場合は--dist loadscope、file 単位なら--dist loadfileが用意されています。([pytest-xdist]1)さらに pytest-xdist には、worker 間で test order / amount が一致しないテストは扱えないという既知制限があります。unordered set を使った parametrization などは worker ごとに collection order が変わり得ます。(pytest-xdist)
#1064 の Stop Condition には「pytest-xdist 導入後に flake になる場合 Stop」とありますが、実装者にとっては遅すぎます。実装前に以下を AC 化してください。
uv run --locked pytest --collect-only -q <targets>の baseline と xdist 導入後の collect target 数が一致する-n 0または通常 pytest で統合 invocation が pass する-n autoを試す--dist=loadscope/--dist=loadfile/ sequential subset 分離のいずれかを PR 本文に明記する7. Ruff 導入は妥当。ただし「最小ルールセット」「no auto-fix」「exit code」を契約化すべきです
Ruff は Rust 製の Python linter / formatter で、既存 linter/formatter より 10〜100 倍高速と説明されています。
ruff checkはファイル・ディレクトリを再帰的に受け取れます。導入初期はselect = ["E", "F"]のような小さい rule set から始めることが推奨されています。([Astral Docs]3) ([Astral Docs]4)#1063 の方向性は正しいですが、CI gate としては次を明記してください。
--fixは CI では禁止、--exit-zeroも禁止です。Ruff は violation で exit 1、設定不備等で exit 2 になるため、fast-fail gate として使えます。([Astral Docs]4)8.
uvdependency group の追加方法は正しいが、AC はuv lockだけでは弱いです現行
pyproject.tomlの dev group はpytest>=8.0,pyyaml>=6.0,jsonschema>=4.0のみで、ruffとpytest-xdistは未登録です。uv 公式 docs では、development dependencies は local-only で
[project]ではなく[dependency-groups]に置かれ、uv add --dev pytestはdevgroup を作成・更新します。またdevgroup は既定でuv run/uv syncに含まれます。([Astral Docs]5)したがって #1063/#1064 は
pyproject.toml手編集 +uv lockでもよいですが、実装プロンプトでは以下を推奨します。AC は
rg -cだけでなく、実際にuv run --locked ruff --versionとuv run --locked pytest --version、必要ならuv run --locked pytest -n 0 --versionまで確認するべきです。修正すべき Issue 契約
#1059 parent
修正案:
4 lane 設計へ移行→4 lane classification policy を導入し、workflow 上では Ruff fast-static step と pytest unified step に反映するci_test_selection/v1の target list が actual pytest invocation と一致」を追加#1060
docs/skill 追加だけなら、Skill に current implementation と target design の区別を入れてください。まだ #1061/#1063/#1064 が未実装なのに、Skill が「Ruff lane あり」「pytest unified 済み」と読める形になると、後続エージェントが未実装仕様を現行仕様として扱います。
必須追記:
#1061
Allowed Paths に
docs/dev/ci-performance.mdを追加するか、別 child issue を作ってください。pnpm_installphase を python-test から消すのに docs を変えないのは、baseline artifact の比較可能性を壊します。検証コマンドは global grep ではなく、python-test job scope の YAML parse に変更してください。
#1063
Ruff step の contract は以下まで固定してください。
uv run --locked ruff check --select E,F ...--fix--exit-zero.claude/worktreesなどの巨大・派生領域を明示除外#1064
一番危険です。pytest target list を workflow 内に二重管理しているため、また同じ drift が起きます。
pytest invocationとci_test_selection/v1のpytest_argsは単一ソースから生成してください。最小案は
.github/workflows/ci.yml内で shell array / JSON heredoc を一度だけ定義し、それを pytest 実行と artifact generator の両方へ渡す形です。より堅い案はscripts/ci/python_test_targets.pyのような小スクリプトを作ることですが、その場合 #1064 の Allowed Paths を広げる必要があります。実装順の推奨
E,Fの fast-static gate を追加ci_runtime_baseline_v1の before/after を P50/P95 または 3-run bootstrap として PR body に貼るそのまま投げるなら、このプロンプト
現状判定は 実装着手前に Issue 契約修正が必要です。方向性は良いですが、今のまま進めると CI 高速化より先に証跡契約が壊れます。
squne121 commentedon Jun 20, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 25, 2026
判定
REQUEST_CHANGES。Issue #1059 は現時点ではクローズ不可です。
主要 child の実装自体は進んでいます。しかし親Issueの完了条件と Verification Commands が一致しておらず、現在の
mainも「Python-only lane」「pytest統合済み」「正本ドキュメントと実装が同期」という親ゴールから再び乖離しています。特に重大なのは、親AC2が「Python test の wall-clock短縮」を要求しているのに、実際の証跡が pytest部分だけの時間を測定している点です。また、AC1の「child issueがマージ済み」という条件を、単なるIssueの
closed状態で検証しているため、手動クローズやnot_plannedでも通過できます。実装上、評価できる部分
#1064で追加された以下の設計は妥当です。
--ignore、--deselect、worker数、schedulerを.github/ci/python-test-plan.jsonに集約したevalを使わず、NUL区切りargvを介して安全にworkflowへ渡したloadscopeに固定したuv run --lockedによりlockfile driftを拒否しているこれらは、pytest-xdistが全workerで同一のcollection順序・件数を要求することや、
-n autoが実行環境のCPU数に依存することを考えると、再現可能性の面で正しい方向です。 ([pytest-xdist]1)ただし、これらの強い基盤の上に、後続変更による契約driftが積み重なっています。
Blocker
P0-1. 親Issueのclose判定がfalse positiveを許す
親IssueのClosure Ruleは「#1060/#1061/#1063/#1064がすべてマージ済み」を要求しています。しかしVerification Commandsは各Issueの
stateやclosedAtしか確認していません。これは「実装PRがmainへマージされた」「期待した成果物がmainに存在する」を証明しません。実際、この系譜にある #1097 は、Claude Code向けroutingを追加するIssueとして作成されたものの、最終的には
state_reason: not_plannedでクローズされています。Issueのclosed状態だけを完了証拠に使えない実例です。改善案
親のclose verifierは、少なくとも次を検証すべきです。
検証は以下を組み合わせます。
merged == truecompleted親のcloseは「過去にchildが閉じたか」ではなく、現行mainが親ゴールの不変条件を満たすかで判定する必要があります。
P0-2. AC2は「Python test wall-clock短縮」を証明していない
親AC2は、
ci_runtime_baseline_v1により「Python test のwall-clockが短縮していること」を要求しています。ところが #1064 の比較式は、以下だけを合計しています。Codex CLI導入、Codex execpolicy、Ruff、uv環境構築、artifact生成、その他のPython関連処理は含まれていません。証跡上はpytest部分がP50で約221秒から約78秒へ短縮されていますが、これは pytest phaseの高速化であり、
python-testjob全体のwall-clock短縮ではありません。現在の
python-testには、pytest parallel/serial laneの後にNode.jsセットアップ、Codex CLIのnpm導入、Codex実行、別のpytest invocationが存在します。したがって、pytest部分が高速化していても、job全体が遅くなっている可能性を現在のAC2は検出できません。改善案
次のどちらかへ契約を明確化します。
案A:親ACを狭める
この場合、IssueタイトルとOutcomeも「Python test高速化」ではなく「pytest execution phase高速化」に修正します。
案B:本来の親ゴールを維持する
同一の以下のcohort fingerprintでbase/head各20 runを比較します。
最終判断には、pytest phaseとjob totalの両方を残すべきです。
P0-3. 「Python-only lane」「pytest統合済み」という不変条件が現在は成立していない
#1123は、#1061でNode/pnpmを削除した結果、Node-backed hook testsがfresh runnerで失敗したため、「
python-testをPython-only laneとして成立させる」目的で追加されています。しかし現在の
python-testには以下が再混入しています。actions/setup-node@v6これはpnpmの再導入ではありませんが、Python-only laneという設計境界は失われています。また「pytestをplan駆動の単一stepへ統合」という説明とも一致しません。
改善案
Codex関連を独立jobへ移します。
さらにworkflowをYAMLとして構造解析し、以下をfail-closeで固定します。
単純な
rg -c pytestではなく、YAML AST上のjobs.python-test.stepsを検査すべきです。P0-4. 正本ドキュメントとSkillが現行実装を誤って説明している
現行planは固定
workers: 4、dist: loadscopeです。ところがcanonical Skillは「pytest-xdist導入後の推奨」として-n auto --dist loadscopeを示し、別箇所でも「pytest -n autoを導入済み」と記述しています。-n autoは物理CPU数に依存するため、固定cohortでの性能比較方針とも矛盾します。 (pytest-xdist)docs/dev/test-lane-policy.mdとSkillは、次のような古い状態も残しています。python-testはNode/pnpmを使わない一方、#1080は既にcompletedで、現行
node-backed-hook-testsも当初の2 nodeid以外へ拡張されています。Claude Code agent向けの明示routingを扱った #1097 は
not_plannedで閉じられており、現行検索ではCI_SKILL_ROUTINGはCodex agent定義にしか確認できません。CodexのSkillは、最初に名前とdescriptionだけが読み込まれ、descriptionとの一致により暗黙選択されます。公式文書も、hooksは有用なguardrailではあるものの完全なenforcement boundaryではないと説明しています。したがって、staleなSkill本文・description・routingは単なる文書不備ではなく、エージェントが誤ったCI変更を行う運用障害です。 ([OpenAI Developers]2)
改善案
手作業で同期する方式を廃止し、次を追加します。
検証対象:
.claude/agentsと.codex/agentsのrouting方針「Target Policy」と「Current Implementation」は別の機械可読ブロックに分離すべきです。
High priority
P1-1. 手動test target allowlistでは全テスト収集を保証できない
現行planのnoteには、
tests/test_hook_boundaries_doc.pyが既に存在していたにもかかわらず、ファイルが変更されるまでplanへ登録されておらず、登録後に既存の失敗2件が露見したと記録されています。その2件は現在deselectされています。#1644でも、PRで追加されたtest fileをpython-test-planへ後追い登録する作業が必要になっています。同Issue自身もdirectory-wideの未分類Python test guardをスコープ外として残しています。
これは次の攻撃・故障経路を残します。
deselectで隔離されるpytest-xdistは各workerが全collectionを実行し、同一collectionを要求しますが、そもそもpytestへ渡していないファイルの存在は検出しません。 (pytest-xdist)
改善案
リポジトリ内の全Python testを分類するinventory gateを追加します。
すべてのtest fileが正確に1分類されることを検証します。
可能な箇所はファイル単位列挙ではなく、ディレクトリ単位targetへ移行します。個別ファイルtargetが必要な場合は、理由をmachine-readableに要求します。
P1-2.
ignore/deselectが恒久quarantineとして無期限化している現行planには以下があります。
特にhook-boundariesの2件は、noteに「follow-upで修正すべき」と書かれているだけで、Issue番号、owner、期限、解除条件がplan上にありません。
改善案
rawな
deselect: [string]を廃止し、次の形にします。validatorは以下を拒否します。
serial laneも単なる隔離ではなく、非hermeticな実装を直すための期限付きquarantineとして管理すべきです。
P1-3.
python_test_planのfail-closed保証が後付けフィールドへ及んでいない中央loaderの
load_plan()が厳格に検証しているのは、主に以下です。schema_versiontargetsignoredeselectparallel_excludexdist一方、後から追加された以下は同じ場所で検証されません。
secondary_coverageruntime_verification_only_markersnotesgenerate_ci_test_selection_artifact.pyはsecondary_coverageやruntime markerの読込エラーを文字列としてartifactに記録しますが、最終exit codeを決めるのはcollection、git diff、uncovered changed testsです。設定エラー自体は常にfatalではありません。テストも、secondary coverage metadataのエラーを「記録されること」として検証しており、無変更時にCI全体を落とす契約にはなっていません。つまり「planはfail-closed」という説明は、現在の全フィールドについては成立しません。
改善案
python_test_plan/v2をJSON Schema化します。{ "type": "object", "additionalProperties": false, "required": [ "schema_version", "targets", "ignore", "quarantines", "xdist", "secondary_coverage" ] }さらに以下を検証します。
provider_jobがworkflow内に実在するpyproject.tomlに登録されている#1724でも、cross-job coverageについてprovider側の実artifact・collected nodeid・head SHAを照合する仕組みが残余gapとして明示されています。
P1-4. Ruff設定がSSOT化されておらず、実装・Skill・docsがdriftしている
pyproject.tomlのRuff設定は主にline lengthのみで、実際のrule setである--select E,F --ignore E402と対象pathはworkflowのCLIへ埋め込まれています。Skill内にはruff check .や異なる例も残っています。Ruffは
pyproject.tomlのlint.select、lint.ignore、lint.per-file-ignoresを正本として利用できます。CLIオプションは設定をoverrideするため、現在の方式は文書・ローカル実行・CI間のdriftを作りやすい設計です。 ([Astral Docs]4)改善案
workflowは次の単純な呼出しにします。
E402を全領域でglobal ignoreするのではなく、本当にimport-order例外が必要なファイルへ限定すべきです。
P1-5. 親ACに必要なruntime artifactがfail-openでuploadされる
ci_runtime_baseline_v1のuploadはif-no-files-found: warnです。つまりartifact生成に失敗しても、upload step自体は警告で継続できます。親AC2の必須証拠として扱うなら不適切です。GitHub公式の
upload-artifactは、if-no-files-found: errorを指定すると該当ファイルがない場合にactionを失敗させられます。 (GitHub)改善案
通常PRでoptional artifactとする場合と、性能判定runを分離します。
artifactの存在だけでなく、最低サンプル数、run ID重複、runner cohort、phaseの完全性も検証対象にします。
Medium priority hardening
P2-1. scheduler選定証拠のcohortが弱い
loadscope、load、workstealの比較はWSL2上の各3 runで行われ、その後のbase/head 20 runは採用schedulerだけをGitHub-hosted runner上で測っています。fixture再利用の説明は合理的ですが、「CI runnerでも最適」という判断を直接実測したわけではありません。schedulerを選択する性能主張を行うなら、固定worker数・同一GitHub runner image上で候補を比較すべきです。ローカル比較を使う場合は「選択用heuristic」であり、CI性能証拠ではないと明記します。
P2-2. benchmark-sensitive workflowのAction参照をfull SHAへ固定する
現行workflowは
actions/checkout@v6、actions/setup-node@v6、actions/upload-artifact@v7のmajor tag参照です。major tagは運用上便利ですが、長期的なbenchmark再現性やsupply-chain境界ではfull commit SHA固定の方が強固です。GitHubはActions policyでfull-length commit SHAへの固定を要求でき、セキュリティ上もimmutableなSHA pinningを推奨しています。 ([GitHub Docs]6)
少なくとも性能baseline収集workflowでは、Action SHA、Codex package version、lockfile digestをcohort fingerprintへ含めるべきです。
P2-3. 高リスクなCI migrationに独立レビュー証拠が弱い
PR #1151の記録されたレビューでは、self-authored PRであり、review subagentが利用できなかったためcontrol-planeが手順を代行したと明記されています。また、20-run数値の妥当性は人間監査へ委ねられています。
これは実装不良の直接証拠ではありませんが、CI coverage、性能数値、fail-close契約を同時に変更するPRとしては独立性が弱い状態です。将来は次のいずれかを要求すべきです。
親Issueの改訂Closure Contract案
#1059は、元の4 childを閉じるだけのdelivery-rollupではなく、current-state invariant parent に更新すべきです。
最終結論
#1059の中核実装、特にpytest plan SSOT、固定worker、lane union、collection/diffのfail-closeは高品質です。しかし親Issueとしては、次の3点が未解決です。
したがって、現時点の判定は REQUEST_CHANGES / keep open です。親本文を上記Closure Contractへ更新し、少なくともP0の4項目を解消してからclose判定を再実施すべきです。
squne121 commentedon Jul 25, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jul 25, 2026
判定
現行の #1059 契約を基準にすると、Closeのために新しい実装Issueを追加する必要はありません。
#1059 は、OWNERレビューのうちP0-1「child完了証明」とP0-2「性能指標のスコープ」を本文へ反映済みです。一方、Python-only境界、ドキュメント同期、test inventory、quarantine、Ruff SSOT、artifact fail-closeなどは、明示的に非ブロッキングのfollow-up候補へ降ろされています。
元のchild PRはすべてmerge済みです。
実装: CI test lane policy docs と ci-test-performance skill を追加する #1060 → PR feat(#1060): CI test lane policy docs と ci-test-performance skill を追加する #1078、merge commit
7b816777...実装: python-test から setup-node-pnpm と pnpm install を削除する #1061 → PR chore(ci): remove python-test pnpm bootstrap #1121、merge commit
db86c058...実装: Python fast-static lane に Ruff を fast fail-fast gate として導入する #1063 → PR ci: add Ruff fast-static gate before pytest #1129、merge commit
f2ee8f66...実装: pytest target plan を SSOT 化し serial→xdist 段階移行と ci_test_selection fail-close 化を行う(python-test 並列化 migration) #1064 → PR 実装: python-test を pytest-xdist 並列化(plan SSOT / serial 統合 / generator fail-close)(#1064) #1151、merge commit
54858e27...AC2のpytest実行phaseについても、同一runner imageでbase/head各20 runを比較し、P50は
221130.5 ms → 77882.0 ms、P95は228195.5 ms → 80564.4 msへ短縮した証跡があります。最新取得できたPR headのCIでは、
typecheck、test、build、python-testを含むciworkflowが成功しています。ただし、#1059の契約は「現行main」での確認を要求しているため、最終main SHAに対する証跡固定だけはClose前に再実行すべきです。Close前に必要な作業
これは新規Issueではなく、#1059自身への最終コメントとして実施するのが適切です。
併せてAC1~AC3のチェックボックスを更新し、close reasonを
completedにします。タイトルも実際の限定された性能主張に合わせ、次へ直すのが妥当です。Close後の後継Issue案
以下は**#1059のchildにはしない**でください。
parent_issue: none、related_issues: "#1059"とし、#1059のCloseを阻害しない独立follow-upにします。Issue案1: Codex runtimeを専用jobへ分離する
現行
python-testには、plan駆動pytestの後にactions/setup-node@v6、Codex execpolicy、Codex固有pytestが存在します。そのため、過去に成立させたPython-only境界と「plan駆動pytestのみ」という説明が現在は成立しません。タイトル
ci: Codex execpolicyを専用jobへ分離しpython-testのPython-only invariantを復元する
本文案
Current Validated Scope
python-testjobにはactions/setup-node@v6が存在する。.github/ci/python-test-plan.jsonのplan外で実行される。Outcome
python-testはPython、uv、Ruff、plan-driven parallel/serial pytestのみを実行する。codex-execpolicy専用jobへ移す。In Scope
.github/workflows/ci.ymlへのcodex-execpolicyjob追加scripts/ci/verify_python_test_lane.pyの追加docs/dev/ci-performance.mddocs/dev/test-lane-policy.md.claude/skills/ci-test-performance/SKILL.mdOut of Scope
python_test_planschema migrationAcceptance Criteria
jobs.python-test.stepsにactions/setup-node、setup-node-pnpmが存在しないpython-test内にnode、npm、pnpm、codexを起動するcommandが存在しないpython-test内のpytest実行はplan由来のparallel laneとserial laneのみであるcodex-execpolicyjobが既存execpolicy matrixとCodex固有pytestを実行するpnpm typecheck、pnpm lint、pnpm test、pnpm buildが成功するAllowed Paths
.github/workflows/ci.ymlscripts/ci/verify_python_test_lane.pyscripts/ci/tests/docs/dev/ci-performance.mddocs/dev/test-lane-policy.md.claude/skills/ci-test-performance/SKILL.mdRuntime Verification Applicability
Outcome
python_test_plan/v2をJSON Schemaで定義し、未知キー・型不一致・不正path・不正markerを拒否する。rawな恒久
deselectを、Issue、owner、reason、導入日、期限、解除条件を持つ構造化quarantineへ移行する。In Scope
.github/ci/python-test-plan.schema.jsonの追加.github/ci/python-test-plan.jsonのv2移行scripts/ci/python_test_plan.pyの全フィールド検証対応Quarantine Contract
Acceptance Criteria
additionalProperties: falseであるsecondary_coverageとruntime_verification_only_markersの構造エラーが常にfatalになるignoreと、失敗test隔離用quarantineが区別されるOut of Scope
Allowed Paths
.github/ci/python-test-plan.json.github/ci/python-test-plan.schema.jsonscripts/ci/python_test_plan.pyscripts/ci/tests/.claude/skills/pr-review-judge/scripts/generate_ci_test_selection_artifact.py.claude/skills/pr-review-judge/scripts/tests/docs/dev/test-lane-policy.md.claude/skills/ci-test-performance/SKILL.mdCurrent Validated Scope
secondary_coverage.dedicated_lanesはprovider jobの実行artifactを検証せず、宣言を信頼している。Outcome
Classifications
In Scope
scripts/ci/verify_python_test_inventory.pyci-test-coverage-gatejobsecondary_coverageconsumer更新Acceptance Criteria
**/test_*.pyおよび**/*_test.pyを規定された除外領域以外から列挙するhead_sha、run_id、run_attempt、provider_job、collected files/nodeidsを持つhead_shaが対象PR headと一致しない場合に拒否するsecondary_coverage宣言pathがprovider artifactで実際にcollectされていることを検証するci-test-coverage-gateが成功するOut of Scope
Allowed Paths
.github/workflows/ci.yml.github/ci/python-test-plan.jsonscripts/ci/verify_python_test_inventory.pyscripts/ci/tests/.claude/skills/pr-review-judge/scripts/generate_ci_test_selection_artifact.py.claude/skills/pr-review-judge/scripts/tests/docs/dev/test-lane-policy.md.claude/skills/ci-test-performance/SKILL.mdOutcome
pyproject.tomlへ集約する。ruff checkcommandにする。verify_ci_test_performance_contract.pyがworkflow、plan、docs、Skillのcurrent-state invariantを検証する。In Scope
[tool.ruff.lint]へのselect = ["E", "F"]E402ignoreの廃止または最小化per-file-ignoresscripts/ci/verify_ci_test_performance_contract.pyVerifier Scope
python-testとdedicated jobの構成Acceptance Criteria
pyproject.tomlに定義される--select E,Fやglobal--ignore E402を重複定義しないAllowed Paths
pyproject.toml.github/workflows/ci.ymlscripts/ci/verify_ci_test_performance_contract.pyscripts/ci/tests/docs/dev/ci-performance.mddocs/dev/test-lane-policy.md.claude/skills/ci-test-performance/SKILL.md.agents/skills/ci-test-performance/SKILL.mdCurrent Validated Scope
pytest_parallel_ms + pytest_serial_msに限定される。CI_TEST_PERFORMANCE_ASSESSMENT_V2のschema/validatorは存在するが、benchmark workflowへの配線は未実装。Outcome
python_test_job_total_msを測定する。CI_TEST_PERFORMANCE_ASSESSMENT_V2を生成・検証し、性能主張を機械判定する。Metric Boundary
Required Cohort Fingerprint
Acceptance Criteria
workflow_dispatchまたは明示inputが存在するtest -sとschema validatorを実行するif-no-files-found: errorであるCI_TEST_PERFORMANCE_ASSESSMENT_V2を既存validatorで検証するOut of Scope
CI_TEST_PERFORMANCE_ASSESSMENT_V2schemaの再設計Allowed Paths
.github/workflows/ci.yml.github/workflows/ci-python-test-benchmark.ymlscripts/ci/scripts/ci/tests/docs/dev/ci-performance.mddocs/dev/ci-runtime-baseline-*.md.claude/skills/ci-test-performance/SKILL.mdsqune121 commentedon Jul 25, 2026
Parent Closure Verification(control-plane 独立検証)
OWNER の判定(PARENT_CLOSURE_VERIFICATION_V1 案)を、以下すべて
git/ghの実コマンドで独立に再検証した。独立検証で見つかった軽微な訂正
OWNER 案の
closing_pr: 1121(issue 1061 向け)について、GitHub のclosingIssuesReferencesAPI は PR #1121 が自動的に close するのは #1123 のみであることを示している。#1061 は同一の merge commit (db86c058...) を参照して手動でcompletedclose されている。実質的な解消内容(same commit)は一致しており false positive ではないが、機械的な close-link だけに依拠する将来の自動検証ロジックでは、この「手動 close + 同一 commit 参照」パターンも正当な completion として扱えるようにする必要がある。結論
上記すべての項目を独立に確認し、
decision: close_readyを支持する。本 Issue をcompletedとして close する。[-]CI python-test 高速化: test lane 分離・pytest 統合・Ruff 導入・Skill 化[/-][+]CI python-test pytest実行phase高速化: test lane分類・pytest統合・Ruff導入・Skill化[/+]squne121 commentedon Jul 25, 2026
Parent Closure Verification 完了(control-plane独立検証済み、上記コメント参照)。全child mergeを確認し AC1-AC3 を満たしたためCloseする。