Repository navigation
実装: visual-surface dependency registry と required visual-impact policy check を導入する - #2045
Conversation
…y check を導入する (#2019) registry-first canonical SSOT (docs/dev/visual-surfaces.yml) + TypeScript compiler API ベースの決定論的 resolver (.mjs + Python orchestration) を追加し、 VISUAL_IMPACT_DECLARATION_V1 (untrusted PR body) と VISUAL_IMPACT_DECISION_V1 (trusted CI 生成) を分離した required CI check `visual-impact-policy` を導入する。 ci_verdict_summary_v2.py への DAG 接続、CODEOWNERS 新設、Issue 起票・編集・ レビュー系スキルへの共有 visual_impact schema 参照を含む。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #2045 closed). |
…osed 修正 pr-review-judge の REQUEST_CHANGES(Blocker 1/2/3)に対応する。 - visual-impact-policy job の GITHUB_OUTPUT 破損を修正: `git rev-parse` (--verify なし)が未解決 `<rev>:<path>` を stdout に echo する挙動と `|| echo fallback` が合わさり、`$GITHUB_OUTPUT` に key=value 形式でない 裸の行が書き込まれていた。`git rev-parse --verify --quiet` へ置き換える。 - governed Python invocation policy(#1193)違反を修正: `CHECK_RUN_ID` 解決の `python3 -c "..."` command substitution を jq ベースの抽出に置き換える。 - PR Body Japanese Check FAIL を修正: 本 PR が変更する .github/pull_request_template.md / docs/dev/agent-skill-boundaries.md / docs/ops/branch-protection.md の whole-file per-block 日本語比率検査で 不足していた prose block に日本語文を追加する。 Refs #2019
CI_TEST_PERFORMANCE_DECISION_V1(PR レビュー修正差分への対応記録)
CI_TEST_PERFORMANCE_DECISION_V1:
schema: CI_TEST_PERFORMANCE_DECISION_V1
issue_number: 2019
pr_number: 2045
decision_scope: ci_change
changed_paths:
- .github/workflows/ci.yml
- .github/pull_request_template.md
- docs/dev/agent-skill-boundaries.md
- docs/ops/branch-protection.md
lane_classification:
fast_static:
applicable: true
evidence:
- "uv run --locked python scripts/ci/check_python_invocation_policy.py --strict -> OK: 0 violations in 79 governed surface files (14 exceptions loaded)"
required_commands:
- "uv run --locked python scripts/ci/check_python_invocation_policy.py --strict"
- "uv run --locked python scripts/ci/verify_python_test_lane.py --ci-yml .github/workflows/ci.yml"
python_unit:
applicable: true
evidence:
- "uv run --locked pytest scripts/ci/tests/test_python_invocation_policy.py -q -> 72 passed"
required_commands:
- "uv run --locked pytest scripts/ci/tests/test_python_invocation_policy.py -q"
contract_artifact:
applicable: false
evidence: []
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: false
missing_pytest_args: []
risk_flags:
- "本変更は既存 required check(visual-impact-policy / python-test / python-test-core)の fail-closed 修正であり、CI 高速化の主張(performance claim)を含まない(claim.kind: none 相当)。lane 構成・worker 数・python-test-plan は変更していない。"
reviewer_gate:
approve_allowed: true
required_evidence:
- CI_CHECK_RUN_SCOPED
follow_up_required: []修正内容の要約
|
…ules 欠如を fail-closed に見誤る問題を修正
Blocker 2(governed Python invocation policy 違反)を修正した結果、
python-test-core job が初めて pytest ステップまで到達し、
scripts/agent-ops/tests/test_resolve_visual_impact.py の2テストが
`resolve_visual_impact.mjs produced no output (... ERR_MODULE_NOT_FOUND)`
で FAIL することが判明した。
原因: 既存の skipif は `shutil.which("node") is None` のみを見ており、
`node` 実行可能ファイルの有無しか判定しない。`python-test-core` job は
Python-only(`pnpm install` を実行しない、#1760)という意図的な lane 設計
のため `node_modules/typescript` が存在せず、`resolve_visual_impact.mjs`
の `import ts from 'typescript'` が ERR_MODULE_NOT_FOUND で落ちる。
修正: skip 条件に `node_modules/typescript` の存在確認を追加し、
node バイナリはあるが依存パッケージ未インストールの環境では
クリーンに SKIP する。AC4/AC5 相当の end-to-end 検証は
`pnpm install` 済みの `test` job で実行される
`tests/agent-ops/resolve-visual-impact-*.test.ts`(Vitest、実際の
resolve_visual_impact.py / .mjs subprocess を呼ぶ統合テスト)で
引き続きカバーされるため、検証の欠落にはならない。
Refs #2019
判定現行 head の レビューでは、#1958 の HUD 変更、#2014/PR #2024 の baseline・runtime evidence 修復、#2019 の恒久的 co-change enforcement 契約まで遡りました。特に PR #2024 は当時の manifest に automated consumer が存在しないことを明示しており、将来 consumer を追加する際の contract test を前提としていました。#2045 はその consumer に相当しますが、実 workflow が生成した manifest と policy consumer を結ぶ end-to-end contract test が欠けています。 P0-1 — evaluator の非ゼロ終了が |
| シナリオ | 必須結果 |
|---|---|
src/ui/combatHud.ts 変更、declaration 欠落 |
CheckRun failure |
| registry schema に unknown key | CheckRun failure |
| surface/producer mapping を head で削除 | affected または failure |
| producer を coverage root 外へ rename | old/new 両方を検出して affected |
| baseline PNG だけ変更 | 当該 surface が affected |
| critical surface に running-only evidence | failure |
manifest の mismatched_pixels: "0" |
schema/type failure |
| valid per-surface manifest | decision schema-valid、CheckRun success |
| evaluator/workflow 自身を PR で変更 | trusted check の実装は変更されない、または owner approval 必須 |
| waiver | current-head owner approval+open issue+有効期限が揃った場合のみ success |
評価できる点
PR body に Refs #2019 を使用し、post-merge enforcement 完了前に Issue を自動 close しない方針は適切です。PR body の untrusted input を shell 展開せずファイルへ書くこと、job permissions を read-only に限定したこと、exact head checkout、declaration parser の厳格化、classifier への required check 接続も方向性としては妥当です。以前のコメントで指摘された $GITHUB_OUTPUT 汚染、governed Python invocation、content validation の3件も修正されています。
ただし、これらは今回の中心問題である「policy failure が GitHub check failure になるか」「decision が候補 PR から独立して信頼できるか」を解決していません。
実取得した検証材料
- [Current-head evidence manifest JSON](sandbox:/mnt/data/pr2045-visual-baseline-review-evidence-v1.json)
- [Current-head visual-impact decision JSON](sandbox:/mnt/data/pr2045-visual-impact-decision-v1.json)
- [最小再現結果](sandbox:/mnt/data/pr2045-minimal-reproduction.txt)
現行 head は merge 不可です。P0-1、P0-2、P0-3、P0-4、P0-5 の解消と、trust boundary の再設計または実効的な保護設定が確認できるまで REQUEST_CHANGES が妥当です。
…rdening (OWNER P0/P1) OWNER REQUEST_CHANGES (#2045 (comment)) identified that the visual-impact-policy CI job could PASS unconditionally in several ways. This addresses: - P0-1: `set +o pipefail` before `| tee` masked non-zero evaluator exit codes; artifact upload used `if-no-files-found: warn`. Both now fail closed, with a real subprocess/shell integration test proving the pipefail behavior change. - P0-2: resolve_result.errors (resolver/registry/mjs failures) were never checked by evaluate_pr_policy; a crashed mjs subprocess with returncode != 0 was trusted if stdout happened to parse as JSON; the registry was re-parsed unvalidated for the policy step. Now resolver errors fail the policy, mjs exit code / schema / surface-key-set / resolver_version are verified, and the single validated head registry doc is reused. - P0-3: workflow never passed --base-ref/--head-ref, so union-based registry-deletion detection never ran in production; global_invalidators/ coverage_roots are now unioned across base+head too. - P0-4: changed paths were collected via `--name-only` and force-cast to status "modified" in the decision digest, losing rename/add/remove semantics; baseline PNG/spec-only changes bypassed disposition entirely (contracts.baseline/spec are outside coverage_roots). Now `--name-status -z --find-renames` feeds a typed record set, renames evaluate both old/new path, and contract paths are treated as producer paths. - P0-5: the live evidence manifest emits `mismatched_pixels` as a JSON *string* ("0"), while the consumer compared it with `== 0` (int) -- permanently False. Fixed at both the producer (cast to int) and consumer (defensive type coercion) layers. (Full VISUAL_BASELINE_REVIEW_EVIDENCE_V1 V2 schema redesign per OWNER's full field list is NOT done -- out of scope for this fix_delta pass, see PR report.) - P0-6: trust boundary constraint (evaluator runs from PR head) is explicitly Not Controlled and documented in the PR body Safety Claim Matrix; full untrusted/trusted 2-phase redesign is out of scope. - P1-2: decision `evidence` payload now matches the canonical schema (baseline_unchanged/canonical_verify_success/evidence_manifest_digest/ expected_actual_diff_available/authorized_owner, additionalProperties: false) instead of an unvalidated {"ok","reason"} shape, and the decision is schema-validated before upload. - P1-3: tracking_issue_checker now performs a real `gh issue view` lookup (fail-closed to unverified on any error); waiver authorized-owner scoping is now per-surface (via codeowners_rules) instead of a flat union across every registered surface's contract paths. - P1-5: push/workflow_dispatch runs (PR number 0, schema minimum 1) now skip the policy-check/upload steps instead of emitting a schema-invalid decision. All existing scripts/agent-ops/tests/*visual_impact*/test_resolve_visual_impact.py/ test_visual_surfaces_schema.py pass unchanged (273 total), plus 25 new regression tests for the above. pnpm typecheck/lint/test/build all pass. actionlint on the modified workflow passes with zero findings. Refs #2019
…を schema 検証対象から除外する commit 838134a で --base-ref/--head-ref を実配線したことで露見した実バグ (本 PR 自身の base ref が registry ファイル導入前の main コミットのため `load_and_validate_registry()` が合成した空 registry ドキュメントを schema 検証にかけてしまい、`surfaces` の `minProperties: 1` に違反して `RegistryError` になり、visual-impact-policy job が本 PR 自身の diff に 対して常に fail する)を修正する。 `load_registry_text()` が `(text, existed_at_ref)` を返すよう変更し、 `load_and_validate_registry()` は「ref に registry ファイルが存在しない (bootstrap ケース)」場合は schema 検証をスキップして合成した空 ドキュメントをそのまま返すようにした。「ref に存在するが内容が壊れて いる」場合は従来通り RegistryError を送出する。 実 repository 履歴(本 PR の base_sha である 11ed12e が docs/dev/visual-surfaces.yml 導入前のコミットであること)を使った 回帰テストを追加した。 Refs #2019
…ase-locked evaluator, TS/Vite unsupported-setting detection OWNER REQUEST_CHANGES (P0-5/P0-6/P1-1/P1-4) full completion: - P0-5: per-surface VISUAL_BASELINE_REVIEW_EVIDENCE_V2 manifest (contract_digest binding, per-record manifest_sha256 tamper check, CheckRun binding sourced ONLY from an independently-fetched CheckRun API lookup, never the manifest's own self-report). component-vrt-report now builds one record per registered surface via a new `--mode build-evidence-manifest` CLI (baseline_sha256 always computed from the on-disk baseline, never trusted). CheckRun resolution now filters by check_name + status=="completed" + app.slug, selecting the most-recently-completed match instead of an ambiguous first row. - P0-6: full untrusted/trusted 2-phase `pull_request_target` split was evaluated and found architecturally infeasible within this Issue's confirmed Allowed Paths (a `pull_request_target` job cannot coexist with this file's `pull_request` jobs in the same workflow file; a second workflow file is outside the confirmed Allowed Paths and introduces a high-risk permission surface that warrants explicit human/branch-protection review). Implemented mitigation instead: the visual-impact-policy job now materializes and executes the BASE-BRANCH-LOCKED copy of resolve_visual_impact.py/mjs and both schemas (`git show <base_sha>:...`) for both changed-path parsing and policy evaluation, so a candidate PR can no longer neuter its own evaluator logic. Bootstrap fallback (files not yet present at base) is logged, never silent. - P1-1: resolve_visual_impact.mjs now detects tsconfig paths/baseUrl, Vite resolve.alias, and package.json imports/exports and fails the whole resolver run closed (via the existing resolve_result.errors wiring) when any is configured. CSS/module read failures are also fail-closed via unknown_impact instead of silently truncating the graph walk. - P1-4: closed four producer/consumer seam gaps -- workflow-shaped `--mode changed-paths` / `--mode build-evidence-manifest` CLI subprocess integration tests, real git-repo rename classification (git mv + git diff --name-status -z --find-renames, not a synthetic fixture), a real V2 manifest parsed/verified end to end through evaluate_pr_policy, and a registry fixture with an actual duplicate top-level/nested key proving yaml.safe_load() rejection. `git diff --name-status -z --find-renames` parsing is extracted from ci.yml's inline heredoc into `parse_git_diff_name_status_z()` (importable, unit-tested, and now also base-branch-locked). Co-Authored-By: Claude Sonnet 5 <[email protected]>
…anifest の uv not found を解消する Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta iteration 3 (2026-08-09): P0-5 / P0-6 / P1-1 / P1-4 完全対応OWNER REQUEST_CHANGES (#2045 (comment)) の残り4項目に対応した(head P0-5 完全対応: evidence manifest V2 化
P0-6: untrusted/trusted 2-phase 化 — 部分対応(完全な
|
推奨アクション結論は PR #2045 をまだ merge-ready 扱いしない です。P0-5 / P1-1 / P1-4 は解消済みとしてよい一方、P0-6 は なお、確認時点の live head は提示された 問題は CI の green/red ではなく trust boundary です。現行 さらに live ruleset 恒久設計では、 ただし、ここにもう一段重要な問題があります。第2 workflow を追加するだけでは required-check spoofing まで解決しません。 GitHub の通常の required status check は workflow 名や event trigger を区別しません。GitHub App source を指定することはできますが、untrusted と trusted の両方が したがって strict な P0-6 の完成条件は、次のいずれかまで含めるべきです。
そして #2019 の現在の contract では、Allowed Paths 外変更、新規 Issue、外部サービス・権限変更、repository protection mutation が stop condition に入っています。つまり、これ以上 worker が同じ 補足として、現在の CODEOWNERS は保護対象を 次に Claude Code / Codex CLI へ渡すプロンプトこれは「さらに PR #2045 / Issue #2019 の P0-6 trust-boundary blocker を対象に、OWNER scope-reframe 前提の adversarial refinement を実行してください。 対象:
重要:
OWNER decision現行の base-locked evaluator は defense-in-depth として保持候補だが、P0-6 の完全な trust boundary とは認定しない。 理由: したがって P0-6 の semantic status は現時点では: P0_6_STATUS: needs-fix CI green / MERGEABLE だけを根拠に approve しないこと。 作業
禁止事項
最終出力以下の順で簡潔に返すこと:
P0-6 が cryptographically / administratively independent な gate になっていない限り、最終 verdict は この順序なら、「same-job mitigation を積み増し続けるループ」から抜けて、P0-6 の threat model と enforcement identity を先に確定できます。現状ではこれが最も安全な次手です。 |
…加する (#2019 Scope Delta) `workflow_run` トリガー(base/default branch にジョブ定義が固定される GitHub Actions の 仕様上の性質)を使う `.github/workflows/visual-impact-trusted-consumer.yml` を新規追加し、 候補 PR head が `pull_request` トリガーの `visual-impact-policy` ジョブ定義自体を改変できる 構造的欠陥(P0-6)を、producer artifact の独立検証と専用 CheckRun 発行で補完する。 - `resolve_visual_impact.py` に `--mode verify-trusted-artifact` を追加し、 decision artifact の schema 検証・digest 検証・head_sha/PR番号/repository 一致検証を producer job の内容改変に依存せず独立に行う - trusted consumer は PR head を checkout せず、PR head 由来のスクリプト/パッケージを実行しない - `scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py`(AC31-AC37 対応)を追加
CI_TEST_PERFORMANCE_DECISION_V1(AC30-AC37 実装分, commit 4bd29c6)CI_TEST_PERFORMANCE_DECISION_V1:
schema: CI_TEST_PERFORMANCE_DECISION_V1
issue_number: 2019
pr_number: 2045
decision_scope: ci_change
changed_paths:
- .github/workflows/visual-impact-trusted-consumer.yml
- scripts/agent-ops/resolve_visual_impact.py
- scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py
lane_classification:
fast_static:
applicable: true
evidence: [actionlint, ruff]
required_commands: [actionlint .github/workflows/visual-impact-trusted-consumer.yml]
python_unit:
applicable: true
evidence: [scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py]
required_commands:
- uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -q
contract_artifact:
applicable: true
evidence: [docs/dev/visual-impact.schema.json への additionalProperties:false 準拠検証]
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: false
missing_pytest_args: []
risk_flags:
- "新規 workflow_run トリガー job は main マージ後でないと実発火しない(既知の制約。PR 自身の CI では検証できない)"
reviewer_gate:
approve_allowed: true
required_evidence:
- CI_CHECK_RUN_SCOPED
follow_up_required: []新規追加 job( |
Summary
docs/dev/visual-surfaces.yml(registry-first canonical SSOT)とdocs/dev/visual-surfaces.schema.json(additionalProperties false・閉域 enum の JSON Schema)を新設し、combat-hud-running/combat-hud-criticalを独立エントリとして登録するscripts/agent-ops/resolve_visual_impact.mjs(static import graph 決定論的解決: CSS@import/url()、?url/?raw、静的new URL(..., import.meta.url))と、registry 読込・base/head union・policy 判定・declaration/decision/waiver 評価を担うscripts/agent-ops/resolve_visual_impact.py(二層構成)を追加するVISUAL_IMPACT_DECLARATION_V1(untrusted PR body 自己申告)とVISUAL_IMPACT_DECISION_V1(trusted CI 生成)をdocs/dev/visual-impact.schema.jsonに分離定義し、declaration のみでは PASS しない disposition 評価(verified_unchanged/baseline_changed/waived)を実装するwaivedの owner authority は trusted base branch CODEOWNERS から導出し、PR body 自己申告や本 PR 自身が新設する head 側 CODEOWNERS を authority にしない.github/workflows/ci.ymlに required jobvisual-impact-policyを追加(needs: [component-vrt-report]+if: always()、permissionsはcontents/actions/checks/pull-requests/issues: readのみ、on.pull_request.typesにopened/synchronize/reopened/edited/ready_for_reviewを追加).claude/skills/pr-review-judge/scripts/ci_verdict_summary_v2.pyのCLASSIFICATION_MAP/REQUIRED_CHECKS/ci-verdict-summaryのneedsにvisual-impact-policyを接続し、GitHub Actions App source pinning(app.slugフィルタ)を追加する.github/CODEOWNERSを新設し、registry/baseline/resolver/policy evaluator/workflow/CODEOWNERS 自身/verdict classifier を保護対象に含める(本 PR 自体はこの新設 CODEOWNERS を自己の trusted source として扱わない)create-issue/edit-issue/issue-contract-review/review-issueの各 SKILL.md とdocs/dev/agent-skill-boundaries.mdに、単一の canonical schema ファイルdocs/dev/visual-impact.schema.jsonへの参照を追加する(重複定義なし)docs/dev/visual-baseline-registry.mdを「visual-surfaces.ymlが canonical SSOT であり本ファイルは generated projection である」旨に更新し、docs/ops/branch-protection.mdの既存 required-checks 記述 drift(live 6件 vs 記述5件)を記述更新のみで解消する(live API mutation は行わない).github/pull_request_template.mdにVISUAL_IMPACT_DECLARATION_V1の canonical declaration producer 欄を追加するVisual Impact Declaration(視覚影響申告)
本 PR は UI(DOM/CSS)自体は変更しないが、fix_delta(下記参照)で
scripts/agent-ops/resolve_visual_impact.pyのMETA_POLICY_PATHS(
.github/workflows/ci.yml・resolver 自身・registry・schema)を追加し、評価器/CI ワイヤリング自身の変更を no-impact 扱いしない設計にした結果、
本 PR 自体がその
.github/workflows/ci.ymlとscripts/agent-ops/resolve_visual_impact.pyを変更しているためcombat-hud-running/combat-hud-criticalの両 surface がmeta_policy_changeとして affected 判定される(意図した挙動。評価器自身の変更を静かに no-impact 扱いする方が危険なため)。実際の baseline
PNG は変更しておらず、
component-vrt-reportの canonical VRT lane は同一 head で成功しているため、両 surface とも
verified_unchangedを宣言する。
Checks
pnpm typecheck)を実行し、型エラーが無いことを確認したpnpm lint)を実行し、規約違反が無いことを確認したpnpm test)を実行し、1872 件のテスト全てが成功したpnpm build)を実行し、成果物の生成に成功した検証コマンド結果(AC ごと)
test -f docs/dev/visual-surfaces.yml && test -f docs/dev/visual-surfaces.schema.json→ PASSrg -n "combat-hud-running|combat-hud-critical" docs/dev/visual-surfaces.yml→ PASS(両エントリ独立存在)rg -n "update_command_id" docs/dev/visual-surfaces.schema.json→ PASS(閉域 enum、unknown id は schema failure)uv run --locked pytest scripts/agent-ops/tests/test_resolve_visual_impact.py -q→ 8 passedtest -f tests/agent-ops/resolve-visual-impact-registry-union.test.ts→ PASS(diff_producer_mappings()単体テストはtest_resolve_visual_impact.py側)pnpm exec vitest run tests/agent-ops/resolve-visual-impact-vite-deterministic.test.ts→ PASSpnpm exec vitest run tests/agent-ops/resolve-visual-impact-unknown-impact.test.ts→ PASSpnpm exec vitest run tests/agent-ops/resolve-visual-impact-coverage-boundary.test.ts→ PASSuv run --locked pytest scripts/agent-ops/tests/test_visual_impact_declaration_parser.py -q→ 8 passeduv run --locked pytest scripts/agent-ops/tests/test_visual_impact_declaration_schema.py -q→ 9 passeduv run --locked pytest scripts/agent-ops/tests/test_visual_impact_decision_binding.py -q→ 7 passeduv run --locked pytest scripts/agent-ops/tests/test_visual_impact_declaration_only_never_passes.py -q→ 5 passeduv run --locked pytest scripts/agent-ops/tests/test_visual_impact_baseline_changed_evidence.py -q→ 6 passeduv run --locked pytest scripts/agent-ops/tests/test_visual_impact_waiver_authority.py -q→ 4 passeduv run --locked pytest scripts/agent-ops/tests/test_visual_impact_waiver_negative.py -q→ 7 passeduv run --locked pytest scripts/agent-ops/tests/test_visual_surfaces_schema.py -q→ 11 passedrg -n "visual-impact-policy" .github/workflows/ci.yml→ PASS(needs: [component-vrt-report]+if: always()を YAML parse でも確認済み)rg -n "vrt_evidence_artifact_digest" .github/workflows/ci.yml→ PASS(job output 経由、filename 依存なし)rg -n "visual-impact-policy" .claude/skills/pr-review-judge/scripts/ci_verdict_summary_v2.py→ PASS(ci-verdict-summaryのneedsにも追加済み)rg -n "ready_for_review" .github/workflows/ci.yml→ PASSvisual-impact-policy.permissions == {contents/actions/checks/pull-requests/issues: read}を確認(write なし)uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests/test_visual_impact_policy_verdict.py -q→ 11 passed(success/failure/missing/skipped/cancelled/stale-head/missing-CheckRun-ID/wrong-GitHub-App/unknown-source を synthetic-but-schema-faithful fixture で決定論的に検証。既存test_ci_verdict_summary_v2.pyのstale_head_sha等と同一手法)test -f .github/CODEOWNERS→ PASSuv run --locked pytest scripts/agent-ops/tests/test_resolve_visual_impact.py -k regression_1958 -q→ 1 passed(実装: combat HUD の配置・safe-zone・情報優先度を実装する #1958 相当の diff で combat-hud-running が affected と判定される回帰再現テスト)rg -n "VISUAL_IMPACT_DECLARATION_V1" .github/pull_request_template.md→ PASStest -f docs/dev/visual-impact.schema.json→ PASS(4 SKILL.md が同一ファイルを参照、重複定義なし)rg -n "generated projection" docs/dev/visual-baseline-registry.md→ PASSuv run --locked pytest scripts/agent-ops/tests/test_visual_impact_current_head_binding.py -q→ SKIPPED(ローカル環境に live PR head が存在しないため。Runtime Verification Applicability の skip_conditions に従い exit 77 相当の pytest.skip。SKIP を PASS と偽装していない。pr-review-judge が実 PR head 上で改めて検証する)pnpm typecheck/pnpm lint/pnpm test(1872 passed)/pnpm build→ 全 PASStest -f .github/workflows/visual-impact-trusted-consumer.yml→ PASS(P0-6 trust boundary を閉じる trusted consumer job を新規追加。workflow_runトリガーで PR head を checkout せず動作する専用 workflow)uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -k schema_violation -q→ 2 passed(test_schema_violation_additional_property_rejected/test_schema_violation_missing_required_field_rejected。evidence manifest の schema 逸脱を fail-closed で拒否)uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -k digest_tamper -q→ 2 passed(test_digest_tamper_evidence_manifest_record_rejected/test_digest_tamper_decision_claim_does_not_match_manifest_record。digest 改ざんを独立検証で検出)uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -k forced_success -q→ 1 passed(test_forced_success_producer_still_fails_independent_verification。producer が exit 0 を強制しても trusted consumer の独立再検証で失敗判定になることを確認)uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -k missing_artifact -q→ 1 passed(test_missing_artifact_never_silently_passes。producer artifact 欠落を無条件 PASS にしない)uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -k stale_head -q→ 1 passed(test_stale_head_rejected。workflow_runの head_sha が現在の PR head と不一致の場合を拒否)uv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -k no_pr_head_execution -q→ 2 passed(test_no_pr_head_execution_no_checkout_ref_override/test_no_pr_head_execution_no_package_scripts。workflow YAML を静的検証し、PR head への checkout ref override や package.json script 実行が存在しないことを確認。test_repository_mismatch_rejected/test_pull_request_number_mismatch_rejected/test_oversized_decision_artifact_rejected/test_malformed_json_rejected/test_workflow_triggers_on_workflow_run/test_workflow_check_name_present/test_job_permissions_are_minimal/test_valid_artifact_passesを含む同ファイル全17テストをuv run --locked pytest scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py -qで実行し 17 passed を確認済み)rg -n "visual-impact-policy-trusted" .github/workflows/visual-impact-trusted-consumer.yml scripts/agent-ops/tests/test_visual_impact_trusted_consumer.py→ PASS(専用 CheckRun 名visual-impact-policy-trustedが workflow・job 名・publish step・テストアサーションの全箇所で一貫)Schema Change Applicability
schema_change.claude/skills/pr-review-judge/scripts/ci_verdict_summary_v2.pyのCLASSIFICATION_MAP/REQUIRED_CHECKS(producer と consumer の境界をまたぐ machine-readable contract)に("ci", "visual-impact-policy")という新しいエントリを追加し、さらにcheck_runs_api_to_raw_checks()関数へ GitHub Actions App のソースを検証するフィルタ(app.slugの照合)を追加したため。加えてdocs/dev/visual-surfaces.yml・docs/dev/visual-surfaces.schema.json・docs/dev/visual-impact.schema.jsonという新規スキーマファイルを追加している。Schema Consumer Inventory
変更対象 schema 1:
ci_verdict_summary_v2.CLASSIFICATION_MAP/REQUIRED_CHECKS(既存 schema への追加)before/after 差分:
Consumer 列挙(rg コマンド例と結果):
Consumer 更新状況:
.claude/skills/pr-review-judge/scripts/ci_verdict_summary_v2.py.claude/skills/pr-review-judge/scripts/tests/test_ci_verdict_summary_v2.pyvisual-impact-policyの success check を追加、_api_row/api_rowhelper にappフィールドを追加(wrong-GitHub-App source pinning の副作用対応).claude/skills/pr-review-judge/scripts/tests/test_visual_impact_policy_verdict.pydocs/dev/ci-operations.md変更対象 schema 2:
docs/dev/visual-surfaces.yml/docs/dev/visual-surfaces.schema.json/docs/dev/visual-impact.schema.json(新規 schema)Consumer 列挙:
scripts/agent-ops/resolve_visual_impact.py(唯一の producer/consumer、本 PR 内で新規作成)のみ。他ファイルからの参照は 4 SKILL.md のドキュメント参照(コード consumer ではない)。Consumer 更新状況: N/A(新規 schema につき既存 consumer なし)
Compatibility Decision(互換性判定)
additive(追加のみで既存要素は変更しない)backward_compatible(後方互換)no(不要)CLASSIFICATION_MAP/REQUIRED_CHECKSへのキー追加のみで既存キーの意味・型を変更しないため、既存の分類ロジックには影響しない。check_runs_api_to_raw_checks()の app-slug フィルタ追加は、既存の全 fixture/consumer がapp.slug: "github-actions"を持つ real GitHub API レスポンス形状と一致するため既存挙動を変えない(テストは synthetic fixture にappフィールドを追加して整合させた)。修正差分(OWNER レビュー指摘への対応)
OWNER が本 PR へ直接 REQUEST_CHANGES した
(https://github.com/squne121/loop-protocol/pull/2045#issuecomment-5229744411)。
修正は commit 838134a に含まれる。以下の P0/P1 の指摘事項を修正した:
set +o pipefailと| teeの組み合わせで evaluator の非ゼロ終了が握りつぶされ job が常に成功していた不具合を修正した。
set -o pipefailに変更し、artifact upload のif-no-files-foundもwarnからerrorに変更した。実 shell を経由する negativeintegration test(
test_pr2045_p0_1_pipefail_negative_integration)で修正前後の挙動差を再現した。
resolve_result.errors(resolver/registry/mjs の内部失敗)が
evaluate_pr_policy()で一切参照されておらず、resolver が壊れても無条件 PASS していた不具合を
修正した。mjs の非ゼロ終了・schema 不一致・surface key set 不一致・
resolver_version不一致を検知して fail-closed にし、registry の二重 parse(policy 側の再
yaml.safe_load)を廃してresolve()が返す単一の検証済み registry を再利用するようにした。
--base-ref/--head-refを受け取れる設計だったが、workflow が実際には一度も渡していなかったため、本番実行では base/head union が常に無効化
されていた不具合を修正した。
.github/workflows/ci.ymlから実 SHA を渡すよう配線し、
global_invalidators/coverage_rootsも base/head でunion するよう拡張した。この修正を有効化したことで、本 PR 自身の
base ref(registry ファイルがまだ存在しない 実装: visual-surface dependency registry と required visual-impact policy check を導入し、UI変更PR内でVRT処置を強制する #2019 マージ前の main)に
対する bootstrap ケースが誤って schema failure になる実バグが判明し、
併せて修正した(
load_registry_text()が「ref に存在しない」場合と「存在するが壊れている」場合を区別し、bootstrap の合成空 registry は
schema 検証をスキップするようにした)。
git diff --name-onlyで rename/added/removed の実態を失い、decision digest が全エントリを
modifiedに強制していた不具合と、affected 判定が producer path のみを見て
contracts.baseline/specを含んでいなかったため baseline PNG や VRT spec のみの変更が affected
判定をバイパスできた不具合を修正した。
git diff --name-status -z --find-renamesを使い、rename は old/new 両方を評価し、registry/resolver/CI workflow 自身の変更は全 surface に影響する
meta policy change として扱うようにした。
mismatched_pixelsが JSON 文字列"0"になっており、consumer 側が== 0(int 比較)で比較していたため常に False(
canonical_verify_successが常に偽)になっていた不具合を、producer(int cast)と consumer(防御的型変換)の両方で修正した。加えて OWNER
が要求した evidence manifest V2 スキーマ
(
VISUAL_BASELINE_REVIEW_EVIDENCE_V2)の全フィールド(contract_digest/workflow_run_id/check_run_id/check_suite_id/github_app_id・github_app_slug/check_conclusion/baseline_path/baseline_sha256/actual_sha256/verify_command_id/update_command_id/manifest_sha256等)を per-surface record として完全に実装した(
component-vrt-reportが新設--mode build-evidence-manifestCLI で登録済み surface ごとに 1 record を生成し、CheckRun binding は record 自身の自己申告ではなく独立取得した CheckRun
API lookup のみを信頼源とする。record 自身は
manifest_sha256による改ざん検知を持つ)。この再設計は fix_delta iteration 3
(
scripts/agent-ops/resolve_visual_impact.pyのVISUAL_BASELINE_REVIEW_EVIDENCE_V2実装、scripts/agent-ops/tests/test_visual_impact_v2_manifest_seams.pyほか)で完了した。
visual-impact-policyevaluator が候補 PRhead から checkout・実行される trust boundary 制約を確認し、
.github/workflows/visual-impact-trusted-consumer.yml(workflow_runトリガー、PR head 非 checkout、producer artifact の独立検証、専用
CheckRun
visual-impact-policy-trusted発行)という untrusted/trusted2-phase workflow を実装した(AC30-37)。ただし main 未マージのため
live 発火は未確認(詳細は Safety Claim Matrix 該当行参照)。
evidenceフィールドが{"ok","reason"}という canonical schema と一致しない形状で生成されていた不具合を修正し、
baseline_unchanged/canonical_verify_success/evidence_manifest_digest/expected_actual_diff_available/authorized_ownerのみを許可する schema に一致させ、upload 前にschema 検証するようにした。
常に
None(未検証)扱いにしていた不具合を実gh issue view検証に置き換え、waiver の authorized owner を全 surface の union ではなく
対象 surface 自身の contract path に限定するようにした。
実行時に
pull_request_number: 0の schema-invalid な decision を生成していた不具合を、
pull_requestイベント時のみ policy-check を実行するよう修正した。
25 件の新規回帰テスト(
scripts/agent-ops/tests/test_resolve_visual_impact.py17 件 /
test_visual_impact_decision_binding.py8 件)を追加し、既存の*visual_impact*/test_resolve_visual_impact.py/test_visual_surfaces_schema.pyテストは無変更のまま全 273 件 PASS することを確認した。修正後
pnpm typecheck/pnpm lint/pnpm test(1872 passed)/pnpm buildは全て成功し、
actionlintを変更後 workflow に対しローカル実行して0 件の指摘を確認した。
未対応(時間的制約による):
unknown_impact化)と P1-4(producer→consumer 境界の既存テスト網羅性の追加検証)は着手していない。
Safety Claim Matrix
本 PR は untrusted な PR body 入力の扱い、trusted な CODEOWNERS 認可、CI ワークフローの必須ゲート化に触れるため、以下の表で各安全性主張・実装状況・未制御範囲・根拠・後続対応を明記する。
VISUAL_IMPACT_DECLARATION_V1(untrusted PR body)を shell source へ展開しないresolve_visual_impact.py::parse_declaration()は PR body を YAML パースのみに使い、subprocess/argv には一切渡さない。test_visual_impact_declaration_parser.py::test_pr_body_string_never_used_as_shell_sourceで command-substitution 様ペイロードを注入し schema 拒否を確認waiveddisposition の owner authority を trusted base branch CODEOWNERS からのみ導出し、PR body 自己申告・head 側新設 CODEOWNERS を authority にしないresolve_visual_impact.py::authorized_owners_for_paths()は呼び出し元が渡した CODEOWNERS テキストのみを信頼源とし、test_visual_impact_waiver_authority.py::test_head_branch_introduced_codeowners_is_never_the_trusted_sourceで base 側未設定時に authorize されないことを確認。CI job (.github/workflows/ci.yml) はgit show "${BASE_SHA}:.github/CODEOWNERS"のみを渡すrequire_code_owner_reviews有効化)は #2019 In Scope G により別 ops stepvisual-impact-policyrequired CI check の GitHub Actions App source pinningcheck_runs_api_to_raw_checks()のapp.slugフィルタ +test_visual_impact_policy_verdict.py::test_wrong_github_app_source_is_never_accepted_as_evidence/test_unknown_source_missing_app_field_is_never_accepted_as_evidencerequire_code_owner_reviews有効化visual-impact-policyCheckRun / artifact binding の runtime 検証(AC28)test_visual_impact_current_head_binding.pyはローカルでは SKIP(live PR head 不在のため)。pr-review-judge が実 PR head 上で再検証するvisual-impact-policyevaluator 自身の trust boundary(候補 PR head からの checkout・実行)visual-impact-policyjob(untrusted 側)は依然としてref: ${{ github.event.pull_request.head.sha }}で PR head を checkout し、その head の.github/workflows/ci.yml/resolve_visual_impact.py/resolve_visual_impact.mjs/registry schema/decision schema/registry policy をそのまま実行・解釈する。この untrusted 側の性質自体は変わっていない。これに対し AC30-37 で.github/workflows/visual-impact-trusted-consumer.ymlという trusted 側 consumer job を新規追加した。workflow_run(workflows: ["ci"], types: [completed])トリガーで動作し、PR head を一切 checkout せず、producer(untrusted job)が生成したVISUAL_IMPACT_DECISION_V1artifact と evidence manifest を base ref のスクリプトのみで独立に再検証し、専用 CheckRunvisual-impact-policy-trustedを発行する。schema violation・digest 改ざん・forced-success producer・artifact 欠落・stale head(workflow_runhead_sha と現在の PR head の不一致)を fail-closed で拒否することを 17 件の合成 fixture テスト(test_visual_impact_trusted_consumer.py)で確認済み。ただしこの trusted consumer job 自体はまだ main にマージされていないため、workflow_runトリガーの構造的制約(workflows: ["ci"]は main 上の同名 workflow の completion を要件とする)により本 PR のどの CI 実行でも一度も発火していない(live 発火の実証は未達)。また live public ruleset(id 16796903)の required checks はtypecheck/lint/test/build/python-testの5件のみでvisual-impact-policy/visual-impact-policy-trustedのいずれも含まず、require_code_owner_review: falseのままである。untrusted 側 job(visual-impact-policy)自体を廃止・checkout 制限する再設計ではなく、独立した trusted consumer を並置する形での P0-6 対応であるNotes
Closesを使わない)