Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "sortie の 30秒タイムアウトを defeat から切り離し、neutral terminal (`timeout`) として表示・定義する"
change_kind: mixedParent Issue
none(単独改善 / #689 M2 手動プレイテスト由来の follow-up)
Parent Goal Ref
- Goal: sortie の terminal 状態のうち「30秒タイムアウト」をゲームデザイン上の hp0 defeat から切り離し、将来の reward/debrief consumer が区別できる neutral terminal として扱う
- Desired Destination: なし(単独 Issue)
Current Validated Scope
src/systems/SortieSystem.tsの terminal 判定で、30秒タイムアウトを defeat から切り離した neutral outcome として表現するsrc/render/CanvasRenderer.tsの結果オーバーレイで、timeout 時に defeat tone を使わず中立ラベル「戦闘終了」を描画するsrc/state/GameState.tsのSortieStatus/SortieResult/SortieEndReasonを timeout 区別に必要な範囲で拡張するdocs/product/features/sortie.mdとdocs/playtest/m2-combat-mvp.mdの「30秒タイムアウト = defeat」記述を中立表記へ更新するtests/sortie-system.test.tsとtests/e2e/m2-combat-mvp.spec.tsの timeout 期待値を中立表現へ更新する
Remaining Parent Gaps
- 報酬付与ロジックそのもの(debrief / reward)の実装は本 Issue のスコープ外。本 Issue は「タイムアウトを defeat から分離した neutral terminal として定義する」ことに限定する
- victory 文言の中立化(「VICTORY」表記の再検討)は本 Issue では扱わず、必要なら別 Issue とする
Outcome
30秒タイムアウトで sortie が終了したとき、SortieResult が hp0 敗北と区別可能な timeout outcome / timeout endReason を持ち、SortieState.status も defeat ではなく timeout になり、CanvasRenderer が「戦闘終了」中立ラベルと neutral tone を描画し、docs/product/features/sortie.md / docs/playtest/m2-combat-mvp.md / tests/e2e/m2-combat-mvp.spec.ts が timeout=defeat の記述を更新済みで、Vitest と E2E が PASS している状態。
In Scope
SortieSystemの terminal 判定でタイムアウトを defeat と区別する timeout outcome 表現SortieStatus/SortieResult/SortieEndReasonの timeout 区別に必要な最小拡張CanvasRendererの timeout 終了時 presentation を中立ラベル「戦闘終了」へ変更docs/product/features/sortie.md/docs/playtest/m2-combat-mvp.md/tests/e2e/m2-combat-mvp.spec.tsの timeout 意味づけ更新(敗北ではなく neutral terminal)- 対応する unit test / E2E 期待値の追加・更新
Out of Scope
- 報酬付与(reward / debrief)ロジックの実装
- hp0 による defeat、敵全滅 victory の判定ロジック変更
- VICTORY 文言の中立化
- HUD(DOM)側のステータス集約(別 Issue)
- ダメージ/HP の数値フォーマット是正(別 Issue)
Product Spec Context
diff_rationale: Timeout is a neutral terminal result distinct from hp0 defeat so future reward/debrief consumers can branch on outcome without inferring from endReason alone.
changed_requirement_id: sortie.timeout_terminal_result
affected_sections:
- docs/product/features/sortie.md: Authority / Conflict Resolution
- docs/product/features/sortie.md: Sortie State Machine
- docs/product/features/sortie.md: End Conditions
- docs/product/features/sortie.md: SortieResult
- src/ui/HudController.ts: sortie status/result labels
- src/main.ts: E2E snapshot sortie.status/result bridge
- docs/playtest/m2-combat-mvp.md: timeout evidence wording
- tests/e2e/m2-combat-mvp.spec.ts: timeout fixture assertions
Related Migration
- M2 playtest: AC11 timeout_30s_terminal の人間観察動画を M3 gate 前に採取して waiver を解消する #690 の
timeout_30s_defeatは旧仕様として扱い、timeout neutral terminal に合わせて用語を更新する - spec/impl(#483): MVP sortie を敵機全滅勝利・30秒終了に変更する #542 / feat(#542): MVP sortie を敵機全滅勝利・30秒終了に変更する #552 の M2 文言と E2E/playtest の証跡ラベルも defeat ベースの表現から neutral terminal 表現へ移行する
報酬受領可能は将来の reward/debrief consumer の期待値であり、本 Issue で reward 実装を前倒ししない
Acceptance Criteria
- AC1: 30秒タイムアウト終了時の
SortieResultが、hp0 による defeat とプログラム的に区別できる(outcome: 'timeout'とendReason: 'timeout'を持ち、endedは post-result ack 用に残す)。 - AC2:
CanvasRendererがタイムアウト終了時にDEFEATではなく中立ラベル「戦闘終了」を描画し、defeat tone を使わない。 - AC3:
docs/product/features/sortie.md/docs/playtest/m2-combat-mvp.md/tests/e2e/m2-combat-mvp.spec.tsが timeout を「敗北(defeat)」ではなく中立な戦闘終了として記述している。 - AC4: hp0 defeat / 敵全滅 victory / 同一 tick 優先順位 の既存挙動が回帰していない(unit test で PASS)。
- AC5: timeout の E2E 期待値が中立表現に更新され、Canvas overlay / HUD の timeout 表示が defeat ベースではない。
- AC6: 追加・更新した unit test を含め Vitest 全件が PASS する。
- AC7:
pnpm typecheckが PASS する。 - AC8:
pnpm lintが PASS する。 - AC9:
pnpm buildが PASS する。
Verification Commands
# AC1
$ pnpm test -- tests/sortie-system.test.ts
# AC2
# preflight-scope: runtime_only
$ pnpm test:e2e -- tests/e2e/m2-combat-mvp.spec.ts
# AC3
$ rg -n "戦闘終了" docs/product/features/sortie.md docs/playtest/m2-combat-mvp.md tests/e2e/m2-combat-mvp.spec.ts src/render/CanvasRenderer.ts
# AC4
$ pnpm test -- tests/sortie-system.test.ts
# AC5
# preflight-scope: runtime_only
$ pnpm test:e2e -- tests/e2e/m2-combat-mvp.spec.ts
# AC6
$ pnpm test
# AC7
$ pnpm typecheck
# AC8
$ pnpm lint
# AC9
$ pnpm buildRuntime Verification Applicability
- decision: not_applicable
- reason: 本 Issue は static / automated test の更新で完結し、別途の人間 runtime verification は要求しない。E2E は Allowed Paths 内の自動検証として扱う。
Allowed Paths
src/systems/SortieSystem.tssrc/state/GameState.tssrc/render/CanvasRenderer.tssrc/ui/HudController.tssrc/main.tsdocs/product/features/sortie.mddocs/playtest/m2-combat-mvp.mdtests/sortie-system.test.tstests/e2e/m2-combat-mvp.spec.ts
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
SortieResultoutcome 型変更が e2e(tests/e2e/m2-combat-mvp.spec.ts)の defeat pixel 判定に波及し、Allowed Paths 外の修正が必要になった場合
Required Skills
- TypeScript / TSC strict
- ECS(state / systems 分離)
- Canvas 2D 描画
Scope Delta(任意)
N/A
Notes for Reviewer
- 本 Issue はゲームデザイン判断(30秒経過は hp0 defeat ではなく neutral terminal)を人間(実装: AC8 viewport/DPR 証跡を Evidence Panel 実測値で docs に反映し waiver を解消する #689 実施者 squne121)が確定済みであることを前提とする。
docs/product/features/sortie.md/docs/playtest/m2-combat-mvp.md/tests/e2e/m2-combat-mvp.spec.tsの現行記述は timeout=defeat なので、spec・playtest・E2E の語彙更新を本 Issue の In Scope に含める。- 由来: 実装: AC8 viewport/DPR 証跡を Evidence Panel 実測値で docs に反映し waiver を解消する #689 (comment)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
squne121 commentedon Jun 6, 2026
判定
REQUEST CHANGES。
#725 の方向性自体は妥当です。ただし、現状の Issue 契約のままだと「表示だけ
DEFEATを隠す」「型・状態遷移・docs・playtest 証跡はまだ timeout defeat のまま」という中途半端な実装になりやすいです。#725 は「30秒 timeout を defeat と区別し、中立な“戦闘終了”表示にする」ことを目的にし、
SortieSystem.ts、GameState.ts、CanvasRenderer.ts、docs/product/features/sortie.md、tests/sortie-system.test.tsを対象にしています。AC も timeout の区別、renderer 表示、docs 修正、HP0/victory 回帰、テスト通過を求めています。([GitHub]1)一方、現在の main はすでに #680/#709 で
endReason: 'timeout'を持っています。つまり AC1 の「明示フラグで timeout を distinguishable にする」は既に概ね満たされています。現状コードでは timeout はoutcome: 'defeat', endReason: 'timeout'で、SortieState.statusもresult.outcome由来なのでdefeatに遷移します。([GitHub]2)ブロッカー
1. #725 は「UI 表示修正」なのか「ドメインモデル変更」なのか曖昧
現状の
SortieResultは discriminated union ですが、timeout は依然としてoutcome: 'defeat'側に属します。SortieEndReasonコメントも timeout を「defeat」と説明しています。([GitHub]3)#725 の文面は「defeat と区別」「中立な戦闘終了」「報酬受領可能」と読めるため、単に
CanvasRendererでendReason === 'timeout'のときだけ表示を変える実装では、内部契約は defeat のままです。これは将来の reward/debrief/persistence 実装で高確率に破綻します。要求修正案:
どちらかを Issue に明記してください。
A. 最小変更案:
outcome: 'defeat'は維持し、UI/文書上だけ timeout を「戦闘終了」と表示する。ただしこれは「ゲームロジック上は defeat のまま」と明記する。B. 推奨案:
timeout を defeat から型レベルで切り離す。例:
TypeScript の discriminated union は共通プロパティの literal type によって安全に絞り込めるため、この種の状態契約に向いています。網羅性チェックには
neverを使えます。(TypeScript)2.
endedという既存 status と衝突しやすいSortieStatusにはすでに'ended'があります。現在の docs でもendedは result 表示後の post-result 状態として説明されています。([GitHub]5)そのため、timeout の outcome/status に安易に
endedを使うと、「30秒で戦闘終了した結果」なのか「結果確認後に sortie を閉じた状態」なのかが混線します。推奨:
timeout 結果は
outcome: 'timeout'またはoutcome: 'completed'のように、既存status: 'ended'と衝突しない名前にする。個人的にはtimeoutが最も誤読が少ないです。3.
CanvasRendererのラベルだけ直すと defeat 色が残る現在の renderer は
state.sortie.result.outcomeだけを見てVICTORY/DEFEATを決め、victory でなければ defeat 扱いの色・表示になります。つまり timeout でラベルだけ戦闘終了にしても、赤系の defeat overlay が残る可能性があります。([GitHub]6)これは UI 上の semantic leak です。
「中立な戦闘終了」とするなら、少なくとも presentation を中央集約してください。
Canvas の
fillText()は指定座標に文字列を描画する API なので、renderer test では pixel diff だけでなく、mock context のfillText('戦闘終了', ...)とfillStyle/presentation helper を検証できます。([MDN Web Docs]7)4. Allowed paths が足りない可能性が高い
#725 の allowed paths は renderer と sortie unit test までですが、Stop condition では
tests/e2e/m2-combat-mvp.spec.tsの defeat pixel 変更可能性に触れています。([GitHub]1)これは「必要なら止まる」ではなく、ほぼ確実に事前スコープ化すべき箇所です。#552 で 30秒 timeout は defeat として E2E/docs/unit に入った経緯があり、timeout 表示を変えるなら E2E の期待値もズレる可能性が高いです。([GitHub]8)
要求修正:
allowed paths に少なくとも以下を追加するか、別 Issue に明示分離してください。
現状のままでは AC2「renderer label が戦闘終了」は
rgと unit test だけでごまかされるリスクがあります。5. docs の修正範囲が過小評価されている
docs/product/features/sortie.mdは複数箇所で timeout を defeat として規定しています。Authority、States、Transition table、End Conditions、Normative per-tick evaluation、SortieResultshape、endReasonmapping の全てが影響します。([GitHub]5)#725 のメモは「docs line 42-43/62/82」程度に見えますが、これは不足です。部分置換だと docs 内で「timeout は戦闘終了」「timeout は defeat」が混在します。
要求修正:
検証に negative grep を入れてください。
rg -n "timeout.*defeat|defeat.*timeout|30秒.*defeat|30秒.*敗北|timeout.*敗北|敗北.*timeout" \ docs/product/features/sortie.md src testsただし、過去経緯として残す changelog/comment は allowlist 化してください。
6. #690 / #542 / #552 との整合が未処理
#690 は
timeout_30s_defeatの手動動画証跡 waiver を扱う Issue です。#725 で timeout を中立化するなら、#690 の名称・証跡観点・playtest vocabulary も旧仕様になります。([GitHub]9)また #542 では M2 MVP の仕様として「30秒到達は victory ではなく defeat/end treatment」「優先順位は defeat > victory > timeout」と整理されています。#552 でも 30秒 timeout → defeat として docs/test/E2E を更新した履歴があります。([GitHub]10)
要求修正:
#725 に以下を追加すべきです。
#689 は viewport/DPR 証跡が主題で、timeout 動画 waiver は #690 に分離されていました。#725 の「#689 からの follow-up」という説明だけでは根拠として弱いです。([GitHub]11)
7. reward/debrief の表現が先走っている
#725 は「中立な戦闘終了 / 報酬受領可能」と書いていますが、reward/debrief の実装は out of scope です。docs の現状でも persistence/rewards は non-goal です。([GitHub]1)
危険:
「報酬受領可能」と仕様文に書くと、未実装なのに product contract だけ先に確定します。
推奨文言:
推奨する #725 の再定義
この Issue は次のように契約を締めた方が安全です。
実装上の注意点
state.enemies.length > 0の guard は維持してください。JavaScript のArray.prototype.every()は空配列でtrueを返すため、敵配列が空のときに victory 判定が誤爆しないようにする現在の guard は重要です。([MDN Web Docs]12)現在の
SortieSystemは HP0 → victory → timeout の順で terminal result を作っています。timeout を中立化しても、同 tick の優先順位は既存の regression test を残すべきです。([GitHub]13)最終レビューコメント案
そのまま GitHub に貼るなら以下です。
結論として、#725 は実装前に Issue 契約を締め直すべきです。特に
outcome/statusを変えるかどうか、E2E を今回含めるか、#690 の旧timeout_30s_defeat表記をどう処理するかを曖昧にしたまま着手すると、後続の reward/debrief 実装でまた仕様債務になります。docs(#690): レビュー指摘対応 — Manual Checklist の timeout=defeat 残存を分離し証跡 pro…
docs(#690): M2 AC11 timeout 中立 terminal の人間観察証跡を記録し deferred waiver を…