Conversation
- ScanDataServiceにsaveAnalysisCommentメソッドを追加
- QRスキャン画面で分析後に自動的にFirestoreへ保存
- 既存の分析結果がある場合は初期表示
- 再分析ボタンで最新の分析結果に更新可能
- users/{userId}/meishies/{friendUserId}コレクションに保存
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThe changes introduce analysis comment persistence functionality by adding a new Changes
Sequence DiagramsequenceDiagram
actor User
participant UI as Scan View
participant Service as ScanDataService
participant Firebase as Firebase<br/>(Firestore + Auth)
User->>UI: Load scan data
UI->>Firebase: Get current user ID
Firebase-->>UI: User ID
UI->>Service: getAnalysisComment(currentUserId,<br/>friendUserId)
Service->>Firebase: Query analysis comment
Firebase-->>Service: Comment data
Service-->>UI: Existing comment
UI->>UI: Display comment (if exists)
User->>UI: Trigger AI analysis
UI->>UI: Show loading indicator
UI->>Service: Perform analysis
Service-->>UI: Analysis comment result
UI->>Service: saveAnalysisComment(currentUserId,<br/>friendUserId, comment)
Service->>Firebase: Persist comment & timestamp
Firebase-->>Service: Success
Service-->>UI: Saved
UI->>UI: Update UI with new comment
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Visit the preview URL for this PR (updated for commit 83b13eb): https://animeishi-73560--pr165-vk-6022-gemini-db-15-19ppdxj3.web.app (expires Wed, 04 Feb 2026 14:56:44 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f1f494a67df8ccbb2232f73b6ccab4934a51e505 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@lib/ui/camera/services/scan_data_service.dart`:
- Around line 154-174: The success log in saveAnalysisComment currently prints
raw user IDs (currentUserId and friendUserId); remove those identifiers from
logs to avoid exposing PII—update the print('analysisComment保存成功: $currentUserId
-> $friendUserId') to a non-identifying message (e.g., 'analysisComment保存成功') or
log a masked identifier if needed, and ensure no other places in
saveAnalysisComment output raw IDs.
In `@lib/ui/camera/view/scandata.dart`:
- Around line 113-121: The Firestore persistence call to
ScanDataService.saveAnalysisComment is allowed to throw and bubble up, masking a
successful analysis; wrap that call in its own try-catch so persistence errors
are swallowed/logged without altering the outer flow. Locate the block that
checks currentUserId and calls ScanDataService.saveAnalysisComment (the
currentUserId variable and ScanDataService.saveAnalysisComment call) and change
it to call saveAnalysisComment inside a new try { await
ScanDataService.saveAnalysisComment(...) } catch (e, st) { log the error via
your logger or FirebaseCrashlytics but do not rethrow } so the generated comment
is preserved even when saving fails.
- Around line 64-75: The code calls setState() after awaiting async work (e.g.,
after ScanDataService.getAnalysisComment) which can throw "setState() called
after dispose"; add a mounted guard before calling setState — for example, after
the await that retrieves savedComment check if (!mounted) return; then call
setState(() { analysisComment = savedComment; });; apply the same pattern to
other post-await setState() calls in this class (including in _runAnalysis()) to
avoid updating state on disposed widgets.
- ユーザーIDのログ出力を削除してプライバシーを保護 - 非同期処理後のsetState()にmountedチェックを追加 - saveAnalysisCommentのエラーを分離して分析結果を保護
GitHub issue #159: Geminiによる分析情報をデータベースに保存する機能を実装
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.