Skip to content

オートモードの折り返し時にTTSの初回放送を再発火するよう変更#6408

Merged
TinyKitten merged 2 commits into
devfrom
feature/auto-mode-turnaround-first-speech
Jul 12, 2026
Merged

オートモードの折り返し時にTTSの初回放送を再発火するよう変更#6408
TinyKitten merged 2 commits into
devfrom
feature/auto-mode-turnaround-first-speech

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jul 12, 2026

Copy link
Copy Markdown
Member

概要

オートモードの折り返し(終点で約1分停車後に方面を逆転して折り返す挙動、#6403 で追加)に続く変更です。折り返して新しい行き先へ発車する際、TTS の初回放送(「この電車は〜行きです」)が改めて再生されるようにしました。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • src/hooks/useSimulationMode.ts: 終点での待機完了後に方面(selectedDirection / selectedBound)を逆転させるタイミングで resetFirstSpeechAtom をインクリメントするようにした。これにより useTTS 側で firstSpeechtrue に戻る。
  • 行き先(selectedBound)の変更と併せて firstSpeech が再セットされるため、useTTS の抑止ロジック(suppressFirstSpeechUntilDepartureRef / computeSuppressionDecision)により終点停車中(arrived=true)は再生されず、折り返して発車した後(arrived=false)に初回放送が改めて再生される。
  • ループ線は折り返さない(従来どおり周回を継続する)ため、この再発火の対象外。
  • src/hooks/useSimulationMode.test.tsx: 折り返し前は resetFirstSpeech が発火しないこと、折り返し時に resetFirstSpeech がインクリメントされること(初回放送の再発火)を検証するアサーションを追加。

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

npx jest src/hooks/useSimulationMode.test.tsx(25 件パス)、npm run typecheck、Biome lint を実行し、いずれも成功を確認。

関連Issue

Refs #6403

スクリーンショット(任意)


🤖 Generated with Claude Code

https://claude.ai/code/session_012dhifdRFT6ZRWghyvrDFzk


Generated by Claude Code

Summary by CodeRabbit

  • 機能改善
    • 折り返し運転の開始時に音声案内を初期化し、折り返し後の発車時に初回案内が再生されるよう改善しました。
  • テスト
    • 終点到着後の待機中に不要な音声案内が再生されないことを確認するテストを追加しました。
    • 折り返し時の音声案内リセット動作を検証するテストを追加しました。

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 45 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7bee6b67-8ebe-4ada-9d00-26e4260b7caa

📥 Commits

Reviewing files that changed from the base of the PR and between b702324 and 076a232.

📒 Files selected for processing (1)
  • src/hooks/useSimulationMode.test.tsx
📝 Walkthrough

Walkthrough

終点到達後の折り返し開始時にresetFirstSpeechAtomをインクリメントする処理を追加し、待機中は更新されず、折り返し時に更新されることをテストで検証します。

Changes

シミュレーション折り返し音声制御

Layer / File(s) Summary
折り返し時の初回音声リセット
src/hooks/useSimulationMode.ts, src/hooks/useSimulationMode.test.tsx
終点待機後の折り返し開始時にresetFirstSpeechAtomを現在値から1増加させる処理を追加し、待機中の未更新と折り返し時の更新値をテストで確認します。

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

Sequence Diagram(s)

sequenceDiagram
  participant useSimulationMode
  participant store
  participant resetFirstSpeechAtom
  participant TTS
  useSimulationMode->>store: 現在値を取得
  useSimulationMode->>store: 値を1増加
  store->>resetFirstSpeechAtom: 更新を反映
  resetFirstSpeechAtom->>TTS: 初回スピーチを再発火
Loading

Possibly related PRs

Poem

ぴょんと折り返し、列車は進む
初めの声を、もう一度呼ぶ
待機のあいだは静かにして
発車の時には音を咲かす
うさぎも耳をぴんと立てる 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 主変更である折り返し時のTTS初回放送の再発火を簡潔に表しており、内容に合致しています。
Description check ✅ Passed 概要・変更の種類・変更内容・テスト・関連Issueが揃っており、テンプレート要件を概ね満たしています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/auto-mode-turnaround-first-speech

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

@TinyKitten TinyKitten self-assigned this Jul 12, 2026
@github-actions github-actions Bot added the react label Jul 12, 2026
@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/hooks/useSimulationMode.test.tsx`:
- Around line 663-667: Update the store.get mock for resetFirstSpeechAtom in the
affected tests to return a nonzero current value such as 3, while continuing to
return the location object for locationAtom. Assert that the update sets the
value to 4 and verify the setter is called exactly once, covering both the
“current value + 1” behavior and duplicate updates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2cf5aeef-8ac6-4074-a2b9-c0208201679b

📥 Commits

Reviewing files that changed from the base of the PR and between 151d7f4 and b702324.

📒 Files selected for processing (2)
  • src/hooks/useSimulationMode.test.tsx
  • src/hooks/useSimulationMode.ts

Comment thread src/hooks/useSimulationMode.test.tsx Outdated
@TinyKitten TinyKitten merged commit 9c5fe10 into dev Jul 12, 2026
6 checks passed
@TinyKitten TinyKitten deleted the feature/auto-mode-turnaround-first-speech branch July 12, 2026 20:58
@TinyKitten TinyKitten mentioned this pull request Jul 12, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants