-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] 운세 생성 실패 시 안내 Dialog 노출 #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 운세 생성 실패 시 안내 Dialog 노출 #263
Conversation
Walkthrough운세 생성 실패 처리 로직을 도입하고 흐름을 재구성했습니다. 실패 상태를 생성 중과 유사하게 취급해 경로/내비게이션을 정리하고, 실패일을 데이터스토어에 기록·자동 초기화합니다. UI 상태에 실패 다이얼로그 플래그를 추가하고 화면에 다이얼로그를 표시합니다. 워커는 실패 시 실패 기록 후 재시도/종료를 분기합니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as 사용자
participant VM as FortuneViewModel
participant Repo as FortuneRepository
participant Worker as PostFortuneWorker
participant DS as FortunePreferences
participant UI as FortuneScreen
User->>VM: 운세 생성 트리거
VM->>Repo: 생성 작업 스케줄 요청
Repo->>Worker: WorkManager 작업 실행
rect rgb(245,245,255)
note over Worker: 생성 시도
Worker->>DS: attemptId 기록 (CREATING)
Worker->>Repo: 운세 생성 호출
alt 생성 실패
Worker->>Repo: markFortuneAsFailed(attemptId)
Repo->>DS: FAILED=true, FAILED_DATE=today
Worker-->>Repo: Result.failure()
Repo-->>VM: FortuneCreateStatus.Failure
VM->>UI: state.isCreateFailureDialogVisible = true
UI->>User: 실패 다이얼로그 표시
User->>VM: 확인
VM->>UI: 다이얼로그 비활성화 후 홈으로 내비게이션
else 생성 성공
Worker->>Repo: markFortuneAsCreated(attemptId)
Repo->>DS: 오늘 데이터 저장, FAILED_DATE 제거
Repo-->>VM: FortuneCreateStatus.Success
VM->>UI: 로딩 해제 및 화면 갱신
end
end
%% 익일 자동 리셋
rect rgb(255,250,240)
note over DS: 자정 경과 후 관찰
VM->>DS: isFortuneFailedFlow 구독
DS-->>VM: FAILED=true, FAILED_DATE=어제 -> 자동 리셋 후 false 발행
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
feature/fortune/src/main/java/com/yapp/fortune/FortuneContract.kt (1)
18-18: 속성 네이밍 개선 고려
isCreateFailureDialogVisible보다는isCreationFailureDialogVisible이 더 명확하고 일관된 네이밍일 수 있습니다. "creation failure"가 "create failure"보다 더 자연스러운 영어 표현입니다.- val isCreateFailureDialogVisible: Boolean = false, + val isCreationFailureDialogVisible: Boolean = false,feature/fortune/src/main/java/com/yapp/fortune/FortuneViewModel.kt (2)
67-74: 요구사항 충족: 실패 시 로딩 해제 + 안내 다이얼로그 표시운세 생성 실패를 UI로 명확히 노출하는 흐름이 적절합니다. 현재 목표에 부합합니다.
가능하다면 Failure에 원인 정보가 있다면(에러 코드/메시지) 로그/분석용으로 함께 기록해 두는 것도 고려해 주세요.
76-80: Idle 재발행 시 중복 네비게이션 가능성: distinctUntilChanged 권장상태 흐름이 Idle을 반복 발행하면 네비게이션 사이드이펙트가 중복 발생할 수 있습니다. upstream에 distinctUntilChanged()를 붙이면 안전합니다.
적용 예시(observeFortune 내):
- fortuneRepository.fortuneCreateStatusFlow.collect { status -> + fortuneRepository.fortuneCreateStatusFlow + .distinctUntilChanged() + .collect { status ->필요 시 import:
import kotlinx.coroutines.flow.distinctUntilChanged
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
core/alarm/src/main/java/com/yapp/alarm/receivers/AlarmInteractionActivityReceiver.kt(2 hunks)core/datastore/src/main/java/com/yapp/datastore/FortunePreferences.kt(6 hunks)core/datastore/src/test/kotlin/com/yapp/datastore/FortunePreferencesTest.kt(1 hunks)feature/fortune/src/main/java/com/yapp/fortune/FortuneContract.kt(1 hunks)feature/fortune/src/main/java/com/yapp/fortune/FortuneScreen.kt(3 hunks)feature/fortune/src/main/java/com/yapp/fortune/FortuneViewModel.kt(3 hunks)feature/fortune/src/main/java/com/yapp/fortune/scheduler/WorkManagerPostFortuneTaskScheduler.kt(0 hunks)feature/fortune/src/main/java/com/yapp/fortune/worker/PostFortuneWorker.kt(2 hunks)feature/fortune/src/main/res/values/strings.xml(1 hunks)feature/mission/src/main/java/com/yapp/mission/MissionViewModel.kt(1 hunks)
💤 Files with no reviewable changes (1)
- feature/fortune/src/main/java/com/yapp/fortune/scheduler/WorkManagerPostFortuneTaskScheduler.kt
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-14T15:32:44.064Z
Learnt from: DongChyeon
PR: YAPP-Github/Orbit-Android#252
File: domain/src/main/java/com/yapp/domain/repository/FortuneRepository.kt:16-17
Timestamp: 2025-09-14T15:32:44.064Z
Learning: Fortune creation requests have at least a 1-minute gap between them in the Orbit Android app, making atomic guards for race condition prevention unnecessary in the fortune creation flow.
Applied to files:
feature/mission/src/main/java/com/yapp/mission/MissionViewModel.ktcore/alarm/src/main/java/com/yapp/alarm/receivers/AlarmInteractionActivityReceiver.kt
🧬 Code graph analysis (2)
feature/fortune/src/main/java/com/yapp/fortune/FortuneScreen.kt (1)
core/ui/src/main/java/com/yapp/ui/component/dialog/OrbitDialog.kt (1)
OrbitDialog(35-121)
core/datastore/src/main/java/com/yapp/datastore/FortunePreferences.kt (2)
data/src/main/java/com/yapp/data/local/datasource/FortuneLocalDataSourceImpl.kt (1)
todayEpoch(36-36)core/datastore/src/main/java/com/yapp/datastore/UserPreferences.kt (1)
todayEpoch(31-31)
⏰ 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 (13)
feature/mission/src/main/java/com/yapp/mission/MissionViewModel.kt (1)
145-151: 코드 가독성 향상됨when 표현식을 사용하여
FortuneCreateStatus에 따른 분기 처리가 더 명확해졌습니다. 특히Creating과Failure상태를 동일하게 처리하는 로직이 잘 표현되었습니다.feature/fortune/src/main/java/com/yapp/fortune/FortuneScreen.kt (1)
191-198: 다이얼로그 dismiss 처리 확인 필요
OrbitDialog에onCancel파라미터가 전달되지 않아 사용자가 다이얼로그 외부를 탭하거나 백 버튼을 눌렀을 때도onConfirm(즉,onNavigateToHome)이 호출됩니다. 이것이 의도된 동작인지 확인이 필요합니다.core/datastore/src/test/kotlin/com/yapp/datastore/FortunePreferencesTest.kt (2)
151-179: 실패 후 재시도 테스트 추가 👍운세 생성 실패 후 재시도 시나리오를 검증하는 테스트가 잘 작성되었습니다. 실패 상태가 성공할 때까지 유지되는 것을 확인하는 중요한 테스트입니다.
181-197: 날짜별 실패 상태 자동 초기화 테스트 추가 👍이전 날짜의 실패 상태가 자동으로 초기화되는 것을 검증하는 테스트가 잘 작성되었습니다. 사용자 경험 개선에 중요한 기능입니다.
core/alarm/src/main/java/com/yapp/alarm/receivers/AlarmInteractionActivityReceiver.kt (1)
55-67: 실패 상태 처리 로직 통합
FortuneCreateStatus.Creating과FortuneCreateStatus.Failure를 동일하게 처리하도록 통합한 것이 적절합니다. 두 상태 모두 fortune 화면으로 이동해야 하는 시나리오입니다.feature/fortune/src/main/res/values/strings.xml (1)
3-5: 사용자 친화적인 에러 메시지 👍운세 생성 실패에 대한 명확하고 간결한 안내 메시지입니다. 네트워크 연결 확인을 안내하는 것이 적절합니다.
feature/fortune/src/main/java/com/yapp/fortune/worker/PostFortuneWorker.kt (2)
31-31: 실패 상태에서 재시도 방지
FortuneCreateStatus.Failure일 때Result.failure()를 반환하여 무한 재시도를 방지하는 것이 적절합니다.
58-60: 취소 예외 처리 개선
CancellationException발생 시 실패 상태로 마킹하는 로직이 추가되었습니다. 이는 워커가 취소되었을 때 적절한 상태 관리를 보장합니다.core/datastore/src/main/java/com/yapp/datastore/FortunePreferences.kt (3)
38-38: 실패 날짜 추적 기능 추가
FAILED_DATE키를 추가하여 실패가 발생한 날짜를 추적할 수 있게 되었습니다. 날짜별 실패 상태 관리에 필수적인 기능입니다.
119-138: 날짜 기반 실패 상태 자동 초기화 로직실패 날짜가 오늘이 아닌 경우 자동으로 실패 상태를 초기화하는 로직이 잘 구현되었습니다. 사용자가 다음 날 새로운 시도를 할 수 있도록 보장합니다.
191-191: 성공 시 실패 날짜 정리운세 생성 성공 시
FAILED_DATE를 제거하는 것이 적절합니다. 깔끔한 상태 관리를 보장합니다.feature/fortune/src/main/java/com/yapp/fortune/FortuneViewModel.kt (2)
100-109: 성공 시 다이얼로그 플래그 초기화 OK재시도 성공 시 다이얼로그 상태를 해제하여 UI가 정상 전환되도록 한 점 적절합니다.
137-139: 홈 네비게이션 전에 플래그 클리어 OK — 다이얼로그 cancel 동작만 확인 필요플래그를 먼저 해제하고 네비게이션을 보내는 순서가 안전합니다.
다이얼로그가 뒤로가기/바깥 터치로 취소되지 않도록 설정했는지(혹은 취소 시에도 이 액션을 통해 플래그가 해제되는지) 확인 부탁드립니다. 취소가 가능하지만 플래그가 true로 남으면 Idle 분기에서 홈 이동이 억제되어 화면이 정지될 수 있습니다.
Codecov Report❌ Patch coverage is ❌ Your project status has failed because the head coverage (6.10%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #263 +/- ##
============================================
+ Coverage 5.85% 6.10% +0.24%
Complexity 67 67
============================================
Files 53 53
Lines 4847 4864 +17
Branches 706 712 +6
============================================
+ Hits 284 297 +13
- Misses 4537 4539 +2
- Partials 26 28 +2
🚀 New features to boost your workflow:
|
Related issue 🛠
closed #262
어떤 변경사항이 있었나요?
CheckPoint ✅
PR이 다음 요구 사항을 충족하는지 확인하세요.
Work Description ✏️
Uncompleted Tasks 😅
N/A
To Reviewers 📢
Summary by CodeRabbit
신기능
버그 수정