Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #782 の playtest で要求された debug pause/resume surface を追加し、瞬間状態の観測と証跡採取を可能にする"
change_kind: codeRuntime Verification Applicability
decision: immediate
reason: "pause/resume は UI インタラクションと simulation 凍結の boundary を持つ runtime 機能であり、pnpm test の unit test と build 成果物の動作確認が本 Issue 内で成立する"
applicable_acs: [AC3, AC4, AC5, AC7]
execution_environment: local
skip_conditions: []
fallback_policy: human_judgment
artifact_requirements: "PR comment にテスト結果を添付する"
if_immediate: "AC3、AC4、AC5、AC7 の動作検証が本 Issue 内で成立する。証跡は PR に添付する。"Parent Issue
none(単独改善)
Parent Goal Ref
- Goal: 戦闘中の瞬間状態を停止して観測・スクリーンショットできる debug pause/resume surface を追加する
- Desired Destination:
src/main.tsの frame loop に pause state を接続し、simulation を止めたまま描画と HUD 確認を継続できる状態にする
Current Validated Scope
- playtest feedback で「瞬間状態をスクリーンショットするための pause 機能」「UI ボタンに加えて ESC ショートカット」が要求されている
- fixed timestep 60Hz と render / systems 分離は維持する必要がある
- pause は debug / evidence 採取用の最小 surface に限定し、戦闘 UI 全体の再設計とは切り離して進められる
- pause state は
src/main.tsの runtime-local debug control であり、sortie lifecycle(LoopPhase)とは分離する
Remaining Parent Gaps
- HUD/UI レイアウト全体の再設計は別 follow-up で扱う
- プレイヤー向け HP/HULL 表示ポリシーは別 follow-up で扱う
Outcome
戦闘中に pause/resume を UI と Escape から切り替えられ、pause 中は simulation が進まず、描画と HUD の確認は継続でき、関連テストと build が PASS している状態。
In Scope
- pause/resume state を
src/main.tsの runtime-local debug state として保持する(LoopPhase、GameState、snapshot schema は変更しない) - UI ボタンまたは既存 HUD surface から pause/resume を操作できるようにする
Escapekeydown と DOM button は同じ toggle 関数を使うEscapeはevent.key === "Escape"で処理し、event.repeatは無視する(movement KEY_CODE_MAP には追加しない)- pause 中は
advanceSimulationLoopに pause duration を渡さず、simulation accumulator を進めない - pause 中も
requestAnimationFrame、hud.render(...)、renderer.render(...)は継続する - pause に入るとき、firing/pointer active state が resume 直後に暴発しないようにする
- normal UI の pause feedback は
Paused/Resumeなどの player-facing 最小文言に限定する - debug metadata(telemetry / LoopPhase / exact HP / tick count)は debug panel / evidence mode に隔離し、通常 HUD に露出しない
- 対応する unit / interaction test を追加する
Out of Scope
- 戦闘 UI 全体のレイアウト再設計
Claim rewardの命名や通常 UI と debug UI の大規模整理- HP/HULL 数値表示ポリシーの変更
- replay / frame-step / slow motion の追加
LoopPhase/GameState/ snapshot schema への pause state 追加- CanvasRenderer による pause overlay 描画
- telemetry / exact combat values の通常 UI 表示
- GitHub Pages workflow や配布 pipeline の再設計
Acceptance Criteria
- AC1: 戦闘中に DOM の pause/resume affordance が追加され、状態に応じて
Pause/Resumeが識別できる - AC2:
Escapekeydown で pause/resume を toggle でき、key repeat では複数 toggle されない - AC3: pause 中は simulation step が実行されず、tick / elapsedMs / sortie.elapsedTicks / projectile age / enemy state が進まない
- AC4: pause 中も requestAnimationFrame loop、render、HUD 更新は継続する
- AC5: pause 中に経過した wall-clock duration は resume 後に catch-up simulation として消費されない
- AC6: pause feedback は normal/debug vocabulary boundary に従い、通常 UI に telemetry / LoopPhase / exact HP/HULL を露出しない
- AC7: pause 中の input は simulation に反映されず、resume 直後に held fire が暴発しない
- AC8: 対応テストを含め
pnpm typecheck/pnpm test/pnpm buildが通る
Verification Commands
# AC1
$ rg -n "debugPause|isPaused|pauseState" src/main.ts
# AC1
$ rg -n "Pause|Resume" src/ui/
# AC2
$ rg -n '"Escape"' src/main.ts
# AC2
$ rg -n "event\.repeat" src/main.ts
# AC3
$ pnpm test
# AC4
$ pnpm test
# AC5
$ rg -n "isPaused|debugPause" src/main.ts
# AC5
$ pnpm test
# AC6
$ pnpm test
# AC7
$ pnpm test
# AC8
$ pnpm typecheck
$ pnpm test
$ pnpm buildAllowed Paths
src/main.tssrc/ui/src/input/tests/
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合(特に
src/state//src/render/CanvasRenderer.ts) - In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
LoopPhase/GameState/ snapshot schema 変更が必要になった場合- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- TypeScript / TSC strict
- fixed timestep loop control
- DOM UI event wiring
- Vitest BDD
Scope Delta(任意)
N/A
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jun 11, 2026
結論
#786 は必要ですが、この本文のまま実装エージェントに渡すと危険です。方向性は「PR #782 の playtest で要求された debug pause/resume surface を追加し、pause 中も render/HUD 確認を継続する」なので妥当です。ただし、現状の #786 は pause state をどこに持つか、fixed timestep accumulator をどう凍結するか、通常 UI と debug surface をどう分離するか、証跡採取をどう検証するか が弱いです。#786 自体にはコメントがなく、まだ契約補強の余地があります。
最重要判断はこれです。
理由は、現在の
LoopPhaseはpreparation | running | debrief_pending_reward | debrief_reward_claimedの4値で、GameStateには pause flag がありません。#786 の Allowed Paths にsrc/state/は含まれておらず、固定契約・型定義変更は Stop Condition です。敵対的レビュー
BLOCKER 1: pause state の所有者が未定義
#786 は「pause/resume state を
src/main.ts側の loop control に追加する」と書いていますが、ACでは「tick が進行しない」「HUD に feedback」としか定義していません。実装者がLoopPhase = 'paused'を追加した場合、src/state/GameState.ts変更が必要になり、Allowed Paths と Stop Conditions に抵触します。現状のmain.tsはstateを作成し、HUD actions、input、renderer、simulation loop を接続する orchestration owner なので、pause はここに閉じるのが自然です。修正案として、Issue本文に次を明記してください。
GameStateに永続化したい、E2E hook に正式公開したい、またはLoopPhaseとして扱いたいなら、それは #786 の範囲ではなく、Allowed Paths にsrc/state/を追加し、schema/contract change として再設計すべきです。BLOCKER 2: fixed timestep accumulator の凍結条件が曖昧
現在の frame loop は毎フレーム
advanceSimulationLoop(accumulatorMs, deltaMs, ...)を呼び、その後hud.render(state)とrenderer.render(state)を呼びます。advanceSimulationLoopはdeltaMsを accumulator に足し、固定ステップ分だけstepFnを実行し、残差を返す純関数です。ここで雑に
stepSimulation()だけ no-op にすると、見かけ上 tick は止まっても、loop accounting と検証が不明瞭になります。さらにpreviousFrameTimeを pause 中に更新しない実装にすると、resume 時に pause 中の経過時間が一気にdeltaMsとして入り、simulation が catch-up する危険があります。requestAnimationFrameは再描画前に callback を呼び、callback は自分で次のrequestAnimationFrameを要求する one-shot 方式です。また、animation の進行は timestamp/current time を使って計算すべきで、高リフレッシュレート画面では frame 数前提の実装が速くなり得ます。([MDNウェブドキュメント]1) したがって #786 は「render は継続、simulation delta は加算しない」という boundary を明記すべきです。推奨契約はこれです。
AC3 は「tick が進まない」だけでなく、paused duration が resume 後に catch-up simulation として消費されないことまで含めるべきです。
BLOCKER 3:
Escapeを movement input に混ぜると設計が壊れる現在の
KEY_CODE_MAPは WASD と Arrow keys をMovementKeyに対応させるだけです。bindInput()の keydown/keyup も movement boolean を更新する責務に限定されています。Escapeをこの map に足すのは不適切です。pause toggle は movement command ではなく runtime control です。MDN の KeyboardEvent key value でも Esc は"Escape"と定義され、通常は exit/cancel/escape 操作に使われます。([MDNウェブドキュメント]2)Issue本文に次を追加してください。
さらに、pause に入る瞬間に
primaryPressedを解除するかどうかも決めるべきです。今のInputStateは movement/pointer/fire 相当の状態を保持しており、pause 中に pointer down が残ったままだと resume 直後に意図しない fire が起きる可能性があります。MAJOR 4: debug surface と通常 UI の境界が #800 の正本と衝突しやすい
#800 の accepted artifact は、通常プレイ UI と debug surface の境界を product SSOT として定義しています。そこでは
DOM HUD overlayは player-facing status と command affordance を担う一方、telemetry dump、LoopPhase、raw reward state、developer-only toggle は禁じられています。Debug panelだけが LoopPhase、telemetry、exact HP、raw reward state、evidence metadata を扱えます。#786 は「debug pause/resume surface」と「pause 状態を user-facing に識別できる最小フィードバック」を同時に要求しています。このままだと実装者が既存 command rail に
DEBUG PAUSED / LoopPhase / tick / exact HPを出し、#785/#800 で問題視された「通常 UI に内部語彙・テレメトリが露出する」問題を再発させます。#785 では PR #782 後の問題として、画面に収まらない、内部状態名が多い、Claim rewardが曖昧、<1表示、debug/dev UI と player-facing UI の未分離が明記されています。修正すべき方針はこうです。
ARIA 的には、状態文言の更新は
role="status"の live region に載せる方針自体は妥当です。statusrole は advisory information を focus を奪わず伝える live region として定義されます。([MDNウェブドキュメント]3) 既存 HUD test でもrole="status"/aria-live="polite"は確認されています。MAJOR 5: Verification が弱い。
rgでは pause correctness を証明できない#786 の Verification Commands は
rgとpnpm testが中心ですが、pause は文字列存在ではなく runtime boundary の問題です。#770/#782 でも grep 系 verification が AC4 disabled policy の検出で失敗し、実装と検証のズレが露呈しています。最低限、次のテスト観点が必要です。
DOM ボタンの disabled/enabled を検証するなら、Playwright は role locator を推奨しており、
toBeDisabled()/toBeEnabled()の assertion も提供しています。([Playwright]4) ([Playwright]5) ネイティブのdisabled属性はフォームコントロールを操作不能・focus不能にし、クリック等の browsing events を受けないため、pause/resume の unavailable state は callback guard だけでなく DOM disabled として表すべきです。([MDNウェブドキュメント]6) ([MDNウェブドキュメント]6)ただし、既存
tests/main-loop.test.tsはadvanceSimulationLoop単体の fixed timestep / panic clamp しか見ていません。pause gating がmain.tsに閉じるなら、pause 用の test harness を追加するか、loop orchestration をテスト可能な小関数へ抽出する必要があります。MAJOR 6: 証跡採取目的なのに distribution/runtime evidence が不足している
#786 の動機は「瞬間状態の観測と証跡採取」です。ならば
pnpm buildだけでは弱いです。package.jsonにはbuild,preview,test:e2eがあり、test:e2eはVITE_E2E_MODE=true pnpm build && playwright testです。Vite 公式は、
vite previewは build 済みdistをローカルで確認するためのもので、本番サーバとして設計されたものではないと説明しています。([vitejs]7) GitHub Pages に repo path で配布する場合はbase: '/<REPO>/'の設定が必要です。([vitejs]7)#800 の evidence policy も、PR preview の一時 URL だけに依存せず、stable artifact URL、full commit SHA、Actions run ID、artifact digest、retention、live asset check、viewport、DPR、zoom、userAgent、timezone、build metadata、paused/running state、screenshot/video reference を残す方針です。
#786 の PR には、少なくとも次を要求した方がよいです。
Playwright screenshot は
page.screenshot({ path })や element screenshot を使えるため、pause surface の証跡採取は E2E/playtest evidence と相性がよいです。([Playwright]8)#786 本文の修正案
In Scope に追加
Out of Scope に追加
Canvas に pause overlay を出したいなら、Allowed Paths に
src/render/CanvasRenderer.tsを追加してください。現状の Allowed Paths では、Canvas overlay 実装は Stop Condition です。Acceptance Criteria の強化案
AIエージェントに渡すなら、先に入れるべき制約文
最終判定
実装着手は可。ただし、#786 はそのままでは契約不足です。
特に
LoopPhaseへ pause を混ぜる実装、pause 中 accumulator を進める実装、既存 command rail に debug metadata を露出する実装、grep だけで AC を満たしたことにする実装は reject 対象にすべきです。優先して直すべき順序は、
pause state の所有者→fixed timestep freeze semantics→Escape input contract→normal/debug UI boundary→runtime evidenceです。squne121 commentedon Jun 11, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: none
human_escalationsqune121 commentedon Jun 11, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 11, 2026
ClaudeCode作業ログ
追加で気をつける点
max_iterations=3で止まったこと自体は正常です。skill 側の loop policy は、needs-fixで
iteration + 1 >= max_iterationsになったらhuman_escalationへ送る設計になっています。 また termination policy でも、3 回目の
needs-fixで停止し、max_iterations を超えて自動継続しないことが明記されています。
今回の人間判断は「lint を契約 gate から外す」で十分です。ここで package.json に
lint:appを追加する、VC allowlist を変える、.claude/skills/.system/を直す、などに広げると #786 の pause/resume 実装 Issue から逸れます。必要なら別 Issue
で「app scoped lint script を追加する」を起票するのが安全です。
● 人間判断を受け取りました。issue-author で 2 点を修正し、reviewer で approve を確認します。
● issue-author(Issue #786 最終修正適用)
⎿ Done (13 tool uses · 22.5k tokens · 1m 30s)
(ctrl+o to expand)
● STATUS: ok — 最終 review を実行します。
● issue-reviewer(Issue #786 最終レビュー)
⎿ Done (17 tool uses · 38.5k tokens · 2m 6s)
(ctrl+o to expand)
● reviewer が ## Machine-Readable Contract
セクションが消えたと報告しています。現在の本文を確認します。
● Bash(gh issue view 786 --repo squne121/loop-protocol --json body -q .body | head -30)
⎿ WRITE_OK
e-Readable Contract
… +33 lines (ctrl+o to expand)
● issue-author が ## Machine-Readable Contract ヘッダを破損させました。control-plane
が直接修正します。
● Bash(gh issue view 786 --repo squne121/loop-protocol --json body -q .body >
/tmp/issue-786-current.md
wc -l /tmp/issue-786-current.md)
⎿ 150 /tmp/issue-786-current.md
Read 1 file (ctrl+o to expand)
● 先頭の破損を直接修正して GitHub に書き戻します。
● Write(/tmp/issue-786-fixed.md)
⎿ Wrote 147 lines to ../../../../tmp/issue-786-fixed.md
1 ## Machine-Readable Contract
2
3
yaml 4 contract_schema_version: v1 5 issue_kind: implementation 6 parent_issue: "none" 7 goal_ref: "PR #782 の playtest で要求された debug pause/resume surface を追加 し、瞬間状態の観測と証跡採取を可能にする" 8 change_kind: code 9… +163 lines (ctrl+o to expand)
● Bash(gh issue edit 786 --repo squne121/loop-protocol --body-file /tmp/issue-786-fixed.md
&& echo "OK")
⎿ #786
OK
● Bash(gh issue view 786 --repo squne121/loop-protocol --json body -q .body | head -5)
⎿ ## Machine-Readable Contract
● ヘッダ修正を確認。最終 review を実行します。
● issue-reviewer(Issue #786 最終レビュー(ヘッダ修正後))
● RVA セクションを checker が期待する YAML コードブロック形式に直接修正します。
● Update(/tmp/issue-786-fixed.md)
⎿ Added 10 lines, removed 8 lines
10
11 ## Runtime Verification Applicability
12
13 -- decision: immediate
14 -- reason: pause/resume は UI インタラクションと simulation 凍結の boundary
-を持つ runtime 機能であり、pnpm test の unit test と build 成果物の動作確認
-が本 Issue 内で成立する
15 -- applicable_acs: [AC3, AC4, AC5, AC7]
16 -- execution_environment: local
17 -- skip_conditions: []
18 -- fallback_policy: human_judgment
19 -- artifact_requirements: PR comment にテスト結果を添付する
20 -- if immediate: AC3、AC4、AC5、AC7 の動作検証が本 Issue 内で成立する。証跡
-は PR に添付する。
13 +
yaml 14 +decision: immediate 15 +reason: "pause/resume は UI インタラクションと simulation 凍結の boundary +を持つ runtime 機能であり、pnpm test の unit test と build 成果物の動作確認 +が本 Issue 内で成立する" 16 +applicable_acs: [AC3, AC4, AC5, AC7] 17 +execution_environment: local 18 +skip_conditions: [] 19 +fallback_policy: human_judgment 20 +artifact_requirements: "PR comment にテスト結果を添付する" 21 +if_immediate: "AC3、AC4、AC5、AC7 の動作検証が本 Issue 内で成立する。証跡は + PR に添付する。" 22 +23
24 ## Parent Issue
25
● Bash(gh issue edit 786 --repo squne121/loop-protocol --body-file /tmp/issue-786-fixed.md
&& echo "OK")
⎿ #786
OK
● issue-reviewer(Issue #786 最終レビュー(RVA YAML 形式修正後))
⎿ Done (7 tool uses · 28.5k tokens · 1m 21s)
(ctrl+o to expand)
● VERDICT: approve — Step 5 (approved 終了) に進みます。
● Bash(echo '{"termination_reason":"approved","issue_number":786}' |
uv run python3
.claude/skills/issue-refinement-loop/scripts/publish_termination_report.py \…)
⎿ [publish_termination_report] comment posted for issue #786
● Issue #786 の refinement loop が approved で完了しました。
完了サマリー
#786
anchor comment の全 BLOCKER/MAJOR を反映した変更:
┌───────────────────┬─────────────────────────────────────────────────────────────────┐
│ 項目 │ 内容 │
├───────────────────┼─────────────────────────────────────────────────────────────────┤
│ pause state │ src/main.ts local state に限定、LoopPhase/GameState │
│ の所有者 │ 変更禁止を明文化 │
├───────────────────┼─────────────────────────────────────────────────────────────────┤
│ accumulator 凍結 │ pause 中は advanceSimulationLoop に duration を渡さない │
│ │ contract を追記 │
├───────────────────┼─────────────────────────────────────────────────────────────────┤
│ Escape 境界 │ event.key === "Escape"/event.repeat 無視・movement KEY_CODE_MAP │
│ │ 除外を明記 │
├───────────────────┼─────────────────────────────────────────────────────────────────┤
│ UI 境界 │ normal HUD は Paused/Resume 最小文言のみ、debug metadata は隔離 │
├───────────────────┼─────────────────────────────────────────────────────────────────┤
│ AC │ 6 → 8 に拡張(AC7 入力暴発防止、AC8 build gate) │
├───────────────────┼─────────────────────────────────────────────────────────────────┤
│ VC │ baseline fail を保証するパターンに修正、LP016 形式を遵守 │
├───────────────────┼─────────────────────────────────────────────────────────────────┤
│ Runtime │ decision: immediate、AC3/AC4/AC5/AC7 に タグ │
└───────────────────┴─────────────────────────────────────────────────────────────────┘
注意: issue-author SubAgent が本文を複数回破損したため、最終的な本文適用は control-plane
が直接 gh issue edit で実行しました(memory: feedback_haiku_mutation_fabrication)。
✻ Cogitated for 9m 55s
squne121 commentedon Jun 11, 2026
Contract Snapshot (2026-06-11T18:38:31Z)
src/main.ts,src/ui/,src/input/,tests/.claude/worktrees/issue-786-debug-pause-resume-surfaceworktree-issue-786-debug-pause-resume-surfacesqune121 commentedon Jun 11, 2026
implement-issue: 実装完了 (2026-06-11T18:49:34Z)
.claude/worktrees/issue-786-debug-pause-resume-surfaceworktree-issue-786-debug-pause-resume-surfaceAC 充足結果
fix: #786 enforce loopPhase guard on pause and strengthen AC3/AC4/AC5…