Skip to content

feat: add edit-issue tests directory coverage to python-test-plan (#1303) - #1307

Merged
squne121 merged 3 commits into
mainfrom
worktree-issue-1303-edit-issue-tests-coverage
Jul 3, 2026
Merged

squne121 merged 3 commits into
mainfrom
worktree-issue-1303-edit-issue-tests-coverage

Conversation

@squne121

@squne121 squne121 commented Jul 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

背景

PR #1301 は required CI の python-test / node-backed-hook-tests が ci_test_selection/v1 artifact generation で Changed tests: 1, Uncovered tests: 1(.claude/skills/edit-issue/tests/test_edit_issue_txn.py)を検出し fail していた。python-test-plan の target をディレクトリ単位に寄せることで、同ディレクトリ配下の新規テストが自動的に coverage に入るようにする。

Allowed Paths 遵守

検証コマンド結果

Issue #1303 の Verification Commands を worktree 内で実行し、全 5 件とも成功したことを確認した。

  • AC1(targets への追加確認): uv run --locked pytest scripts/ci/tests -k python_test_plan を実行し、53 件成功、91 件は対象外として除外された。
  • AC2(ディレクトリ target の存在確認): rg -n '"\.claude/skills/edit-issue/tests/",' .github/ci/python-test-plan.json を実行し、10 行目で一致を確認した。
  • AC3(ci_test_selection 関連テストの確認): uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests -k ci_test_selection を実行し、15 件成功した。
  • AC4(artifact generator テストの確認): uv run --locked pytest .claude/skills/pr-review-judge/tests/test_generate_ci_test_selection_artifact.py を実行し、5 件成功した。
  • AC5(fail-closed policy 維持の確認): uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests .claude/skills/pr-review-judge/tests を実行し、342 件すべて成功した。

補足として、Issue 本文に記載された追加確認コマンドも実行し、以下を確認した。

  • python3 scripts/ci/python_test_plan.py --emit run-argv --mode parallel --format lines の出力に .claude/skills/edit-issue/tests/ が含まれていることを確認した。
  • python3 scripts/ci/python_test_plan.py --emit scope-argv --check-paths --format json を実行し、全パスの存在確認が成功した。

受け入れ条件の達成状況

  • AC1: targets に .claude/skills/edit-issue/tests/ を追加した。
  • AC2: 個別 target 2 件をディレクトリ target に置換し、重複を解消した。
  • AC3: parallel run argv にディレクトリ target が含まれることを確認した。
  • AC4・AC5: fail-closed policy と node-backed hook split policy はいずれも緩和していない。

Notes

)

Replace the two individual edit-issue/tests file targets with the directory
target so newly added tests in that directory (e.g. test_edit_issue_txn.py
from PR #1301 / Issue #1287) are covered by the python-test lane and the
ci_test_selection/v1 artifact without requiring a plan edit per new file.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

github-actions Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1307 closed).

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

判定

APPROVE。 Issue #1303 の Allowed Paths(.github/ci/python-test-plan.json のみ)を厳守した最小の CI plan 修正であり、5 件の Acceptance Criteria をすべて満たしている。

Evidence Check

Blockers

なし。

Non-blockers

  • 本 PR は PR #1301(Issue #1287)を unblock するための先行 PR であり、Draft のまま維持する。ready 化・merge は人間判断を待つ。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "b05c15bfed4d87d0bd02cd8a32a75a3569ae8f7b"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "DRAFT"
blockers: []
allowed_paths_gate:
  status: ok
allowed_paths_gate_source: review_subagent
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []

@squne121

squne121 commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

結論

BLOCKERなし。APPROVE相当。ただし、PR #1307 は Draft のままなので、merge-ready ではなく「人間が Ready 化して merge → PR #1301 を update/rebase → CI 再実行」が正しい順序です。

PR #1307 の実変更は .github/ci/python-test-plan.json だけで、個別 target 2件を削除し、.claude/skills/edit-issue/tests/ ディレクトリ target に置換しています。差分は Issue #1303 の Allowed Paths と一致し、追加3行・削除3行・変更ファイル1件の最小修正です。

敵対的レビュー結果

1. PR #1301 unblock の機構は妥当

PR #1301 は .claude/skills/edit-issue/tests/test_edit_issue_txn.py を追加しており、PR #1307 はこのファイルを含むディレクトリ全体を python-test-plan の target に入れる修正です。PR #1303 の目的も、PR #1301 の ci_test_selection/v1 uncovered changed test blocker を解消することに限定されています。

外部仕様上も、pytest はコマンドライン引数としてディレクトリ・ファイル・node id の組み合わせを受け取り、ディレクトリ内の test_*.py / *_test.py を再帰収集します。したがって、個別ファイル列挙からディレクトリ target に寄せる判断は pytest の通常仕様に沿っています。(pytest)

2. python-test と ci_test_selection の drift は増えていない

このリポジトリでは、python-test の実行対象と ci_test_selection/v1 artifact の pytest_argv が同じ python-test-plan.json loader から生成される設計です。loader は scope_argv / run_argv を生成し、構造・重複・path hygiene・parallel_exclude の整合を fail-closed に検証します。

CI workflow 側も、parallel pytest 実行前に loader を独立コマンドで実行し、空 argv や loader failure を即 fail にしています。これは今回の directory target 化によって壊れていません。

3. node-backed-hook-tests 側の uncovered 判定にも効く

重要なのは、PR #1301 の blocker が python-test だけでなく node-backed-hook-tests でも出ていた点です。node-backed job は hook nodeid 2件だけを明示的に pytest_args として渡しますが、同時に plan=".github/ci/python-test-plan.json" も渡しているため、generator は plan targets を secondary coverage として扱えます。

generator 側では、changed test が現在 job の collected files に存在しない場合でも、plan target の path prefix に含まれていれば cross_job_covered_test_files として扱い、uncovered_changed_test_files から除外します。今回の .claude/skills/edit-issue/tests/ target はこの prefix 判定に正しく乗ります。

4. fail-closed policy は緩和されていない

generate_ci_test_selection_artifact.py は collection failure と diff failure を明示的に CI failure にし、uncovered が残る場合だけ exit 1 を返す構造です。今回のPRはこのロジックを変更していません。

また、python-test-plan.json の ignore / deselect / parallel_exclude / secondary_coverage の既存構造も維持されています。追加されたのは target 置換と notes の説明のみです。

残るリスク・改善要求

Non-blocker 1: regression が恒久テストに落ちていない

PR本文では rg による AC2 確認を実施していますが、scripts/ci/tests/test_python_test_plan.py には「.claude/skills/edit-issue/tests/ が exactly once」「旧個別 target 2件が存在しない」を固定する専用テストはありません。既存テストは real plan の schema、schemas/tests、Codex lane、path existence などを見ていますが、今回の edit-issue directory coverage 自体は恒久回帰テスト化されていません。

ただし Issue #1303 の Allowed Paths は .github/ci/python-test-plan.json のみなので、このPRでテスト追加を要求するとスコープ違反になります。後続Issueにするのが妥当です。

追加するなら以下の2テストです。

def test_real_plan_includes_edit_issue_tests_directory_once():
    plan = mod.load_plan(_PLAN_PATH)
    assert plan["targets"].count(".claude/skills/edit-issue/tests/") == 1
    assert mod.scope_argv(plan).count(".claude/skills/edit-issue/tests/") == 1


def test_real_plan_does_not_duplicate_edit_issue_individual_targets():
    plan = mod.load_plan(_PLAN_PATH)
    assert ".claude/skills/edit-issue/tests/test_guard_issue_body.py" not in plan["targets"]
    assert ".claude/skills/edit-issue/tests/test_issue_contract_hygiene_autofix.py" not in plan["targets"]

Non-blocker 2: directory target は将来の blast radius を広げる

今回の修正は「今後 edit-issue/tests に追加されるテストを自動で python-test lane に入れる」ため、目的には合っています。一方で、将来このディレクトリに非 hermetic、Node 依存、実 GitHub API 依存、時間依存のテストを置くと、python-test lane に自動混入します。

pytest-xdist の --dist loadscope は module/class 単位で同一 worker にまとめるため、fixture reuse には向きますが、非 hermetic な副作用を隔離する仕組みではありません。(pytest-xdist)

対策は、.claude/skills/edit-issue/tests/ 配下は pure pytest / hermetic unit test のみという運用を明文化し、例外が必要なら parallel_exclude または dedicated lane を別Issueで設計することです。

Non-blocker 3: PR #1301 はまだ unblock 済みではない

PR #1307 の head では ci workflow が success していますが、PR #1301 の現 head では ci workflow が failure のままです。これは PR #1307 がまだ Draft/open で main に入っていないためで、矛盾ではありません。

順序は固定すべきです。

  1. PR feat: add edit-issue tests directory coverage to python-test-plan (#1303) #1307 を Ready 化して merge
  2. PR feat: add edit-issue transaction helper (#1287) #1301 を update branch / rebase
  3. PR feat: add edit-issue transaction helper (#1287) #1301 の python-test / node-backed-hook-tests を再実行
  4. ci_test_selection/v1 の uncovered_changed_test_files: [] を確認

Non-blocker 4: Preview URL コメントはCI専用PRではノイズ

PR #1307 に Pages preview コメントが付いていますが、今回の変更は CI plan JSON のみで、runtime / hosted asset の検証対象ではありません。コメント自体も asset-level live check 未検証と明記しています。

blocker ではありませんが、CI-only / docs-only / agent-only PR では preview publish comment を抑止するか、runtime_verification: not_applicable のときは “N/A” 表示に寄せた方がレビューの認知負荷が下がります。

関連PR/Issueとの整合

PR #1307 は、#1287 / PR #1301 の実装内容には触れていません。これは Issue #1303 の Out of Scope と一致しています。

また、#1287 の前提だった controlled metadata executor は PR #1295 で merge 済み、raw issue metadata mutation の local main guard 側の一本化も PR #1298 で merge 済みです。したがって、#1307 の役割は「実装PRの中身を評価する」ことではなく、「その実装PRで追加された test file が CI selection に漏れないよう plan SSOT を更新する」ことに限定されます。

推奨判定

verdict: APPROVE
merge_ready: false
reason: "Draft PR のため。技術的 blocker はなし"
blockers: []
non_blockers:
  - "edit-issue directory coverage の恒久回帰テストを後続Issue化"
  - "将来の非hermetic test混入を防ぐため edit-issue/tests のlane policyを明文化"
  - "PR #1307 merge後に PR #1301 を update/rebase して ci_test_selection artifact を再確認"
  - "CI-only PR では Pages preview comment を抑止または N/A 化"
required_next_action:
  - "PR #1307 を Ready 化して merge"
  - "PR #1301 を update branch / rebase"
  - "PR #1301 の python-test と node-backed-hook-tests を再実行"

ローカルでの pytest 再実行はしていません。確認したのは GitHub 上のPR/Issue/差分/コメント/レビュー/関連PR/Workflow conclusion と、pytest・pytest-xdist の公式仕様です。

@squne121
squne121 marked this pull request as ready for review July 3, 2026 16:53
@squne121
squne121 merged commit 6caa608 into main Jul 3, 2026
18 checks passed
@squne121
squne121 deleted the worktree-issue-1303-edit-issue-tests-coverage branch July 3, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: python-test-plan に edit-issue tests directory coverage を追加する

1 participant