Skip to content

fix: FetchFirstInstallUseCase nil 처리 로직 개선#801

Merged
Do-hyun-Kim merged 2 commits into
developfrom
fix/#800-midnight-contributorview-issue
Apr 8, 2026
Merged

fix: FetchFirstInstallUseCase nil 처리 로직 개선#801
Do-hyun-Kim merged 2 commits into
developfrom
fix/#800-midnight-contributorview-issue

Conversation

@Do-hyun-Kim

@Do-hyun-Kim Do-hyun-Kim commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator
  • Keychain에 값이 없으면 기존 사용자로 간주

🔵PR을 올리기 전 아래 사항을 확인해주세요.

  • 구현한 로직과 기능이 올바르게 작동되는지 충분히 테스트해주세요.
  • 코드의 성능이나 메모리 효율성이 적절하게 고려되었는지, 불필요한 코드가 없는지 검토해주세요.
  • 이번 PR에서 구현된 주요 기능이나 해결된 문제에 대해 자세히 서술해주세요.
    (위 내용은 지워주세요)

😽개요

  • (작업한 코드에 대한 간략한 설명해주세요)

🛠️작업 내용

(소제목)

  • (작업한 코드에 대한 자세한 설명해주세요. 필요하다면 이미지나 표를 첨부해주세요)
이미지①

(소제목)

  • (작업한 코드에 대한 자세한 설명해주세요. 필요하다면 이미지나 표를 첨부해주세요)
이미지①

🟡차후 계획 (Optional)

  • (작업한 코드가 추후 우리 프로젝트에 어떤 영향을 끼칠지, 앞으로 PR계획을 설명해주세요)

🗾이미지 (Optional)

이미지①

✅테스트 케이스

  • (구현한 로직 검증을 위해 테스트한 내용을 설명해주세요)

🙏🏻아래와 같이 PR을 리뷰해주세요.

  • PR 내용이 부족하다면 보충 요청해주세요.
  • 코드 스타일이 팀의 규칙에 맞게 작성되었는지, 일관성을 유지하고 있는지 확인해주세요.
  • 코드에 대한 문서화나 주석이 필요한 부분에 적절하게 작성되어 있는지 확인해주세요.
  • 구현된 로직이 효율적이고 올바르게 작성되었는지, 아키텍처를 잘 준수하고 있는지 검토해주세요.
  • 네이밍, 포매팅, 주석 등 코드의 일관성이 유지되고 있는지 확인해주세요.

Summary by CodeRabbit

변경 사항

  • 리팩토링
    • 첫 설치 및 온보딩 상태 감지 로직이 업데이트되었습니다.

- Keychain에 값이 없으면 기존 사용자로 간주
@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 28379c1e-0bb5-4701-8a16-dc423179dd3c

📥 Commits

Reviewing files that changed from the base of the PR and between be11783 and e97c9fa.

📒 Files selected for processing (1)
  • 14th-team5-iOS/Domain/Sources/UseCases/My/FetchFirstInstallUseCase.swift

Walkthrough

FetchFirstInstallUseCase.swiftexecute() 메서드에서 저장소 반환값의 옵셔널 처리 로직을 변경했습니다. nil 값 처리와 제어 흐름이 재구성되어 첫 설치 여부와 온보딩 완료 여부를 다르게 해석합니다.

Changes

Cohort / File(s) Summary
옵셔널 값 처리 로직 변경
14th-team5-iOS/Domain/Sources/UseCases/My/FetchFirstInstallUseCase.swift
fetchFirstInstall() nil 값일 때 updateFirstInstall(true) 호출 후 true 반환하도록 변경. 온보딩 확인 로직은 nil 값이 더 이상 return true를 트리거하지 않고, 명시적으로 false인 경우에만 true 반환.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45분

Possibly related PRs

Suggested reviewers

  • akrudal

Poem

🐰 옵셔널 값의 미로 속에서,
nil은 더 이상 거짓이 아니라네!
첫 설치를 판단하는 로직 다시 생각하고,
온보딩의 흐름도 새롭게 정의하네 ✨
세심한 변화로 더욱 명확해진 흐름!

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 PR의 주요 변경 사항(FetchFirstInstallUseCase의 nil 처리 로직 개선)을 명확하게 반영하며, 코드 변경 내용과 일치합니다.

