バス路線でGetStationsByLineIdが0件になる問題を種別なし駅一覧へのフォールバックで修正 - #1622
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LM9j6JJciEV1jmhLTt7Hod
Contributor
📝 WalkthroughWalkthrough
Changes駅一覧取得フォールバック
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GetStationsByLineId
participant get_by_line_id_with_train_type
participant get_by_line_id_without_train_types
GetStationsByLineId->>get_by_line_id_with_train_type: 列車種別付き駅一覧を要求
get_by_line_id_with_train_type->>get_by_line_id_without_train_types: 結果が空の場合にフォールバック
get_by_line_id_without_train_types-->>GetStationsByLineId: 種別なし駅一覧を返却
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LM9j6JJciEV1jmhLTt7Hod
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.
概要
バス路線で
GetStationsByLineIdが常に0件を返し、アプリでバス停一覧が全く表示されなくなっていた問題を修正します。#1614「列車種別なしの経路分岐を削除」で、種別を持たない駅向けのフォールバック(
get_by_line_id_without_train_types)が削除され、get_by_line_id_with_train_typeに一本化されました。しかし統合後のクエリのtarget_line_groupCTE はt.kind IN (0,1) OR t.priority > 0で種別グループを選択するため、BusRoute(kind=7・priority=0)しか種別を持たないバス路線ではグループが一切マッチせず、常に空の結果を返していました。#1612 の各停種別の起動時補完はtransport_type = 0(鉄道)限定のため、バス停は補完対象外です。変更の種類
変更内容
get_by_line_id_with_train_typeで種別グループベースのクエリが0件だった場合に、種別なしの駅一覧クエリへフォールバックするように変更(列車種別なしの経路分岐を削除 #1614 で削除されたget_by_line_id_without_train_typesを復元)station_id未指定 /direction_idによる並び順反転の4ケース)GetStationsByLineIdのフォールバック挙動を追記テスト
cargo fmt --all -- --checkが通ることcargo clippy -- -D warningsが通ること(SQLX_OFFLINE=true)cargo test(SQLX_OFFLINE=true)が通ること(427 + 41 件パス)追加の統合テストはローカルの PostgreSQL 16 に対して
TEST_DATABASE_URL=... cargo test --lib --package stationapi --features integration-tests test_get_by_line_id_with_train_type_falls_back_for_bus_linesで実行し、パスを確認済みです。なおline_repository/train_type_repositoryの既存統合テスト27件はベースコミット(5c82996)でも同様に失敗するローカル環境依存の問題で、本変更とは無関係です(CI ではintegration-testsfeature が無効のため実行されません)。関連Issue
スクリーンショット(任意)
🤖 Generated with Claude Code
https://claude.ai/code/session_01LM9j6JJciEV1jmhLTt7Hod