Repository navigation
実装: ensure_contract_snapshot.py の materialized_go fingerprint PATCH regression test を追加する - #1568
Conversation
Preview URLPreview removed (PR #1568 closed). |
pr-review-judge REQUEST_CHANGES 対応。CI python-test job で AC1/AC3 の live test(実 gh API write を伴う)が gh 未認証環境で無条件に FAIL していた問題と、 Issue #1562 Notes for Reviewer が要求していた live-test deselect 機構の未実装 を解消する。pyproject.toml に github_live marker を登録し、既定 addopts に `-m 'not github_live'` を追加。明示的に `-m github_live` を指定すれば引き続き 実行され PASS することを確認済み(gh 認証済み環境で2件 PASS)。
Fix delta 対応完了(pr-review-judge REQUEST_CHANGES)pr-review-judge が指摘した2点を解消しました。head: 対応内容
Allowed Paths Scope Delta
検証結果
CI_TEST_PERFORMANCE_DECISION_V1CI_TEST_PERFORMANCE_DECISION_V1:
schema: CI_TEST_PERFORMANCE_DECISION_V1
issue_number: 1562
pr_number: 1568
decision_scope: dependency_change
changed_paths:
- "pyproject.toml"
- ".claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.py"
lane_classification:
fast_static:
applicable: false
evidence:
- "pyproject.toml の変更は [tool.pytest.ini_options] のみ(lint/typecheck 設定に影響しない)"
required_commands: []
python_unit:
applicable: true
evidence:
- "pyproject.toml の pytest 設定(marker/addopts)変更は python-test job の全 pytest 実行に影響する"
required_commands:
- "uv run --locked pytest .claude/skills/impl-review-loop/tests/ -q"
- "uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.py -m github_live -v"
contract_artifact:
applicable: false
evidence:
- "schema/contract ファイルの変更なし"
required_commands: []
integration:
applicable: false
evidence:
- "pnpm build / E2E に影響なし"
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
approve_denied_reason: null
follow_up_required:
- null |
pr-review-judge REQUEST_CHANGES 対応: github_live marker で default pytest
実行から意図的に除外された test file (gh CLI 未認証の CI 環境では構造的に
実行不可) を、G1 (ci_test_selection/v1) の uncovered_changed_test_files
から正しく除外できるようにする。
- .github/ci/python-test-plan.json に runtime_verification_only_markers
["github_live"] を追加する (secondary_coverage.dedicated_lanes とは意味が
異なるため流用しない: dedicated_lanes は実在する別 CI job によるカバレッジ
を宣言するが、github_live テストを実行する CI job は存在しない)。
- generate_ci_test_selection_artifact.py に
check_runtime_verification_only_coverage() を追加する。変更されたテスト
ファイルが default 収集で 0 件かつ marker 明示指定 (-m "github_live") の
収集で 1 件以上であることを、実際に pytest --collect-only を2回実行して
確認する (宣言だけでは判定しない、fail-closed を維持)。
- runtime_verification_only_test_files / runtime_verification_only_evidence
/ runtime_verification_only_markers を artifact に透明性フィールドとして
追加する。
- test_generate_ci_test_selection_fail_close.py に regression test を追加
する: 正当な例外の確認、既存の fail-closed 挙動 (markers があっても
genuinely uncovered なファイルは uncovered のまま) の回帰確認、markers
未設定時に例外機構が完全に無効なままであることの確認。
CI_TEST_PERFORMANCE_DECISION_V1:
schema: CI_TEST_PERFORMANCE_DECISION_V1
issue_number: 1562
pr_number: 1568
decision_scope: ci_change
changed_paths:
- .github/ci/python-test-plan.json
- .claude/skills/pr-review-judge/scripts/generate_ci_test_selection_artifact.py
- .claude/skills/pr-review-judge/scripts/tests/test_generate_ci_test_selection_fail_close.py
lane_classification:
fast_static:
applicable: false
evidence: []
required_commands: []
python_unit:
applicable: true
evidence:
- "uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests/ (95 passed)"
- "uv run --locked pytest .claude/skills/pr-review-judge/tests/ (95 passed)"
- "uv run --locked pytest scripts/ci/tests/ (170 passed, loader unaffected by new unknown top-level key)"
required_commands:
- "uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests/test_generate_ci_test_selection_fail_close.py"
contract_artifact:
applicable: true
evidence:
- "generate_ci_test_selection_artifact.py drives the ci_test_selection/v1 G1 gate consumed by python-test CI step"
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:
- "runtime_verification_only markers exemption only exempts files whose tests are provably reachable under the declared marker (double real pytest --collect-only probe); a misconfigured plan (wrong marker name) fails closed back to uncovered, never silently passes."
reviewer_gate:
approve_allowed: true
required_evidence:
- TEST_VERDICT_MACHINE
- CI_CHECK_RUN_SCOPED
follow_up_required: []
Fix delta(2回目): G1 ゲートの
|
PR repair executor 実施報告(implementation-worker, PR repair mode)pr-review-judge の REQUEST_CHANGES(2 blocker)に対応しました。 実施内容
結果
|
squne121
left a comment
There was a problem hiding this comment.
LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: "163d6f772ca31f627effb6982de8a0a8d747da39"
merge_ready: true
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "CLEAN"
blockers: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- ".claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.py"
- ".claude/skills/pr-review-judge/scripts/generate_ci_test_selection_artifact.py"
- ".claude/skills/pr-review-judge/scripts/tests/test_generate_ci_test_selection_fail_close.py"
- ".github/ci/python-test-plan.json"
- "pyproject.toml"
violations: []
producer_role: review_subagent
worker_report_used_as_canonical: false
contract_fingerprint:
contract_source_kind: issue_comment
contract_source_id: "5010104462"
contract_body_sha256: "sha256:dbc456d52b15f5dbca9b17b26b2f888d72ea8da14bccc0c70649241ece4f1ad0"
base_ref: main
base_sha_at_snapshot: "6cc00c58fa9c2690ac88f80012b74c0d33e62d30"
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []独立検証サマリー
- allowed_paths_gate:
ensure_contract_snapshot.py --mode auto(副作用なし)で fresh go snapshot(issue comment5010104462)のbody_sha256が Issue #1562 現行本文と完全一致することを再確認。allowed_paths_review_gate.pyを実行しstatus: ok, violations: []。 - CI:
ci_verdict_summary.py --expected-head-sha 163d6f77...でstatus: all_pass、failed_checks: []/pending_checks: []/stale_checks: []。python-testjob を含む全 required job がSUCCESS。 - AC coverage: PR本文
## 受け入れ条件の達成状況に AC1〜AC5 全件が[x]+ 根拠付きで記載。AC1/AC3 は disposable GitHub Issue(#1566/#1567)を用いた実 API live test で独立 readback 済み。 - Allowed Paths 遵守:
git diff --name-statusで変更5ファイルが Issue #1562 現行 Allowed Paths(6項目)に完全一致。scope creep なし。 - mergeability:
MERGEABLE/CLEAN(update_branch 実施済み)。
merge_ready: true。Draft PR のため人間の最終マージ判断を待ちます。
判定REQUEST_CHANGES — 現状はマージ阻害です。 対象は PR head 検証用に公式CI成果物から抽出した値を以下に固定しました。
1.
|
squne121
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES
Mergeability
- mergeable=MERGEABLE, merge_state_status=BEHIND
Evidence Check
- TEST_VERDICT_MACHINE は
f4f03d2f66e993676c51bc8b984dd12592e5345aに一致し、AC1〜AC5 は PASS、skip はありません。 - CI_CHECK_RUN_SCOPED は current HEAD で
all_passです。 - Allowed Paths gate は current HEAD で
okです。 - 旧 review comment(
163d6f...対象)は本判定根拠に使用していません。
Blockers
- AC5 が求める「対象ファイルの全 test が runtime marker で選択される」証明がありません。現実装は default collect 0件と marker collect 1件以上だけを確認しており、
addoptsを除いた全 nodeid 集合と marker-selected nodeid 集合の一致を確認していません。 runtime_verification_only_evidence.default_collect_okが成功時にもnullのままで、probe 成功状態を監査可能に保持していません。
Required auto actions
update_branch: PR はBEHINDのため、修正後に main を取り込んで current HEAD を更新する。update_pr_body_hygiene: AC4 の本文証跡を、新規test_github_live_marker_collection.py::test_github_live_marker_default_collect_deselectsの実行結果へ更新する。
LOOP_VERDICT_V2
LOOP_VERDICT_V2:
verdict: REQUEST_CHANGES
reviewed_head_sha: f4f03d2f66e993676c51bc8b984dd12592e5345a
merge_ready: false
mergeability:
mergeable: MERGEABLE
merge_state_status: BEHIND
blockers:
- "AC5 の全 nodeid と marker 選択 nodeid の一致検証がない"
- "runtime_verification_only_evidence.default_collect_ok が null のまま"
required_auto_actions:
- kind: update_branch
executor: implementation-worker
skill: implement-issue.update_branch
mechanical: true
blocking_merge_ready: true
expected_head_sha: f4f03d2f66e993676c51bc8b984dd12592e5345a
- kind: update_pr_body_hygiene
executor: implementation-worker
skill: open-pr.update_pr
mechanical: true
blocking_merge_ready: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.py
- .claude/skills/impl-review-loop/tests/test_github_live_marker_collection.py
- .claude/skills/pr-review-judge/scripts/generate_ci_test_selection_artifact.py
- .claude/skills/pr-review-judge/scripts/tests/test_generate_ci_test_selection_fail_close.py
- .github/ci/python-test-plan.json
- pyproject.toml
allowed_paths_gate_source: review_subagent
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, merge_state_status=CLEAN
Evidence Check
1c9fdf99b2a7700fcf25ab4cc8b108b67c4a4b79に一致する TEST_VERDICT_MACHINE は AC1〜AC5 PASS、skip なしです。- CI_CHECK_RUN_SCOPED は current HEAD で
all_passです。 - Allowed Paths gate は
okで、6変更ファイルはすべて Issue #1562 の許可パス内です。 - 前回指摘した AC5 の全 nodeid parity と
default_collect_okの監査記録は、現行差分と回帰テストで解消済みです。
Blockers
- なし
LOOP_VERDICT_V2
LOOP_VERDICT_V2:
verdict: APPROVE
reviewed_head_sha: 1c9fdf99b2a7700fcf25ab4cc8b108b67c4a4b79
merge_ready: true
mergeability:
mergeable: MERGEABLE
merge_state_status: CLEAN
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
status: ok
changed_files_source: git_diff_name_status_find_renames_z
changed_files:
- .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.py
- .claude/skills/impl-review-loop/tests/test_github_live_marker_collection.py
- .claude/skills/pr-review-judge/scripts/generate_ci_test_selection_artifact.py
- .claude/skills/pr-review-judge/scripts/tests/test_generate_ci_test_selection_fail_close.py
- .github/ci/python-test-plan.json
- pyproject.toml
allowed_paths_gate_source: review_subagent
Summary
ensure_contract_snapshot.py --mode auto --postがstatus: ok / source: materialized_goを返したのに、投稿された go コメント本文にexpected_contract_fingerprintが存在しない」という不具合を、AC1 として現行 HEAD(PR feat: source-bound contract fingerprint を materialize する #1548 以降)に対して実 GitHub API で再現確認した。ensure_contract_snapshot()をmode=auto, do_post=Trueで実行し、投稿された go コメントを独立したgh apiGET で再取得したところ、expected_contract_fingerprintの 7 項目キーがすべて正しく存在した。Issue 実装: ensure_contract_snapshot.py の materialized_go 経路で fingerprint PATCH が反映されないバグを修正する #1562 が記録した「fingerprint のない go コメント」は、PR feat: source-bound contract fingerprint を materialize する #1548 マージ前の古い(patch_comment呼び出しを持たない)producer worktree による実行の残骸だった、という Issue 実装: ensure_contract_snapshot.py の materialized_go 経路で fingerprint PATCH が反映されないバグを修正する #1562 本文の fact-check(issue-refinement-loop investigation)の結論と一致する。ensure_contract_snapshot.py自体のコード変更は行わない。代わりに、この「現行 HEAD の正しい two-phase POST→PATCH→readback 挙動」を恒久的に固定する regression test(実 GitHub API を用いる AC1 live test +patch_comment()単体を対象にした AC3 regression test)を新規ファイルとして追加した。加えて、pr-review-judge の REQUEST_CHANGES を受けた fix delta でgithub_livepytest marker(AC4)とruntime_verification_only_markers(AC5, G1 ゲート連携)を追加した。Closes #1562(本 Issue を解決する)
Changes(変更内容)
.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot_fingerprint_patch.pyTestFingerprintActuallyPosted::test_fingerprint_actually_posted(AC1): disposable GitHub Issue を作成し、run_contract_review_once()のみモックした状態でensure_contract_snapshot()を実行。post_comment/patch_comment/verify_controlled_publisher_comment_id_binding/capture_base_ref_and_shaはすべて実gh apisubprocess を経由する。返却されたcontract_snapshot_urlを関数内部の readback とは独立したgh apiGET で再取得し、expected_contract_fingerprintの 7 項目キー全てを検証。テスト終了時(成功/失敗いずれでも)finallyで disposable Issue をgh issue closeする。TestFingerprintPatchActuallyApplied::test_fingerprint_patch_actually_applied(AC3):patch_comment()を単体で直接呼び出す regression test。実際に provisional コメントを POST →patch_comment()で最終 fingerprint 入りボディに PATCH → 独立 GET で PATCH が実際に適用されたことを確認する。ghCLI 未認証等)の場合はpytest.skipではなくpytest.fail("environment_blocked: ...")を返す設計(docs/dev/runtime-verification-policy.mdの SKIP 規約に整合)。@pytest.mark.github_liveを付与(AC4)。pyproject.tomlの[tool.pytest.ini_options]にmarkers = ["github_live: ..."]と既定addoptsへの-m 'not github_live'を追加(AC4)。通常のpytestフルスイート実行では live test が deselect され、-m github_liveを明示指定した場合のみ実行される。.github/ci/python-test-plan.jsonにruntime_verification_only_markers: ["github_live"]を追加(AC5)。.claude/skills/pr-review-judge/scripts/generate_ci_test_selection_artifact.pyに、変更された test file が default 収集で 0 件・marker 明示指定収集で 1 件以上であることを実際にpytest --collect-only二重実行で確認できた場合のみuncovered_changed_test_filesから除外しruntime_verification_only_test_filesに記録するロジックを追加(AC5, fail-closed 維持)。.claude/skills/pr-review-judge/scripts/tests/test_generate_ci_test_selection_fail_close.pyに AC5 の regression test を追加。Verification Commands
受け入れ条件の達成状況
patch_comment実装を含む版、PR feat: source-bound contract fingerprint を materialize する #1548 以降)でensure_contract_snapshot.py --mode auto --postを実 GitHub Issue(disposable Issue [disposable-live-test] ensure_contract_snapshot AC1 run b106779c #1566)に対して実行し、status: ok, source: materialized_goを得た直後に独立gh apiGET で同一コメントを再取得したところ、本文にexpected_contract_fingerprintの 7 項目キーがすべて実在することを確認した(結果: 現行 HEAD では不具合非再現)。根拠:TestFingerprintActuallyPosted::test_fingerprint_actually_posted -m github_livePASS(下記 Verification Commands / Runtime Verification Evidence 参照)。.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.pyが引き続き全て PASS することを regression 確認した。根拠:uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py→93 passed in 0.23s(本 update_branch 後の HEAD で再実行済み)。patch_comment呼び出しと独立 readback 検証)を固定する regression test を新規ファイルtest_ensure_contract_snapshot_fingerprint_patch.pyに追加し PASS を確認した。根拠:TestFingerprintPatchActuallyApplied::test_fingerprint_patch_actually_applied -m github_livePASS(disposable Issue [disposable-live-test] ensure_contract_snapshot AC3 run b62d600c #1567 使用・close 済み)。test_ensure_contract_snapshot_fingerprint_patch.py内の live test にgithub_livepytest marker を付与し、pyproject.tomlの[tool.pytest.ini_options]に marker 登録と既定addoptsへの-m 'not github_live'追加を行った。default 収集の exit 5・2 deselectedと、-m github_live指定時の2件以上収集は、新規の default 実行可能 regression nodeidtest_github_live_marker_collection.py::test_github_live_marker_default_collect_deselectsが subprocess で assert する。根拠:uv run --locked pytest .claude/skills/impl-review-loop/tests/test_github_live_marker_collection.py::test_github_live_marker_default_collect_deselects→1 passed in 0.53s。.github/ci/python-test-plan.jsonにruntime_verification_only_markers: ["github_live"]を追加し、generate_ci_test_selection_artifact.pyが default 収集で 0 件であることに加え、-o addopts=で取得した対象ファイルの全 nodeid 集合と-m "github_live"選択集合が完全一致する場合に限りuncovered_changed_test_filesから除外しruntime_verification_only_test_filesに記録するようにした。default_collect_okは成功時も bool として記録する。marker 対象外の nodeid を含むファイルおよび markers が無効なファイルは引き続きuncovered_changed_test_filesに残る fail-closed 回帰を確認した。根拠:uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests/test_generate_ci_test_selection_fail_close.py→23 passed in 0.08s。Checks
pnpm typecheck(型エラーなし)pnpm lint(lint エラーなし)pnpm test(96 files / 1575 tests すべて成功)pnpm build(ビルド成功)uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py(21 件すべて成功)Runtime Verification Evidence(動作検証証跡)
AC1: 現行 HEAD で
ensure_contract_snapshot.py --mode auto --postを実 GitHub Issue に対して実行し、投稿された go コメント本文にexpected_contract_fingerprintが実在することを確認するghCLI(squne121認証済み、repowrite scope)、実リポジトリsqune121/loop-protocol実行ログ(クリックで展開)
AC3:
patch_comment()の実 subprocess 境界に対する PATCH + 独立 readback の regression test実行ログ(クリックで展開)
Schema Change Applicability
not_schema_changeexpected_contract_fingerprintの 7 項目スキーマ自体は変更しない(実装: source-bound contract fingerprint を materialize する #1537 で確定済み、Issue 実装: ensure_contract_snapshot.py の materialized_go 経路で fingerprint PATCH が反映されないバグを修正する #1562 の Out of Scope)。本 PR はテストファイルの新規追加とpyproject.toml/python-test-plan.json/ G1 ゲート generator への marker 連携追加のみで、ensure_contract_snapshot.pyのプロダクションコードは変更していない。Schema Consumer Inventory
N/A(
not_schema_changeのため)Safety Claim Matrix
[disposable-live-test]プレフィックス付きで作成し、成功/失敗にかかわらずfinallyで必ずgh issue closeする(Issue 自体は close 済み状態で識別可能な形で残る)github_livemarker により live test は通常の CIpython-testjob から deselect される。G1 ゲート(generate_ci_test_selection_artifact.py)はこの deselect を宣言のみで信用せず、default 収集、-o addopts=による全 nodeid 収集、marker 選択収集の3 probeで全 nodeid 集合の完全一致を確認してからuncovered_changed_test_files除外を許可するdefault_collect_ok: trueの artifact evidenceCI テストパフォーマンス判断
Notes
git diff --stat origin/main...worktree-issue-1562-ensure-contract-snapshot-py-materialized)は新規テストファイル1件とpyproject.toml/.github/ci/python-test-plan.json/generate_ci_test_selection_artifact.py/ 既存 regression test ファイルへの追加のみで、.claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.pyは一切変更していないことを control-plane が独立検証済み。この事実に合わせて、Issue 実装: ensure_contract_snapshot.py の materialized_go 経路で fingerprint PATCH が反映されないバグを修正する #1562 の Allowed Paths から未使用のensure_contract_snapshot.pyを除去した(edit-issueskill 経由、ISSUE_EDIT_TXN_RESULT_V1: status ok)。この補正により、同ファイルを Allowed Paths に含む OPEN Issue 実装: pr_review_only VC の current-head adjudication を修正する #1540 とのcheck_implementation_overlap.py上の structural collision(旧 route:human_review_required)が解消され、route: proceed_with_collision_evidenceを得た。update_branchにより PR ブランチを main の最新 HEAD に更新した(merge_only、conflict なし、CI 全 green 再確認済み)。(2) 本セクション「## 受け入れ条件の達成状況」を新規追加し、AC1〜AC5 全件について達成根拠を明記した。allowed_paths_gate.status == stale_snapshotの指摘は control-plane による fresh go snapshot 再 materialize(https://github.com/squne121/loop-protocol/issues/1562#issuecomment-5010104462)で既に解消済みのため本コミットでの追加対応は不要と判断した。