Skip to content

実装: component-vrt-report の combat-hud-running VRT baseline を #1958 新レイアウトに合わせて再生成する #2014

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1958"
goal_ref: "#1958 / PR #2006 により失効した combat-hud-running component VRT baseline を、critical HUD fragment の欠落を実際に検出できる comparator 契約のもとで再生成し、判別力のある runtime evidence を current head に紐づけて残す"
change_kind: code
preflight_scope: pr_review_only

Parent Issue

#1958(combat HUD の配置・safe-zone配置・情報優先度の実装。PR #2006 でマージ済み)。本 Issue は、その production HUD 変更により失効した component-vrt-report(非required・report-only)の combat-hud-running baseline を追従させる debt repair として、#1958 の子 Issue に位置付け直す。

Parent Goal Ref

#1958 の Outcome(combat HUD の safe-zone 配置・情報優先度実装)。本 Issue は、その変更で component-vrt-report が failing のまま放置されている状態を解消する debt repair として起票されたが、PR #2024 のレビュー過程で、baseline 再生成だけでは comparator 自体に回帰検出力がないという Stop Condition が発火した(Source 参照)。本 Issue はその Stop Condition の解消を含む形に再スコープする。

Current Validated Scope

  • tests/component/combat-hud-running.vrt.test.ts の comparator 契約を、実測ノイズから校正した allowedMismatchedPixels 絶対値上限を allowedMismatchedPixelRatio: 0.02 と併記する形に更新し、status / elapsed / pause / edge-control の critical subregion を個別に検証する capture もしくは visual assertion を追加する。
  • HULL / Pause / elapsed を意図的に非表示にする env-gated negative-control mutation lane を追加し、通常の screenshot assertion が non-zero mismatch で fail することを CI 上で証明する。
  • hp=25/maxHp=100 等の critical fixture を追加し、critical warning の視覚契約を実際に一度は撮影する。
  • 上記の契約変更を反映した状態で、tests/component/__screenshots__/combat-hud-running.vrt.test.ts/combat-hud-running-chromium-linux.png(および critical fixture 用の新規 baseline PNG)を CI ピン留め canonical environment 内で再生成する。
  • 「3 回連続実行で安定」の evidence を、コミット済み baseline file の不変性ではなく、各 fresh process が保存した actual PNG の SHA-256 一致によって証明する。
  • current head に紐づく expected/actual/diff・mismatch count・effective pixel limit・mutation control 結果を、PR comment または CI artifact として構造化 evidence(VISUAL_BASELINE_REVIEW_EVIDENCE_V1)で残す。

Remaining Parent Gaps

Outcome

.github/workflows/ci.yml の component-vrt-report ジョブ(非required・report-only)が、critical HUD fragment(HULL / Pause / elapsed)の欠落を実際に検出できる comparator 契約のもとで PASS する状態にする。具体的には、tests/component/combat-hud-running.vrt.test.ts の comparator に校正済み絶対値 pixel cap と critical subregion assertion を追加し、env-gated mutation negative-control lane でその検出力を証明したうえで、critical fixture を含めて baseline PNG 群を CI ピン留め canonical environment で再生成・コミットし、current head に紐づく判別力のある runtime evidence を残す。恒久的な co-change enforcement(visual-surface dependency registry・required visual-impact policy check)は Issue #2019 で別途実装する。

In Scope

  • tests/component/combat-hud-running.vrt.test.ts の既存 combat-hud-running シナリオの comparator に、実測ノイズ(fresh-run actual と現行 baseline の diff)から校正した allowedMismatchedPixels 絶対値上限を追加し、allowedMismatchedPixelRatio: 0.02 と併記する(Vitest は比率と絶対値を併記した場合、厳しい方を採用する)。
  • status / elapsed / pause / edge-control の critical subregion に対する個別 capture または個別の小さい visual assertion を追加する。各 critical subregion の DOM ルートには data-critical-subregion="status|elapsed|pause|edge-control" 属性を付与し、テストコードから機械可読に選択できるようにする。DOM の toBeVisible() だけでは代替しない(Vitest の visibility 定義では opacity: 0 も visible 扱いのため、visual mutation または computed-style/pixel assertion を用いる)。
  • HULL・Pause・elapsed を意図的に非表示にする env-gated mutation negative-control lane(新規 test ファイルまたは既存ファイル内の env-gated describe/test)を追加し、CI wrapper で通常の screenshot assertion が必ず non-zero mismatch で fail することを確認する。
  • hp=25/maxHp=100 等、critical warning が表示される critical fixture のシナリオを追加し、対応する baseline PNG を新規に capture・コミットする。
  • 上記のテスト・comparator 変更を反映した状態で、combat-hud-running-chromium-linux.png(既存 running シナリオ)と新規 critical fixture 用 baseline PNG を、CI がピン留めしている Playwright Docker イメージ(mcr.microsoft.com/playwright@sha256:9bd26ad900bb5e0f4dee75839e957a89ae89c2b7ab1e76050e559790e946b948)内で pnpm test:vrt:update:component を対象 spec に絞って実行し再生成する。
  • 再生成前後で expected/actual/diff を個別に目視レビューし、実装: combat HUD の配置・safe-zone・情報優先度を実装する #1958 の意図した新レイアウト(status 左下・elapsed 上部中央・条件付き edge control)以外の差分がないことを確認する(blanket tolerance widening は行わない)。
  • 各 fresh browser process が reference とは別に actual PNG を保存する evidence capture(locator.screenshot({ path: ... }) 等)を追加する。pnpm test:vrt:evidence:triple-run(新規 pnpm script。pnpm test:vrt:component を fresh process で 3 回連続実行し、各回の actual PNG から actual_sha256_run_1 / actual_sha256_run_2 / actual_sha256_run_3 を計算・比較する単一コマンド)を追加する。
  • head SHA、container digest、browser/tool versions、viewport、DPR、run ID、artifact ID、baseline/actual SHA-256、mismatched pixel count、effective pixel limit、mutation control 結果を含む VISUAL_BASELINE_REVIEW_EVIDENCE_V1 相当の evidence manifest を生成し、current head に紐づく形で CI artifact または PR comment として残す。
  • 上記に必要な範囲で vitest.visual.config.ts(calibration に config 変更が必要な場合)、.github/workflows/ci.yml(mutation negative-control lane / evidence artifact 生成の CI 統合が必要な場合)、package.json(新規 pnpm script が必要な場合)、docs/dev/visual-baseline-registry.md(comparator 契約・evidence 方針の記述更新。maturity 遷移は含まない)を変更する。

Out of Scope

Acceptance Criteria

  • AC1: tests/component/combat-hud-running.vrt.test.ts の combat-hud-running シナリオの comparator が allowedMismatchedPixelRatio: 0.02 に加えて allowedMismatchedPixels 絶対値上限を指定しており、その値が実測ノイズ(fresh-run actual と再生成後 baseline の diff)から導出されたものであり、任意の固定値ではないことがコメントまたは evidence manifest で追跡可能である。
  • AC2: status / elapsed / pause / edge-control の critical subregion それぞれについて、data-critical-subregion 属性で選択した個別 capture または個別の小さい visual assertion が tests/component/ 配下に存在する。
  • AC3: HULL・Pause・elapsed のいずれかを意図的に非表示にする env-gated mutation negative-control lane が存在し、CI 上でその lane を有効化すると通常の screenshot assertion が non-zero mismatch で fail する(false-negative にならない)。
  • AC4: hp=25/maxHp=100 等、critical warning を表示する critical fixture のシナリオと、対応する baseline PNG が新規に追加されている。
  • AC5: tests/component/__screenshots__/combat-hud-running.vrt.test.ts/combat-hud-running-chromium-linux.png(および AC4 の critical fixture baseline)が、AC1-AC3 の comparator/critical-region/mutation-control 契約変更を反映した最終状態で、CI ピン留め canonical environment 内で再生成されコミット更新されている。
  • AC6: CI ピン留め canonical environment 内で pnpm test:vrt:component(対象 spec 限定)を実行すると、running シナリオ・critical fixture シナリオともに PASS し、mutation negative-control lane は AC3 の通り意図通り fail する。
  • AC7: pnpm test:vrt:evidence:triple-run が、AC6 の通常 assertion(mutation lane を除く)を fresh browser process で 3 回連続実行し、各回で保存した actual PNG の SHA-256(actual_sha256_run_1 / actual_sha256_run_2 / actual_sha256_run_3)が 3 回とも一致することを確認して exit code 0 で終了する。コミット済み baseline file が --update なしの実行で変化しないことの確認だけでは満たさない。
  • AC8: current head SHA・CI run ID・artifact ID・baseline SHA-256・actual_sha256_run_1/2/3・mismatched pixel count・effective pixel limit・mutation control 結果(hull_hidden / pause_hidden / elapsed_hidden それぞれの expected_failure 判定)を含む evidence manifest が生成され、current head に紐づく形で CI artifact または PR comment として残っている。旧 head の自己申告や、baseline PNG のみの artifact では満たさない。
  • AC9: 本 Issue で変更されるファイルは、拡張後 Allowed Paths の集合と完全に一致する(origin/main...HEAD の changed-path 集合が Allowed Paths のいずれかに一致する)。

Verification Commands

# AC1
# preflight-scope: pr_review_only
$ rg -n "allowedMismatchedPixels" tests/component/combat-hud-running.vrt.test.ts
# AC2
# preflight-scope: pr_review_only
$ rg -n "data-critical-subregion" tests/component/ -g "*.vrt.test.ts"
# AC3
# preflight-scope: pr_review_only
$ rg -n "mutation" tests/component/ -g "*.vrt.test.ts"
# AC4
# preflight-scope: pr_review_only
$ rg -n "mountCriticalScenario" tests/component/combat-hud-running.vrt.test.ts
# AC5
# preflight-scope: pr_review_only
$ pnpm test:vrt:component -- tests/component/combat-hud-running.vrt.test.ts
# AC6
# preflight-scope: pr_review_only
$ pnpm test:vrt:component -- tests/component/combat-hud-running.vrt.test.ts
# AC7
# preflight-scope: pr_review_only
$ pnpm test:vrt:evidence:triple-run
# AC8
# preflight-scope: pr_review_only
$ rg -rn "VISUAL_BASELINE_REVIEW_EVIDENCE_V1" .
# AC9
# baseline-expect: pass
$ git diff --name-only origin/main...HEAD

