Bug fixes : stabilize auth, privacy lock, and insight reports#49
Conversation
- prevent repeated splash screens after authentication
- fix Clerk sign-out crashes and upgrade Clerk Expo
- show privacy cover only in background or recents
- fix report freshness detection and source synchronization
- improve AI report regeneration and retry handling
- bump app version and refine privacy policy content
|
Warning Review limit reached
Next review available in: 9 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR migrates sign-out logic to Clerk's useClerk hook, adds a retry() operation and shared source-snapshot normalization to the AI insight report feature (client and Supabase edge function), refines app-lock AppState handling, gates the launch splash on auth callback routes, edits privacy policy text, and applies minor config/sync fixes. ChangesClerk Authentication Updates
AI Insight Report Retry and Snapshot Sync
App Lock Lifecycle AppState Handling
App Launch Gate Splash Routing
Privacy Policy Text Updates
Misc Config and Sync Guard Fix
Estimated code review effort: 4 (Complex) | ~55 minutes Sequence Diagram(s)sequenceDiagram
participant ReportScreen
participant useAIInsightReport
participant SupabaseFunction
ReportScreen->>useAIInsightReport: onRetry() calls retry()
useAIInsightReport->>useAIInsightReport: check lastFailedOperationRef
alt last failure was regenerate
useAIInsightReport->>SupabaseFunction: requestGeneration(true)
else last failure was generate
useAIInsightReport->>SupabaseFunction: requestGeneration(false)
else no recorded failure
useAIInsightReport->>SupabaseFunction: refresh()
end
SupabaseFunction-->>useAIInsightReport: report result
useAIInsightReport-->>ReportScreen: updated report state
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@app.json`:
- Line 5: The app version was bumped in app.json, but the native build
identifiers were not updated. Update the android.versionCode and set
ios.buildNumber in the app configuration alongside the version change, keeping
them in sync with the new 1.0.2 release since AppVersionSource is local and
auto-increment is disabled. Locate the version fields in app.json and bump the
native numbers manually before the next store build.
In `@hooks/useAIInsightReport.ts`:
- Around line 182-183: Move the lastFailedOperationRef.current assignment out of
the top of refresh() and requestGeneration() in useAIInsightReport so
guard-clause early exits do not overwrite the previously failed action. Keep the
enabled/hydration/connectivity/in-flight checks first, then set
lastFailedOperationRef.current only immediately before the try block for the
operation being attempted. Make sure both refresh and generation paths preserve
the exact failed action for retry().
In `@supabase/functions/generate-insight-report/index.ts`:
- Around line 727-746: The retry path in generate-insight-report is reusing
buildNarrativeRetryPrompt(prompt) for provider_response_truncated, which keeps
pushing for fuller output instead of reducing size. Update the narrative retry
logic in the callAIProvider loop to distinguish truncation from invalid JSON
(for example with a wasTruncated flag) and use a dedicated truncation retry
prompt that asks for shorter, more concise output while preserving the original
field caps from buildNarrativePrompt. Keep the existing JSON-repair retry prompt
only for parse failures, and route retries based on the branch hit in the
previous attempt rather than inferring it from error across iterations.
🪄 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: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ef5a71d2-cc22-41fd-b680-500f37ec58fd
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (16)
.gitignoreapp.jsonapp/insights/report/[periodType].tsxcomponents/app-lock/AppLockScreen.tsxcomponents/auth/auth-screen.tsxcomponents/onboarding/app-launch-gate.tsxcomponents/profile/profile-screen.tsxcontent/legal/privacyPolicy.tshooks/useAIInsightReport.tshooks/useAppLockLifecycle.tshooks/useAutoSync.tslib/insights/reportSourceSnapshot.tspackage.jsonsupabase/functions/_shared/buildReportSourceSnapshot.tssupabase/functions/generate-insight-report/index.tstests/report-source-snapshot.test.mjs
💤 Files with no reviewable changes (1)
- .gitignore
Summary by CodeRabbit
New Features
Bug Fixes
Chores