✏️ 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 fix/#800-midnight-contributorview-issue

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
14th-team5-iOS/Domain/Sources/UseCases/My/FetchFirstInstallUseCase.swift (1)

22-23: 온보딩 조회는 필요 시점으로 지연하면 흐름이 더 선명해집니다.

installednil이면 조기 반환하므로, fetchIsFirstOnboarding()는 그 이후에 읽어도 동일 동작입니다.

제안 diff
 public func execute() -> Bool {
     let hasInstalledBefore = myRepositroy.fetchFirstInstall()
-    let hasCompletedOnboarding = myRepositroy.fetchIsFirstOnboarding()
     
     guard let installed = hasInstalledBefore else {
         myRepositroy.updateFirstInstall(true)
         return false
     }
     
     if !installed {
         return true
     }
+
+    let hasCompletedOnboarding = myRepositroy.fetchIsFirstOnboarding()
     
     if let onboarded = hasCompletedOnboarding, !onboarded {
         return true
     }
     
     return false
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@14th-team5-iOS/Domain/Sources/UseCases/My/FetchFirstInstallUseCase.swift`
around lines 22 - 23, The onboarding flag
(myRepositroy.fetchIsFirstOnboarding()) should be fetched lazily after you
confirm installed isn't nil to avoid unnecessary work and keep control flow
clear: call myRepositroy.fetchFirstInstall() first, check the returned installed
value and early-return if nil, and only then call
myRepositroy.fetchIsFirstOnboarding() to determine onboarding status; update
FetchFirstInstallUseCase (references: fetchFirstInstall, fetchIsFirstOnboarding,
myRepositroy) accordingly.
14th-team5-iOS/Bibbi/Sources/Presentation/Home/Reactor/MainViewReactor.swift (1)

209-219: 테스트 레이블이 있는 .debug() 호출을 제거하거나 DEBUG 빌드로 제한해 주세요.

라인 209와 219의 .debug("true 값 테스트 입니다잉"), .debug("false 값 테스트 입니다잉")은 실제 운영 경로에서 불필요한 로그를 생성합니다. #if DEBUG 가드로 감싸거나 공통 로거로 통일하는 것이 좋습니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@14th-team5-iOS/Bibbi/Sources/Presentation/Home/Reactor/MainViewReactor.swift`
around lines 209 - 219, Remove the inline `.debug("true 값 테스트 입니다잉")` and
`.debug("false 값 테스트 입니다잉")` calls in the Observable chain inside
MainViewReactor (the branches that return Observable.concat with
`.just(.setInTime(true))`/`.just(.setInTime(false))` near the calls to
`mutate(action: .fetchMainNightUseCase)` and `mutate(action: .setTimer(isInTime,
time))`); either delete these `.debug(...)` calls entirely or wrap them behind a
build-time guard (`#if DEBUG`) or replace them with calls to the shared logger
used across the app so that they do not emit in production. Ensure the change
keeps the surrounding Observable.concat and existing mutations intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@14th-team5-iOS/Bibbi/Sources/Presentation/Home/Reactor/MainViewReactor.swift`:
- Around line 209-219: Remove the inline `.debug("true 값 테스트 입니다잉")` and
`.debug("false 값 테스트 입니다잉")` calls in the Observable chain inside
MainViewReactor (the branches that return Observable.concat with
`.just(.setInTime(true))`/`.just(.setInTime(false))` near the calls to
`mutate(action: .fetchMainNightUseCase)` and `mutate(action: .setTimer(isInTime,
time))`); either delete these `.debug(...)` calls entirely or wrap them behind a
build-time guard (`#if DEBUG`) or replace them with calls to the shared logger
used across the app so that they do not emit in production. Ensure the change
keeps the surrounding Observable.concat and existing mutations intact.

In `@14th-team5-iOS/Domain/Sources/UseCases/My/FetchFirstInstallUseCase.swift`:
- Around line 22-23: The onboarding flag (myRepositroy.fetchIsFirstOnboarding())
should be fetched lazily after you confirm installed isn't nil to avoid
unnecessary work and keep control flow clear: call
myRepositroy.fetchFirstInstall() first, check the returned installed value and
early-return if nil, and only then call myRepositroy.fetchIsFirstOnboarding() to
determine onboarding status; update FetchFirstInstallUseCase (references:
fetchFirstInstall, fetchIsFirstOnboarding, myRepositroy) accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d21d9628-d065-4712-9ecf-15339bf16674

📥 Commits

Reviewing files that changed from the base of the PR and between 68f13df and be11783.

📒 Files selected for processing (2)
  • 14th-team5-iOS/Bibbi/Sources/Presentation/Home/Reactor/MainViewReactor.swift
  • 14th-team5-iOS/Domain/Sources/UseCases/My/FetchFirstInstallUseCase.swift

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Keychain에 저장된 “첫 설치 여부” 플래그가 nil일 때의 동작을 변경해, 첫 설치/온보딩 판단 로직을 더 안전하게 처리하려는 PR입니다.

Changes:

  • FetchFirstInstallUseCase에서 fetchFirstInstall() 결과가 nil인 경우를 별도로 처리하도록 로직 수정
  • MainViewReactor에서 first install 분기 처리 시 Rx debug 로그를 추가

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
14th-team5-iOS/Domain/Sources/UseCases/My/FetchFirstInstallUseCase.swift 첫 설치/온보딩 여부 조회 시 nil 케이스를 guard로 분기 처리
14th-team5-iOS/Bibbi/Sources/Presentation/Home/Reactor/MainViewReactor.swift first install 분기에서 Rx debug()로 값 확인 로그 추가

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


if !hasInstalledBefore {
guard let installed = hasInstalledBefore else {
myRepositroy.updateFirstInstall(true)

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

execute()hasInstalledBefore == nil일 때 updateFirstInstall(true)를 저장하면서 false(=기존 사용자로 판단)를 반환하고 있는데, 다른 경로에서는 UpdateExistingUserUseCase가 기존 사용자 처리로 updateFirstInstall(false)를 저장하고 있어 값의 의미가 코드 전반에서 상충합니다. fetchFirstInstall/updateFirstInstall에 저장되는 Bool의 의미(첫설치 여부 vs hasLaunchedBefore 여부)를 한 가지로 정리하고, nil 처리 시 저장하는 값도 그 의미에 맞게 통일해 주세요.

Suggested change
myRepositroy.updateFirstInstall(true)
myRepositroy.updateFirstInstall(false)

Copilot uses AI. Check for mistakes.
Comment on lines 208 to 212
return Observable.concat([
.just(.setInTime(true)),
.just(.setInTime(true)).debug("true 값 테스트 입니다잉"),
.just(.setEnabeldCamera(false)),
.just(.setCameraType(.midNight)),
self.mutate(action: .fetchMainNightUseCase),

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

Observable.debug가 그대로 남아 있고 로그 메시지도 테스트용/비격식 문구(“true 값 테스트 입니다잉”)입니다. 프로덕션 로그 오염 및 성능/운영 이슈가 될 수 있으니 제거하거나 #if DEBUG로 감싸서 디버그 빌드에서만 동작하도록 변경해 주세요.

Copilot uses AI. Check for mistakes.
Comment on lines 218 to 222
return Observable.concat([
.just(.setInTime(false)),
.just(.setInTime(false)).debug("false 값 테스트 입니다잉"),
.just(.setGuideLineView(false)),
.just(.setCameraType(.midNight)),
self.mutate(action: .fetchMainNightUseCase),

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

아래 분기에서도 Observable.debug에 테스트용 메시지(“false 값 테스트 입니다잉”)가 포함되어 있습니다. 릴리즈 빌드에 남지 않도록 제거하거나 #if DEBUG 조건부 로깅으로 대체해 주세요.

Copilot uses AI. Check for mistakes.
- MainViewReactor 디버깅용 Observable 코드 제거
@Do-hyun-Kim Do-hyun-Kim merged commit bc28787 into develop Apr 8, 2026
1 check failed
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