pnpm test:vrt:component / pnpm test:vrt:update:component は build を含まない hermetic な VC である。pnpm typecheck / pnpm lint / pnpm test / pnpm build は project-constitution の必須検証として PR レビュー時に別途実行する(本 Issue 固有の AC/VC には含めない)。AC7 の「3 回連続」・AC8 の evidence manifest は Runtime Verification Applicability の artifact_requirements で evidence として記録する。

Runtime Verification Applicability

decision: immediate
reason: "comparator 感度・critical subregion・mutation negative control・baseline 再生成は Vitest Browser Mode 上の実 Chromium レンダリングでのみ検証でき、静的解析では代替できない"
applicable_acs: [AC1, AC2, AC3, AC4, AC5, AC6, AC7, AC8, AC9]
execution_environment: "CI ピン留め Playwright Docker イメージ(mcr.microsoft.com/playwright@sha256:9bd26ad900bb5e0f4dee75839e957a89ae89c2b7ab1e76050e559790e946b948)内、Vitest Browser Mode、Chromium、viewport 1280x720、DPR 1"
skip_conditions: "pinned Docker イメージが利用不可、browser launch failure、pnpm install --frozen-lockfile の dependency lock mismatch"
fallback_policy: "host 環境生成または skip された evidence は PASS として扱わない。canonical environment での実行結果のみを merge blocker 解除の根拠とする。current head と紐づかない自己申告 evidence(旧 head で取得した3回実行等)は evidence として扱わない"
artifact_requirements:
  - head_sha
  - run_id
  - artifact_id
  - container_digest
  - node_version
  - pnpm_version
  - vitest_version
  - playwright_version
  - chromium_version
  - viewport
  - device_scale_factor
  - baseline_sha256
  - actual_sha256_run_1
  - actual_sha256_run_2
  - actual_sha256_run_3
  - mismatched_pixels
  - effective_pixel_limit
  - mutation_controls: { hull_hidden: expected_failure, pause_hidden: expected_failure, elapsed_hidden: expected_failure }
  - expected_actual_diff_review

