Repository navigation
大江戸線都庁前の外回り/内回りをgroupIdで取り違える駅位置特定のバグを修正 - #6349
Merged
Merged
Conversation
都庁前は外回り/内回りでgroupIdが共通だがidは別々に採番されており、groupIdだけの findIndexでは配列中で先に見つかる方に固定され、実際の現在地と異なる位置を 基準に区間計算をしてしまっていた。useBounds(大江戸線の行き先表示区間切り出し)と findNearestStation(列車種別変更時の現在地補正、呼び出し元のuseTrainTypeModalの 存在チェックも含む)をid優先のマッチングに変更した。 Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYPA7eobZEejKS4Y3MrRuA
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughgroupIdが同一でもidが異なる駅を区別するため、findNearestStation、useBounds、useTrainTypeModalの現在地特定と比較条件がid基準に変更され、関連テストも更新された。 Changesid基準の現在地特定への変更
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/useBounds.test.tsx`:
- Around line 202-207: The test data in useBounds.test.tsx is manually building
Station objects with a cast, which weakens type safety and consistency. Update
this case to use the shared createStation factory, overriding only the needed id
and groupId values so the stations array stays strongly typed and the `as
unknown as Station[]` cast can be removed. Refer to the test setup around the
stations array and keep the existing station ordering/semantics unchanged.
In `@src/utils/findNearestStation.test.ts`:
- Around line 189-209: The new regression test in findNearestStation should also
cover the OUTBOUND path, since the current case only verifies the INBOUND
branch. Add a symmetric test alongside the existing inner/outer/groupId
collision scenario using the same createStation setup and findNearestStation
call, but pass direction as OUTBOUND and assert the expected nearest station
result there as well. This will validate both branches of the findNearestStation
logic and guard against regressions in the OUTBOUND-specific flow.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: 4df4ad53-2b1b-4c18-bb38-9978e82213eb
📒 Files selected for processing (5)
src/hooks/useBounds.test.tsxsrc/hooks/useBounds.tssrc/hooks/useTrainTypeModal.tssrc/utils/findNearestStation.test.tssrc/utils/findNearestStation.ts
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYPA7eobZEejKS4Y3MrRuA
This was referenced Jul 4, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
大江戸線の都庁前(外回り/内回り)のように
groupIdは同一だがidは別々に採番されている駅について、groupIdだけで駅配列内の現在地インデックスを特定していた箇所をid優先のマッチングに修正しました。groupIdベースのfindIndexは常に配列中で先に見つかる方(必ずしも実際の現在地と同じ出現ではない)に固定されてしまうため、行き先表示の区間切り出しや列車種別変更時の現在地補正が誤った位置を基準に行われる不具合がありました。変更の種類
変更内容
useBounds.ts: 大江戸線の行き先/経由駅表示区間を切り出すためのstationIndexを、groupId一致からid一致に変更findNearestStation.ts: 列車種別変更時に現在駅が新しい駅リストに存在しない場合の位置探索をidベースに変更(シグネチャもcurrentGroupIdからcurrentStationIdに変更)useTrainTypeModal.ts: 上記シグネチャ変更に伴う呼び出し元の更新。あわせて、現在駅が新しい駅リストに存在するかの判定(currentInNewList)もid一致に変更(groupId一致だと無関係な出現を現在駅と誤認し、位置補正がスキップされてしまうため)useBounds.test.tsx/findNearestStation.test.ts:groupIdが同一でidが異なる駅(都庁前の外回り/内回り相当)がある場合に、正しい方の出現を基準に位置特定できることを検証するリグレッションテストを追加テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Generated by Claude Code
Summary by CodeRabbit