Skip to content

Conversation

@comst19
Copy link
Collaborator

@comst19 comst19 commented Jan 6, 2026

1. ⭐️ 변경된 내용

  • 인증번호 검증 response로 oauthProvider이 null 이면 toDomain 시 null이 되도록 변경

2. 🖼️ 스크린샷(선택)

3. 💡 알게된 부분

4. 📌 이 부분은 꼭 봐주세요!

Summary by CodeRabbit

  • Refactor
    • Enhanced null-safety in OAuth authentication provider resolution to explicitly handle invalid or unknown provider codes, improving robustness of the authentication flow.

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

@comst19 comst19 requested a review from kkh725 January 6, 2026 11:49
@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

The pull request modifies OAuth provider handling by changing the return type of OAuthProvider.create() from non-null to nullable and updates VerifyAuthCodeResponse.toDomain() accordingly. Invalid OAuth provider codes now return null instead of defaulting to UNKNOWN.

Changes

Cohort / File(s) Summary
OAuth Provider API Nullability
core/domain/src/main/java/com/puzzle/domain/model/auth/OAuthProvider.kt, core/network/src/main/java/com/puzzle/network/model/auth/VerifyAuthCodeResponse.kt
Return type of OAuthProvider.create(code: String?) changed from OAuthProvider to OAuthProvider?. The function now returns null for invalid/unrecognized codes instead of UNKNOWN. Corresponding change in VerifyAuthCodeResponse.toDomain() return type to reflect nullable provider.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

리뷰 원해요🔥

Suggested reviewers

  • kkh725
  • tgyuuAn

Poem

🐰 Null or not, the choice is made clear,
No UNKNOWN shadows will linger here,
OAuth codes now speak their honest truth—
A nimble return, a nullable sleuth! ✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: making oauthProvider return null when unauthenticated during auth code verification.
Description check ✅ Passed The description follows the required template structure with all sections present, and the main change is documented in section 1 explaining the null return behavior for oauthProvider.
✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link

@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

🤖 Fix all issues with AI Agents
In
@core/network/src/main/java/com/puzzle/network/model/auth/VerifyAuthCodeResponse.kt:
- Line 14: The helper function toDomain() in VerifyAuthCodeResponse only
converts the oauthProvider field and should be renamed to clarify its limited
purpose; rename to toOAuthProviderDomain() (or getOAuthProvider()) in
VerifyAuthCodeResponse.kt and update all call sites (notably
AuthRepositoryImpl.verifyAuthCode()) to use the new name, ensuring nullable
return handling is preserved and updating any tests or usages accordingly so the
method name accurately reflects it only maps the oauthProvider enum rather than
the full response.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b5248e and aaf42b2.

📒 Files selected for processing (2)
  • core/domain/src/main/java/com/puzzle/domain/model/auth/OAuthProvider.kt
  • core/network/src/main/java/com/puzzle/network/model/auth/VerifyAuthCodeResponse.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
core/domain/src/main/java/com/puzzle/domain/model/auth/OAuthProvider.kt (2)

7-7: This suggestion should be reconsidered. The UNKNOWN enum value is actively used in the codebase to check OAuth provider state (see AlreadyRegisteredPhoneDialog.kt:25). Although create() may return null for unrecognized providers, the enum value itself remains necessary for runtime comparisons and conditional logic throughout the application.

Likely an incorrect or invalid review comment.


12-16: Confirm the breaking API change has been properly handled.

The return type changed from OAuthProvider to OAuthProvider?. The single call site in VerifyAuthCodeResponse.kt properly handles the nullable return by declaring its own return type as OAuthProvider?, correctly propagating the null case.

val oauthProvider: String?,
) {
fun toDomain(): OAuthProvider = OAuthProvider.create(oauthProvider)
fun toDomain(): OAuthProvider? = OAuthProvider.create(oauthProvider)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find all usages of toDomain() in the codebase
rg -n '\.toDomain\(\)' --type kotlin -C 3

# Also search for VerifyAuthCodeResponse usages
rg -n 'VerifyAuthCodeResponse' --type kotlin -C 2

Repository: Piece-Puzzly/Piece-Android

Length of output: 29658


🏁 Script executed:

cat -n core/network/src/main/java/com/puzzle/network/model/auth/VerifyAuthCodeResponse.kt

Repository: Piece-Puzzly/Piece-Android

Length of output: 593


🏁 Script executed:

sed -n '100,140p' core/data/src/main/java/com/puzzle/data/repository/AuthRepositoryImpl.kt

Repository: Piece-Puzzly/Piece-Android

Length of output: 1004


🏁 Script executed:

rg -n 'object OAuthProvider|class OAuthProvider|fun create' --type kotlin -A 15 | grep -A 15 'OAuthProvider'

Repository: Piece-Puzzly/Piece-Android

Length of output: 5896


Rename method to clarify it only converts the OAuth provider field.

The method name toDomain() is misleading—it only converts the oauthProvider field to an OAuthProvider enum, while the response also contains role, accessToken, refreshToken, and isPhoneNumberDuplicated. These other fields are handled separately in the caller (AuthRepositoryImpl.verifyAuthCode()), making the partial conversion unclear.

Consider renaming to toOAuthProviderDomain() or getOAuthProvider() to accurately reflect what the method does. Alternatively, if all fields should be converted together, create a complete domain response model.

Regarding null handling: the nullable return type is already properly managed at the call site, where AuthRepositoryImpl.verifyAuthCode() is typed to return OAuthProvider? and directly returns the result.

🤖 Prompt for AI Agents
In
@core/network/src/main/java/com/puzzle/network/model/auth/VerifyAuthCodeResponse.kt
at line 14, The helper function toDomain() in VerifyAuthCodeResponse only
converts the oauthProvider field and should be renamed to clarify its limited
purpose; rename to toOAuthProviderDomain() (or getOAuthProvider()) in
VerifyAuthCodeResponse.kt and update all call sites (notably
AuthRepositoryImpl.verifyAuthCode()) to use the new name, ensuring nullable
return handling is preserved and updating any tests or usages accordingly so the
method name accurately reflects it only maps the oauthProvider enum rather than
the full response.

Copy link
Collaborator

@kkh725 kkh725 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다

@comst19 comst19 merged commit bf43d6e into develop Jan 6, 2026
2 checks passed
@comst19 comst19 deleted the fix/PC-000_OAuth branch January 6, 2026 12:22
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.

3 participants