Skip to content

fix: ゲーム時間を鬼放出後から数える - #126

Merged
rinyaaa merged 2 commits into
mainfrom
119-fix/game-duration-after-release
Sep 28, 2026
Merged

rinyaaa merged 2 commits into
mainfrom
119-fix/game-duration-after-release

Conversation

@rinyaaa

@rinyaaa rinyaaa commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

背景 / 目的

Closes #119

9/24のプレイテストで「30分に設定したのに25分から始まった」と報告があった。

設定の「全体時間」は、開始から終了までの時間として扱われ、鬼放出までの待ち時間を含んでいた。放出待ち5分・全体30分の設定では、放出後のカウントダウンが25分から始まる。ユーザーと相談し、設定した時間を鬼放出後の鬼ごっこの時間として数えることにした。

変更内容

  • room_repository.dart: 開始・放出・終了の時刻計算を純粋関数 computeGameSchedule に切り出し、endsAt = releasedAt + gameDurationSec にした
  • room_setting_page.dart: ラベル「全体時間」を「鬼ごっこの時間(放出後)」に変えた。「全体時間は待機時間より長く」の検証は不要になったので外した
  • docs/rtdb-schema.md・README: endsAt の式と gameDurationSec の意味を更新
  • RTDBのフィールド名 gameDurationSec は変えていない(意味だけ変わる)

動作確認

  • flutter test: 全件成功
  • flutter analyze: エラー・警告なし
  • 追加したテスト: 放出待ち5分・30分の設定で、終了が開始から35分後(放出から30分後)になる
  • 実機での確認: 未実施。放出後のカウントダウンが30:00から始まるかを確認したい

スクリーンショット / 動画

設定画面のラベル文言のみ変更。

変更前 変更後
全体時間 鬼ごっこの時間(放出後)

レビューで見てほしいところ

  • 放出待ちを含めた全体の所要時間は、設定値より放出待ちのぶん長くなる(5分 + 30分 = 35分)。遊ぶ前の案内で伝えたほうがよいかもしれない
  • UIモック(docs/ui-mockup-2a.html)には設定画面の該当項目が無いため、照合は不要だった

影響範囲・注意点

  • ゲームの終了時刻(meta/endsAt)、設定画面
  • すでに開始済みのルームには影響しない(開始時に一度だけ計算するため)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 仕様変更

    • ゲーム時間は鬼の放出後から数えるようになりました。放出までの待機時間はゲーム時間に含まれません。
    • 設定画面の時間説明を「鬼放出後の時間」に変更し、待機時間との合計を基準にした入力エラー表示をなくしました。保存中でない場合は、待機時間の長さにかかわらず設定を保存できます。
  • テスト

    • 鬼の放出時刻と、放出後のゲーム時間に基づく終了時刻を確認するテストを追加しました。

30分・放出待ち5分の設定だと、放出後の残り時間が25分から始まっていた。
終了時刻を releasedAt + gameDurationSec にし、設定画面の「全体時間」を
「鬼ごっこの時間(放出後)」に改めた。全体時間が待機時間より長いことの
検証は不要になったので外した。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5f084b06-05e5-461e-8e16-357799dc9872

📥 Commits

Reviewing files that changed from the base of the PR and between c00c4ac and b115064.

📒 Files selected for processing (5)
  • README.md
  • docs/rtdb-schema.md
  • lib/features/room/repository/room_repository.dart
  • lib/features/room/view/room_setting_page.dart
  • test/features/room/repository/game_schedule_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

ゲーム時間を鬼放出後から数える仕様に合わせ、設定画面とドキュメントを更新しました。ゲームスケジュールは放出時刻を計算し、その時刻からゲーム時間を加えて終了時刻を設定します。計算を検証するテストを追加しました。

Changes

鬼放出後のゲーム時間

Layer / File(s) Summary
ゲーム時間の定義
lib/features/room/view/room_setting_page.dart, docs/rtdb-schema.md, README.md
鬼ごっこの時間を「鬼放出後の時間」として表示し、放出待ち時間を含まないことを明記しました。放出待ち時間との合計に基づくエラー表示と保存ボタンの制限を削除しました。
放出・終了時刻の計算
lib/features/room/repository/room_repository.dart, test/features/room/repository/game_schedule_test.dart
computeGameScheduleが開始時刻と放出待ち時間からreleasedAtを算出し、そこからgameDurationSec後のendsAtを返します。放出・終了時刻を検証するテストを追加しました。

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: sana-sagegami

Merge Risk: ⚪ Minimal · up to b1150

The game duration now runs from oni release, and the inspected displays and end checks follow that schedule. No issue identified here prevents merging after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to b1150

The new timing matches the intended after-release game duration. The review found no newly introduced unauthorized access path, but the changed end-time contract warrants care for clients running different versions.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — For a room started with the same settings, the later endsAt extends the client-enforced game-over and join cutoff by releaseWaitSec. The existing rules already allow an authenticated client to write any room’s meta and settings, including the effective cutoff.

Security Findings and Attack Paths

  • inferred — An authenticated client can bypass the UI’s host checks to alter stored room settings or meta. That path and the ability to alter endsAt predate this PR; the timing change does not add a caller or database permission.

Trust Boundaries and Controls

  • observed — The settings form limits normal duration selections and the waiting-page start button is host-only. RoomRepository reads persisted settings at start, while the database rules do not enforce those UI limits or host identity.

Resilience and Maintainability Implications

  • inferred — Repeated or concurrent starts can replace startedAt or interleave the separate timestamp and status writes. The sequence is pre-existing, although the new schedule uses its resulting startedAt.

