Repository navigation
DevOverlayの精度チャートとm表示の配色を最大許容精度に応じて調整 - #6113
Conversation
📝 WalkthroughWalkthrough位置精度(LOCATION ACCURACY)の表示色を、 Changes位置精度表示の色分け仕様更新
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/utils/accuracyChart.test.ts (1)
3-195:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
afterEachでjest.clearAllMocks()を追加してください。このファイルにも
afterEach(() => { jest.clearAllMocks(); })を入れて、テスト間のモック状態汚染を確実に防いでください。As per coding guidelines
**/*.test.{ts,tsx}: テストのafterEachでjest.clearAllMocks()を呼び出してください。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/utils/accuracyChart.test.ts` around lines 3 - 195, Add an afterEach hook calling jest.clearAllMocks() to this test suite to prevent mock state leakage; specifically, inside the describe('generateAccuracyChart', ...) block (near the top of the file where the tests are declared and alongside other lifecycle hooks), insert afterEach(() => { jest.clearAllMocks(); }) so every test of generateAccuracyChart runs with cleared mocks.
🧹 Nitpick comments (1)
src/utils/accuracyChart.test.ts (1)
158-175: ⚡ Quick win閾値のマジックナンバーは定数参照に寄せてください。
200/1500/1501をBAD_ACCURACY_THRESHOLDとMAX_PERMIT_ACCURACY参照に置き換えると、将来の閾値変更時にテストの追従漏れを防げます。差分案
import { generateAccuracyChart } from './accuracyChart'; +import { MAX_PERMIT_ACCURACY } from '../constants/location'; +import { BAD_ACCURACY_THRESHOLD } from '../constants/threshold'; @@ - it('should use red color for accuracy > MAX_PERMIT_ACCURACY', () => { - const result = generateAccuracyChart([1501, 2000, 3000]); + it('should use red color for accuracy > MAX_PERMIT_ACCURACY', () => { + const result = generateAccuracyChart([ + MAX_PERMIT_ACCURACY + 1, + MAX_PERMIT_ACCURACY + 500, + MAX_PERMIT_ACCURACY + 1500, + ]); @@ - const result = generateAccuracyChart([200, 750, 1500]); + const result = generateAccuracyChart([ + BAD_ACCURACY_THRESHOLD, + 750, + MAX_PERMIT_ACCURACY, + ]); @@ - const result = generateAccuracyChart([10, 100, 199]); + const result = generateAccuracyChart([ + 10, + 100, + BAD_ACCURACY_THRESHOLD - 1, + ]);Also applies to: 184-192
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/utils/accuracyChart.test.ts` around lines 158 - 175, Replace magic numbers in the accuracyChart tests with the threshold constants: update the test cases that call generateAccuracyChart to use BAD_ACCURACY_THRESHOLD and MAX_PERMIT_ACCURACY (and expressions based on them, e.g., BAD_ACCURACY_THRESHOLD - 1, BAD_ACCURACY_THRESHOLD, MAX_PERMIT_ACCURACY, MAX_PERMIT_ACCURACY + 1) instead of hard-coded 200/1500/1501 so the tests reference the constants directly and follow future threshold changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/utils/accuracyChart.test.ts`:
- Around line 3-195: Add an afterEach hook calling jest.clearAllMocks() to this
test suite to prevent mock state leakage; specifically, inside the
describe('generateAccuracyChart', ...) block (near the top of the file where the
tests are declared and alongside other lifecycle hooks), insert afterEach(() =>
{ jest.clearAllMocks(); }) so every test of generateAccuracyChart runs with
cleared mocks.
---
Nitpick comments:
In `@src/utils/accuracyChart.test.ts`:
- Around line 158-175: Replace magic numbers in the accuracyChart tests with the
threshold constants: update the test cases that call generateAccuracyChart to
use BAD_ACCURACY_THRESHOLD and MAX_PERMIT_ACCURACY (and expressions based on
them, e.g., BAD_ACCURACY_THRESHOLD - 1, BAD_ACCURACY_THRESHOLD,
MAX_PERMIT_ACCURACY, MAX_PERMIT_ACCURACY + 1) instead of hard-coded
200/1500/1501 so the tests reference the constants directly and follow future
threshold changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7f9dff97-3cc5-498e-a2c0-9ff6497d7106
📒 Files selected for processing (4)
src/components/DevOverlay.test.tsxsrc/components/DevOverlay.tsxsrc/utils/accuracyChart.test.tssrc/utils/accuracyChart.ts
概要
DevOverlay の測位精度ビジュアライズの配色を見直し、「最大許容精度(
MAX_PERMIT_ACCURACY= 1500m)を超えると赤」になるよう統一しました。あわせて、精度チャートが黄色になる精度域では LOCATION ACCURACY の m 表示も黄字にして、数値とチャートの双方で精度悪化を示します。変更の種類
変更内容
src/utils/accuracyChart.ts)の赤色判定をBAD_ACCURACY_THRESHOLD(200m) 以上から、最大許容精度MAX_PERMIT_ACCURACY(1500m) 超過に変更し、メトリクスカードのisAccuracyOverLimit警告と整合させた。BAD_ACCURACY_THRESHOLD(200m) 以上・MAX_PERMIT_ACCURACY(1500m) 以下)を黄色に変更。src/components/DevOverlay.tsxの LOCATION ACCURACY の m 表示を、チャートが黄色になる精度域では黄字(#facc15)、許容精度を超えた場合は従来どおり赤字(#f87171)で表示するよう調整。accuracyChart.test.tsの色判定テストを更新し、DevOverlay.test.tsxに黄字表示・赤字優先・閾値未満は黄字にしないケースを追加。テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Generated by Claude Code
Summary by CodeRabbit
リリースノート
新機能
改善