Repository navigation
feat(#489): implement SortieSystem and sortie state machine - #530
Conversation
Add SortieState discriminated union to GameState, implement SortieSystem with victory/defeat/terminal-gate/defeat-precedence logic, connect EnemySpawnSystem/EnemyAISystem/SortieSystem to stepSimulation in main.ts, and add M2 bootstrap via startSortie. All 9 required test cases pass. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
検証結果レポートIssue #489: SortieSystem and sortie state machine
総合判定
検証の詳細AC1: SortieSystem.ts と GameState sortie state
AC6,AC7,AC14: 二重 result 防止・terminal gate 後 mutation・defeat precedence
AC9: sortie-system.test.ts 存在と 9 テストケース
AC10: typecheck/lint/test/build
AC13: main.ts 関数接続
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: BLOCKED
branch_behind_main: false
baseline_only: false
verification_commands_pass: 8
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results: []All Verification Commands passed successfully. PR is ready for merge (mergeable=MERGEABLE; BLOCKED status is due to required status checks, not merge conflicts). |
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 全 14 AC PASS(根拠は下記)
- Allowed Paths: 遵守(変更ファイルは src/main.ts / src/state/GameState.ts / src/systems/SortieSystem.ts / src/systems/index.ts / tests/sortie-system.test.ts のみ)
- CI Verification: 全 7 checks (build/e2e/lint/python-test/test/typecheck/Generate-session-manifest) が head SHA 3e3b4c9 で conclusion=success
- 検証コマンド結果: TEST_VERDICT_MACHINE v1 コメントにて verification_commands_pass=8 / fail=0 / skipped=0 を確認。pnpm test 253 passed
AC coverage 詳細
pr_review_only VC(AC2-AC4, AC5, AC8, AC11)を worktree grep で確認:
- AC2 (elapsedTicks-based timer): SortieSystem.ts に
elapsedTicks += 1実装あり、fixedDeltaMs で targetTicks を計算。確認済み - AC3 (120秒 victory):
SORTIE_DURATION_MS = 120_000,targetTicks = Math.ceil(SORTIE_DURATION_MS / fixedDeltaMs),isVictory = elapsedTicks >= targetTicks確認済み - AC4 (HP 0 defeat):
isDefeat = state.player.hp <= 0確認済み - AC5 (result shape):
{ outcome, durationMs, kills, shotsFired, playerHpRemaining }が SortieResult として GameState.ts と SortieSystem.ts 双方で確認済み - AC6 (二重生成防止): terminal gate
if (state.sortie.status !== 'running') returnが runSortieSystem 先頭にある。status が victory/defeat になった後は再計算されない - AC7 (terminal 後 mutation 停止): 同 terminal gate による。確認済み
- AC8 (persistence/upgrade 実装なし): SortieSystem.ts に persist / localStorage / upgrade の記述なし。確認済み
- AC11 (elapsedTicks authority):
durationMs = elapsedTicks * fixedDeltaMsで計算、state.elapsedMs 非使用。確認済み - AC12 (M2 bootstrap): main.ts L75 に
startSortie(state, defaultSimulationConfig.fixedDeltaMs)がグローバル初期化後に呼ばれている - AC13 (stepSimulation 先頭の sortie gate): main.ts L101 に
if (state.sortie.status !== 'running') { return }が stepSimulation 先頭にある - AC14 (defeat precedence):
isDefeatを先に評価しoutcome = isDefeat ? 'defeat' : 'victory'で defeat 優先が確認済み
Schema / Safety Gate
- schema_change_applicability: not_schema_change(新規 state field 追加だが consumer 境界をまたぐ外部 schema contract への変更なし、内部型追加のみ)
- Safety-sensitive: 非該当(transport / permission / sandbox / auth / MCP 変更なし)
Blockers
なし
Non-blockers
なし
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 3e3b4c9d0c586b30bb262db239be4bb70504ca12
recommendations: []
follow_up_issue_requests: []
判定: REQUEST_CHANGESPR #530 は #489 を閉じる実装として、 Blocker 1:
|
…orchestration step - Fix 1: clamp playerHpRemaining to [0, maxHp] on victory; 0 on defeat - Fix 2: extract runSortieSimulationStep export; main.ts delegates to it - Fix 3: add e.defeated guard to kills filter - Fix 4: Object.freeze on result for runtime immutability - Tests: +2 clamp tests, terminal-gate upgraded to runSortieSimulationStep Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: BLOCKED
branch_behind_main: false
baseline_only: false
verification_commands_pass: 8
verification_commands_fail: 0
verification_skipped_count: 0
runtime_ac_results: []検証結果レポートIssue #489: Sortie Start/End State Machine
総合判定
Note: PR mergeStateStatus is BLOCKED, but this is unrelated to code verification. All Acceptance Criteria verification commands have passed successfully. |
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 全 AC1〜AC14 対応確認。TEST_VERDICT_MACHINE (head_sha=2a597e54c855730432c89ff7cc933d98ea24a494) が verification_skipped_count=0、verification_commands_pass=8 を報告。
- Allowed Paths: 変更ファイル 5 件(
src/main.ts,src/state/GameState.ts,src/systems/SortieSystem.ts,src/systems/index.ts,tests/sortie-system.test.ts)はすべて Issue #489 の Allowed Paths 内。逸脱なし。 - CI Verification: CI run 26701463457 (head_sha 一致) で build/e2e/lint/python-test/test/typecheck 全 pass。
- 検証コマンド結果: TEST_VERDICT_MACHINE が 8 VC を全 PASS 確認(exit 0)。255 tests passed(前回 253 + 新規 2)。
fix_delta 確認結果
| 修正項目 | 確認結果 |
|---|---|
playerHpRemaining: defeat 時 0、victory 時 clamp |
diff 確認済み。outcome === 'defeat' ? 0 : Math.min(maxHp, Math.max(0, hp)) |
runSortieSimulationStep を SortieSystem.ts に抽出・エクスポート |
diff 確認済み。export function runSortieSimulationStep(...) |
src/main.ts から runSortieSimulationStep を呼び出し |
diff 確認済み。stepSimulation 内で呼び出し |
terminal-gate テストが runSortieSimulationStep 経由で検証 |
diff 確認済み。runSortieSimulationStep を複数回呼んで state が変化しないことを検証 |
kills フィルタに e.defeated === true |
diff 確認済み。e.defeated && が追加されている |
Object.freeze({ ... } satisfies SortieResult) |
diff 確認済み。Object.freeze({ ... } satisfies SortieResult) |
| 新規テスト(clamp/negative-hp defeat)追加 | diff 確認済み。2 テストケース追加(+2 counts) |
Blockers
なし
Non-blockers(任意改善)
- PR 本文に
## Schema Change Applicabilityセクションがない。SortieResult/SortieStateは internal ECS game state であり consumer boundary をまたぐ contract ではないため実害はないが、PR template の慣例に沿ってschema_change_applicability: not_schema_changeと根拠を明示するとレビュー時の判断が明確になる。
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 2a597e54c855730432c89ff7cc933d98ea24a494
recommendations: []
follow_up_issue_requests:
- title: "PR テンプレートに schema_change_applicability: not_schema_change の明示例を追記する"
issue_kind: implementation
severity: optional_follow_up
source:
kind: pr_review
url: "https://github.com/squne121/loop-protocol/pull/530"
note_id: "1"
dedupe_key: "follow-up:squne121/loop-protocol:https://github.com/squne121/loop-protocol/pull/530:1"
desired_destination: "not_schema_change の PR でも schema_change_applicability セクションを明示する慣例が確立されている"
validated_scope_delta: "PR template または open-pr SKILL.md に not_schema_change の明示例を追記する"
origin_skill: pr-review-judge
labels:
- triage-required
Closes #489
Summary
SortieStatediscriminated union (idle | running | victory | defeat | ended) とSortieResultshape をsrc/state/GameState.tsに追加(AC1, AC5)src/systems/SortieSystem.tsを新規実装:startSortie/runSortieSystem/SORTIE_DURATION_MS(AC2–AC7, AC11, AC14)src/systems/index.tsにSortieSystemを追加src/main.tsのstepSimulationを更新: terminal gate,EnemySpawnSystem/EnemyAISystem/SortieSystem接続, M2 bootstrap(AC12, AC13)tests/sortie-system.test.tsに 9 必須テストケースを実装(AC9)検証コマンド結果
test -f src/systems/SortieSystem.tsgrep -n "SortieState|sortie" src/state/GameState.tstest -f tests/sortie-system.test.tsgrep -n "startSortie|runSortieSystem|runEnemySpawnSystem|runEnemyAISystem" src/main.tspnpm typecheckpnpm lintpnpm testpnpm build実装メモ
SortieStatediscriminated union の型制約上、property 直接代入は型エラーになるためstate.sortie = { ... }でオブジェクト置き換えを採用elapsedTicks >= targetTicksのみ(state.elapsedMsは不使用: AC11)durationMs = elapsedTicks * fixedDeltaMs(state.elapsedMsを使わない: AC11)state.tick(tick increment 前): 実装: hitbox / collision / damage / defeat を実装する #488 との整合(AC kills-boundary)isDefeatを先に評価(AC14)Contract Snapshot
#489 (comment)
🤖 Generated with Claude Code