Skip to content

オートモードが通過駅を迂回するバグを修正&オートモードv1の完全廃止 - #5274

Merged
TinyKitten merged 3 commits into
devfrom
fix/automode
Feb 13, 2026
Merged

TinyKitten merged 3 commits into
devfrom
fix/automode

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Feb 13, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • 距離ベースのウェイポイント選択によりナビゲーション精度を向上しました。
  • Refactor

    • レガシー自動モード関連の設定・定数・フラグ・フック呼び出しを削除し、自動モードは単一フラグで統一しました。
    • 表示・ラベルや送信されるレポートの自動モード表現を簡素化しました。
    • 自動モードの自動起動処理を削除しました。
  • Tests

    • レガシー自動モードに依存するテストを削除・整理しました。

@coderabbitai

coderabbitai Bot commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

レガシー自動モードフラグ enableLegacyAutoMode をコードベースから削除し、autoModeEnabled に統合。useAutoMode フックとそのテストを削除、フィードバック側ラベルを簡素化、useSimulationMode にウェイポイントベースの進行ロジックを追加しています。

Changes

Cohort / File(s) Summary
データ型: Report の更新
functions/src/models/feedback.ts, src/models/Report.ts
Report 型から enableLegacyAutoMode を削除。報告ペイロードのフィールド数が減少。
フィードバックワーカーの簡素化
functions/src/workers/feedback.ts
AUTOMODE_V1/AUTOMODE_V2 を削除し AUTOMODE_ENABLED を導入。enableLegacyAutoMode の参照を除去し、GitHubラベル/本文生成を単純化。
永続化キー・定数削除
src/constants/asyncStorage.ts, src/constants/threshold.ts
LEGACY_AUTO_MODE_ENABLED と AUTO_MODE_* 関連定数を削除。関連する定数定義が除去。
useAutoMode フック削除と公開面変更
src/hooks/index.ts, src/hooks/useAutoMode.ts, src/hooks/useAutoMode.test.tsx
useAutoMode のエクスポート除去、実装と対応テストを削除。古い自動モード実装を撤去。
画面・設定周りのクリーンアップ
src/screens/Main.tsx, src/components/Permitted.tsx, src/store/atoms/navigation.ts
useAutoMode() 呼び出しを削除。NavigationState と初期 state から enableLegacyAutoMode を削除し、初期設定読み込みでの取得を除去。
フック内ペイロード・テスト修正
src/hooks/useFeedback.ts, src/hooks/useOpenRouteFromLink.test.tsx, src/hooks/useSimulationMode.test.tsx
enableLegacyAutoMode 参照を削除し、レポート送信ペイロードとテストモック・依存配列を調整。
シミュレーションモードの改良
src/hooks/useSimulationMode.ts
ウェイポイントベースの進行ロジック追加(segmentProgressDistanceRef、距離計算、targetWaypoint 選択、bearing 計算)。有効判定を autoModeEnabled のみに簡略化。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 古い旗をそっと置き、ぴょんと跳ぶ。
一つに揃った道で風を切る。
ウェイポイントを辿る軽やかな足取り、
コードの草原を跳ねる一歩一歩。
さあ、新しい列車に乗って行こう。 🚆✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、変更セットの主要な目的を明確に表現しています。「オートモードが通過駅を迂回するバグを修正&オートモードv1の完全廃止」は、バグ修正とレガシー機能廃止の2つの重要な変更を正確に反映しています。
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into dev

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/automode

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/hooks/useSimulationMode.ts (1)

85-87: useMemo が不要になっています。

autoModeEnabled をそのまま返すだけのため、useMemo のオーバーヘッドは不要です。

♻️ 簡素化の提案
-  const enabled = useMemo(() => {
-    return autoModeEnabled;
-  }, [autoModeEnabled]);
+  const enabled = autoModeEnabled;

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/hooks/useSimulationMode.ts (1)

190-243: ⚠️ Potential issue | 🟠 Major

無効な segmentIndexRef でウェイポイント空配列になり自動進行が停止し得ます。

駅リスト更新(方面/路線切替など)で segmentIndexRef.current が範囲外になると currentSegmentStationIndex === -1 となり、waypoints が空のまま step が早期 return し続けます。ここはインデックス不正時にリセット/クランプするガードを入れておくのが安全です。

修正案(インデックス不正時にリセット)
       const currentSegmentStation =
         maybeRevsersedStations[segmentIndexRef.current];
       const currentSegmentStationIndex = maybeRevsersedStations.findIndex(
         (s) => s.id === currentSegmentStation?.id
       );
+      if (currentSegmentStationIndex === -1) {
+        segmentIndexRef.current = 0;
+        childIndexRef.current = 0;
+        segmentProgressDistanceRef.current = 0;
+        return;
+      }
@@
       const nextStopStationIndex = maybeRevsersedStations.findIndex(
         (s) => s.id === nextStopStation.id
       );
+      if (nextStopStationIndex === -1) {
+        segmentIndexRef.current = 0;
+        childIndexRef.current = 0;
+        segmentProgressDistanceRef.current = 0;
+        return;
+      }

@TinyKitten
TinyKitten merged commit 7b425a7 into dev Feb 13, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the fix/automode branch February 13, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant