GetTrainRouteのline_group_idをprotoどおりoptional扱いにし未指定時は路線の駅列にフォールバック - #1586
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
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 (3)
📝 WalkthroughWalkthroughget_train_route の line_group_id 引数が u32 から Option に変更された。トレイト、ユースケース実装、gRPC ハンドラ、テストモックが更新され、line_group_id 未指定時は from_station_id の line_cd を用いて駅列を構築する分岐が追加された。NotFound エラーの entity_type 文言も変更された。 Changesline_group_id の Optional 化
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant GrpcHandler
participant QueryInteractor
Client->>GrpcHandler: get_train_route(line_group_id: Option<u32>)
GrpcHandler->>QueryInteractor: get_train_route(from, to, line_group_id)
alt line_group_id が Some
QueryInteractor->>QueryInteractor: get_stations_by_line_group_id
else line_group_id が None
QueryInteractor->>QueryInteractor: from駅取得 -> line_cdでget_stations_by_line_id
end
QueryInteractor-->>GrpcHandler: 駅列
GrpcHandler-->>Client: レスポンス
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
10 tasks
10 tasks
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.
概要
GetTrainRouteRequest.line_group_idは proto でoptionalと定義されているにもかかわらず、実装が未指定時にINVALID_ARGUMENT (line_group_id is required)を返していた乖離を解消する。変更の種類
変更内容
line_group_id is requiredガードを削除し、Option<u32>のまま use case へ渡すように変更get_train_route(trait / interactor / モック)のシグネチャをline_group_id: Option<u32>に変更line_group_id未指定時は from 駅の所属路線(line_cd)の駅列にフォールバックし、種別なし(各駅停車・単一路線走行)の経路を返す。指定時は従来どおり line_group ベースの経路station in routeに変更テスト
cargo fmt --all -- --checkが通ることcargo clippy -- -D warningsが通ることcargo test(SQLX_OFFLINE=true)が通ること上記に加え、ローカルDBに対して実機確認済み:
line_group_idなし(山手線 大崎→渋谷)で segments が正常返却、line_group_idあり(363)で従来どおり返却されることを grpcurl で確認。関連Issue
スクリーンショット(任意)
Summary by CodeRabbit