Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@swolfand
Copy link
Collaborator

@swolfand swolfand commented Dec 18, 2025

Summary of changes

This pull request adds support for client trust verification during sign-in, which is required when a user signs in from a new or untrusted device. It introduces a new UI flow for client trust, updates navigation and state handling, and enhances the code verification screen with contextual warnings.

Client Trust Verification Feature:

  • Added a new sign-in status NEEDS_CLIENT_TRUST to the SignIn.Status enum to represent the requirement for client trust verification.
  • Updated the authentication state machine and navigation (AuthState, AuthDestination, and AuthView) to handle the new client trust status and route users to the appropriate UI. [1] [2] [3] [4]

User Interface Enhancements:

  • Introduced the SignInClientTrustView composable, which displays a warning message and code input for client trust verification, delegating to the appropriate code or help views based on the verification strategy.
  • Updated the SignInFactorCodeView to accept an isClientTrust flag and display a contextual warning message when client trust verification is required. [1] [2] [3] [4] [5]

Localization:

  • Added a new string resource for the client trust warning message to the localization files.

Code Quality and Baseline Updates:

  • Updated the Detekt baseline to reflect new and removed long method and parameter list warnings related to the new client trust code and removed/modified methods. [1] [2]

Summary by CodeRabbit

  • New Features

    • Added client-trust verification flow for sign-ins from new or untrusted devices.
    • New sign-in status to represent "needs client trust".
  • UI

    • Sign-in flow now includes a dedicated device-trust verification step (phone/email code).
    • Warning message displayed above the code input when verifying identity on a new device.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 18, 2025

📝 Walkthrough

Walkthrough

Adds a client-trust sign-in flow: a new SignIn.Status value NEEDS_CLIENT_TRUST; AuthState now maps that status to a new AuthDestination.SignInClientTrust; AuthView adds the SignInClientTrust destination and entry. Introduces SignInClientTrustView composable which delegates to SignInFactorCodeView for PHONE_CODE/EMAIL_CODE and shows a client-trust warning. SignInFactorCodeView gains an isClientTrust parameter and renders the warning when true. Adds a new string resource for the new-device prompt. Changes visibility of VerificationState and SignUpCodeField to public. Updates detekt baseline and adds a ConfigurationManager private method; .gitignore updated.

Pre-merge checks

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title is vague and generic, using non-descriptive phrasing that doesn't clearly convey the main objective of the changeset. Consider a more specific title like 'Add client trust verification flow for sign-in' to better communicate the primary change to reviewers scanning history.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description provides comprehensive coverage of all major changes including authentication status, navigation routing, UI components, localization, and code quality updates, matching the template requirements.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 29330bd and 86dfa6e.

📒 Files selected for processing (3)
  • .gitignore (1 hunks)
  • source/ui/src/main/java/com/clerk/ui/signin/code/SignInFactorCodeView.kt (6 hunks)
  • source/ui/src/main/java/com/clerk/ui/signup/code/SignUpCodeView.kt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*

⚙️ CodeRabbit configuration file

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.

Files:

  • source/ui/src/main/java/com/clerk/ui/signup/code/SignUpCodeView.kt
  • source/ui/src/main/java/com/clerk/ui/signin/code/SignInFactorCodeView.kt
🔇 Additional comments (3)
.gitignore (1)

29-30: LGTM!

The additions to .gitignore are appropriate: excluding /docs/ aligns with common practice of keeping auto-generated or build-time documentation artifacts out of version control, and the existing build output exclusions remain consistent.

source/ui/src/main/java/com/clerk/ui/signup/code/SignUpCodeView.kt (1)

113-120: Looks good.

The visibility change from internal to public for SignUpCodeField is straightforward and aligns with the PR's goal of exposing client trust flows. No blocking issues.

source/ui/src/main/java/com/clerk/ui/signin/code/SignInFactorCodeView.kt (1)

1-215: Looks good.

The changes are straightforward and safe to merge. The isClientTrust parameter is properly propagated with backward-compatible defaults, and the conditional rendering logic is correct.


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 and usage tips.

@swolfand swolfand force-pushed the sam/mobile-366-update-to-client-trust branch from b75ec4d to 29330bd Compare December 18, 2025 20:52
@github-actions
Copy link
Contributor

❌ Paparazzi found snapshot diffs.

  • Download the paparazzi-report artifact from this workflow to see the HTML report and image diffs.
  • If the changes are expected, re-record locally and commit the updated golden images.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b75ec4d and 29330bd.

