Repository navigation
TTS文言を各テーマの公式車内放送の言い回しに刷新し、他社線直通境界駅の御礼・直通先案内放送を追加 - #6162
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 (1)
📝 WalkthroughWalkthrough複数電車テーマの車内自動放送テンプレートを公式放送に統一。JR-West停留所リスト表現の変更、TTS文脈構築ロジック(直通境界駅判定、線路/列車種別情報の事前計算)の拡張、5テーマのテンプレート文言(終点/乗換案内/英語語彙)の再構成、および対応する回帰テストの整備。 ChangesTTS放送テンプレートシステムの公式文言対応化
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labelsreact 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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/hooks/tts/formatters.test.ts (1)
1-11:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
afterEachでjest.clearAllMocks()を追加してください。このファイルは
*.test.tsですが、モック状態のクリアが未設定です。将来このファイルにモックが追加された際のテスト汚染を防ぐため、ファイル先頭付近にafterEach(() => jest.clearAllMocks())を入れてください。
As per coding guidelines: "**/*.test.{ts,tsx}: テストのafterEachでjest.clearAllMocks()を呼び出してください".🤖 Prompt for 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. In `@src/hooks/tts/formatters.test.ts` around lines 1 - 11, Add a test teardown to clear Jest mocks: in the test file (formatters.test.ts) near the top (just after imports) add an afterEach callback that calls jest.clearAllMocks() so any mocks added later won't leak between tests; ensure the statement uses afterEach(() => jest.clearAllMocks()) and is placed before any test definitions that use the imported symbols like dedupeLinesByTtsName, formatFirstConnectedLineEnPhrase, formatJrWestStopsListEn, replaceJapaneseText, stripParensForTTS, and stripStationParensForTTS.Source: Coding guidelines
🤖 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/formatters.ts`:
- Around line 160-163: The joinWithAnd function produces "A, and B" for two
items; update joinWithAnd to handle names.length === 2 as a special case and
return "A and B" (keep the existing behavior for 0 or 1 item and the current
comma-separated logic for 3+ items); reference the joinWithAnd(names: string[])
function and adjust its branching so it returns names[0] + ' and ' + names[1]
when names.length === 2.
---
Outside diff comments:
In `@src/hooks/tts/formatters.test.ts`:
- Around line 1-11: Add a test teardown to clear Jest mocks: in the test file
(formatters.test.ts) near the top (just after imports) add an afterEach callback
that calls jest.clearAllMocks() so any mocks added later won't leak between
tests; ensure the statement uses afterEach(() => jest.clearAllMocks()) and is
placed before any test definitions that use the imported symbols like
dedupeLinesByTtsName, formatFirstConnectedLineEnPhrase, formatJrWestStopsListEn,
replaceJapaneseText, stripParensForTTS, and stripStationParensForTTS.
🪄 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: 8aa29146-f508-4b9d-afd4-3230d593b71c
📒 Files selected for processing (6)
src/hooks/tts/formatters.test.tssrc/hooks/tts/formatters.tssrc/hooks/tts/templates.tssrc/hooks/useTTSText.bus.test.tsxsrc/hooks/useTTSText.test.tsxsrc/hooks/useTTSText.ts
概要
TTSの読み上げ文言を、各テーマが模している鉄道事業者の実車自動放送の公式文言に合わせて書き換えました。文言は以下の一次資料・実車放送書き起こしで一字一句確認したものをベースにしています(会社名・路線名・駅番号はすべて既存の動的変数のままで、定型句のみ公式の言い回しに変更)。
変更の種類
変更内容
src/hooks/tts/templates.ts: 全テーマのNEXT/ARRIVINGテンプレートを公式文言に書き換え(YAMANOTE/SAIKYOはJR東日本 通勤型共通テンプレートに統合)formatJrWestStopsListEn)isNextStopThroughBoundary/nextLineJa/nextLineEnをuseTTSText.tsに追加(東京メトロ・東急・都営テーマで使用。JR系は出典未確認のため対象外)formatJrWestStopsListEnのテストを追加テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Generated by Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests