Repository navigation
地下鉄でも精度安定時はスムージングを適用する - #5670
Conversation
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 Walkthroughウォークスルー位置情報ストアのテストスイートを追加し、地下鉄路線での位置スムージング判定を「精度履歴の安定性」に基づく条件付きに変更。テストは各種安定性/閾値ケースと非地下鉄でのスムージング適用を検証する。 変更内容
推定レビュー難度🎯 3 (中程度) | ⏱️ ~20 分 関連する可能性のあるPR
詩
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/store/atoms/location.test.ts (1)
109-120: 200m境界(>=)を直接検証するケースを追加するとより堅牢です。現状は平均250mでの確認なので、仕様境界の平均ちょうど200mケースも1本あると回帰を防ぎやすいです。
✅ 追加例(境界200m)
+ it('平均精度がちょうど200mでもスムージングをスキップする', () => { + setStationLineType(LineType.Subway); + // 平均200m、CVは低い + store.set(accuracyHistoryAtom, [190, 200, 210, 200]); + + const loc = makeLocation(35.0, 139.0, 200, 1000); + setLocation(loc); + + const result = store.get(locationAtom); + expect(result?.coords.latitude).toBe(35.0); + expect(result?.coords.longitude).toBe(139.0); + });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/store/atoms/location.test.ts` around lines 109 - 120, Add a new unit test that covers the 200m boundary by setting accuracyHistoryAtom to values whose average is exactly 200 (e.g., [200,200,200,200] or mix that averages to 200), then call setStationLineType(LineType.Subway), setLocation(makeLocation(..., accuracy=200, ...)) and assert locationAtom returns the raw coords (same as the existing test expectations); place this alongside the existing test so the smoothing skip behavior for average >= 200 is explicitly verified.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/store/atoms/location.test.ts`:
- Around line 41-45: The tests leave lastFilteredLocationAtom state between
cases—add a test-only reset helper in the location module (e.g., export function
resetLocationTestState() or similar) that clears lastFilteredLocationAtom and
any other module-scoped state used by setLocation, then call that helper from
the test beforeEach alongside the existing store.set(locationAtom, null),
store.set(accuracyHistoryAtom, []), and setStationLineType(null); update
references to lastFilteredLocationAtom and setLocation in location.ts to ensure
the helper resets the same internal symbols the logic uses.
---
Nitpick comments:
In `@src/store/atoms/location.test.ts`:
- Around line 109-120: Add a new unit test that covers the 200m boundary by
setting accuracyHistoryAtom to values whose average is exactly 200 (e.g.,
[200,200,200,200] or mix that averages to 200), then call
setStationLineType(LineType.Subway), setLocation(makeLocation(..., accuracy=200,
...)) and assert locationAtom returns the raw coords (same as the existing test
expectations); place this alongside the existing test so the smoothing skip
behavior for average >= 200 is explicitly verified.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fff9233b-e386-4d86-8499-dbf6ebee26aa
📒 Files selected for processing (2)
src/store/atoms/location.test.tssrc/store/atoms/location.ts
Summary
LineType.Subway)で無条件にスムージングをスキップしていた処理を、精度の安定性を判定した上で制御するように変更変更内容
src/store/atoms/location.ts:isAccuracyStable()関数を追加し、skipSmoothingの条件をSubway && !isAccuracyStable(history)に変更src/store/atoms/location.test.ts: 新規テスト5件(非地下鉄、地下鉄+不安定、地下鉄+安定、サンプル不足、安定だが高精度)安定性判定の仕様
MIN_STABILITY_SAMPLESMAX_STABLE_CVBAD_ACCURACY_THRESHOLDリグレッションリスク
LineType.Subwayチェックで短絡評価されるため影響なしローカル実行コマンド
Test plan
https://claude.ai/code/session_0136uqgSRjobn4E4trATATDX
Summary by CodeRabbit
概要