📒 Files selected for processing (7)
  • config/detekt/detekt-baseline.xml (1 hunks)
  • source/api/src/main/kotlin/com/clerk/api/signin/SignIn.kt (1 hunks)
  • source/ui/src/main/java/com/clerk/ui/auth/AuthState.kt (1 hunks)
  • source/ui/src/main/java/com/clerk/ui/auth/AuthView.kt (3 hunks)
  • source/ui/src/main/java/com/clerk/ui/signin/clienttrust/SignInClientTrustView.kt (1 hunks)
  • source/ui/src/main/java/com/clerk/ui/signin/code/SignInFactorCodeView.kt (5 hunks)
  • source/ui/src/main/res/values/strings.xml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • source/ui/src/main/res/values/strings.xml
  • source/ui/src/main/java/com/clerk/ui/auth/AuthState.kt
  • source/ui/src/main/java/com/clerk/ui/auth/AuthView.kt
  • config/detekt/detekt-baseline.xml
🧰 Additional context used
📓 Path-based instructions (1)
**/*

⚙️ CodeRabbit configuration file

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.

Files:

  • source/api/src/main/kotlin/com/clerk/api/signin/SignIn.kt
  • source/ui/src/main/java/com/clerk/ui/signin/code/SignInFactorCodeView.kt
  • source/ui/src/main/java/com/clerk/ui/signin/clienttrust/SignInClientTrustView.kt
🧬 Code graph analysis (2)
source/ui/src/main/java/com/clerk/ui/signin/code/SignInFactorCodeView.kt (1)
source/ui/src/main/java/com/clerk/ui/signin/clienttrust/SignInClientTrustView.kt (1)
  • ClientTrustWarningMessage (66-75)
source/ui/src/main/java/com/clerk/ui/signin/clienttrust/SignInClientTrustView.kt (3)
source/ui/src/main/java/com/clerk/ui/theme/ClerkComposeTheme.kt (1)
  • ClerkThemeOverrideProvider (53-58)
source/ui/src/main/java/com/clerk/ui/signin/code/SignInFactorCodeView.kt (1)
  • SignInFactorCodeView (53-71)
source/ui/src/main/java/com/clerk/ui/auth/AuthState.kt (1)
  • PreviewAuthStateProvider (166-170)
🔇 Additional comments (2)
source/ui/src/main/java/com/clerk/ui/signin/code/SignInFactorCodeView.kt (1)

58-58: Add tests for the client trust verification flow.

This PR introduces significant new functionality (new status, navigation destination, UI components) without accompanying tests. Please add unit or integration tests to cover the client trust verification path.

source/ui/src/main/java/com/clerk/ui/signin/clienttrust/SignInClientTrustView.kt (1)

55-55: No action needed. SignInGetHelpView is a support/help view for unsupported strategies, not an authentication path. It intentionally does not accept the onAuthComplete callback because it doesn't handle authentication completion—it only provides a way to contact support via email. The current implementation is correct.

Likely an incorrect or invalid review comment.

Comment on lines +191 to +192
/** Client trust verification is required. */
@SerialName("needs_client_trust") NEEDS_CLIENT_TRUST,
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add tests for the new NEEDS_CLIENT_TRUST status.

The enum addition looks correct, but no tests were included in this review. Please add tests to verify:

  • Serialization/deserialization of the new status value
  • Handling of this status in the sign-in flow
🤖 Prompt for AI Agents
In source/api/src/main/kotlin/com/clerk/api/signin/SignIn.kt around lines 191 to
192, the new enum value NEEDS_CLIENT_TRUST was added but there are no tests
covering it; add unit tests that (1) verify JSON serialization and
deserialization of the NEEDS_CLIENT_TRUST enum value (round-trip encode->decode
produces the same enum and the serialized string equals "needs_client_trust"),
and (2) exercise the sign-in flow behavior when a response/state returns
NEEDS_CLIENT_TRUST (mock the sign-in service or controller to return this status
and assert the downstream handling, e.g. that the controller maps it to the
expected HTTP response/redirect or that the state machine transitions
appropriately). Place serialization tests alongside existing SignIn
enum/serialization tests (e.g. in test/kotlin/com/clerk/api/signin/) and place
sign-in flow tests with the sign-in controller/service tests, using existing
test fixtures/mocks and assertions to mirror other status tests.

@swolfand swolfand merged commit 1a92e7d into main Dec 18, 2025
10 checks passed
@swolfand swolfand deleted the sam/mobile-366-update-to-client-trust branch December 18, 2025 21:03
swolfand added a commit that referenced this pull request Dec 18, 2025
* Add updates to client trust

* refactor: change internal interfaces to public visibility for verification and sign-up code fields
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