Skip to content

環状路線のETA取得時のdirectionIdとfrom/toの割り当てが進行方向と逆だった不具合を修正 - #6337

Merged
TinyKitten merged 1 commit into
devfrom
claude/graphql-eta-directionid-e9ov0b
Jul 3, 2026
Merged

TinyKitten merged 1 commit into
devfrom
claude/graphql-eta-directionid-e9ov0b

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

概要

#6334 のフォローアップ。環状路線のETA取得で directionId を送るようにしたが、環状路線における INBOUND/OUTBOUND と API 駅格納順の対応が線形路線と逆であることを見落としており、山手線内回り乗車時に逆側(外回り)の弧が返って ETA が一切表示されなかった(canary ビルドの実機で確認された不具合)。

変更の種類

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

変更内容

  • LOOP_LINE_DIRECTION_ID のマッピングを反転: INBOUND(内回り)→ 1(配列逆順) / OUTBOUND(外回り)→ 0(格納順)。環状路線の進行方向規約は線形路線と逆(useNextStation の環状分岐 groupIndex - 1、useLoopLine の inbound が反転配列走査であることに整合)。山手線の格納順(大崎→渋谷→新宿→池袋→上野→東京→品川)は外回りに相当する
  • 環状路線では fromStationId / toStationId も進行方向の始端→終端になるよう線形路線と逆に割り当てる。従来の割り当てのままだと StationAPI の方向指定つき弧選択(環状路線の到着時間推定で継ぎ目をラップする弧を選択し山手線のETAが出ない問題を修正する StationAPI#1581)が継ぎ目を跨いだ2駅分の弧に潰れ、ETA 対象駅が返らない
  • 線形路線(isLoopLine === false)の from/to と directionId 未送信の挙動は従来と同一
  • テストを修正後の期待値に更新し、環状路線の INBOUND/OUTBOUND それぞれで directionId と fromStationId / toStationId の両方を検証するようにした

テスト

ローカルで npm run lint && npm test && npm run typecheck を実行し、すべて通過(181 スイート / 1928 テスト)。

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

関連Issue

参考: #6334 / TrainLCD/StationAPI#1581

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


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • 環状路線での到着予測時に、方面の選択に応じた駅の並びと方向判定が正しく反映されるようになりました。
    • ループ路線で一部の区間が意図しない扱いになる不具合を修正し、始点・終点の対応が安定しました。

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

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ab0ba5eb-19fe-49d5-985e-32d1e892baf4

📥 Commits

Reviewing files that changed from the base of the PR and between 4aa8fa0 and 385ca6a.

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

📝 Walkthrough

Walkthrough

環状路線(LOOP)におけるLineDirectionとAPIのdirection_id(0/1)の対応関係を入れ替え、fromStationId/toStationIdの割り当てロジックをtravelsInStoredOrder判定に基づいて変更しました。それに伴い、対応するテストの期待値とテスト名も更新されています。

Changes

環状路線direction対応

Layer / File(s) Summary
direction_id対応と端点割り当てロジック
src/hooks/useEstimateArrivalTimes.ts
LOOP_LINE_DIRECTION_IDのLineDirection→direction_id対応を入れ替え、travelsInStoredOrder判定を導入してfromStationId/toStationIdの割り当てを反転するロジックに変更。
テスト期待値の更新
src/hooks/useEstimateArrivalTimes.test.tsx
環状路線かつINBOUND/OUTBOUNDのテストケース名とdirectionId、fromStationId/toStationIdの期待値を新しい対応規約に合わせて更新。

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

Possibly related PRs

  • TrainLCD/MobileApp#6320: 同じくuseEstimateArrivalTimes.ts/テストファイルの環状路線INBOUND/OUTBOUND時のdirectionIdとfromStationId/toStationIdの扱いを変更している。

Poem

環になった線路の上で
向きがくるりとひっくり返る
from と to も入れ替わり
テストもうさぎも大合唱
🐰 ぴょんと跳ねて弧を描く

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PRの主変更である環状路線ETAのdirectionId/from-to割り当て修正を的確に要約しています。
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/graphql-eta-directionid-e9ov0b

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

@TinyKitten
TinyKitten merged commit da1bc49 into dev Jul 3, 2026
6 checks passed
@TinyKitten
TinyKitten deleted the claude/graphql-eta-directionid-e9ov0b branch July 3, 2026 14:42
@TinyKitten TinyKitten mentioned this pull request Jul 3, 2026
4 of 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