Hardening Proposals

  • proposed — For a future room-authorization change, enforce host identity and duration bounds at the database write boundary rather than relying on the form.
  • proposed — If repeated starts must be prevented, make the complete waiting-to-playing transition conditional and atomic across its timing fields.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは、ゲーム時間を鬼放出後から数える主要な変更を明確かつ簡潔に示しています。
Description check ✅ Passed 背景、変更内容、動作確認、UI変更、レビュー観点、影響範囲を記載しています。実機確認が未実施である点も明記されており、テンプレートを十分に満たしています。
Linked Issues check ✅ Passed 直接リンクされた #119 は、30分設定が放出待ち時間を含めて25分で終了する問題に関係します。PRは computeGameSchedule を追加し、鬼の放出時刻から gameDurationSec を数えて終了時刻を計算します。放出待ち5分とゲーム時間30分で開始から35分後に終了するテストも追加しています。設定ラベルと説明も放出後の時間を示し、放出待ち時間を超える入力を要求する検…
Out of Scope Changes check ✅ Passed 確認できる変更は、#119の時間計算を修正する実装、設定表示と入力検証の更新、RTDBスキーマおよびREADMEの定義更新、関連する自動テストに限定されています。これらはすべて、放出後からゲーム時間を数える仕様に直接関係します。無関係な変更は確認できません。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

うさぎが時計をぴょんとのぞく
鬼の放出まで、そっと待つ
放出のあとに三十分
終了時刻もぴたりと決まる
にんじん片手に、テストを読む
月の広場で、ぴょんと祝う

Comment @coderabbitai help to get the list of available commands.

@rinyaaa

rinyaaa commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator Author

@claude review

@claude

claude Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Claude finished @rinyaaa's task in 1m 51s —— View job


レビュー完了

  • コンテキストの取得(PR差分・関連ファイルの確認)
  • 依頼内容の把握(レビュー依頼)
  • room_repository.dart の computeGameSchedule を確認
  • room_setting_page.dart のラベル変更・検証削除を確認
  • テスト(game_schedule_test.dart)を確認
  • ドキュメント(README / rtdb-schema.md)との整合を確認
  • レビュー結果をコメントに反映

総評

目的(鬼放出後からgameDurationSecを数える)に対して、変更は的確でスコープも適切です。computeGameScheduleへの切り出しはstartGame(既存のゲーム開始処理)から呼ばれる一箇所に閉じており、game_page.dart・game_alerts.dart・restart_recovery.dartなど他の画面はRTDBに保存済みのreleasedAt/endsAtを読むだけなので、影響範囲がPR説明の通り「開始時に一度だけ計算」に収まっていることを確認しました。既存のroom_repository_test.dartのテストもendsAtをfixtureで直接指定しているため、この変更による既存テストの破壊はありません。

確認した実装

  • lib/features/room/repository/room_repository.dart:158-163, 513-521: releasedAt = startedAt + releaseWaitSec*1000、endsAt = releasedAt + gameDurationSec*1000という式は、issueの意図(放出待ち5分・全体30分→放出後30分間)と一致しています。純粋関数として切り出したことでテスタブルになっているのも良い設計判断です。
  • lib/features/room/view/room_setting_page.dart: isValidと警告文の削除は妥当です(「全体時間は放出待ちより長く」という制約が意味的に不要になったため)。ボタンのonPressed条件も追随して修正されています。Colors.redは他の箇所(231, 282, 446, 450行目)でまだ使われているので、import漏れ・未使用importの問題もありません。
  • テスト test/features/room/repository/game_schedule_test.dart: 放出待ち5分・(デフォルト値の)30分設定で開始から35分後に終了する、というシナリオを正しく検証しています。

気になった点(軽微、ブロッカーではありません)

  1. test/features/room/repository/game_schedule_test.dart:20-21: 2つ目のテストはRoomSetting(releaseWaitSec: 300)のみを渡し、gameDurationSecはRoomSetting側のデフォルト値(1800秒=30分)に依存しています。テストの意図(「全体30分」の設定)がRoomSettingのデフォルト値定義と暗黙に結びついてしまうため、gameDurationSec: 1800を明示した方が、将来デフォルト値が変わってもテストの意図がコードだけで読み取れて安全です。
    Fix this →

  2. PRの説明にもある通り、放出待ち+鬼ごっこ時間で「設定した時間より実際の所要時間が長くなる」点は仕様として妥当ですが、プレイヤー向けの案内(ルール説明や設定画面の補足文言など)に反映するかどうかは別途検討した方が良さそうです。実装自体に問題はありません。

実行できなかった確認

このレビュー環境にFlutter/Dart SDKが導入されておらず、flutter analyze・flutter testをこちら側で再実行できませんでした。PR記載の実行結果(全件成功・警告なし)を確認する形になります。

Claudeのレビュー指摘への対応。RoomSettingの既定値(30分)に頼らず、
gameDurationSec: 1800 を明示した。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Updates game duration to start after demon release, so the configured time is fully playable.

Changes:

  • Calculates endsAt from releasedAt + gameDurationSec.
  • Updates settings labels and validation.
  • Updates documentation and adds schedule tests.
File Description
test/​features/​room/​repository/​game_schedule_test.dart Tests post-release duration behavior.
README.md Updates game timing documentation.
lib/​features/​room/​view/​room_setting_page.dart Updates the label and removes obsolete validation.
lib/​features/​room/​repository/​room_repository.dart Computes the revised game schedule.
docs/​rtdb-schema.md Documents the updated timing semantics.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rinyaaa
rinyaaa merged commit 19e3627 into main Sep 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

30分だけど25分から始まってた

2 participants