Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1380"
ancestor_issue: "#1370"
goal_ref: "VRT suite 増加後も CI summary と artifact validator が実際の比較条件を capture 単位で正しく監査できるようにする"
change_kind: workflow
preflight_scope: pr_review_only
runtime_verification_applicability: not_applicable
baseline_expect: failRuntime Verification Applicability
- decision: not_applicable
- reason: 本 Issue の変更対象は CI summary 生成(shell)・Python static validator・pytest unit test・docs のみであり、ゲームプロセスの起動・通信・I/O を伴わない。
pnpm test:vrt:e2e(実 Playwright 実行)はpreflight_scope: pr_review_onlyとして PR レビュー時に確認するが、baseline immediate な runtime AC としては要求しない。
Parent Issue
Parent Goal Ref
- Goal: 導入: 右側 command rail をゲーム内 DOM overlay に統合する #1370 の battle-stage DOM overlay VRT を、未完成 UI を
frozenbaseline として凍結しない形で段階導入する。 - Desired Destination: 実装: Playwright + Vitest Browser Mode 段階導入で #1370 battle-stage DOM overlay を VRT 保護 #1380 を VRT rollout tracker として扱い、child issue の完了で registry / fixture / VRT / CI / update guard / advisory triage / 後続 baseline 昇格を追跡する。
Dependencies
- Depends on: 実装: Playwright primary VRT suite を pending/provisional baseline だけで導入する #1386
- Blocks or precedes: 実装: required CI を snapshot read-only に固定し baseline canonicalization を reviewed PR 境界に限定する #1388
- Required before active component-suite validation: 実装: Vitest Browser Mode component VRT を report-only scaffold として追加する #1389
- Related provenance gap: 実装: VRT fixture 適用の app 側 attestation marker を追加する #1728
Current Validated Scope
.github/workflows/ci.ymlとscripts/check-visual-artifact-pipeline.pyを、suite 単位ではなく capture 単位(test file 内の個々のtoHaveScreenshot()/expectDomOverlayScreenshot()呼び出し)の active VRT 一覧ベースへ拡張する。- capture ごとの browser / project / channel / comparator / artifact scope(job 単位か suite 単位か)/ digest / directory の出力を docs(
docs/dev/visual-baseline-registry.md)の component 追跡と揃える。 - Dependencies 行は本 Issue が依存・先行する Issue 番号として扱う。
- baseline PNG は追加・更新しない。
Remaining Parent Gaps
- snapshot update local-human-only guard、Vitest component VRT、AI/VLM triage は後続 Issue で扱う。
- Playwright custom reporter によるランタイム証跡収集(本 Issue の PR 実装: Playwright primary VRT suite を pending/provisional baseline だけで導入する (#1386) #1721 レビュー由来の追加証跡で指摘された P1-1 の恒久解)は本 Issue のスコープ外とし、static validator の限界(TypeScript source regex 解析)を明示した上で別 Issue に切り出す。
Outcome
CI summary と visual artifact validator が、active な VRT capture(suite ではなく、test file 内の個別 screenshot 呼び出し単位)ごとの screenshot directory / comparator(maxDiffPixels または maxDiffPixelRatio のいずれか一方)/ tolerance / artifact scope(job 単位か suite 単位か)/ artifact digest を cross-validate し、関連 checks が PASS する状態にする。
In Scope
.github/workflows/ci.ymlの VRT summary を capture 単位へ拡張- active な capture ごとの screenshot directory / browser / project / channel / viewport / DPR / comparator種別(
maxDiffPixelsormaxDiffPixelRatio、両方ではなく片方のみ)/ tolerance / stylePath / artifact scope(joborsuite)/ artifact URL / digest / retention 出力 scripts/check-visual-artifact-pipeline.pyの capture 単位対応(maxDiffPixelsとmaxDiffPixelRatioの両方を検査し、両方指定・両方欠落を fail とする)- artifact 不在状態(
uploaded/no_files/step_not_run/upload_failed)の契約化 - Playwright E2E と将来の Vitest component VRT の directory 分離契約を docs に明文化
- validator 用 fixture / unit test(正常系・主要否定系)の追加
- Dependencies 行を実際の Issue 番号形式へ修正
Out of Scope
- 新規 VRT baseline PNG
- Vitest Browser Mode の導入本体(実装: Vitest Browser Mode component VRT を report-only scaffold として追加する #1389)
- snapshot update script(実装: required CI を snapshot read-only に固定し baseline canonicalization を reviewed PR 境界に限定する #1388)
- AI/VLM triage
- Playwright custom reporter によるランタイム証跡収集の実装(P1-1 の恒久解、別 Issue)
docs/schemas/visual-evidence-contract.schema.jsonを正本とする machine-readable manifest 生成器(scripts/generate-visual-evidence-summary.py)の新設(Allowed Paths には確保するが、本 Issue の AC はこの生成器の実装を必須としない — 既存の CI shell summary + validator の capture 単位拡張で AC を満たす場合はそれで足りる)
Acceptance Criteria
- AC1: CI summary が active な VRT capture(suite ではない)を列挙する。
- AC2: summary が capture ごとに screenshot directory / browser / project / viewport / DPR / comparator種別と値(
maxDiffPixelsまたはmaxDiffPixelRatio)/ stylePath / artifact scope(joborsuite)/ artifact URL / digest / retention を出力する。 - AC3: validator が M2 固定 path だけでなく、active な capture ごとの directory と comparator options(
maxDiffPixelsとmaxDiffPixelRatioの両方)を cross-validate する。 - AC4: summary が実値とずれた場合、validator が hard fail する。
- AC5: comparator の
maxDiffPixels/maxDiffPixelRatio排他性(両方指定・両方欠落)を validator が検査し fail する。 - AC6: Playwright と Vitest の screenshot directory が混線しない契約が docs にある。
- AC7: artifact 不在状態(
uploaded/no_files/step_not_run/upload_failed)を validator が区別して検査する。 - AC8:
python-testlane で validator が常設実行される。 - AC9: validator 用の正常系・否定系 fixture / unit test が追加される。否定系には最低限、以下を含む: (a)
maxDiffPixelRatioの値をmaxDiffPixelsとして誤表記した場合に fail、(b) comparator を両方同時指定した場合に fail、(c) active capture の directory drift で fail、(d) duplicate capture ID で fail、(e) pending-baseline を active capture として登録した場合に fail、(f) Playwright と Vitest の baseline root 混線で fail、(g) artifact digest 配線欠落で fail。 - AC10: typecheck / lint / test / build / python-test relevant checks が PASS する。
Verification Commands
# AC1
$ rg -n "active.*capture" .github/workflows/ci.yml scripts/check-visual-artifact-pipeline.py
# AC2
$ rg -n "screenshot directory" .github/workflows/ci.yml
# AC3
$ rg -n "maxDiffPixelRatio" scripts/check-visual-artifact-pipeline.py
# AC4
$ uv run python3 -m pytest scripts/tests/test_check_visual_artifact_pipeline.py -k hard_fail -q
# AC5
$ uv run python3 -m pytest scripts/tests/test_check_visual_artifact_pipeline.py -k exclusivity -q
# AC6
# baseline-expect: pass
$ rg -n "Playwright" docs/dev/visual-baseline-registry.md
# AC7
$ uv run python3 -m pytest scripts/tests/test_check_visual_artifact_pipeline.py -k artifact_status -q
# AC8
# baseline-expect: pass
$ rg -n "check-visual-artifact-pipeline.py" .github/workflows/ci.yml
# AC9
$ uv run python3 -m pytest scripts/tests/test_check_visual_artifact_pipeline.py -q
# AC10
$ pnpm typecheck
# AC10
$ pnpm lint
# AC10
$ pnpm test
# AC10
$ pnpm buildAllowed Paths
.github/workflows/ci.ymlscripts/check-visual-artifact-pipeline.pyscripts/tests/test_check_visual_artifact_pipeline.pytests/fixtures/**tests/e2e/visual-utils.tstests/e2e/visual-overlay.spec.tsplaywright.config.tsdocs/schemas/visual-evidence-contract.schema.jsondocs/dev/visual-baseline-registry.md.github/ci/python-test-plan.json
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- baseline PNG の追加・更新が必要になった場合
- GitHub Actions artifact upload major pin を変更する必要が出た場合
- external service upload が必要になった場合
tests/e2e/reporters/**(Playwright custom reporter)の新設が必要と判明した場合(P1-1 の恒久解は別 Issue のスコープ)
Required Skills
- GitHub Actions
- Python
- TypeScript(Playwright helper の型定義変更を含む)
- Visual regression testing
Required Design References
docs/dev/visual-baseline-registry.md.github/workflows/ci.ymlscripts/check-visual-artifact-pipeline.pytests/e2e/visual-utils.ts- PR 実装: Playwright primary VRT suite を pending/provisional baseline だけで導入する (#1386) #1721 レビューコメント: 実装: Playwright primary VRT suite を pending/provisional baseline だけで導入する (#1386) #1721 (comment)
- Issue 実装: VRT CI evidence matrix と artifact validator を active suite 対応に拡張する #1387 anchor comment(敵対的レビュー): 実装: VRT CI evidence matrix と artifact validator を active suite 対応に拡張する #1387 (comment)
Scope Delta(任意)
- 追加パス:
.github/ci/python-test-plan.json - 理由: PR 実装: VRT CI evidence matrix と artifact validator を capture 単位に拡張する (#1387) #1813 の CI
python-testjob がci_test_selection/v1artifact 生成時に「Uncovered tests: 1」で fail-closed した。原因は本 Issue で新設したscripts/tests/test_check_visual_artifact_pipeline.pyが.github/ci/python-test-plan.json(python-test job のターゲット SSOT)に未登録のため。新規テストファイルを実行対象へ登録するには本ファイルのtargetsに 1 行追加する変更が必要で、これは元の Allowed Paths 外だった。 - 承認: リポジトリオーナーが本 Scope Delta を承認済み(impl-review-loop 実行中の会話)。
- 影響範囲:
targets配列への 1 エントリ追加のみ(ignore/deselect/ スキーマは変更しない)。
Delivery Rule
- 1 Issue = 1 PR
- 作業前に issue-contract-review で fresh
CONTRACT_REVIEW_RESULT_V1 status: goを取得する。 - 実装: Playwright + Vitest Browser Mode 段階導入で #1370 battle-stage DOM overlay を VRT 保護 #1380 は rollout tracker として残し、この Issue はここに記載した Allowed Paths 内で完結させる。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jul 25, 2026
PR #1721 レビュー由来の追加証跡(follow-up A)
PR #1721(Issue #1386 実装, Playwright primary VRT suite)の人間レビュー指摘 #3([P1 / Merge-train blocker])で、この Issue の AC3(validator が active suite の directory / comparator options を cross-validate する)が扱うべき具体的な失敗パターンが確認されたので、本 Issue のスコープを補強する追加証跡として記録する。
確認された具体的な失敗パターン
baseline path: m2-combat-mvp.spec.ts/とcomparator: maxDiffPixels=1を固定出力し、#1386で追加されたtests/e2e/visual-overlay.spec.ts(screenshot directory・maxDiffPixelRatiocomparator・Canvas mask)に対応していない。scripts/check-visual-artifact-pipeline.py想定箇所)はDEFAULT_SPEC = tests/e2e/m2-combat-mvp.spec.tsに固定されたうえ、正規表現でmaxDiffPixelsのみ抽出しmaxDiffPixelRatioを検査しない。maxDiffPixelRatio)、新 overlay が 2% 許容でも、別 screenshot のmaxDiffPixels: 1を拾って「suite の comparator は 1 pixel」と誤認できる状態が実際に存在する。この Issue の AC への反映提案
maxDiffPixelsとmaxDiffPixelRatioを suite ごとに明示的に区別し、どちらの comparator が使われているかを summary / validator の両方で machine-readable に出力・検査すること。maxDiffPixelsormaxDiffPixelRatio/ threshold / baseline digest / artifact URL・digest を単一の machine-readable manifest から生成・検査する設計を優先する(PR 実装: Playwright primary VRT suite を pending/provisional baseline だけで導入する (#1386) #1721 レビューでの提案)。本コメントは Issue #1387 の Machine-Readable Contract・AC・Allowed Paths を変更するものではなく、実装着手時に参照すべき具体的な証跡として追加する。
squne121 commentedon Jul 26, 2026
判定
BLOCKED — 現状の Issue contract のまま実装着手すべきではありません。
目的自体は妥当です。現行validatorは
m2-combat-mvp.spec.tsとmaxDiffPixelsに固定され、CI summaryも旧baseline pathとmaxDiffPixels=1を固定表示しているため、PR #1721で追加されたoverlay VRTの実態を監査できません。問題は、#1387がこの欠陥を認識している一方、データモデル・Allowed Paths・検証方法が、要求している保証水準に届いていないことです。関連する流れは、#1384でregistryを文書化し、#1385でfixture/freeze CSSを導入し、#1386/PR #1721でPlaywright primary VRTを追加、そのレビュー由来のCI監査欠陥を#1387へ移送した、というものです。fixtureが実際にアプリへ適用されたかを証明する別欠陥は#1728、snapshot更新禁止は#1388、Vitest Browser Modeは#1389に分離されています。
敵対的レビュー
P0-1. comparatorは「suite」ではなく「capture/baseline」に属する
#1387はactive suiteごとにcomparator/toleranceを出す設計ですが、既存実装だけで既に破綻しています。
同じ従来Playwright領域に以下が混在しています。
timeout-overlay:maxDiffPixels: 1running-hud:maxDiffPixelRatio: 0.08running-hud-overlay-legacy-current:maxDiffPixels: 100つまり、test fileやsuiteを一単位としてcomparatorを一つ持たせることはできません。正しい階層は次です。
現行Issueの「suite comparator」をそのまま実装すると、複数captureのどれか一つを代表値として誤報するか、配列を文字列化しただけの曖昧なsummaryになります。
P0-2. active suiteとartifactのスコープが定義されていない
現行CIは通常の
pnpm test:e2e:ciでpreview-namespace以外のPlaywright specをまとめて実行し、playwright-report/とtest-results/をジョブ単位で一回だけuploadします。test:vrt:e2eはpackage scriptとして存在しますが、CIの独立laneとしては実行されていません。したがって、各suite行に同じartifact URL/digestを複製すると、「suite専用artifact」のように見える虚偽のprovenanceになります。最低でも次を分離すべきです。
ci_lane_idartifact_scope: job | suiteartifact_contains_suite_idssuite_execution_statuscapture_execution_status現在のartifactがジョブ共用なら、artifact情報はトップレベルに一度だけ置き、suiteから参照させる必要があります。
P0-3. 単一正本化は現在のAllowed Pathsでは実現できない
現在のactive VRT情報は少なくとも三重管理です。
docs/dev/visual-baseline-registry.mdvisual-utils.tsの手書きVISUAL_BASELINE_REGISTRY_IDS/MATURITYvisual-utils.ts自身も、Markdown registryと手動同期する設計だと明記しています。しかし#1387のAllowed Pathsには次が含まれません。
tests/e2e/visual-utils.tstests/e2e/visual-overlay.spec.tsplaywright.config.tspackage.jsonIssueコメントは「単一のmachine-readable manifest」を推奨していますが、現在のAllowed Pathsではconsumer側をそのmanifestへ接続できません。結果として「第四の手書き正本」を追加するだけになる可能性が高いです。
P0-4. fixture/unit coverageが受け入れ条件として成立していない
In Scopeにはvalidator fixture/unit coverageがありますが、Allowed Pathsは
tests/fixtures/**だけです。テストfixtureは置けても、pytest test本体を追加できません。さらにVerification Commandsはgrepと正常系validator実行だけであり、AC4の「summaryが実値とずれたらhard fail」を実証していません。コード検索でも
VISUAL_ARTIFACT_PIPELINE_CHECK_V1の実装はvalidator本体しか確認できず、専用unit testは存在しません。最低限、以下の否定系テストが必要です。
P1-1. source regexの拡張は安全な解決策ではない
現行validatorはTypeScriptを正規表現で読み、viewport、snapshotPathTemplate、
maxDiffPixelsを抽出しています。object spread、importされた定数、helper default、複数screenshot call、project override、条件分岐には対応できません。「
maxDiffPixelRatio用regexを追加する」程度では、同じ問題を拡大するだけです。Playwrightはcustom reporterを公式に提供し、test annotationもreporterから取得できます。各visual testへregistry IDなどをannotationとして付与し、reporterが実行済みtest/project/resultをmachine-readable JSONへ出す方が、TypeScript source regexより堅牢です。 (Playwright)P1-2. 比較条件のfingerprintが不足している
Playwrightの視覚比較条件には、pixels/ratio以外にも以下があります。
threshold。既定値は0.2scale。assertionでは既定cssanimationscaretmaskmaskColorstylePathこれらを記録しないと、summary上は同じcomparatorでも実際の比較結果が変わり得ます。 ([Playwright]2)
また現行helperはコメント上「
maxDiffPixelsとmaxDiffPixelRatioは排他的」としていますが、実装は「両方未指定」しか拒否せず、両方指定された場合はmaxDiffPixelsを選びratioを黙って捨てます。#1387がsource解析だけ行っても、実際に有効なoptionの決定規則を正しく表現できません。この修正にはvisual-utils.tsが必要ですが、現在はAllowed Paths外です。P1-3. artifact digestの意味が曖昧
actions/upload-artifactのartifact-digestは、uploadされたartifactのSHA-256 digestです。これは次とは別物です。upload-artifact@v6は既にartifact-id、artifact-url、artifact-digestを出力するため、#1387でmajor pinを変更する必要はありません。 ([GitHub]3)フィールドは少なくとも次のように命名分離すべきです。
なお、artifact自身の内容に「自分自身のupload digest」を格納することは自己参照になるため不可能です。upload digestはsummaryか、別のattestation envelopeに置く必要があります。
P1-4. static validatorとruntime evidenceを混同している
python-testlaneのvalidatorが確認できるのは、workflow YAMLに正しい式が書かれているかまでです。実際の以下の値はe2e runtimeでしか確定しません。したがって二段階に分ける必要があります。
workflow配線、schema、固定contract、summary generator呼び出しを検査する。
reporter出力、baseline hash、attachment inventory、実際のproject情報を検査する。
現在のsummaryのようにshellの
echoで設定値を再記述する方式は廃止し、同じmanifestからsummaryを生成すべきです。P1-5. artifact不在状態を契約化していない
現在のupload stepは
if-no-files-found: warnです。build失敗やtest開始前失敗ではreport/resultsが存在せず、URLやdigestが得られない可能性があります。一方、#1387はartifact URL/digestをactive suiteの必須項目のように記述しています。次の状態を区別する必要があります。
N/A文字列への潰し込みはmachine-readable contractとして不適切です。P1-6. #1728未完了中はscenario provenanceを完全とは主張できない
#1728が指摘するように、test側WeakMapへfixtureを保存したことと、アプリがfixtureを実際に読み込んでstateへ反映したことは別です。attestation markerがない状態でsummaryへ
scenario: running-hudと書いても、それは要求値であって実行証明ではありません。#1387自体を#1728でブロックする必要まではありませんが、manifestには次が必要です。
unavailableの間はfrozen promotion不可とすべきです。P2-1. Vitestとの共通化はnamespaceを分けるべき
#1389はVitest Browser Modeをreport-onlyで導入し、Playwrightとはscreenshot directoryを分離する契約です。Vitestはbaseline名へbrowser/platformを含め、比較optionも
comparatorName、allowedMismatchedPixelRatio、allowedMismatchedPixelsなどPlaywrightと異なります。実際に両方を指定した場合の処理規則もPlaywright helperとは異なります。 (Vitest)共通の
comparator文字列へ正規化せず、framework別の型を持たせるべきです。P2-2. dependency表記がmachine-readableではない
#1387の
Depends on: split Issue 3はIssue番号ではありません。リポジトリのissue-contract-reviewはnative dependency APIを主情報源とし、fallbackもDepends on #N形式を前提にしています。少なくとも次へ置換すべきです。
推奨設計
1. 正本をcapture単位のmachine-readable contractにする
2. Playwright reporterでruntime結果を出す
各testへannotationで
capture_id/registry_idを付け、custom reporterが以下を出します。Playwright公式のreporter/annotation APIで実装可能です。 (Playwright)
3. summaryをmanifestから生成する
CI shell内にfingerprintを再記述しない構成にします。
Python validatorは、summary本文を曖昧なsubstringで読むのではなく、generator入力とworkflow wiringを検査します。
Issue contractで必須の修正
Allowed Pathsは少なくとも次まで広げる必要があります。
Acceptance Criteriaには次を追加すべきです。
Verification Commandsも最低限、次を追加すべきです。
最終結論
#1387は必要なIssueですが、現状のまま進めると「hard-coded summary」を「より複雑なhard-coded summary」に置き換えるだけです。
実装着手前の必須修正は次の4点です。
推奨判定:
issue-contract-review status: blocked。Issue refinement後にfresh preflightを取り直すべきです。squne121 commentedon Jul 26, 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 26, 2026
Allowed Paths 拡張の承認(ANCHOR_SCOPE_REFRAME_V1)
squne121 commentedon Jul 26, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 26, 2026
Contract Review Result
squne121 commentedon Jul 26, 2026
implement-issue: overlap preflight human override 記録 (proceed_with_collision_evidence 相当)
check_implementation_overlap.pyの実行結果はroute: human_review_requiredでしたが、リポジトリオーナー(人間)が候補を精査し false positive と明示的に判断したため、実装を続行します。Evidence
evidence_sha256: sha256:d2bb8290fdb710faea2152c527e0c5855be987ea931b56b2db98ebfb6129c9f0decision_inputs_sha256: sha256:f23bb62c53e47f5b0063ce620af7b5b0b72593743cbc95b674209b6507bb742d/tmp/overlap_preflight_1387.json(IMPLEMENT_SCOPE_COLLISION_PREFLIGHT_V1)候補
Depends on: #1386)overlapping_paths: [](実ファイル重複なし)shared_ac_ids(AC番号付けテンプレートの一致)/shared_output_schema: [CONTRACT_REVIEW_RESULT_V1](契約レビュー出力スキーマ名の一致)policy_class: C2a(closed predecessor 経由の依存)人間判断
リポジトリオーナーが上記候補を確認し、Issue #1387 と #1386 の間に実装上の衝突はなく、構造シグナルのみの false positive であることを承認しました。
proceed_with_collision_evidence相当として実装を続行します。後続: Step 3 以降(worktree 作成 → 実装 → Verification Commands → open-pr 経由 Draft PR 作成)へ進みます。PR 本文に
evidence_sha256を転記します。squne121 commentedon Jul 26, 2026
implement-issue: Step 7 直前 drift re-check 結果
check_implementation_overlap.pyを再実行した。human_review_required(不変)overlapping_paths: []、policy_class: C2a、reasonsは初回実行と完全一致。current_issue.body_sha256/ candidate 実装: Playwright primary VRT suite を pending/provisional baseline だけで導入する #1386 のbody_sha256は初回実行と一致(contract 本文に実質的な変更なし)。
evidence_sha256は初回実行時(sha256:d2bb8290...)と異なる(
sha256:7f1824ca43b7899af99111acba4a7de0722a2bf807eb0e82de1f681635d4e586)が、これは evidence に含まれる
source.collected_atタイムスタンプの差分によるもので、候補集合・contract 本文・route いずれも変化していない。
同一候補・同一 route(既にリポジトリオーナーが false positive として承認済み)
であるため、新規の human_review_required 発生ではなく実質的な drift ではないと
判断し、Step 3 以降(実装・検証・PR 起票)を継続する。
squne121 commentedon Jul 26, 2026
Contract Review Result
fix: python-test-plan.json に test_check_visual_artifact_pipeline.py を登録
fix: docs/dev/visual-baseline-registry.md の見出し日本語比率不足を解消