Repository navigation
EstimateArrivalTimesの結果を始点から終点までの区間に絞り込む - #1575
Conversation
group_stopsのfrom/to位置を検出しても範囲でスライスしておらず、 経路上の全駅を返していたバグを修正
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughestimate_route_arrival_times の推定対象が、group_stops 全体から from/to の両端を含む区間に限定された。from_pos/to_pos の確認と同一駅の除外が追加され、順方向・逆方向ともに from→to 順で推定するよう変更された。対応テストも追加された。 Changes区間限定ロジックとテスト
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review Generated by Claude Code |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
stationapi/src/use_case/interactor/query.rs (1)
2413-2429: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
station_cdとstation_g_cdを分けたデータで検証してください。実装は
station_cdで端点を探していますが、このテストデータはstation_cd == station_g_cdなので、ID種別の取り違えを検出できません。station_cdを 102/103/104、station_g_cdを 2/3/4 のように分け、呼び出しはstation_cd、返却順の検証はstation_g_cdのままにすると回帰検出力が上がります。Also applies to: 2445-2463
🤖 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 `@stationapi/src/use_case/interactor/query.rs` around lines 2413 - 2429, The route arrival time test currently uses identical values for station_cd and station_g_cd, so it cannot catch ID mixups in the lookup logic. Update the affected test cases around estimate_route_arrival_times and build_interactor to use distinct station_cd values for the endpoints (for example 102/103/104) while keeping station_g_cd as the returned sequence IDs (for example 2/3/4), and keep the call site using station_cd with the assertions still checking station_g_cd.
🤖 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.
Nitpick comments:
In `@stationapi/src/use_case/interactor/query.rs`:
- Around line 2413-2429: The route arrival time test currently uses identical
values for station_cd and station_g_cd, so it cannot catch ID mixups in the
lookup logic. Update the affected test cases around estimate_route_arrival_times
and build_interactor to use distinct station_cd values for the endpoints (for
example 102/103/104) while keeping station_g_cd as the returned sequence IDs
(for example 2/3/4), and keep the call site using station_cd with the assertions
still checking station_g_cd.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6331a5ef-37ce-4eaf-b5b7-9fac8ba8a7ef
📒 Files selected for processing (3)
.sqlx/query-6c3b77baaf7b51c4986b8d2a4cfb3f94275ee3595d31aa43938cc1bbd43f0268.json.sqlx/query-c153bbe0cade8f513aeef1475527327a7240e45dd257123047ed4b4618c3c329.jsonstationapi/src/use_case/interactor/query.rs
💤 Files with no reviewable changes (2)
- .sqlx/query-6c3b77baaf7b51c4986b8d2a4cfb3f94275ee3595d31aa43938cc1bbd43f0268.json
- .sqlx/query-c153bbe0cade8f513aeef1475527327a7240e45dd257123047ed4b4618c3c329.json
CodeRabbitの指摘に対応: station_cd=station_g_cdだとlookupロジックの station_cd/station_g_cd混同バグを検出できないため区別する
CodeRabbitのDocstring Coverageチェック(75% < 80%)対応
|
@coderabbitai review |
✅ Action performedReview finished.
|
概要
EstimateArrivalTimes RPC が、
from_station_idからto_station_idまでの区間ではなく、経路(line_group_cd/line_cd)上の全駅の到着時間を返してしまっていたバグを修正しました。変更の種類
変更内容
estimate_route_arrival_times(stationapi/src/use_case/interactor/query.rs)で、経路候補(group_stops)内のfrom_station_id/to_station_idの位置を検出した後、その範囲でスライスせずに経路全体を推定関数に渡していたバグを修正fi,ti)が両方見つかった場合のみ対象とし、fi < tiならそのままスライス、fi > tiなら区間を反転して from→to 順に並べ替えるように統一(direction_idの有無に関わらず一貫して範囲を絞り込む)direction_id指定時に fi > ti となる逆順ケースで、範囲外の駅が除外されつつ from→to 順に反転されることを確認するテストcargo sqlx prepare --workspaceにより不要になったクエリキャッシュ2件を削除テスト
cargo fmt --all -- --checkが通ることcargo clippy -- -D warningsが通ることcargo test(SQLX_OFFLINE=true)が通ること関連Issue
スクリーンショット(任意)
Summary by CodeRabbit