Skip to content

connectedRoutesの区間に通過駅を含む駅グループIDの並びを追加 - #1690

Merged
TinyKitten merged 1 commit into
devfrom
feature/route-leg-station-group-ids
Sep 22, 2026
Merged

TinyKitten merged 1 commit into
devfrom
feature/route-leg-station-group-ids

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

概要

connectedRoutes の RouteLeg に stationGroupIds: [Int!] を追加しました。乗車駅から降車駅までの駅グループ ID を進行順に並べたもので、通過駅も含みます。探索結果 (JourneyLeg.station_group_ids) をそのまま返します。

アプリはこの並びに沿って、区間ごとに選んだ種別(既定は各停)の駅リストから駅を拾います。これでアプリ側の弧の選び方(LOOP_LINE_IDS と駅数の比較)が要らなくなります。

変更の種類

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

変更内容

  • schema/public.graphql / src/graphql/types.rs: RouteLeg.stationGroupIds: [Int!] を追加(フィールドの追加だけなので、既存クライアントに影響はありません)
  • stationapi/src/model.rs: model::RouteLeg に station_group_ids: Vec<u32> を追加
  • stationapi/src/use_case/interactor/query.rs: get_connected_routes で探索結果の並びを渡すようにした(追加の引き当ては無く、計算量は変わりません)
  • src/repository.rs: 実データのテストを追加。各区間の並びが 2 駅以上あり、先頭が fromStation.groupId、末尾が toStation.groupId と一致することを確かめます
  • docs/architecture.md / AGENTS.md: 駅 ID ではなく駅グループ ID にした理由(アプリが選ぶ種別は、探索で使った系統とは別の路線を走ることがある)と、同じ駅グループが 2 回出る系統(大江戸線の都庁前)の扱いを追記

駅 ID は路線ごとに違いますが、駅グループ ID ならどの種別の駅リストとも突き合わせられます。同じ駅グループが 2 回出る系統では、直前に拾った駅に隣り合うほうを選んでもらう前提です。

テスト

  • make fmt が通ること

  • make clippy が通ること(wasm32 ターゲットを含む)

  • make test が通ること

  • make clippy: 新しい警告はありません(出ているのは generated/ が無いときの build.rs の案内だけ)

  • make test: 全件成功(stationapi 422 件、stationapi-worker 19 件ほか)

  • ローカルは generated/ が無く data/*.csv にフォールバックした状態で確かめました。make schema(起動した Worker の SDL との差分)は CI に任せています

関連Issue

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

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 新機能
    • connectedRoutes の各区間で、乗車駅から降車駅までの駅グループID一覧を取得できるようになりました。
    • 一覧には通過駅が進行順で含まれ、列車種別に対応する駅リストとの照合や、環状線での経路選択に利用できます。
  • ドキュメント
    • 駅グループID一覧の仕様と、同一駅グループが複数回現れる場合の扱いを追記しました。

@TinyKitten TinyKitten self-assigned this Sep 22, 2026
@github-actions github-actions Bot added feature 要望対応や課題解決 deploy-dev labels Sep 22, 2026
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 100d664e-293b-49bc-a7aa-f7a116a0bf5f

📥 Commits

Reviewing files that changed from the base of the PR and between 98fb18b and 65a0ca7.

📒 Files selected for processing (7)
  • AGENTS.md
  • docs/architecture.md
  • schema/public.graphql
  • src/graphql/types.rs
  • src/repository.rs
  • stationapi/src/model.rs
  • stationapi/src/use_case/interactor/query.rs

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


📝 Walkthrough

Walkthrough

RouteLegに駅グループID列を追加しました。経路探索結果からGraphQLのstationGroupIdsまで値を伝播し、順序と両端の駅グループを検証します。

Changes

駅グループ経路情報

Layer / File(s) Summary
RouteLegへの駅グループID設定
stationapi/src/model.rs, stationapi/src/use_case/interactor/query.rs
RouteLegが通過駅を含むstation_group_idsを保持します。経路探索結果の値を設定します。
GraphQL公開と検証
schema/public.graphql, src/graphql/types.rs, src/repository.rs, docs/architecture.md, AGENTS.md
GraphQLにstationGroupIdsを追加します。値をi32へ変換します。先頭と末尾が乗車駅・降車駅の駅グループと一致することを検証します。仕様文書を更新します。

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant RouteQuery
  participant JourneyLeg
  participant RouteLeg
  participant GraphQL
  RouteQuery->>JourneyLeg: station_group_idsを取得
  JourneyLeg->>RouteLeg: station_group_idsを設定
  RouteLeg->>GraphQL: stationGroupIdsへ変換
Loading

Merge Risk: ⚪ Minimal · up to 65a0c

この変更は経路区間に駅グループ列を追加するもので、既存クライアントへの影響はなく、マージ可能です。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは、connectedRoutes の RouteLeg に通過駅を含む駅グループIDの並びを追加する主要変更を具体的に示しています。
Description check ✅ Passed 概要、変更の種類、変更内容、テスト、関連Issue、スクリーンショットの各セクションがあります。変更内容とテスト結果も具体的です。関連Issueとスクリーンショットは任意項目のため、未記入でも問題ありません。
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


うさぎは駅グループを数える
通過駅の列をそっと運ぶ
ループでは同じ駅も残る
GraphQLへ順序を渡す
にんじん列車が走り出す

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy-dev feature 要望対応や課題解決 graphql rust

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant