Repository navigation
feat(#705): inject build-time commit SHA into Evidence Panel via VITE_LOOP_COMMIT_SHA - #712
Conversation
…_LOOP_COMMIT_SHA
- Add `src/vite-env.d.ts` declaring `ImportMetaEnv.VITE_LOOP_COMMIT_SHA?: string`
- Add `resolveAppUnderTestCommit()` in `playtestEvidence.ts`: reads
`import.meta.env.VITE_LOOP_COMMIT_SHA`, validates as `/^[0-9a-f]{40}$/`,
returns commit SHA on success or "unknown" + commit_unknown_reason on fallback.
AC5: object shape is branched — commit_unknown_reason key is absent on success.
- Update `AppUnderTest` type: `commit: string`, `commit_unknown_reason?: string`
- Update `deploy-pages.yml` (main + PR preview jobs): add "Resolve and inject commit SHA"
step using `git rev-parse HEAD`, pass SHA via `VITE_LOOP_COMMIT_SHA` env to build,
add "Verify commit SHA in dist" step after each build. PR preview checkout now uses
`ref: \${{ github.event.pull_request.head.sha }}` (AC9).
- Add resolveAppUnderTestCommit test suite (SHA injection, fallback, AC5 shape check)
- Update `manual-playtest-runbook.md`: replace `environment.commit` schema with
`app_under_test.commit`, add commit SHA confirmation procedure (AC12)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Preview URLPreview removed (PR #712 closed). |
squne121
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES
Mergeability
- mergeable=MERGEABLE, merge_state_status=BEHIND
Evidence Check
- AC coverage: OK - AC1〜AC13 すべて PR 本文で根拠付きで記載済み(AC8 は runtime_only で defer 明示、AC10/AC6/AC13 は pr_review_only で diff 確認済み)
- Allowed Paths: 遵守 - 変更ファイル 5 件(
.github/workflows/deploy-pages.yml,src/ui/playtestEvidence.ts,src/vite-env.d.ts,tests/playtest-evidence.test.ts,docs/playtest/manual-playtest-runbook.md)すべて Allowed Paths 内 - CI Verification: typecheck/lint/test/build/actionlint/python-test はすべて pass(head SHA: 0e27e71)
- Schema Consumer Inventory: 存在・before/after 差分・consumer 更新状況テーブル完備
- Safety Claim Matrix: 存在・Not controlled = N/A(secret 混入なし)
Blockers
-
CI fail: PR Body Japanese Check(head SHA:
0e27e71afd5581e024ab99a4300168f00cd08673)aggregate_ratio: 0.103(threshold: 0.1)、failed_blocks: 9- PR 本文が主に英語で記述されており、日本語比率が不足している
- このリポジトリの PR 本文日本語比率ガードが失敗している(CI check fail = blocker)
- 対処: PR 本文の主要セクション(Summary, Checks, Notes 等)を日本語に書き換えるか、または
prose_boundary_policyの適用外ブロック(コードブロック等)の比率計算を確認する
-
CI fail: e2e(head SHA:
0e27e71afd5581e024ab99a4300168f00cd08673)GIVEN sortie running WHEN running HUD baseline then HUD screenshot matchesが失敗(836 pixels different)- main ブランチ(
fd8ebd3bf5e7de291041345745a8d11509054ac8)でも同一テストが failure であり pre-existing failure と判断する - 本 PR の変更対象ファイル(workflow / playtestEvidence.ts / vite-env.d.ts / tests/playtest-evidence.test.ts / manual-playtest-runbook.md)は HUD スクリーンショット baselines に無影響
- 対処: pre-existing failure であることを PR 本文に明示し、別 Issue で追跡する(または baseline 更新 PR を先行マージして main を green にする)
Non-blockers
- AC8(runtime_only): PR Preview deploy は完了済み(deploy-pr: pass、URL: https://squne121.github.io/loop-protocol/pr-712/)だが、Evidence Panel の手動確認証跡(expected_sha / workflow_run_id / 表示 SHA 一致)が PR コメントに未投稿。このフローの runtime_only defer は Issue contract で明示されており merge blocking ではないが、マージ前に手動証跡を貼ることを推奨する。
LOOP_VERDICT_V2
LOOP_VERDICT_V2:
verdict: REQUEST_CHANGES
reviewed_head_sha: 0e27e71afd5581e024ab99a4300168f00cd08673
merge_ready: false
mergeability:
mergeable: MERGEABLE
merge_state_status: BEHIND
blockers:
- id: ci_fail_pr_body_japanese_check
description: "PR Body Japanese Check が head SHA 0e27e71afd5581e024ab99a4300168f00cd08673 で失敗。aggregate_ratio=0.103(threshold=0.1)、failed_blocks=9。PR 本文の日本語比率が不足している。"
mechanical: false
- id: ci_fail_e2e_visual_regression
description: "e2e visual regression test (HUD screenshot baseline) が失敗(836 pixels different)。main ブランチでも pre-existing failure が確認されているが、PR CI として fail が存在するため blocker として記録する。PR 本文への pre-existing 明示または別 Issue tracking が必要。"
mechanical: false
required_auto_actions:
- kind: update_branch
executor: implementation-worker
skill: implement-issue.update_branch
blocking_merge_ready: true
mechanical: true
expected_head_sha: 0e27e71afd5581e024ab99a4300168f00cd08673
auto_fix_applied: []
follow_up_issue_requests:
- title: "e2e HUD screenshot baseline が main で pre-existing failure — baseline 更新または waiver 追加"
issue_kind: implementation
severity: mandatory_follow_up
blocking_merge_ready: false
source:
kind: pr_review
url: "https://github.com/squne121/loop-protocol/pull/712"
note_id: "1"
dedupe_key: "follow-up:squne121/loop-protocol:pr-712:1"
desired_destination: "e2e HUD baseline テストが main で green になっている、または waiver が明示されている"
validated_scope_delta: "e2e snapshot baseline の更新(toHaveScreenshot baseline ファイルの再生成)または skip/waiver 追加"
origin_skill: pr-review-judge
labels:
- triage-required
initial_label_profile: implementation
materialization: pending
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
iteration: 1(再レビュー)
Mergeability
- mergeable=MERGEABLE, merge_state_status=UNSTABLE
- UNSTABLE:
PR Body Japanese Check(per-block 9ブロックが英語のみ)とe2e(pre-existing)が非必須チェックとして失敗中。branch protection 必須チェック(typecheck/lint/test/build/python-test/validate-generated-artifact)は全 PASS。
CI Verification
head SHA: 3d643396c8144438148a8fe55727cc30c8aed417
| チェック | 結論 | 必須? |
|---|---|---|
| typecheck | pass | YES |
| lint | pass | YES |
| test | pass | YES |
| build | pass | YES |
| python-test | pass | YES |
| validate-generated-artifact | pass | YES |
| actionlint | pass | NO |
| deploy-pr | pass | NO |
| PR Body Japanese Check | fail | NO |
| e2e | fail | NO |
PR Body Japanese Check 失敗詳細: aggregate_ratio=0.443(閾値 0.1 を超過)だが、per-block チェックで 9 ブロック(Schema Change Applicability/Schema Consumer Inventory/Safety Claim Matrix 等の英語セクション見出し・テーブルヘッダー)が ratio=0.000 で失敗。必須チェックではなく mergeStateStatus=UNSTABLE。
e2e 失敗: HUD スクリーンショット 836px 差異(pre-existing)。PR body に明示済み・#714 で追跡中。
TEST_VERDICT_MACHINE コメントは存在しない(#88 未マージ)。CI_CHECK_RUN_SCOPED で補助証跡確認済み(head_sha 一致・必須ジョブ全 pass)。
Evidence Check
Allowed Paths 遵守
変更ファイル:
.github/workflows/deploy-pages.yml✅docs/playtest/manual-playtest-runbook.md✅src/ui/playtestEvidence.ts✅src/vite-env.d.ts✅tests/playtest-evidence.test.ts✅
全ファイルが Allowed Paths に含まれる。Allowed Paths 外変更なし。
AC coverage
| AC | 判定 | 根拠 |
|---|---|---|
| AC1: main deploy に VITE_LOOP_COMMIT_SHA | ✅ | workflow diff line 57: echo "VITE_LOOP_COMMIT_SHA=$sha" >> "$GITHUB_ENV" (main job) |
| AC2: PR preview deploy に VITE_LOOP_COMMIT_SHA | ✅ | workflow diff line 156: 同上 (deploy-pr job) |
| AC3: 40文字 hex SHA 出力 | ✅ | resolveAppUnderTestCommit(): SHA_REGEX = /^[0-9a-f]{40}$/ で検証、合格時に commit へ出力 |
| AC4: fallback to "unknown" | ✅ | 未設定・不正値で commit: 'unknown' + commit_unknown_reason を返す |
| AC5: commit_unknown_reason absent on success | ✅ | shape branching: success 時は { name, commit: sha } のみ(key なし)。テストで hasOwnProperty 検証済み |
| AC6: secret 非混入 | ✅ | git rev-parse HEAD のみ。secrets.* / github.token 参照なし(diff 確認済み) |
| AC7: typecheck/lint/test/build PASS | ✅ | CI 必須チェック全 PASS(head SHA 一致確認済み) |
| AC8: PR Preview 手動証跡 | ⬜ SKIP | PR Preview URL は live 確認済み(bot コメント)。手動証跡未投稿。Issue contract skip_condition 該当・non-blocker 扱い |
| AC9: git rev-parse HEAD を正とする | ✅ | workflow: sha=$(git rev-parse HEAD)、checkout に ref: ${{ github.event.pull_request.head.sha }} 指定 |
| AC10: dist 内 SHA 検証 | ✅ | "Verify commit SHA in dist" ステップ(grep -rq "$expected_sha" dist/)を main/PR preview 両ジョブに追加済み |
| AC12: runbook を app_under_test.commit に置換 | ✅ | diff: environment.commit → app_under_test.commit 置換・Commit SHA 注入確認セクション追加 |
| AC13: VITE_* への secret 混入なし | ✅ | AC6 と同一確認。secrets.* 参照なし |
Schema Change Applicability
PR 本文に ## Schema Change Applicability セクションあり(schema_change)。AppUnderTest.commit 型変更('unknown' → string)・commit_unknown_reason optional 化。TypeScript 内部型のみ、外部 JSON/API schema 変更なし。
Schema Consumer Inventory
PR 本文に ## Schema Consumer Inventory あり。before/after 差分・consumer テーブル(playtestEvidence.ts / toYaml() / tests/playtest-evidence.test.ts)・更新有無を記載。未対応 consumer なし。
Safety Claim Matrix
PR 本文に ## Safety Claim Matrix あり。Not controlled = N/A(全クレームが bounded)。secret 非混入・bundle 安全性を Evidence 列に記載。
Blockers
なし
Non-blockers(任意改善)
PR Body Japanese Checkper-block 失敗(aggregate は閾値超過): Schema Consumer Inventory / Safety Claim Matrix 等の必須英語セクション見出し・テーブルヘッダーが per-block で ratio=0 を記録。必須チェックではないが、セクション見出しを日本語化するか、validator の per-block 除外対象(table/heading)として扱う改善が将来的に有効。既存 Issue または新規 Issue で対応可。- AC8 手動証跡: PR Preview(https://squne121.github.io/loop-protocol/pr-712/)が live のため、
?playtest_evidence=1で Evidence Panel を開きapp_under_test.commitに 40 文字 hex SHA が表示されることを PR コメントに記録することを推奨(merge 前でなくてもよい)。
LOOP_VERDICT_V2
verdict: APPROVE
reviewed_head_sha: 3d643396c8144438148a8fe55727cc30c8aed417
merge_ready: true
mergeability:
mergeable: MERGEABLE
merge_state_status: UNSTABLE
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests:
- title: "fix: PR body Japanese per-block check が英語専用 section heading/table を誤判定する問題を修正"
issue_kind: implementation
severity: optional_follow_up
blocking_merge_ready: false
source:
kind: pr_review
url: "https://github.com/squne121/loop-protocol/pull/712"
note_id: "1"
dedupe_key: "follow-up:squne121/loop-protocol:https://github.com/squne121/loop-protocol/pull/712:1"
desired_destination: "validate_japanese_content.py の per-block 判定で英語必須セクション見出し・Safety Claim Matrix 等のテーブルが除外対象となり、日本語主体の PR body が誤判定されない状態"
validated_scope_delta: "validate_japanese_content.py の per-block 判定除外ルール拡張(heading/table を prose block 対象外とするか aggregate-only モードを PR body 向けに適用)"
origin_skill: pr-review-judge
labels:
- triage-required
initial_label_profile: tooling
materialization: deferred
Loop Protocol Playtest EvidenceGenerated by playtestEvidence panel (AC8)playtest_evidence_schema_version: v1 |
結論現時点の判定: 条件付き APPROVE 寄り。ただし、マージ前に AC8 証跡の full SHA 明示だけは直した方がよい。 PR #712 の実装方針自体は #705 の契約に概ね合っています。#571 では Pages/PR Preview 上の commit は 指定コメントは最初 敵対的レビューB1. AC8 証跡が「full 40文字 SHA」として機械判定しにくいPR コメントには Evidence Panel YAML が貼られており、 推奨追記: runtime_verification:
preview_url: "https://squne121.github.io/loop-protocol/pr-712/"
expected_head_sha: "3d643396c8144438148a8fe55727cc30c8aed417"
observed_app_under_test_commit: "3d643396c8144438148a8fe55727cc30c8aed417"
match: true
evidence_panel_query: "?playtest_evidence=1"これはコード変更ではなく PR コメント追記で足ります。 B2. 「Schema Change Applicability」の説明が甘いPR 本文は しかし Evidence Panel YAML は人間レビュー・PRコメント・runbook に載る 配布物の証跡フォーマットです。外部 API ではなくても、運用上は consumer を持つ schema です。実際、runbook も 修正推奨: Schema Change Applicability:
- decision: evidence_schema_shape_change
- compatibility: backward-compatible for readers that tolerate optional commit_unknown_reason
- affected artifact: Evidence Panel YAML `playtest_evidence_schema_version: v1`
- reason: success path now emits `app_under_test.commit: <40-char SHA>` and omits `commit_unknown_reason`現状でも #705 の AC5 に沿っているため blocker ではありませんが、「内部型だけ」と言い切るのは不正確です。 B3. workflow の SHA 検証は
|
- deploy-pages.yml: git rev-parse --verify HEAD^{commit} で SHA を取得し
/^[0-9a-f]{40}$/ regex で検証してから GITHUB_ENV に書き込む(B3対応)
- manual-playtest-runbook.md: GitHub Pages / PR Preview の通常系は
40文字 SHA が入る旨を反映(B5対応)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
AC8 Runtime Verification(machine-readable)runtime_verification:
ac: AC8
preview_url: "https://squne121.github.io/loop-protocol/pr-712/"
expected_head_sha: "3d643396c8144438148a8fe55727cc30c8aed417"
observed_app_under_test_commit: "3d643396c8144438148a8fe55727cc30c8aed417"
match: true
workflow_run_id: "27062997749"
evidence_panel_query: "?playtest_evidence=1"
evidence_source_url: "https://squne121.github.io/loop-protocol/pr-712/"
verified_at: "2026-06-06T13:01:32Z"既存コメント(https://github.com/squne121/loop-protocol/pull/712#issuecomment-4638685565)の Evidence Panel YAML に記録されている |
squne121
left a comment
There was a problem hiding this comment.
Verdict (iteration 2): APPROVE
Mergeability
- mergeable=MERGEABLE, merge_state_status=UNSTABLE
- Required checks (typecheck / lint / test / build / python-test / validate-generated-artifact): all PASS
- Non-required failing checks:
actionlint(SC1083 shellcheck false-positive on[[ $sha =~ ^[0-9a-f]{40}$ ]]in both jobs — introduced by B3 fix) andPR Body Japanese Check(mixed EN/JP PR body). Neither is in the required_status_checks list per branch protection API.
Evidence Check
- AC coverage: all AC1–AC13 addressed in PR body with explicit per-AC notes
- Allowed Paths: CLEAN — 5 changed files (.github/workflows/deploy-pages.yml, src/ui/playtestEvidence.ts, src/vite-env.d.ts, tests/playtest-evidence.test.ts, docs/playtest/manual-playtest-runbook.md) all within Allowed Paths
- CI Verification: required checks pass on head SHA 57a6ecc. Non-required actionlint/Japanese Check fail — not blocking.
- B3 fix confirmed: both jobs contain
git rev-parse --verify HEAD^{commit}+[[ ! "$sha" =~ ^[0-9a-f]{40}$ ]]regex guard withexit 1. SC1083 is a shellcheck false-positive; the[[ =~ ]]form correctly interprets{40}as extended regex quantifier in bash. - B5 fix confirmed: runbook updated to "GitHub Pages/PR Preview では通常 40文字 SHA が入る" phrasing.
- AC8 runtime evidence: machine-readable block present at #712 (comment) with
expected_head_sha: 3d643396...,observed_app_under_test_commit: 3d643396...,match: true. SHA predates current head (57a6ecc) but deploy-pr CI passed at current head confirming successful deployment. SHA injection logic unchanged between the two commits. - Schema Consumer Inventory: present and complete, compatibility: backward-compatible.
- Safety Claim Matrix: present, Not controlled = N/A for all claims.
Blockers
なし
Non-blockers
actionlintSC1083 false-positive: shellcheck warns about{40}literal braces in[[ $sha =~ ^[0-9a-f]{40}$ ]]. This is a known false-positive when shellcheck analyzes bash[[ =~ ]]patterns. The fix (add# shellcheck disable=SC1083or usegrep -qEinstead) can be done as a follow-up without re-running AC8 runtime verification.- AC8 runtime evidence SHA (
3d643396...) predates current head (57a6ecce...). The B3 commit did not change SHA injection logic, anddeploy-prCI confirmed successful deploy at current head. A strict re-capture would be ideal but is not required given the mechanism is unchanged. PR Body Japanese Checkfailure: English-heavy sections (Schema Consumer Inventory, Safety Claim Matrix table headers/data) trigger per-block detection. Non-required check. Follow-up Issue #714 context suggests this is a known policy gap.
LOOP_VERDICT_V2
verdict: APPROVE
reviewed_head_sha: 57a6ecce8e5e7528998d9aec3af9efe0973a6582
merge_ready: true
mergeability:
mergeable: MERGEABLE
merge_state_status: UNSTABLE
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests:
- title: "fix: actionlint SC1083 false-positive in deploy-pages.yml SHA regex validation"
issue_kind: implementation
severity: optional_follow_up
blocking_merge_ready: false
source:
kind: pr_review
url: "https://github.com/squne121/loop-protocol/pull/712"
note_id: "1"
dedupe_key: "follow-up:squne121/loop-protocol:pr-712:1"
desired_destination: "actionlint passes without SC1083 warnings on the regex guard steps in deploy-pages.yml"
validated_scope_delta: "Add shellcheck disable=SC1083 comment or replace [[ =~ ]] with grep -qE in the two SHA validation steps of .github/workflows/deploy-pages.yml"
origin_skill: pr-review-judge
labels:
- triage-required
initial_label_profile: fix
materialization: pending
Summary
.github/workflows/deploy-pages.yml: main デプロイおよび PR プレビュービルドで、git rev-parse HEADによりコミット SHA を解決し、VITE_LOOP_COMMIT_SHAとして Vite ビルドに注入するよう変更。PR プレビューの checkout ではref: ${{ github.event.pull_request.head.sha }}を使用して正しいコミットを取得する。ビルド後に「dist 内の commit SHA 検証」ステップを追加(AC1, AC2, AC9, AC10)。src/vite-env.d.ts(新規): TypeScript 型安全のためにImportMetaEnv.VITE_LOOP_COMMIT_SHA?: stringを宣言。src/ui/playtestEvidence.ts:resolveAppUnderTestCommit()を追加。import.meta.env.VITE_LOOP_COMMIT_SHAを読み取り/^[0-9a-f]{40}$/で検証、成功時はcommit: <sha>(commit_unknown_reasonキーなし — AC5 shape branching)、フォールバック時はcommit: "unknown"+commit_unknown_reasonを返す(AC3, AC4, AC5)。AppUnderTest.commit型を'unknown'からstringに拡張。tests/playtest-evidence.test.ts:resolveAppUnderTestCommitのテストスイートを追加。SHA 注入・フォールバック(null/不正値)・AC5 キー不在 shape 確認・境界値(39/41 文字、大文字)を網羅。docs/playtest/manual-playtest-runbook.md:environment.commitスキーマをapp_under_test.commitに置換し、コミット SHA 確認手順と対応マッピング表を更新(AC12)。スコープロールアップ調整: Issue #660(CLOSED、同 parent_issue #571)で GitHub Pages デプロイのベースパス解決を実施済み。本 PR はその成果を踏まえ、PR プレビュー checkout での正しい head SHA 取得と、Evidence Panel への 40 文字コミット SHA 表示を追加する。
Checks
pnpm typecheck— 型エラーなしpnpm lint— lint エラーなしpnpm test(414 テスト PASS)— 全テスト通過pnpm build— ビルド成功Schema Change Applicability
AppUnderTest.commit型を'unknown'(リテラル)からstringに拡張。commit_unknown_reasonを optional(?)に変更。Evidence Panel YAML(playtest_evidence_schema_version: v1)の app_under_test shape の互換的変更(backward-compatible)。成功時に commit_unknown_reason キーが absent になるため、key の存在を仮定する consumer は影響を受ける可能性があるが、optional field として設計済みのため既存 YAML reader への破壊的変更はない。Schema Consumer Inventory
# before
# after
src/ui/playtestEvidence.ts—buildEvidenceData()resolveAppUnderTestCommit()呼び出しに変更。インラインリテラルから関数呼び出しへ。src/ui/playtestEvidence.ts—toYaml()AppUnderTestをそのまま serialize。shape-branched object に対応済み(key が absent なら出力されない)。tests/playtest-evidence.test.tsSafety Claim Matrix
VITE_LOOP_COMMIT_SHAに secret/token が含まれない(AC6, AC13)git rev-parse HEADはコミット SHA のみ出力。ワークフローはsecrets.*を参照しない。CI で確認。VITE_*に設定されるのは commit SHA(40 文字 hex)のみ。pnpm build成功・typecheck PASS。Notes
?playtest_evidence=1で開き、app_under_test.commitに 40 文字 hex SHA が表示されることを PR コメントに手動証跡として貼り付ける。docs/playtest/manual-playtest-runbook.mdの Evidence Panel 出力スキーマ例から古いenvironment.commit記述を削除しapp_under_test.commitに置換済み。Closes #705