fix(account): support sign in or account creation#828
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@copilot review but do not make fixes |
📝 WalkthroughWalkthroughDesktop account access now uses browser-based continuation with updated navigation copy and tests. iOS adds email sign-in/sign-up dispatch, authentication outcome tracking, revised account prompts, outcome-specific headers, and expanded flow tests. ChangesDesktop account access
iOS authentication and account interface
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Verification
Summary by CodeRabbit
New Features
Tests
Greptile Summary
This PR refines the account sign-in UX across desktop and iOS: the desktop flow collapses fake per-provider shortcuts into a single honest "Continue in browser" button (since the bridge always opens the generic hosted flow), while iOS adds a precise sign-in-or-sign-up email path via the new
AccountEmailAuthFlowservice and surfaces outcome-specific copy after authentication.AccountPage.tsx,TabNav.tsx): Removes the Email/Apple/Google shortcut buttons that all called the samebeginLogin(), replaces them with one "Continue in browser" action, and renames labels from "Sign in to ADE" → "Continue to ADE" throughout.AccountEmailAuthFlow.swift,AccountService.swift): NewAccountEmailAuthFlowenum implements identifier-first email auth: triessignInWithEmailCodefirst, falls back tosignUponly on Clerk's preciseform_identifier_not_found/invitation_account_not_existscodes, then verifies against the matching attempt. AddsAccountAuthenticationOutcometo drive post-authentication copy ("Your ADE account is ready" vs "Welcome back").Confidence Score: 5/5
Safe to merge — the email auth flow is well-encapsulated, error-code matching is precise, and the desktop simplification removes misleading UI rather than changing any auth logic.
The AccountEmailAuthFlow correctly tries sign-in first and falls back to sign-up only for Clerk's specific account-not-found codes, with the result (emailVerificationKind) driving the verification path. authenticationOutcome is set only after successful verification and reset on sign-out, keeping state consistent. Desktop changes are purely cosmetic/UX. Test coverage is thorough across all email auth branches.
No files require special attention. The pbxproj registration and Swift auth flow look correct; the desktop component removal of fake provider buttons is clean.
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant UI as AccountSignInView (iOS) participant SVC as AccountService participant FLOW as AccountEmailAuthFlow participant CLERK as ClerkKit UI->>SVC: "sendEmailCode("user@example.com")" SVC->>FLOW: sendCode(email, actions) FLOW->>CLERK: signInWithEmailCode(email) alt Returning user — sign-in succeeds CLERK-->>FLOW: success → currentSignIn set FLOW-->>SVC: .signIn SVC-->>SVC: "emailVerificationKind = .signIn" UI->>SVC: verifyEmailCode("123456") SVC->>FLOW: verifyCode("123456", kind: .signIn) FLOW->>CLERK: currentSignIn.verifyCode("123456") CLERK-->>FLOW: success SVC-->>SVC: "authenticationOutcome = .returningUser" else New user — form_identifier_not_found or invitation_account_not_exists CLERK-->>FLOW: ClerkAPIError (account-not-found code) FLOW->>CLERK: signUp(emailAddress: email) CLERK-->>FLOW: signUp object FLOW->>CLERK: signUp.sendEmailCode() CLERK-->>FLOW: success → currentSignUp set FLOW-->>SVC: .signUp SVC-->>SVC: "emailVerificationKind = .signUp" UI->>SVC: verifyEmailCode("123456") SVC->>FLOW: verifyCode("123456", kind: .signUp) FLOW->>CLERK: currentSignUp.verifyEmailCode("123456") CLERK-->>FLOW: success SVC-->>SVC: "authenticationOutcome = .newAccount" else Unrelated Clerk error (e.g. too_many_requests) CLERK-->>FLOW: ClerkAPIError (other code) FLOW-->>SVC: rethrows error SVC-->>UI: "throws — emailVerificationKind = nil" end SVC->>SVC: "syncFromClerk() → phase = .signedIn" UI->>UI: "onChange(phase) → step = .machines"%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant UI as AccountSignInView (iOS) participant SVC as AccountService participant FLOW as AccountEmailAuthFlow participant CLERK as ClerkKit UI->>SVC: "sendEmailCode("user@example.com")" SVC->>FLOW: sendCode(email, actions) FLOW->>CLERK: signInWithEmailCode(email) alt Returning user — sign-in succeeds CLERK-->>FLOW: success → currentSignIn set FLOW-->>SVC: .signIn SVC-->>SVC: "emailVerificationKind = .signIn" UI->>SVC: verifyEmailCode("123456") SVC->>FLOW: verifyCode("123456", kind: .signIn) FLOW->>CLERK: currentSignIn.verifyCode("123456") CLERK-->>FLOW: success SVC-->>SVC: "authenticationOutcome = .returningUser" else New user — form_identifier_not_found or invitation_account_not_exists CLERK-->>FLOW: ClerkAPIError (account-not-found code) FLOW->>CLERK: signUp(emailAddress: email) CLERK-->>FLOW: signUp object FLOW->>CLERK: signUp.sendEmailCode() CLERK-->>FLOW: success → currentSignUp set FLOW-->>SVC: .signUp SVC-->>SVC: "emailVerificationKind = .signUp" UI->>SVC: verifyEmailCode("123456") SVC->>FLOW: verifyCode("123456", kind: .signUp) FLOW->>CLERK: currentSignUp.verifyEmailCode("123456") CLERK-->>FLOW: success SVC-->>SVC: "authenticationOutcome = .newAccount" else Unrelated Clerk error (e.g. too_many_requests) CLERK-->>FLOW: ClerkAPIError (other code) FLOW-->>SVC: rethrows error SVC-->>UI: "throws — emailVerificationKind = nil" end SVC->>SVC: "syncFromClerk() → phase = .signedIn" UI->>UI: "onChange(phase) → step = .machines"Reviews (2): Last reviewed commit: "docs(account): clarify email auth flow c..." | Re-trigger Greptile