Skip to content

fix(account): support sign in or account creation#828

Merged
arul28 merged 2 commits into
mainfrom
ade/account-signup-semantics-e010e30a
Jul 16, 2026
Merged

fix(account): support sign in or account creation#828
arul28 merged 2 commits into
mainfrom
ade/account-signup-semantics-e010e30a

Conversation

@arul28

@arul28 arul28 commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • adds precise iOS email sign-up fallback only for Clerk account-not-found errors
  • preserves sign-in-or-sign-up outcomes for accurate success copy
  • replaces desktop fake provider shortcuts with one truthful browser action
  • keeps local pairing available without an account

Verification

  • desktop AccountPage and TabNav focused Vitest coverage
  • desktop TypeScript typecheck
  • iOS AccountEmailAuthFlowTests on iPhone 17 Pro simulator
  • docs validation and diff checks

ADE  Open in ADE · PR #828

Summary by CodeRabbit

  • New Features

    • Updated account sign-in experiences across desktop and iOS to use clearer “Continue to ADE” and browser-based messaging.
    • Improved email authentication to support both existing-account sign-in and new-account setup flows.
    • Added outcome-specific guidance after authentication, including clearer next steps for account and machine setup.
    • Refined accessibility labels, button text, and sign-in screen layouts.
  • Tests

    • Added coverage for desktop account states and iOS email authentication scenarios.

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 AccountEmailAuthFlow service and surfaces outcome-specific copy after authentication.

  • Desktop (AccountPage.tsx, TabNav.tsx): Removes the Email/Apple/Google shortcut buttons that all called the same beginLogin(), replaces them with one "Continue in browser" action, and renames labels from "Sign in to ADE" → "Continue to ADE" throughout.
  • iOS (AccountEmailAuthFlow.swift, AccountService.swift): New AccountEmailAuthFlow enum implements identifier-first email auth: tries signInWithEmailCode first, falls back to signUp only on Clerk's precise form_identifier_not_found / invitation_account_not_exists codes, then verifies against the matching attempt. Adds AccountAuthenticationOutcome to drive post-authentication copy ("Your ADE account is ready" vs "Welcome back").
  • Tests: New Vitest coverage for the desktop card states and XCTest coverage for all email auth flow branches.

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

Filename Overview
apps/ios/ADE/Services/AccountEmailAuthFlow.swift New service routing email auth between sign-in and precise sign-up fallback; clean enum design with injected actions for testability.
apps/ios/ADE/Services/AccountService.swift Integrates AccountEmailAuthFlow and adds authenticationOutcome tracking; state management is correct — outcome is set after successful verification and reset on sign-out.
apps/ios/ADETests/AccountEmailAuthFlowTests.swift Comprehensive XCTest coverage for all flow branches including both account-not-found codes, unrelated Clerk errors, and non-Clerk errors.
apps/ios/ADE/Views/Account/AccountSignInView.swift Outcome-driven header title for the machines step; subtitle correctly falls through to existing generic text; accessibility labels simplified.
apps/desktop/src/renderer/components/account/AccountPage.tsx Removes fake per-provider shortcuts, exports SignInCard for testing, and simplifies to a single Continue in browser button; copy changes are internally consistent.
apps/desktop/src/renderer/components/account/AccountPage.test.tsx New Vitest tests cover configured and unconfigured card states, confirming the single browser action and local-pairing message.
apps/desktop/src/renderer/components/app/TabNav.tsx Label and aria-label updated from 'Sign in' to 'Continue' for signed-out state; test updated to match.
apps/ios/ADE/Views/Account/AccountConnectionsSection.swift Text and accessibility label updates only; adds minHeight: 44 touch target to the Continue button for accessibility compliance.
apps/ios/ADE.xcodeproj/project.pbxproj Registers AccountEmailAuthFlow.swift in Sources and AccountEmailAuthFlowTests.swift in the test target.
docs/ARCHITECTURE.md Architecture section updated to describe the new honest browser continuation on desktop and the identifier-first email path on iOS.

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"
Loading
%%{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"
Loading

Reviews (2): Last reviewed commit: "docs(account): clarify email auth flow c..." | Re-trigger Greptile

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Jul 15, 2026 11:57pm

@arul28 arul28 changed the title account-signup-semantics -> Primary fix(account): support sign in or account creation Jul 15, 2026
@arul28

arul28 commented Jul 15, 2026

Copy link
Copy Markdown
Owner Author

@copilot review but do not make fixes

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Desktop 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.

Changes

Desktop account access

Layer / File(s) Summary
Desktop browser sign-in card
apps/desktop/src/renderer/components/account/AccountPage.tsx, apps/desktop/src/renderer/components/account/AccountPage.test.tsx
The signed-out card now presents browser-based continuation, updated messaging, and tests for configured and unconfigured states.
Desktop account navigation
apps/desktop/src/renderer/components/app/TabNav.tsx, apps/desktop/src/renderer/components/app/TabNav.test.tsx
Signed-out account labels and accessibility text now use “Continue to ADE”, with matching link assertions.

iOS authentication and account interface

Layer / File(s) Summary
Email authentication and outcome state
apps/ios/ADE/Services/AccountEmailAuthFlow.swift, apps/ios/ADE/Services/AccountService.swift, apps/ios/ADETests/AccountEmailAuthFlowTests.swift
Email authentication selects sign-in or sign-up based on Clerk errors, verification routes by flow kind, and authentication outcomes are recorded and reset across supported flows.
Account prompts and verification interface
apps/ios/ADE/Views/Account/AccountConnectionsSection.swift, apps/ios/ADE/Views/Account/AccountSignInView.swift
Account prompts, headers, accessibility labels, verification copy, and verification button sizing were updated; machine-step messaging now uses authentication outcomes.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • arul28/ADE#819: Adds the desktop /account flow infrastructure used by the updated account page and login hook.

Suggested labels: desktop, ios, docs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: account flows now support both sign-in and account creation.
✨ 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 ade/account-signup-semantics-e010e30a

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.

❤️ Share

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

@arul28

arul28 commented Jul 15, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 5432052cb8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@arul28
arul28 merged commit 421e068 into main Jul 16, 2026
35 checks passed
@arul28
arul28 deleted the ade/account-signup-semantics-e010e30a branch July 16, 2026 00:59
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.

1 participant