Skip to content

feat: implement AI onboarding screen and fix Apple auth gate#13

Merged
FLAiRistaken merged 4 commits into
developfrom
jules-16776806372225523666-0fb0d3b1
Apr 29, 2026
Merged

feat: implement AI onboarding screen and fix Apple auth gate#13
FLAiRistaken merged 4 commits into
developfrom
jules-16776806372225523666-0fb0d3b1

Conversation

@FLAiRistaken

@FLAiRistaken FLAiRistaken commented Apr 29, 2026

Copy link
Copy Markdown
Owner

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:

  • Implemented src/screens/OnboardingScreen.tsx with full state management and callClaude API integration.
  • Styled according to prototype/firsthand-full.jsx with staggered typing animations and correct green/white theme application.
  • Uses strict TypeScript typing with zero any keywords (CR feedback addressed).
  • Properly parses conversation, waits for ONBOARDING_COMPLETE, updates local context and triggers profile sync before letting the router auto-transition.
  • Updated AuthScreen.tsx to include macos in the Apple Sign-In platform gate.
  • Updated Build_plan.md to 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

    • Interactive AI-powered onboarding chat with step-by-step guidance and visible progress.
    • Animated typing indicators and smoother transitions; input hidden once onboarding completes.
  • Improvements

    • Profile update now applied automatically on onboarding completion.
    • Google Sign-In stability and behaviour improvements.
  • Documentation

    • Build plan and prompt log updated to mark onboarding progress and next steps.

Copilot AI review requested due to automatic review settings April 29, 2026 17:59
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 93ef83fb-dcc1-4b2b-bf02-f9b6d79f7357

📥 Commits

Reviewing files that changed from the base of the PR and between bdd3fb1 and cf25f25.

📒 Files selected for processing (1)
  • src/screens/OnboardingScreen.tsx

📝 Walkthrough

Walkthrough

Implements an AI-driven multi-step onboarding chat in OnboardingScreen (calls callClaude, tracks steps, updates profile on completion), updates build_plan.md to mark Phase 2 onboarding done, and refines Google Sign‑in types by adding GoogleSignInResult and changing signIn() return type.

Changes

Cohort / File(s) Summary
Onboarding Chat Implementation
src/screens/OnboardingScreen.tsx
Replaces placeholder with interactive multi-step chat: initializes assistant via callClaude, maintains message list and input state, shows typing indicator and animated progress bar, detects completion token, parses raw_tools/raw_uses, and calls updateProfile (onboarded: true) after a delay.
Auth Type Definition
src/lib/googleSignIn.ts
Adds exported GoogleSignInResult interface ({ data?: { idToken?: string } }) and changes GoogleSignin.signIn() return type to Promise<GoogleSignInResult> (control flow unchanged).
Documentation
build_plan.md
Marks Phase 2 onboarding (2.1 Onboarding screen) as completed and updates Jules Prompt Log entry status (08 → “✅ Merged”; appends placeholder 09 as pending).

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 I hopped in to chat, a friendly byte,

Guided by Claude through morning and night,
Steps climbed, progress bars gleam and twirl,
Tools and uses gathered, a bright onboarding swirl,
Now profiles updated — hop, celebrate the whirl! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main changes: implementing an AI onboarding screen and fixing Apple auth gate, which aligns with the primary file modifications and PR objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jules-16776806372225523666-0fb0d3b1

Review rate limit: 1/3 review remaining, refill in 30 minutes and 5 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@FLAiRistaken FLAiRistaken review requested due to automatic review settings April 29, 2026 18:13
@FLAiRistaken

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI review requested due to automatic review settings April 29, 2026 18:18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7fac4ca and f58cfd2.

📒 Files selected for processing (3)
  • Build_plan.md
  • src/screens/AuthScreen.tsx
  • src/screens/OnboardingScreen.tsx

Comment thread Build_plan.md
Comment thread src/screens/OnboardingScreen.tsx
Comment thread src/screens/OnboardingScreen.tsx
Comment on lines +129 to +131
setTimeout(async () => {
await updateProfile(updates);
}, 2200);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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' {} || true

Repository: 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.tsx

Repository: 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.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 2 file(s) based on 4 unresolved review comments.

Files modified:

  • src/lib/googleSignIn.ts
  • src/screens/OnboardingScreen.tsx

Commit: bdd3fb10e709d807a89288b47412158d9a0ff822

The changes have been pushed to the jules-16776806372225523666-0fb0d3b1 branch.

Time taken: 3m 13s

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Fixed 2 file(s) based on 4 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/screens/OnboardingScreen.tsx (1)

133-139: ⚠️ Potential issue | 🟠 Major

Surface 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

📥 Commits

Reviewing files that changed from the base of the PR and between f58cfd2 and bdd3fb1.

⛔ Files ignored due to path filters (1)
  • Build_plan.md is excluded by !**/*.md
📒 Files selected for processing (2)
  • src/lib/googleSignIn.ts
  • src/screens/OnboardingScreen.tsx

Comment thread src/screens/OnboardingScreen.tsx
@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • src/screens/OnboardingScreen.tsx

Commit: cf25f2513eb7cf5a729dd1c7176d423898bc0d14

The changes have been pushed to the jules-16776806372225523666-0fb0d3b1 branch.

Time taken: 3m 1s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@FLAiRistaken FLAiRistaken merged commit a35d89a into develop Apr 29, 2026
1 check was pending
@FLAiRistaken FLAiRistaken deleted the jules-16776806372225523666-0fb0d3b1 branch April 29, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants