feat: implement AI onboarding screen and fix Apple auth gate#13
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughImplements an AI-driven multi-step onboarding chat in Changes
Sequence Diagram(s)sequenceDiagram
participant Screen as OnboardingScreen
participant Claude as callClaude
participant Profile as updateProfile
Screen->>Claude: Initialize conversation (assistant prompt)
Claude-->>Screen: Assistant greeting/message
Screen->>Screen: Render assistant message in FlatList
rect rgba(100, 150, 200, 0.5)
Note over Screen,Claude: Message exchange loop
Screen->>Screen: User types and submits message
Screen->>Screen: Append user message, show TypingIndicator
Screen->>Claude: Send accumulated conversation context
Claude-->>Screen: Assistant response (may include completion token)
Screen->>Screen: Strip completion token, update step/progress
end
rect rgba(150, 200, 100, 0.5)
Note over Screen,Profile: Completion flow
Screen->>Screen: Detect completion token → mark done
Screen->>Screen: Parse raw_tools & raw_uses from profileRef
Screen->>Profile: Call updateProfile({ onboarded: true, ...updates })
Profile-->>Screen: Confirmation
Screen->>Screen: Hide input area
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 1/3 review remaining, refill in 30 minutes and 5 seconds. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Build_plan.md`:
- Around line 51-52: Update the Build_plan.md task tracker to reflect the PR
changes: mark "2.2 Profile creation on complete" as done since
src/screens/OnboardingScreen.tsx now builds the profile payload and invokes
updateProfile() on the ONBOARDING_COMPLETE event, and also update/remove the
"Apple gate fix" pending note below so the plan matches the current behavior
implemented in OnboardingScreen.tsx and related onboarding logic.
In `@src/screens/OnboardingScreen.tsx`:
- Around line 117-133: When handling the onboarding completion branch (where
isComplete is truthy in the block that currently calls setDone(true) and updates
profile), also advance the progress step to the final value so the header and
progress bar reflect completion; call setStep with the final step number (e.g.,
setStep(6)) alongside setDone(true) before scheduling updateProfile, referencing
the same block that reads profileRef.current and calls updateProfile(updates) so
the UI reaches the completed "6 of 6" state.
- Around line 122-127: The code builds updates by spreading profileRef.current
into updates which still contains transient fields raw_tools and raw_uses;
remove those transient keys before calling updateProfile()/upsertProfile() to
avoid sending unknown columns. Modify the logic that constructs updates (the
updates object in OnboardingScreen) to copy only the persistent fields or
explicitly omit raw_tools and raw_uses (instead set ai_tools_used, primary_uses,
onboarded) so updateProfile()/upsertProfile() receives a clean payload;
reference profileRef.current, updates, raw_tools, raw_uses, updateProfile(), and
upsertProfile() when making the change.
- Around line 129-131: The delayed call to updateProfile in OnboardingScreen
(the setTimeout wrapper that calls updateProfile(updates)) is unhandled and can
throw (see useProfile.updateProfile behavior), so wrap that call in a try/catch
and surface failures to the user (e.g., set an error state and show a retry
button tied to a new retryUpdateProfile function), or alternatively tie
onboarding completion to the same shared state RootNavigator observes by
updating the profile synchronously via the shared store before calling setDone;
ensure the symbols mentioned (setDone, updateProfile, OnboardingScreen,
RootNavigator) are updated so failures revert optimistic state and provide a
visible retry path or block navigation until updateProfile succeeds.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: aababda0-f8c3-40fc-a17b-d9c8a6b0956c
📒 Files selected for processing (3)
Build_plan.mdsrc/screens/AuthScreen.tsxsrc/screens/OnboardingScreen.tsx
| setTimeout(async () => { | ||
| await updateProfile(updates); | ||
| }, 2200); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Files that read onboarding state =="
rg -n --type=ts --type=tsx -C3 '\bonboarded\b|\bisOnboarded\b|useProfile\s*\(' src
echo
echo "== useProfile implementation =="
fd -i '^useProfile\.ts$' src -x sed -n '1,220p' {}
echo
echo "== Navigator / layout files that may gate onboarding =="
fd -i 'RootNavigator.tsx' src -x sed -n '1,220p' {} || true
fd -i '_layout.tsx' src -x sed -n '1,220p' {} || trueRepository: FLAiRistaken/firsthand
Length of output: 151
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Files that read onboarding state =="
rg -n --iglob='*.ts' --iglob='*.tsx' -C3 '\bonboarded\b|\bisOnboarded\b|useProfile\s*\(' src || echo "Pattern not found or no results"
echo
echo "== useProfile implementation =="
fd -type f -name 'useProfile.ts' src -x cat {} || echo "useProfile.ts not found"
echo
echo "== OnboardingScreen context around lines 129-131 =="
fd -type f -name 'OnboardingScreen.tsx' src -x sed -n '110,150p' {} || echo "OnboardingScreen.tsx not found"
echo
echo "== Navigator / layout files =="
fd -type f \( -name 'RootNavigator.tsx' -o -name '*layout.tsx' -o -name 'root.tsx' \) src || echo "Navigator files not found"Repository: FLAiRistaken/firsthand
Length of output: 4710
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Full OnboardingScreen.tsx context (lines 100-150) =="
cat -n src/screens/OnboardingScreen.tsx | sed -n '100,150p'
echo
echo "== Full useProfile.ts implementation =="
cat -n src/hooks/useProfile.ts
echo
echo "== RootNavigator.tsx full file =="
cat -n src/navigation/RootNavigator.tsxRepository: FLAiRistaken/firsthand
Length of output: 9506
Catch and handle the delayed updateProfile() call to prevent silent failures.
After setDone(true) at line 118, the composer disappears immediately, but the delayed updateProfile() call at lines 129–131 is neither caught nor tied to any recovery mechanism. The updateProfile() function (useProfile.ts:69) throws on database failure after reverting its optimistic update, leaving this error unhandled. Since RootNavigator gates navigation exit based on the database value of onboarded (checked only during initial authentication and auth state changes), a failed sync leaves the user seeing a success state whilst remaining unable to progress from the Onboarding screen.
Either integrate the onboarding completion into the shared state flow that RootNavigator monitors, or wrap the updateProfile() call with error handling and provide a visible retry path to the user.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/screens/OnboardingScreen.tsx` around lines 129 - 131, The delayed call to
updateProfile in OnboardingScreen (the setTimeout wrapper that calls
updateProfile(updates)) is unhandled and can throw (see useProfile.updateProfile
behavior), so wrap that call in a try/catch and surface failures to the user
(e.g., set an error state and show a retry button tied to a new
retryUpdateProfile function), or alternatively tie onboarding completion to the
same shared state RootNavigator observes by updating the profile synchronously
via the shared store before calling setDone; ensure the symbols mentioned
(setDone, updateProfile, OnboardingScreen, RootNavigator) are updated so
failures revert optimistic state and provide a visible retry path or block
navigation until updateProfile succeeds.
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 2 file(s) based on 4 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 2 file(s) based on 4 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/screens/OnboardingScreen.tsx (1)
133-139:⚠️ Potential issue | 🟠 MajorSurface profile-sync failures and provide an in-screen retry path.
Line 133 schedules
updateProfile(updates)after UI completion, but Line 137 only logs failures. If persistence fails, the user sees a completed state without a recovery action and may remain blocked from progressing on next app state evaluation. Please persist an error state and render a retry action tied to the same payload.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/screens/OnboardingScreen.tsx` around lines 133 - 139, The current setTimeout wrapper calling updateProfile(updates) swallows failures by only logging them; change the catch to set a component state (e.g. profileSyncError via useState) and store the failed payload (updates) so the UI can render a visible retry action; implement a retry handler (e.g. retryUpdateProfile) that re-invokes updateProfile with the stored updates, clears profileSyncError on success, and ensure the OnboardingScreen renders a retry button when profileSyncError is present which calls retryUpdateProfile (also consider disabling final navigation/progression until sync succeeds or user explicitly skips).
🤖 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/screens/OnboardingScreen.tsx`:
- Around line 263-265: The styles in OnboardingScreen.tsx use hardcoded font
values (fontSize: 17, fontSize: 11, and fontFamily: 'DMSans_300Light') instead
of theme tokens; update the style objects that set fontFamily and fontSize (the
ones shown and the other occurrences around the file) to use the theme exports
(import Fonts and FontSizes from theme.ts) and replace the literal values with
the appropriate tokens (e.g., Fonts.<appropriateToken> and
FontSizes.<appropriateSizeToken>) so all fontFamily and fontSize references use
Fonts.* and FontSizes.* consistently.
---
Duplicate comments:
In `@src/screens/OnboardingScreen.tsx`:
- Around line 133-139: The current setTimeout wrapper calling
updateProfile(updates) swallows failures by only logging them; change the catch
to set a component state (e.g. profileSyncError via useState) and store the
failed payload (updates) so the UI can render a visible retry action; implement
a retry handler (e.g. retryUpdateProfile) that re-invokes updateProfile with the
stored updates, clears profileSyncError on success, and ensure the
OnboardingScreen renders a retry button when profileSyncError is present which
calls retryUpdateProfile (also consider disabling final navigation/progression
until sync succeeds or user explicitly skips).
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 608871e2-7ecf-4582-a977-53de3cd64fb6
⛔ Files ignored due to path filters (1)
Build_plan.mdis excluded by!**/*.md
📒 Files selected for processing (2)
src/lib/googleSignIn.tssrc/screens/OnboardingScreen.tsx
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 1 unresolved review comment. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 1 file(s) based on 1 unresolved review comment. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
This PR completes task 2.1 from Phase 2 (Onboarding screen) by implementing a fully conversational AI flow powered by Anthropic's Claude API.
Changes:
src/screens/OnboardingScreen.tsxwith full state management andcallClaudeAPI integration.prototype/firsthand-full.jsxwith staggered typing animations and correct green/white theme application.anykeywords (CR feedback addressed).ONBOARDING_COMPLETE, updates local context and triggers profile sync before letting the router auto-transition.AuthScreen.tsxto includemacosin the Apple Sign-In platform gate.Build_plan.mdto flag Task 2.1 as "Done".Tests have been verified (No compilation errors in our components when checking via
tsc --noEmit).PR created automatically by Jules for task 16776806372225523666 started by @FLAiRistaken
Summary by CodeRabbit
New Features
Improvements
Documentation