Repository navigation
useTTSText のテンプレートで欠落していた終点アナウンスを補完 - #5920
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough複数 TTS テーマの NEXT/ARRIVING テンプレートで終点条件を明示する文言を追加し、その動作を検証する Jest テストスイートを導入しました。エクスポートや非テンプレートロジックの変更は含みません。 Changes終点アナウンス実装
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/tts/templates.ts`:
- Around line 106-107: The Japanese template uses isNextStopTerminus for the
terminus check while the English template uses nextStationIsBound, causing
inconsistent behavior; update the JA template fragment that references
isNextStopTerminus to use nextStationIsBound instead (same variable used in EN)
so terminus announcements match for cases like when a middle station is set as
selectedBound; locate the template lines using isNextStopTerminus and replace
that predicate with nextStationIsBound wherever terminus wording is emitted.
In `@src/hooks/useTTSText.test.tsx`:
- Around line 696-700: MID_BOUND_CASES is missing the JR_WEST / ARRIVING
scenario causing a bound-detection regression; add an entry to the
MID_BOUND_CASES array such as { theme: 'JR_WEST', state: 'ARRIVING' as
HeaderStoppingState, en: 'terminal' } (matching the existing shape used for
JR_KYUSHU/JR_WEST) so tests exercise the JR_WEST ARRIVING mid-bound case and
prevent regressions in the bound logic.
- Line 613: Reformat the useEffect dependency array so it matches the project's
Biome formatting rules (two-space indentation, single quotes, UTF-8, and ES5
trailing commas) — specifically update the closing of the useEffect block (the
line with "}, [boundIndex, headerState, nextStationIndex, setLineState,
setStationState, theme]);") to follow Biome's expected spacing and
trailing-comma style (e.g., ensure the array elements and closing
brackets/parenthesis are formatted and include the trailing comma if required).
Run the equivalent of "biome check --write" or apply the project's formatter to
the useEffect dependency array in useTTSText.test.tsx (the useEffect block
containing the dependency list) so CI formatting errors are resolved.
🪄 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: eb33333d-cff7-4f2a-a95f-321f2df12d17
📒 Files selected for processing (2)
src/hooks/tts/templates.tssrc/hooks/useTTSText.test.tsx
Fixes Applied SuccessfullyFixed 2 file(s) based on 2 CodeRabbit feedback item(s). Files modified:
Commit: The latest autofix changes are on the |
概要
useTTSTextの各テーマ NEXT / ARRIVING で欠落していた「次の駅が終点」のアナウンス(JA: 「終点」 / EN: "terminal" / "the last stop")を補完する。bug ラベル付き Issue #5915 への対応。変更の種類
変更内容
src/hooks/tts/templates.ts: 以下のテンプレートに終点アナウンスを追加・調整した。次は、X、終点です。を発話。The next stop is X. ... The last stop.を発話。, terminal.形を追加。ご乗車ありがとうございました。の前に終点、X です。を追加。... brief stop at X terminal ...を発話。、終点ですを追加。まもなく、終点、X、X。の prefix を追加。, the last stopを追加。src/hooks/tts/templates.ts: 副次バグ修正(Issue の ※1)。YAMANOTE / SAIKYO / JR_KYUSHU の ARRIVING でtransferLines.lengthが真のときだけ thanks メッセージが出ていた問題を、ブロック構造を平坦化してisNextStopTerminus/nextStationIsBoundのみで発話されるよう修正。isNextStopTerminus、JR_WEST / JR_KYUSHU はnextStationIsBoundを使用。既存テーマの慣習に揃えている。src/hooks/useTTSText.test.tsx:terminus announcement (#5915)describe を追加。nextStation = stations[last]の状態で NEXT / ARRIVING を呼び、JA に終点/ EN にterminalまたはlast stopが含まれることを検証(全 14 ケース)。selectedBoundを中間駅 (神保町) に設定したケースも追加検証(3 ケース)。終点、X です。ご乗車...連結を正規表現で検証。linesを削除してtransferLinesを空にしたうえで、YAMANOTE / SAIKYO / JR_KYUSHU の ARRIVING で thanks 文が発話されることを検証。テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること検証メモ:
npm test: 1509 / 1509 passed(useTTSText.test.tsx単体は 67 / 67 passed)。npm run typecheck: exit 0。npm run lint: 当該変更前後でFound 20 errors.のまま増減なし。20 件はすべて Windows 環境固有の CRLF フォーマット差分で、CI 環境(Linux)では発生しない既知のローカル差分。関連Issue
Closes #5915
スクリーンショット(任意)
Summary by CodeRabbit
改善
テスト