Repository navigation
feat: visual-impact evidence manifest V3 の compatibility reader を追加する(Phase A) - #2379
Conversation
…gest 対象に含める (#2284) PR #2279 の人間 REQUEST_CHANGES P2-2 指摘への恒久対応。V2 の compatibility excluded だった run_attempt を VISUAL_BASELINE_REVIEW_EVIDENCE_V3 の per-record tamper-evidence digest に含め、required な top-level envelope (schema/workflow_run_id/run_attempt/head_sha/surfaces) を追加した。 verify_trusted_artifact()/evaluate_pr_policy() は manifest 自身の schema フィールドで V2/V3 を dual-read する。 Phase B として ci.yml の producer を実際に --evidence-manifest-schema v3 と generic filename (visual_baseline_review_evidence.json) へ切り替え、 visual-impact-trusted-consumer.yml は移行期間中 legacy/新 filename の 両方を受理し両方存在する場合は fail-closed にした。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2379/ The preview will be removed when this PR is closed. |
fix_delta(pr-reviewer REQUEST_CHANGES 対応、2026-08-28)pr-reviewer の REQUEST_CHANGES 3件のうち、PR 本文の修正で対応可能な項目を反映した(コード変更なし、head は
重要な追加所見:
|
敵対的レビュー結果判定: 対象は現在もDraft・未マージのPR #2379、レビュー対象headは V3スキーマ自体の方向性は良いです。しかし、現状は次の問題があります。
これはセキュリティ強化のための過剰なブロックではありません。既存のPhase A/Phase B分割に戻し、数行の検証と回帰テストを追加すれば解消できる、実用性・CI信号品質の問題です。 Findings[P1] Phase AとPhase Bを同一PRに入れたため、pre-mergeで新しいproduction経路を検証できなくなっていますIssue #2284は、以下の順序を明示しています。
OWNERのREQUEST_CHANGESでも、「同一Issueを順序付き2 PRで進めることが、個人趣味開発として最も管理コストが低い」と整理されています。 ところがPR #2379は、本文で「Phase AとPhase Bを単一PRで実装した」と明記しつつ、「二段階契約に従っている」と主張しています。これは契約上も論理上も両立しません。 実装も同様です。
その結果、current headでは少なくとも次が失敗しています。
特に PR内コメントの「PRを分割してもgapは移動するだけ」「producerとconsumerはマージ時に同時に切り替わる」という説明は、今回のmigrationには当てはまりません。Phase Aを先にマージすれば、Phase B PRのbase-pinned evaluatorとdefault-branch trusted consumerはどちらも既にV3を読めます。したがって、Phase Bはpre-mergeでend-to-end greenを確認できます。 修正案 現在のPRからPhase Bだけを戻してください。
Phase Aマージ後、 [P2] V2 fallbackの
|
…ng の回帰バグを修正する OWNER の敵対的レビュー(PR #2379 review comment)を受け、以下を修正する: - [P1] Issue #2284 は Phase A(V3 reader/dual-read をまず main へ)-> Phase B(ci.yml producer の V3 切替は Phase A マージ後)の順序を要求している。 本PRが両方を同一PRに含めていたため、workflow_run 起動の visual-impact-policy/-trusted が base branch(main)上の V2-only 定義と PR head の V3 manifest の不整合で pre-merge non-green になっていた。 ci.yml の producer cutover を main と同一内容へ戻し、Phase A(V3 builder/validator/dual-reader・V2/V3 テスト・trusted-consumer の legacy/generic dual-filename 対応・CLI 既定値 v2)のみに縮小する。 - [P2-1] verify_trusted_artifact() の V2 フォールバック経路で、 record の head_sha 照合が trusted_rederivation.component_vrt_checkrun_provenance の条件ブロック内に入っており、provenance なしで呼ぶ既存経路では head_sha 不一致を検出できなかった。チェックを条件外の無条件チェックへ戻す。 - [P2-2] V3 no-impact(surfaces: [])経路で、envelope の workflow_run_id/run_attempt が authenticated provenance との比較でしか 検証されておらず、decision との直接比較が欠落していた。 provenance の有無に関わらず decision<->envelope の identity binding を 無条件チェックとして追加する。 - [P3] V3 record 側の workflow_run_id が `!=` 比較のみで strict 型検証されて おらず、float(100.0 == 100)等を許してしまっていた。record 側にも run_attempt と同様の _require_strict_positive_int による strict 検証を追加する。 各修正について、修正前のコードで期待通り verdict.ok=True(偽陽性PASS)に なることを確認した上でテストを追加した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
OWNER の敵対的レビュー(このコメント)への fix_delta 対応が完了しました(head [P1] Phase A へ縮小
[P2-1] V2 head_sha チェックの無条件化
[P2-2] V3 AC6 identity binding の無条件化decision と V3 envelope の [P3] record 側 workflow_run_id の strict 型検証
検証
差分: |
…e へ切り替える (#2388) * feat: ci.yml の evidence manifest producer を V3 schema/generic filename へ切り替える (#2384) Issue #2284 Phase A (PR #2379) で追加された V3 evidence manifest schema・ dual-read compatibility reader を実際に有効化する Phase B。 - Build evidence manifest ステップの CLI 呼び出しに `--evidence-manifest-schema v3` / `--run-id "$GITHUB_RUN_ID"` / `--run-attempt "$GH_RUN_ATTEMPT"` / `--head-sha "$GH_HEAD_SHA"` を追加 - 出力ファイル名を version-neutral な `visual_baseline_review_evidence.json` に統一(tmp 生成先・upload path・download 先・visual-impact-policy 側の `--evidence-manifest-file` 参照の全箇所) - Build/Upload step 名・job summary 見出しを V3 表記へ更新 - artifact 名 `component-vrt-evidence-manifest-${{ github.run_attempt }}` は Issue #2230 の attempt-specific naming 契約どおり変更なし Refs #2284, Refs #2379, Refs #2230 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: ci.yml の V2 表記コメント残存を V3 へ修正する OWNER レビュー(#2388 review comment)の P2 非ブロッキング指摘を反映し、 evidence manifest 生成ステップ近傍の古い "per-surface V2 manifest" コメントを "per-surface V3 manifest" へ修正する(コメントのみの変更)。 Refs #2384 --------- Co-authored-by: Test <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
Summary
Closes #2284 -- Issue #2284 は Phase A のみへスコープ改訂され、本PRがその(改訂後)Outcome を完全に満たすため、本PRで close する。
2026-08-29 OWNER 敵対的レビュー(PR #2379 review comment)を受け、本PRのスコープを Issue #2284 Phase A(V3 compatibility reader / dual-read)のみへ縮小した。 旧版の本PRは Phase A と Phase B(
ci.ymlproducer の V3 切替)を同一PRに含めていたため、workflow_run起動のvisual-impact-policy/visual-impact-policy-trustedが base branch(main)上の V2-only 定義と PR head の V3 manifest の不整合で pre-merge non-green になっていた。その後 Issue #2284 の Scope Delta により Phase B(ci.ymlproducer の V3 切替)は follow-up Issue #2384(blocking: #2284)へ分離された。本PRに含まれるもの(Phase A)
resolve_visual_impact.pyに V3 envelope(schema/workflow_run_id/run_attempt/head_sha/surfaces)を required とし、型・値域を strict 検証するvalidate_evidence_manifest_v3_envelope()を追加_MANIFEST_V3_RECORD_FIELDS = (*_MANIFEST_V2_RECORD_FIELDS, "run_attempt")により、V2 で compatibility-excluded だったrun_attemptを V3 の per-record tamper-evidence digest(manifest_sha256)に含めたworkflow_run_id・run_attemptの string・bool・float・zero・negative・null / duplicatesurface_id/ 未知 schema を拒否)を採用し、V2 の「最初の一致 record を返す」lookup 方式は引き継がないevaluate_pr_policy()/verify_trusted_artifact()は manifest 自身のschemaフィールドで V2/V3 を dual-read する(CLI フラグではなく consumer 側の自動判定)--evidence-manifest-schema v2|v3(既定v2、本PRでは producer 側は一切 v3 を指定しない)を追加visual-impact-trusted-consumer.ymlに、移行期間中 legacy filename(visual_baseline_review_evidence_v2.json)と generic filename(visual_baseline_review_evidence.json)の両方を受理し、両方存在する場合は fail-closed(exit 1)にするロジックを追加(Phase B 後の producer 切替に備えた consumer 側の前方互換対応).github/workflows/ci.ymlの producer 側は変更していない(git diff origin/main -- .github/workflows/ci.ymlは空 -- 下記 Checks 参照)。producer は引き続き V2 schema・legacy filename(visual_baseline_review_evidence_v2.json)で書き込むOWNER fix_delta で追加修正した回帰バグ(P2/P3)
verify_trusted_artifact()の V2 フォールバック経路で、evidence manifest record のhead_sha照合がtrusted_rederivation is not None and trusted_rederivation.component_vrt_checkrun_provenanceの条件ブロック内に入っており、provenance なしで呼ぶ経路では head_sha 不一致を検出できなかった。チェックを条件外の無条件チェックへ移動した。surfaces: [])経路で、envelope のworkflow_run_id/run_attemptが authenticated provenance との比較でしか検証されておらず、decision との直接比較が欠落していた。provenance の有無に関わらず decision<->envelope の identity binding を無条件チェックとして追加した。workflow_run_idが envelope との!=比較のみで strict 型検証されておらず、float(100.0 == 100)等を許容してしまっていた。record 側にもrun_attemptと同様の_require_strict_positive_intによる strict 検証を追加した。各バグについて、修正前のコードで実際に
verdict.ok=True(偽陽性PASS)になることを独立に確認した上でテストを追加している(下記 Checks 節参照)。Checks
uv run --directory <worktree> --locked pytest scripts/agent-ops/tests/ -q -n auto-- PASS(770 passed, 17 skipped, regression なし。fix_delta 前の V3 テスト分と合わせて全件)uv run --directory <worktree> --locked pytest scripts/agent-ops/tests/test_visual_impact_v3_manifest_seams.py -q-- PASS(23 passed。P2-2/P3 の新規4テストを含む)uv run --directory <worktree> --locked pytest scripts/agent-ops/tests/test_visual_impact_v2_manifest_seams.py -q-- PASS(9 passed)uv run --directory <worktree> --locked pytest scripts/agent-ops/tests/test_resolve_visual_impact_artifact_attempt_binding.py -q-- PASS(27 passed。P2-1 の新規1テストを含む)uv run --directory <worktree> --locked ruff check scripts/agent-ops/resolve_visual_impact.py scripts/agent-ops/tests/test_visual_impact_v3_manifest_seams.py scripts/agent-ops/tests/test_resolve_visual_impact_artifact_attempt_binding.py--All checks passed!git diff origin/main -- .github/workflows/ci.yml-- 空(producer 部分が v2/legacy filename のまま main と完全一致していることを確認。Phase B の producer cutover は含まれていない)f1c6b060)を独立に import して同一入力でverify_trusted_artifact()を呼び出し、修正前はverdict.ok=True, reason_codes=[](偽陽性PASS)になることを確認した上で、修正後・新規テストがverdict.ok=Falseを検出することを確認したgh pr checks 2379-- 全チェックpass(visual-impact-policy/visual-impact-policy-trustedを含む。head5e3075e7。詳細は下記)pnpm typecheck / lint / test / build は対象外(本 PR は Python バックエンドスクリプト・pytest・GitHub Actions workflow(
visual-impact-trusted-consumer.yml)のみの変更で TypeScript/Vue 資産に触れていない)。VISUAL_IMPACT_DECLARATION_V1
scripts/agent-ops/resolve_visual_impact.pyと.github/workflows/visual-impact-trusted-consumer.ymlはいずれも resolver のMETA_POLICY_PATHSに含まれmeta_policy_change判定の対象となるため、以下を宣言する。resolve_visual_impact.pyの変更は evidence manifest の読み取り側(dual-read/検証ロジック)のみで、VRT テスト自体(tests/component/combat-hud-critical.vrt.test.ts/tests/component/combat-hud-running.vrt.test.ts)・baseline 画像・component の描画ロジックは一切変更していない。.github/workflows/ci.ymlは今回一切変更していない(本PRから Phase B の producer cutover を除外したため)。visual-impact-trusted-consumer.ymlの変更は artifact 内 evidence manifest ファイル名の dual-filename 受理ロジックのみで、画面表示や VRT baseline には影響しない。verified_unchanged(disposition)とする。実際にcomponent-vrt-reportjob は本PRの CI 上で PASS しており(下記 gh pr checks 参照)、visual-impact-policy/visual-impact-policy-trustedも本PR自身の pre-merge run で green を確認済み。受け入れ条件の達成状況(Issue #2284 改訂後の AC 番号と整合、Phase A スコープ)
schema/workflow_run_id/run_attempt/head_sha/surfaces)の required + strict 型/値域検証run_attempt混入・改ざん検知workflow_run_id/run_attempt型/値域違反・duplicatesurface_id・未知 schema の拒否。workflow_run_idの strict 検証は今回の fix_delta P3 で追加)run_attemptは V2 digest 対象外のまま)--mode build-evidence-manifest --evidence-manifest-schema v3→evaluate_pr_policy()→verify_trusted_artifact()。CLI 経由の producer テストのみで、ci.yml自体は v3 を指定しない)surfaces: []でも envelope tuple 照合で PASS/FAIL。decision<->envelope の直接比較を今回の fix_delta P2-2 で追加)pytest scripts/agent-ops/tests/ -n autoで770 passed, 17 skipped、CI 全チェック green(visual-impact-policy/visual-impact-policy-trustedを含む)を確認Schema Change Applicability
resolve_visual_impact.pyに新スキーマVISUAL_BASELINE_REVIEW_EVIDENCE_V3の読み取り/検証ロジック(reader/dual-read/verifier)を追加した。producer(ci.yml)はこの新スキーマをまだ書き込まない(Phase B として follow-up Issue 実装: ci.yml の producer を V3 evidence manifest へ切り替える(Phase B, Issue #2284 follow-up) #2384 で切替)。Schema Consumer Inventory
scripts/agent-ops/resolve_visual_impact.py(evaluate_pr_policy()/verify_trusted_artifact())schemaフィールドで V2/V3 を dual-read。V2 branch の挙動は変更せず(P2-1 の head_sha 無条件チェック追加を除く).github/workflows/ci.yml(component-vrt-report/visual-impact-policyjob).github/workflows/visual-impact-trusted-consumer.ymlscripts/agent-ops/tests/test_visual_impact_v2_manifest_seams.pyscripts/agent-ops/tests/test_visual_impact_v3_manifest_seams.pyscripts/agent-ops/tests/test_resolve_visual_impact_artifact_attempt_binding.pySafety Claim Matrix
.github/workflows/visual-impact-trusted-consumer.ymlを変更しているため safety-sensitive path pattern(.github/workflows/)に該当し、Matrix を明示する。run_attemptを含み、digest 計算後のrun_attempt改ざんを検出するtest_v3_record_digest_rejects_run_attempt_tampered_after_digest_computedPASSsurfaces: [](no-impact)でも(workflow_run_id, run_attempt, head_sha)の不一致・欠落を fail-closed で検出する(provenance の有無に関わらず)test_v3_no_impact_manifest_fails_when_envelope_head_sha_mismatches/..._run_attempt_mismatches_authenticated_provenance/ fix_delta 新規..._decision_and_envelope_workflow_run_id_mismatch_no_provenance/..._run_attempt_mismatch_no_provenancePASShead_sha不一致を検出するtest_v2_record_head_sha_mismatch_fails_closed_without_trusted_rederivationPASS(修正前コードではverdict.ok=Trueになることを独立確認済み)visual-impact-trusted-consumer.ymlは legacy/generic 両 filename が同時に存在する場合、どちらか一方を無条件に採用せず fail-closed(exit 1)するrun_attemptは digest 対象外、CheckRun-provenance cross-check)は本 PR で変更していないtest_visual_impact_v2_manifest_seams.py全9テスト PASSRuntime Verification Applicability
--mode build-evidence-manifest --evidence-manifest-schema v3)→ policy consumer(evaluate_pr_policy())→ trusted verifier(verify_trusted_artifact())のローカル統合検証、および fix_delta で修正した各バグについて修正前コードでの偽陽性再現確認を実施した。rg文字列一致のみでの PASS 報告はしていない。gh pr checks 2379)を参照。Notes
scripts/agent-ops/resolve_visual_impact.py,.github/workflows/visual-impact-trusted-consumer.yml,scripts/agent-ops/tests/test_visual_impact_v2_manifest_seams.py,scripts/agent-ops/tests/test_visual_impact_v3_manifest_seams.py,scripts/agent-ops/tests/test_resolve_visual_impact_artifact_attempt_binding.pyの範囲内のみを変更。.github/workflows/ci.ymlは Issue 実装: visual-impact evidence manifest schema を V3 化し run_attempt を digest 対象に含める #2284 Allowed Paths に含まれるが、本PRでは Phase A 縮小のため変更していない(main と完全一致)。.github/workflows/ci.ymlの producer cutover(Phase B、follow-up Issue 実装: ci.yml の producer を V3 evidence manifest へ切り替える(Phase B, Issue #2284 follow-up) #2384 で実施)、V2 reader・legacy filename fallback の削除(Phase C)、attestation/OIDC/署名等の producer-authenticity 保証(調査: visual-impact-policy の same-run producer authenticity 保証(固定 producer / full-SHA pinned reusable workflow / artifact attestation)採用可否を決定する #2101 のスコープ)。ci.ymlproducer cutover)は follow-up Issue 実装: ci.yml の producer を V3 evidence manifest へ切り替える(Phase B, Issue #2284 follow-up) #2384(blocking: #2284)で実施する。5e3075e77ab1e3fb95e2e303a4487f9286fde9c6): branch protection required context(typecheck/lint/test/build/python-test/validate-generated-artifact)はすべて PASS。visual-impact-policy/visual-impact-policy-trusted(non-required, informational)も本PR自身の pre-merge run で green を確認済み(gh pr checks 2379実測)。