Allowed Paths

  • tests/component/combat-hud-running.vrt.test.ts
  • tests/component/__screenshots__/combat-hud-running.vrt.test.ts/**
  • vitest.visual.config.ts
  • package.json
  • .github/workflows/ci.yml
  • docs/dev/visual-baseline-registry.md
  • scripts/tests/test_check_visual_artifact_pipeline.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 校正済み allowedMismatchedPixels を導入してもなお critical subregion(HULL/Pause/elapsed/status/edge-control)の欠落が comparator tolerance 内に収まる、mutation negative-control lane が意図通り fail しない、capture root / comparator / fixture に別の欠陥がある、または環境差以外の非決定性が検出された場合(baseline を更新せず、Issue 契約を再定義するために停止する)

Required Skills

  • Visual regression testing
  • Vitest Browser Mode
  • Playwright Docker image compatibility
  • image diff review
  • Chromium rendering determinism
  • pixel-level comparator calibration(絶対値 pixel cap の実測導出)
  • CI evidence artifact 設計

Required Design References

Source

本 Issue は post-merge-cleanup の follow-up 検出により起票され、issue-refinement-loop の anchor comment(OWNER, REQUEST_CHANGES, https://github.com/squne121/loop-protocol/issues/2014#issuecomment-5224590803)を反映して初版が全面的に rewrite された。

その後、本 Issue を Closes する PR #2024(baseline PNG 1 件のみの regeneration)に対し、OWNER が REQUEST_CHANGES review を投稿し(#2024 (comment) )、本 Issue 自身の Stop Condition「candidate が意図した HUD を撮影していない、critical region の欠落が comparator tolerance 内に収まる…場合、baseline を更新せず、Issue 契約を再定義するために停止する」が発火したことを指摘した。具体的には、現行 allowedMismatchedPixelRatio: 0.02(1280×212px capture で実効上限 約5,427px)は、HULL(約4,128px)・Pause(約2,808px)・elapsed(約1,344px)の欠落を tolerance 内に収め得ること、および「3 回連続安定」の evidence が実際には --update なし実行でコミット済み baseline file が不変であることしか確認しておらず actual rendering の同一性を証明していないことが指摘された。OWNER は承認条件として「Issue #2014 の Stop Condition を適用し、Allowed Paths を test/config/CI/registry まで拡張して契約を再定義する」ことを明示的に指示した。

本 rewrite はこの OWNER 指示を反映し、スコープを「baseline 再生成のみ」から「baseline 再生成 + comparator 感度修正(校正済み絶対値 pixel cap・critical subregion assertion・env-gated mutation negative control・critical fixture 追加)+ evidence retrofit(current head 紐づけの actual PNG 3 回 hash 比較・VISUAL_BASELINE_REVIEW_EVIDENCE_V1 相当の evidence manifest)」へ再定義した。#1980 が同種の oracle defect 発見・契約再定義の直接の先例として参照された。#2019 は visual-surface dependency registry の恒久対策として妥当であり続けるが、2% comparator の感度証明と surface-specific negative control は #2019 の明示的な Out of Scope であるため、本 Issue に残す。

さらに、AC4 で追加された hp=25/maxHp=100 critical fixture(combat-hud-critical.png)の実装は、既存の(本 Issue 起票以前から存在する)required check python-test-core の scripts/tests/test_check_visual_artifact_pipeline.py::test_extract_derived_vitest_component_captures_against_real_repo_spec_files を破壊した。同テストが Vitest component-VRT capture ID の期待集合を combat-hud-running.png のみにハードコードしており、AC4 で契約上正当に追加された combat-hud-critical.png を未考慮だったためである。この修正はテストのハードコードされた期待 capture-id 集合を更新するのみであり、新規の production behavior を伴わない。この narrow な修正のために Allowed Paths へ scripts/tests/test_check_visual_artifact_pipeline.py を追加する Scope Delta を適用した。

  • dedupe_key: follow-up:squne121/loop-protocol:pr/2006:component-vrt-report-baseline

Activity

  1. added
    phase/implementation
    agent/implementer
    on Aug 8, 2026
  2. squne121 commented on Aug 8, 2026

    @squne121
    OwnerAuthor

    新しいレイアウトを設計及び決定した際にVRT baseline再生成を作业内に含めるようにできないですか。
    テスト戦略サブエージェントやVRT設計者やIssue作成の際のSSOTに判断が思い出されるようにするとか。
    実装の都度、VRT baseline再生成が別Issueで行われる運用を良くないものだと思っているので再発防止策をWEB調査と検討してほしい。

  3. squne121 commented on Aug 8, 2026

    @squne121
    OwnerAuthor

    判定

    verdict: REQUEST_CHANGES
    target:
      - Issue #2014
      - issuecomment-5224465259
    assessment:
      immediate_baseline_repair: valid_but_contract_needs_fix
      recurrence_prevention: missing
      comment_resolution: not_satisfied

    指定コメントの問題提起は正しいです。
    #2014 は、既に壊れている component VRT を直す緊急補修としては有効です。しかし本文が意図的に「PNG 1ファイルのみ」に閉じ、テスト、registry、Issue 作成契約、CI gate の変更をすべて対象外にしているため、コメントが求める「レイアウト変更と baseline 更新を同じ作業に含める再発防止」には回答していません。

    根本原因

    今回の因果関係は次のとおりです。

    1. 実装: Vitest Browser Mode component VRT を report-only scaffold として追加する #1389 で、createHudController() と production CSS を直接使う combat-hud-running component VRT が導入された。ただし CI は report-only / non-required とされた。
    2. 実装: combat HUD の配置・safe-zone・情報優先度を実装する #1958 / PR 実装: combat HUD の配置・safe-zone・情報優先度を実装する (#1958) #2006 が同じ production HUD の DOM・CSS・配置を変更した。
    3. PR 実装: combat HUD の配置・safe-zone・情報優先度を実装する (#1958) #2006 では Playwright E2E 側の baseline は更新されたが、component baseline は Allowed Paths 外として残された。
    4. component-vrt-report は production HUD 変更により失敗していたにもかかわらず、非requiredであるため PR は承認・マージされた。
    5. post-merge-cleanup が事後的に 実装: component-vrt-report の combat-hud-running VRT baseline を #1958 新レイアウトに合わせて再生成する #2014 を起票した。

    したがって、これは単なる PNG の更新漏れではありません。production source と visual contract の依存関係が機械可読に定義されておらず、PR 内での co-change を強制できなかったワークフロー欠陥です。

    敵対的レビュー findings

    P0-1 — Issue の Outcome が指定コメントと一致していない

    #2014 の Outcome は「report-only job を PASS に戻すこと」であり、再発防止を完了条件に含みません。さらに、テスト定義、comparator、registry、required 化を明示的に除外しています。これでは同じ事象が次の HUD 変更で再発します。

    リポジトリ自身の Issue 作成ガイドは、follow-up でワークフロー不具合を扱う場合、次を要求しています。

    1. 根本原因を特定する。
    2. script・設定・コードによる決定論的修正を第一候補にする。
    3. workaround を採用する場合は、決定論的修正を採用しなかった理由を明示する。

    #2014 は、この比較を行わず、事後 PNG 更新という workaround だけを採用しています。これは既存の authoring guidance に反します。

    Required change:
    #2014 は「既存負債の即時修復」に位置付け直し、別途、一度だけ実装する再発防止 Issue を mandatory follow-up として明記してください。指定コメントは、その再発防止 Issue が完了するまで resolved 扱いにすべきではありません。


    P0-2 — source → visual surface の依存契約が存在しない

    現在の registry にある combat-hud-running (component VRT) 行は、次の情報を持っています。

    • spec と baseline path
    • allowedMismatchedPixelRatio: 0.02
    • report-only / provisional
    • invalidated_by: #1380

    しかし、実際の描画 producer である次のパスを invalidation source として持っていません。

    • src/ui/combatHud.ts
    • src/ui/HudController.ts
    • src/style.css
    • HUD が参照する assets / fonts / tokens

    また、invalidated_by に直接の変更 Issue #1958 も含まれていません。

    その結果、Issue 作成時の exact path overlap 検索では、#1389、#1391、#1980 といった意味的に関連する VRT Issue が発見されず、#1390 と #420 の PNG path 一致有無だけが確認されました。これは依存関係の探索方式として不十分です。

    Required change:
    baseline path ではなく、visual surface ID を中心とした構造化 SSOT が必要です。

    schema_version: visual-surfaces/v1
    
    surfaces:
      combat-hud-running:
        producers:
          modules:
            - src/ui/combatHud.ts
            - src/ui/HudController.ts
          styles:
            - src/style.css
    
        contracts:
          - runner: vitest-browser
            spec: tests/component/combat-hud-running.vrt.test.ts
            baseline: tests/component/__screenshots__/combat-hud-running.vrt.test.ts/combat-hud-running-chromium-linux.png
            job: component-vrt-report
            maturity: provisional
            update_command: pnpm test:vrt:update:component
            verify_command: pnpm exec vitest run --config vitest.visual.config.ts tests/component/combat-hud-running.vrt.test.ts
    
        policy:
          disposition_required: true
          baseline_update_mode: same_pr

    TypeScript/Vite の module import は dependency graph で追跡し、global CSS は最初は明示 mapping にするのが現実的です。Storybook も、git diff と builder の module graph を組み合わせて、直接・間接依存する visual surface を特定しています。これは導入製品の推奨ではなく、影響解析方式の実装 precedent として有用です。(Storybook)


    P0-3 — report-only CI では同一 PR 更新を強制できない

    component-vrt-report は意図的に excluded に分類され、成功・失敗にかかわらず merge-ready を阻害しません。CI 自体は実際の失敗 exit code を保持していますが、最終 verdict には反映されません。

    これは今回の再現条件そのものです。

    • production HUD が変わる
    • component VRT が赤くなる
    • required checks は green
    • PR が merge される
    • 後から baseline-only Issue が生える

    単純に screenshot job 全体を required にすると、環境揺らぎや unrelated PR まで止める可能性があります。必要なのは、別の軽量な required visual-impact policy check です。

    この check は全 PR で必ず起動し、変更された surface ごとに次のいずれかを要求します。

    visual_disposition:
      status:
        - baseline_changed
        - verified_unchanged
        - waived
    • baseline_changed: 同じ PR で baseline が更新され、canonical environment で PASS
    • verified_unchanged: source は変わったが、既存 baseline のまま canonical VRT が PASS
    • waived: owner、理由、追跡 Issue、期限を持つ明示 waiver

    該当 surface があり、いずれの disposition もない場合は required check を失敗させます。これなら、重い VRT job 自体は report-only のままでも、影響を受けた PR に限って未処置の visual regression を merge blocker にできます。

    なお required workflow 自体に paths: filter を設定する設計は避けるべきです。GitHub は path filter で required workflow 全体が skip されると check を Pending のまま残し、merge を阻害します。全 PR で起動する aggregator job の内部で impact の有無を判定する構造が安全です。([GitHub Docs]2)


    P0-4 — 「PNG だけ変更」を先に固定すると、壊れた oracle を承認する危険がある

    #1980 は重要な先例です。当初は baseline PNG の寸法追従だけを行う Issue でしたが、敵対的レビューによって、Canvas mask が capture の約 99.8% を覆い、HUD を実質的に検査していないことが判明しました。そのため、capture semantics、pixel diversity、negative control、registry まで修正する契約に再定義されています。

    #2014 は反対に、次を最初から禁止しています。

    • scenario 定義変更
    • capture root 変更
    • comparator 変更
    • registry 変更
    • PNG 以外の変更

    この契約では、調査中に capture defect や comparator defect を発見しても、正しい修正を行えません。実装者は Stop Condition で停止するしかなく、最悪の場合は赤い test を緑にするためだけに誤った画面を baseline として固定します。

    現在の component test は production DOM、production CSS、固定 GameState、document.fonts.ready、[data-combat-hud] capture を使用しており、基礎設計は妥当です。しかし、その scenario について「重要な HUD 要素を意図的に消した場合に comparator が確実に fail する」という mutation-sensitive な証明はありません。CI に存在する negative control は、.vitest-attachments が artifact upload を往復できることの証明であって、combat-hud-running の visual oracle の有効性を証明するものではありません。

    Required change:
    #2014 に次の Stop Condition を追加してください。

    candidate が意図した HUD を撮影していない、critical region の欠落が comparator tolerance 内に収まる、capture root/comparator/fixture に欠陥がある、または環境差以外の非決定性が検出された場合は baseline を更新せず、Issue 契約を再定義する。


    P1-1 — Verification Commands が Acceptance Criteria を証明していない

    AC1

    現在のコマンドは次です。

    git log -1 --format=%H -- <baseline.png>

    これは、そのファイルに過去のコミットが1件でも存在すれば成功します。

    証明できないものは次のとおりです。

    • current PR で PNG が変更されたこと
    • pinned container 内で生成されたこと
    • current head の source から生成されたこと
    • baseline の digest
    • update command
    • browser / Vitest / Node / pnpm の実バージョン

    つまり、実装前の main でも成立する非判別的 VC です。

    AC4

    現在のコマンドは次です。

    git diff --name-only origin/main...HEAD -- tests/component/

    これはファイル名を表示するだけで、次の場合も exit 0 になります。

    • PNG と test file の2ファイルが変更されている
    • PNG が一切変更されていない
    • tests/component/ 外に大量の変更がある

    AC4 の「変更ファイルが exact singleton である」を検査していません。

    Required change:
    既存の single-command guard に適合する、exact allowed-path checker を用意すべきです。最低限、次を機械判定してください。

    expected_changed_paths:
      - tests/component/__screenshots__/combat-hud-running.vrt.test.ts/combat-hud-running-chromium-linux.png

    そして、集合が完全一致しない場合は non-zero にします。


    P1-2 — Vitest の Issue なのに Playwright の update mode 用語が混入している

    #2014 は再生成後に「--update-snapshots=none(CI の実際のモード)」で実行すると記述しています。しかし component lane は Playwright test runner ではなく Vitest Browser Mode です。

    現在の package scripts は次の構成です。

    "test:vrt:component": "vitest run --config vitest.visual.config.ts",
    "test:vrt:update:component": "vitest run --config vitest.visual.config.ts --update"

    したがって、component VRT の read-only verification は、単に --update を付けずに実行することです。--update-snapshots=none は Playwright 側の語彙であり、Issue 契約に混ぜるべきではありません。

    Vitest の公式手順も、意図した UI 変更時は vitest --update で candidate を作り、更新画像をレビューしてからコミットする運用です。(Vitest)

    また、VC は fuzzy な名前引数より exact spec path にした方が安全です。

    pnpm exec vitest run \
      --config vitest.visual.config.ts \
      tests/component/combat-hud-running.vrt.test.ts

    P1-3 — Runtime Verification Applicability が欠落している

    #2014 の主成果物は、Chromium を起動して DOM を描画し、PNG を比較することです。これは静的検証ではありません。

    それにもかかわらず、Issue には repo 標準の Runtime Verification Applicability がありません。既存 authoring guidance では、decision: immediate の場合に次を要求しています。

    • applicable_acs
    • execution_environment
    • skip_conditions
    • fallback_policy
    • artifact_requirements

    少なくとも以下が必要です。

    decision: immediate
    reason: baseline generation and comparison require real Chromium rendering
    applicable_acs: [AC1, AC3]
    execution_environment: pinned Playwright Docker image, Chromium, DPR 1, viewport 1280x720
    skip_conditions: Docker unavailable, browser launch failure, dependency lock mismatch
    fallback_policy: host-generated or skipped evidence is not PASS
    artifact_requirements:
      - head_sha
      - container_digest
      - node_version
      - pnpm_version
      - vitest_version
      - playwright_version
      - chromium_version
      - viewport
      - device_scale_factor
      - baseline_sha256
      - expected_actual_diff_review

    P1-4 — 「複数回」の定義がない

    「複数回実行して安定していること」では、実装者ごとに1回、2回、10回と解釈が変わります。

    Vitest 自身は、連続した screenshot が一致するまで再撮影する stable screenshot detection を持っていますが、これは単一 test run 内の settling 検出です。clean process / clean container 間の再現性とは別です。(Vitest)

    推奨条件:

    • candidate 生成後
    • --update なし
    • fresh browser process
    • 3回連続 PASS
    • 3回の baseline file digest が不変
    • actual/diff artifact が生成されていない
    • すべて同一 head SHA

    Docker コンテナまで毎回 fresh にするかはコスト次第ですが、少なくとも browser process は fresh にすべきです。


    P1-5 — 2% tolerance の感度が証明されていない

    現在の comparator は allowedMismatchedPixelRatio: 0.02 です。capture が Issue 記載どおり約 1280×212 なら、理論上は約 5,427 pixel の不一致を許容します。

    2% 自体を直ちに過大と断定することはできません。font rasterization を吸収する意図は registry に記載されています。しかし、次が未証明です。

    • status panel の一部欠落
    • elapsed text の欠落
    • edge control の誤表示
    • critical element の数十px移動

    これらが 2% を超えて確実に fail するかどうかです。

    #1728 は E2E VRT について、fixture receipt と具体的 state assertion を screenshot 前に要求し、緩い comparator による silent pass を防ごうとしています。component lane にも同じ思想が必要です。

    恒久対策 Issue では、combat-hud-running 専用に次のいずれかを追加すべきです。

    • critical HUD region を一時的に非表示にして screenshot assertion が fail する negative control
    • status / elapsed / edge control の存在・anchor bounds・非重複を確認する semantic assertions
    • candidate が空、単色、極端に低い pixel diversity でないことの検査

    P1-6 — Issue hierarchy が事実を表していない

    #2014 は次のように記載しています。

    • parent_issue: none
    • 単独改善
    • Remaining Parent Gaps: なし

    しかし実態は次のすべてに接続しています。

    #1380 は明示的に #1389 と #1391 を VRT rollout child として管理しています。
    #1391 も #1958 merge 後の HUD geometry baseline を扱うと明示しています。

    推奨関係は次です。

    parent_issue: "#1958"
    ancestor_issue: "#1380"
    related_issues:
      - "#1389"
      - "#1391"
    source_pr: "#2006"

    少なくとも Remaining Parent Gaps には「visual impact co-change enforcement が未実装」と残す必要があります。


    P1-7 — MRC と Required Skills が正規形から逸脱している

    #2014 の change_kind は test_baseline ですが、現行 implementation template の列挙は次です。

    docs | code | mixed | workflow | data
    

    test_baseline は文書化された値ではありません。validator が偶然通すとしても schema drift です。PNG のみなら data、再発防止まで含めるなら mixed または workflow が妥当です。

    また Required Skills: なし も不適切です。元の #1389 は、この lane に必要な知識として TypeScript、Vitest Browser Mode、Playwright、Python/CI policy を明記しています。baseline-only 作業でも最低限、次は必要です。

    • Visual regression testing
    • Vitest Browser Mode
    • Playwright Docker image compatibility
    • image diff review
    • Chromium rendering determinism

    現行実装で維持すべき点

    環境固定と evidence upload の実装は比較的強固です。

    • Playwright Docker image が digest pin されている
    • package の Playwright version と image version を CI で照合している
    • pnpm install --frozen-lockfile
    • viewport 1280×720、DPR 1
    • actual / expected / diff を含む hidden attachment upload
    • artifact URL と digest の summary
    • hidden-file upload の round-trip negative control

    Vitest と Playwright の公式資料も、visual baseline と verification を同じ OS・browser・設定・hardware 条件で実行するよう求めています。現在の pinned container 方針は維持すべきです。(Vitest)

    問題は rendering environment ではなく、どの source 変更がどの visual contract を無効化するかを発見し、同じ PR 内の処置を強制する配線です。

    推奨する恒久対策

    1. 一度だけ systemic Issue を起票する

    推奨タイトル:

    実装: visual-surface dependency registry と required visual-impact policy check を導入し、UI変更PR内でVRT処置を強制する

    これは「今後も baseline ごとに別 Issue を作る」提案ではありません。今後の別 Issue 発生を止めるための、一度限りの workflow implementation です。

    主要 AC は次の形が妥当です。

    1. 構造化 visual surface registry が producer、test、baseline、job、update/verify command を保持する。
    2. diff と dependency graph から affected surface を決定論的に算出する。
    3. affected surface ごとに baseline_changed | verified_unchanged | waived の disposition を要求する。
    4. disposition がない UI変更PRは required visual-impact-policy check が fail する。
    5. 実装: combat HUD の配置・safe-zone・情報優先度を実装する #1958 相当の fixture diff で、component baseline 未更新が確実に fail する回帰テストを持つ。
    6. baseline 更新は同じ feature branch / PR にのみコミットされ、main 上で自動更新しない。
    7. Issue 作成・編集・review checker が visual impact fields を生成・検証する。
    8. baseline / registry 変更には code-owner review が要求される。

    2. Agent ではなく deterministic resolver を正本にする

    指定コメントでは「テスト戦略サブエージェント」「VRT設計者」「Issue作成時のSSOT」が候補に挙げられています。

    このうち正本にすべきなのは SSOT + deterministic resolver です。LLM に「思い出させる」だけでは再発します。

    また現行の .claude/agents/issue-author.md は deprecated stub で、新規起票は issue-creator、既存修正は issue-editor が担当します。したがって、旧 issue-author や新しい VRT designer agent に規則を複製するのではなく、次へ集約すべきです。

    • structured visual surface registry
    • resolve_visual_impact.py
    • implementation Issue template
    • issue-creator / issue-editor
    • issue-contract-review / review-issue checker
    • required CI policy job

    Issue MRC または専用 section の候補:

    visual_impact:
      decision: affected
      affected_surfaces:
        - combat-hud-running
      disposition: same_pr
      evidence_required: true

    decision: unknown のまま consumer-ready implementation Issue に進むことは禁止します。

    3. controlled update command を作る

    手動で長い Docker command を組み立てるのではなく、surface ID を受け取る controlled executor を作る方が安全です。

    scripts/vrt/update_visual_surface.py \
      --surface combat-hud-running \
      --verify-runs 3

    この executor は次を行います。

    1. registry から exact container digest、update command、baseline path を取得
    2. default branch 上での実行を拒否
    3. pinned container で candidate を生成
    4. baseline digest と environment fingerprint を出力
    5. update flag なしで3回検証
    6. changed paths が登録 baseline に限定されることを検査
    7. VISUAL_BASELINE_UPDATE_RESULT_V1 JSON を生成
    8. PR branch にだけ反映

    Vitest 公式資料も、通常の PR CI で snapshot を無条件自動更新せず、feature branch 上の手動・制御された update workflow を使い、更新画像をレビューする方式を推奨しています。(Vitest)

    4. review ownership を追加する

    baseline path と visual registry に CODEOWNERS を設定し、code-owner approval を必須化するのが妥当です。GitHub は CODEOWNERS に基づく自動 review request と、protected branch / ruleset 上の必須承認を提供します。([GitHub Docs]4)

    ただし同じ CODEOWNERS 行に複数 owner を書いても、GitHub はそのうち1名の承認で条件を満たします。implementation owner と visual owner の独立した二者承認が必要なら、次を組み合わせる必要があります。

    • general required review count
    • required code-owner review
    • latest push 後の再承認
    • または custom required policy check

    #2014 の最小修正案

    #2014 自体は削除せず、既存負債の補修として次のように修正するのが妥当です。

    contract_schema_version: v1
    issue_kind: implementation
    parent_issue: "#1958"
    ancestor_issue: "#1380"
    goal_ref: "#1958 / PR #2006 により失効した combat-hud-running component VRT baseline を、capture validity を確認した上で canonical environment から再生成する"
    change_kind: data
    preflight_scope: pr_review_only

    Acceptance Criteria は最低限、次へ変更します。

    AC1:
      pinned container 内で candidate が生成され、
      head SHA / container digest / tool versions / viewport / DPR /
      baseline SHA-256 が evidence に記録されている。
    
    AC2:
      expected / actual / diff を個別確認し、
      #1958 の意図した status / elapsed / edge-control 配置以外の差分がない。
    
    AC3:
      exact spec path を update flag なしで fresh browser process 3回実行し、
      3回すべて PASS する。
    
    AC4:
      origin/main...HEAD の changed-path 集合が baseline PNG 1件と完全一致する。
    
    AC5:
      capture root、critical region、comparator sensitivity に疑義が見つかった場合は
      PNG を更新せず、契約再定義で停止する。
    
    AC6:
      visual-surface dependency / co-change enforcement の systemic Issue が
      canonical follow-up としてリンクされている。
    

    component-vrt-report を green に戻すだけなら #2014 で完了できます。しかし、指定コメントへの回答として必要なのは AC6 の先にある恒久対策です。

    最終結論

    #2014 は補修 Issue として残してよいものの、現状の契約では承認不可です。

    特に blocking なのは次の4点です。

    1. 指定コメントが求める再発防止を Outcome に含まない。
    2. source と visual surface の依存 SSOT がない。
    3. non-required job のため同一PR処置を強制できない。
    4. PNG-only 制約が capture/comparator defect の正しい修正を妨げる。

    適切な終了条件は、#2014 で current baseline debt を直し、同時に一度限りの visual-impact enforcement Issue を起票・実装し、以後は HUD source 変更PRの中で baseline 更新または unchanged 証明を完結させることです。これが実装されるまで、指定コメントは未解決です。

  4. squne121 commented on Aug 8, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    反映した anchor comment 指摘

    Follow-up materialization

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: ""
        generated_at: "2026-08-08T05:29:22.548327Z"
        body_sha256: "sha256:355b4b2e1a1b1a76c1daf1db4fea7ca2db9a1cd8580e34866e98d6c805ebf71e"
      metadata:
        title_prefix_ready: true
        phase_label_ready: true
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-08-08T05:29:22.548327Z"
      checked_body_sha256: "sha256:355b4b2e1a1b1a76c1daf1db4fea7ca2db9a1cd8580e34866e98d6c805ebf71e"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  5. squne121 commented on Aug 8, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-08T05:52:36Z)

    • PR: test(vrt): combat-hud-running component baseline を #1958 新レイアウトへ追従させる #2024
    • Worktree: .claude/worktrees/issue-2014-combat-hud-vrt-baseline
    • Branch: worktree-issue-2014-combat-hud-vrt-baseline
    • Verification: AC1-AC4 全 PASS(CI ピン留め Docker canonical environment、3 回連続実行で baseline SHA-256 不変を確認)。project-constitution 必須検証(typecheck/lint/test/build)も全 PASS。
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  6. squne121 commented on Aug 8, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-08T00:00:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2024"
      head_sha: "c46a7e60a3e141539a7df00ae0daab882a87bba2"
      issue_number: 2014
      termination_reason: approved
      merge_ready: false
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
  7. squne121 commented on Aug 8, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-08T09:45:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2024"
      head_sha: "6ff12cbb781f6b761bd5dbf3564358eee0a76b14"
      issue_number: 2014
      termination_reason: approved
      merge_ready: true
      iteration: 4
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []

    経緯サマリ

    1. 初回実装(iteration 0)で AC1-AC4(baseline PNG 再生成)を満たし APPROVE・終了報告済みだったが、OWNER が PR test(vrt): combat-hud-running component baseline を #1958 新レイアウトへ追従させる #2024 に詳細な REQUEST_CHANGES を投稿(https://github.com/squne121/loop-protocol/pull/2024#issuecomment-5225055386)。`allowedMismatchedPixelRatio: 0.02` の全幅 capture では critical HUD fragment(HULL/Pause/elapsed)の欠落が tolerance 内に収まり得ることを指摘し、Issue 実装: component-vrt-report の combat-hud-running VRT baseline を #1958 新レイアウトに合わせて再生成する #2014 自身の Stop Condition が発火。
    2. Issue 実装: component-vrt-report の combat-hud-running VRT baseline を #1958 新レイアウトに合わせて再生成する #2014 の契約を再定義(Allowed Paths 拡張、AC1-AC9 へ全面改訂: 絶対値 pixel cap・critical subregion capture・mutation negative-control lane・critical fixture・triple-run render 決定性証跡・VISUAL_BASELINE_REVIEW_EVIDENCE_V1 evidence manifest)。
    3. fix_delta iteration 1-4 を通じて実装・検証・修正を反復:
      • iteration 1: 新契約の実装(AC1-AC9)→ 検証で AC3/AC7/AC8 FAIL(CI verifier polarity バグにより mutation lane の実効性が誤判定)
      • iteration 2: CI verifier polarity バグ修正 → 別の pre-existing test(python-test-core)破壊を発見
      • iteration 3: Allowed Paths を Scope Delta で1ファイル拡張し、当該テストの期待値を修正
      • iteration 4: evidence manifest の head_sha が GitHub Actions の ephemeral merge-preview SHA を誤って参照していたバグを発見・修正
    4. 全 AC1-AC9 を独立検証で PASS 確認(evidence manifest の head_sha 直接ダウンロード照合を含む)。pr-reviewer が APPROVE。
    5. mergeStateStatus: BEHIND のため route_to_update_branch で implementation-worker に update_branch(merge-only)を委譲 → 新 head で再検証・再レビュー → 全 required CI(component-vrt-report / e2e 含む)green・mergeStateStatus: CLEAN を確認し route: approved で終了。
  8. added a commit that references this issue on Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions