Repository navigation
テレメトリ送信をGraphQLのsendLocation/sendLogEvent mutationへ移行 - #6388
Conversation
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 17 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesTelemetry GraphQL migration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant TelemetryHook as useTelemetrySender
participant Crypto as Crypto.randomUUID
participant GraphQL as GraphQL endpoint
participant Tests as telemetry tests
TelemetryHook->>Crypto: generate and retain sessionId
TelemetryHook->>GraphQL: sendLogEvent or sendLocation with variables.input
GraphQL-->>TelemetryHook: return data, errors, and warning
Tests->>GraphQL: inspect mutation request and response
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/hooks/useTelemetrySender.enabled.test.tsx (1)
18-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win固定UUIDモックではセッションIDの再利用を検証できません。
毎回同じ値が返るため、送信ごとにUUIDを再生成する回帰でもテストが通ります。呼び出しごとに異なる値を返し、ログと位置情報のID一致、および
randomUUIDの呼び出し回数を検証してください。As per coding guidelines, 「挙動を変更する際は、同じ変更セット内でテストも更新または追加すること」です。
Also applies to: 155-165, 357-377
🤖 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/hooks/useTelemetrySender.enabled.test.tsx` around lines 18 - 20, The fixed randomUUID mock in the telemetry tests cannot detect session ID regeneration. Update the expo-crypto mock in useTelemetrySender tests to return distinct IDs per call, then assert that log and location payloads share the same session ID and verify the expected randomUUID call count across the relevant test cases.Source: Coding guidelines
src/hooks/useTelemetrySender.ts (1)
61-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winGraphQL操作名をリポジトリ規約に合わせてください。
SendLocationとSendLogEventを、例えばTelemetrySendLocationQuery、TelemetrySendLogEventQueryのような規約準拠名へ変更してください。As per coding guidelines, 「GraphQL 操作名は
FeatureVerbQuery形式にすること」です。Also applies to: 112-118
🤖 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/hooks/useTelemetrySender.ts` around lines 61 - 68, GraphQL operation names in the telemetry mutations violate the repository’s naming convention. Rename the operations in SEND_LOCATION_MUTATION and the corresponding SEND_LOG_EVENT mutation from SendLocation and SendLogEvent to FeatureVerbQuery-style names such as TelemetrySendLocationQuery and TelemetrySendLogEventQuery, updating all references as needed.Source: Coding guidelines
🤖 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.
Inline comments:
In `@src/hooks/useTelemetrySender.ts`:
- Around line 70-82:
SendLocationResponseおよび同ファイル内の対象レスポンススキーマで、data.sendLocation/send*または空でないerrors配列のいずれかを必須にし、空の{}を受理しないようrefine等で検証してください。各safeParse失敗時は黙殺せず、レスポンス内容と解析エラーをconsole.errorへ記録するよう、該当する送信処理も修正してください。
---
Nitpick comments:
In `@src/hooks/useTelemetrySender.enabled.test.tsx`:
- Around line 18-20: The fixed randomUUID mock in the telemetry tests cannot
detect session ID regeneration. Update the expo-crypto mock in
useTelemetrySender tests to return distinct IDs per call, then assert that log
and location payloads share the same session ID and verify the expected
randomUUID call count across the relevant test cases.
In `@src/hooks/useTelemetrySender.ts`:
- Around line 61-68: GraphQL operation names in the telemetry mutations violate
the repository’s naming convention. Rename the operations in
SEND_LOCATION_MUTATION and the corresponding SEND_LOG_EVENT mutation from
SendLocation and SendLogEvent to FeatureVerbQuery-style names such as
TelemetrySendLocationQuery and TelemetrySendLogEventQuery, updating all
references as needed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f1a955eb-57bf-4381-848a-fa501080682f
📒 Files selected for processing (2)
src/hooks/useTelemetrySender.enabled.test.tsxsrc/hooks/useTelemetrySender.ts
Co-Authored-By: Claude Fable 5 <[email protected]>
Fixes Applied SuccessfullyFixed 1 file(s) based on 1 CodeRabbit feedback item(s). Files modified:
Commit: The latest autofix changes are on the |
概要
実験的テレメトリの送信を、REST API (
/api/location・/api/log) から新テレメトリ基盤の GraphQL mutation (sendLocation・sendLogEvent) へ移行する。既存の駅情報 GraphQL とは別基盤のため、既存の GraphQL クライアントには乗せず従来どおり素の fetch で送信する。変更の種類
変更内容
POST {baseUrl}/api/locationからsendLocationmutation (POST {baseUrl}/graphql) に置き換えPOST {baseUrl}/api/logからsendLogEventmutation に置き換えsessionId(必須): expo-crypto のrandomUUID()で初回送信時に生成し、位置情報・ログの両送信で共有coords.speed: サーバ仕様が km/h のため expo-location の m/s から換算(負値=測位不能は null)batteryState: expo-battery の数値 enum を文字列 enum (unknown/unplugged/charging/full) にマッピングappVersion・platform・channel(sendLogEventの必須項目): expo-application /Platform.OS/isDevAppから取得(useFeedbackと同じ慣習)errors配列で返る形式に合わせてレスポンス処理を変更(実エンドポイントで確認済み)テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Summary by CodeRabbit