Skip to content

ディープリンク sids 形式で skips パラメータによる通過駅指定を追加#6012

Merged
TinyKitten merged 1 commit into
devfrom
feature/sids-skips-stop-condition
May 17, 2026
Merged

ディープリンク sids 形式で skips パラメータによる通過駅指定を追加#6012
TinyKitten merged 1 commit into
devfrom
feature/sids-skips-stop-condition

Conversation

@TinyKitten
Copy link
Copy Markdown
Member

@TinyKitten TinyKitten commented May 17, 2026

概要

#6005 案 A の実装。sids ディープリンクと並行する新パラメータ skips を追加し、0-origin インデックスで指定した駅の stopConditionStopCondition.Not(通過扱い)に上書きできるようにする。

URL 例:

TrainLCD://route?sids=1131211,1131310,2800217,2800218&skips=1,2

上記では sids[1]sids[2] が通過扱いになり、それ以外は停車扱いとなる。

変更の種類

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

変更内容

  • useDeepLink.handleUrlskips クエリパラメータをパースし、整数・厳密昇順・範囲内(重複なし)を検証する。
  • useDeepLink.openRouteByStationIdsskipIndices: ReadonlySet<number> | null を追加し、要求した stationIds の 0-origin インデックスに対応する駅の stopConditionStopCondition.Not に上書きする。
  • インデックスは「要求した stationIds」基準で解釈する。サーバが一部の駅を返さず除外しても、残った駅の skip 位置はずれない。
  • 不正値(非整数 / 範囲外 / 重複 / 非昇順)はリンク全体を no-op して受信側が部分的に誤解釈した経路を表示しないようにする。
  • skips 省略時は #6002 と完全に同一の挙動(全駅停車)。
  • ユニットテストを追加: 上書きされること、省略時は変化しないこと、欠落駅があってもインデックスがずれないこと、不正値ケース 10 種で no-op になることを検証。

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

関連Issue

Closes #6005

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

Summary by CodeRabbit

リリースノート

  • New Features
    • ディープリンクで特定の駅をスキップする機能を追加しました。skipsパラメータにより、経路設定時に駅の通過条件を指定できるようになりました。
    • 無効な入力(範囲外の指数、不正な形式)は自動的に無視されます。

Review Change Stack

@TinyKitten TinyKitten self-assigned this May 17, 2026
@github-actions github-actions Bot added the react label May 17, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: adf04f38-258e-4367-92ac-5ec5a9caab32

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1fd86 and 1098a30.

📒 Files selected for processing (2)
  • src/hooks/useDeepLink.test.tsx
  • src/hooks/useDeepLink.ts

📝 Walkthrough

Walkthrough

ディープリンク sids 形式で通過駅を表現する skips パラメータ対応を実装。sids で指定された駅のうち、skipIndices に含まれるインデックスの駅について stopCondition を StopCondition.Not に上書きする。クエリ解析で skips を検証し、不正値時はリンク全体を no-op とする。テストで停車・通過上書きと入力検証を確認。

Changes

skips パラメータによる通過駅指定機能

Layer / File(s) Summary
実装基盤:StopCondition インポートと関数シグネチャ更新
src/hooks/useDeepLink.ts
StopCondition を値としてインポート。openRouteByStationIds に skipIndices パラメータを追加し、stationIds の並びを保ったまま skipIndices に含まれるインデックスの駅について stopCondition を StopCondition.Not に上書きするマッピング処理を実装。
クエリ解析と skips パラメータ検証
src/hooks/useDeepLink.ts
handleUrl で skips をクエリから抽出。整数インデックスの集合として解釈し、非整数・範囲外・重複・非昇順を検出。不正値時はリンク処理を中断、妥当時は skipIndices を openRouteByStationIds に渡す。
skips パラメータのテスト検証
src/hooks/useDeepLink.test.tsx
テストインポート更新。describe('skips parameter') で sids/skips の停車・通過上書き、未指定・空文字・先頭指定時のデフォルト維持、サーバ部分返却時の index 整合、範囲外・不正トークン時の no-op 動作を検証。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • TrainLCD/MobileApp#6003: sids 経路復元ロジック(openRouteByStationIds と handleUrl の sids 分岐)をベースに、本 PR が skipIndices パラメータ追加と stopCondition 上書き、入力検証を実装しています。
  • TrainLCD/MobileApp#6009: 同じく useDeepLink.ts の sids ルートを変更するため、openRouteByStationIds シグネチャと station マッピングロジックでコード競合の可能性があります。
  • TrainLCD/MobileApp#6007: useDeepLink.ts の handleUrl クエリ解析で不正入力を no-op にするパターンを確立しており、本 PR の skips 検証実装と同一フローを共有します。

Suggested labels

react

Poem

🐰 ディープリンク、通過駅も表現できて
skips のインデックス、短く美しく
stopCondition 上書き、validation 厳格
経路再現、今度こそ完全だ!
URL 輝く、楽ウサ♨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PRタイトルは変更内容を正確かつ簡潔に反映しており、sids形式のディープリンクに新しいskipsパラメータを追加する主要な変更を明確に示している。
Description check ✅ Passed PR説明は必須セクション(概要・変更の種類・変更内容・テスト・関連Issue)すべてを含み、実装の詳細と検証方法が十分に記述されている。
Linked Issues check ✅ Passed コード変更は#6005の受け入れ条件をすべて満たしている。案Aのskipsパラメータにより、指定されたインデックスの駅のstopConditionStopCondition.Notに上書きし、不正値時はno-op、省略時は全駅停車となる。
Out of Scope Changes check ✅ Passed すべての変更は#6005で要求されたskipsパラメータの実装に関連しており、スコープ外の変更は認められない。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/sids-skips-stop-condition

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

@TinyKitten TinyKitten merged commit 1c4e622 into dev May 17, 2026
7 checks passed
@TinyKitten TinyKitten deleted the feature/sids-skips-stop-condition branch May 17, 2026 01:23
@TinyKitten TinyKitten mentioned this pull request May 17, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ディープリンク sids 形式で通過駅を表現できるようにする

1 participant