Skip to content

tts文言修正 - #4886

Merged
TinyKitten merged 1 commit into
devfrom
fix/railway-tts
Jan 2, 2026
Merged

TinyKitten merged 1 commit into
devfrom
fix/railway-tts

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jan 2, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

リリースノート

  • 改善
    • 音声テキスト処理のロバスト性を向上させました。
    • データが欠落している場合のエラーハンドリングを強化し、より安定した動作を実現しました。
    • 到着駅の判定ロジックを改善し、正確性を高めました。

✏️ Tip: You can customize this high-level summary in your review settings.

@TinyKitten TinyKitten self-assigned this Jan 2, 2026
@coderabbitai

coderabbitai Bot commented Jan 2, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

useTTSText フックの戻り値の型を undefined[] から [] に変更し、nullable な値の厳格化と null ガード処理を追加。currentLine と selectedBound はオリジンが不在の場合に null を返すように改善。ARRIVING フロー判定を isNextStopTerminus から isAfterNextStopTerminus に切り替え。

Changes

Cohort / File(s) 変更概要
型シグネチャと戻り値の厳格化
src/hooks/useTTSText.ts
戻り値の型を [string, string] | undefined[] から [string, string] | [] に変更。memoized な currentLine と selectedBound が origin 不在時に null を返すように修正。objectSpread を削除し null 返却に統一。
ARRIVING テキスト生成ロジック
src/hooks/useTTSText.ts
「最後の停止」テキスト判定を isNextStopTerminus から isAfterNextStopTerminus に切り替え。boundForEn で optional chaining と nullish coalescing を使用し、undefined 時は空文字列にフォールバック。
Null ガード・エラーハンドリング強化
src/hooks/useTTSText.ts
loopLineBoundEn?.boundFor の optional chaining 導入。複数箇所で undefined 値に対するガード追加。制御フローの早期リターンでデータ不在時の処理を最適化。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰✨ 型をぎゅっと締め直して、

Null ガードでしっかり守ろう、

ARRIVING も目覚めて、

終点への道はより確かに。🚂

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトル「tts文言修正」は、useTTSText.tsファイルの変更内容である戻り値型の変更とTTS関連の文言修正を適切に表現しており、主な変更内容に関連している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9d172f and 1264d5d.

📒 Files selected for processing (1)
  • src/hooks/useTTSText.ts
🧰 Additional context used
📓 Path-based instructions (9)
src/hooks/**/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Custom hooks should use use prefix (e.g., useStationFeed.ts)

Files:

  • src/hooks/useTTSText.ts
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Biome as the formatter for all code files

Files:

  • src/hooks/useTTSText.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx}: Use Biome as the linter for all code files
Use // biome-ignore only for true compatibility issues and include an inline reason

Files:

  • src/hooks/useTTSText.ts
**/*.{ts,tsx,js,jsx,py,java,go,cs}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx,py,java,go,cs}: Use descriptive names for agents that clearly indicate their purpose and domain
Implement agents with well-defined input/output contracts to ensure clear communication
Document agent responsibilities and expected behaviors in comments or docstrings
Use composition and dependency injection for agent collaboration rather than tight coupling
Implement error handling and graceful degradation in agents to improve system resilience

Files:

  • src/hooks/useTTSText.ts
**/*

📄 CodeRabbit inference engine (AGENTS.md)

Use UTF-8 encoding, two-space indentation, single quotes, and ES5 trailing commas as enforced by .editorconfig.

Files:

  • src/hooks/useTTSText.ts
**/*.{js,ts,tsx,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Biome is authoritative for linting; avoid // biome-ignore unless a rule is truly incompatible and document the rationale inline.

Files:

  • src/hooks/useTTSText.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Name components with PascalCase (e.g., StationBanner.tsx).

Files:

  • src/hooks/useTTSText.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Name hooks with use* prefix (e.g., useStationFeed.ts).

Files:

  • src/hooks/useTTSText.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Keep comments purposeful: explain intent or non-obvious constraints, not obvious mechanics.

Files:

  • src/hooks/useTTSText.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4448
File: functions/src/funcs/tts.ts:214-232
Timestamp: 2025-08-11T20:23:23.071Z
Learning: PR #4448 in TrainLCD/MobileApp is specifically about AI feedback summarization and labeling functionality, not about TTS (Text-to-Speech) improvements. The TTS code changes appear to be part of a modularization refactoring but are not the focus of this PR.
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Write commit messages in Japanese (e.g., `テレメトリー送信機をリファクタリングしてnull状態を回避`)
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Commit messages must be single-sentence statements in Japanese (e.g., `テレメトリー送信機をリファクタリングしてnull状態を回避`); prefix production hot fixes with `Hotfix:`.
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Generate commit messages in Japanese
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Code review and feedback should be provided in Japanese
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR #4286.
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4396
File: src/components/TrainTypeBoxJRKyushu.tsx:176-183
Timestamp: 2025-07-18T11:04:45.459Z
Learning: TrainTypeBoxJRKyushuコンポーネントでは、trainTypeNameとprevTrainTypeNameは常に文字列となるため、.split()メソッドを使用する際のnull安全性チェックは不要である。これらの変数はuseMemoとuseLazyPreviousを通じて管理され、translate()関数からのフォールバック値により常に文字列が保証される。
📚 Learning: 2025-05-19T10:59:37.813Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR #4286.

Applied to files:

  • src/hooks/useTTSText.ts
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.{ts,tsx} : Name hooks with `use*` prefix (e.g., `useStationFeed.ts`).

Applied to files:

  • src/hooks/useTTSText.ts
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to src/hooks/**/*.ts : Custom hooks should use `use` prefix (e.g., `useStationFeed.ts`)

Applied to files:

  • src/hooks/useTTSText.ts
🔇 Additional comments (5)
src/hooks/useTTSText.ts (5)

38-41: 型定義の改善 👍

undefined[] から [] への変更は、実際の戻り値(空配列 or 2要素タプル)をより正確に表現しています。


105-113: null ガードの統一化

currentLineOrigin ?? null と selectedBoundOrigin ?? null への変更により、undefined と null が混在することを防ぎ、後続の null チェック(Line 277, 780)との整合性が向上しています。


149-156: null 安全性の向上

loopLineBoundEn?.boundFor が未定義の場合に空文字列へフォールバックすることで、TTS テキスト生成時のランタイムエラーを防いでいます。


878-882: バグ修正 👍

afterNextStation についてのアナウンス(「次の駅の次は...」)において、終点判定を isNextStopTerminus から isAfterNextStopTerminus に修正したのは正しい変更です。アナウンス対象の駅に対応した終点フラグを参照するようになりました。


1066-1070: TOEI テーマでも同様の修正

Line 881 と同様、afterNextStation に関するアナウンスで正しい終点判定フラグを使用するように修正されています。


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

@github-actions github-actions Bot added the react label Jan 2, 2026
@TinyKitten

Copy link
Copy Markdown
Member Author

Warning

Rate limit exceeded

@TinyKitten has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits
Reviewing files that changed from the base of the PR and between d9d172f and 1264d5d.

📒 Files selected for processing (1)

  • src/hooks/useTTSText.ts

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

おっ冷えてるか〜

@coderabbitai

coderabbitai Bot commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@TinyKitten さん、お疲れ様です!😄

レート制限に引っかかってしまいましたね。約2分半お待ちいただければ、レビューを再開できます。その後、@coderabbitai review コマンドでレビューをトリガーしていただくか、新しいコミットをプッシュしていただければと思います。

よろしくお願いします!🍻


🧠 Learnings used
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.

Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Code review and feedback should be provided in Japanese

Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Write commit messages in Japanese (e.g., `テレメトリー送信機をリファクタリングしてnull状態を回避`)

@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 2, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

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.

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.

1 participant