[Fix] 강제 로그아웃 시 전송 대기 행 보존 #602 - #603
Open
edv-Shin wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#️⃣연관된 이슈
Closes #602
📝작업 내용
강제 로그아웃이 서버로 올리지 못한 전송 대기 행을 함께 지우고 있었습니다. 정리 범위를 이탈 이유가 정하도록 바꿨습니다.
SessionExitReason을 추가하고ClearSessionUseCase(reason)로 받습니다. 호출부는 무엇을 지울지 고르지 않고 무슨 일이 있었는지만 알립니다.USER_INITIATED로그아웃, 탈퇴FORCED토큰 만료, 갱신 실패, 진입 실패MainViewModel.transitionToLogin()은FORCED입니다. 트리거 6개(진입 플로우 예외,!isAuthorized,memberId유실,invalid_grant,NoRefreshToken,forceLogoutFlow)가 전부 사용자가 의도하지 않은 경로입니다SettingViewModel.clearLocalSession()은USER_INITIATED입니다AuthRepository에clearTokens()를 추가했습니다.clearSession()은 토큰과 회원ID를 모두 지웁니다AGENTS.md§5.9에 이탈 이유별 범위와 회원ID를 남기는 이유를 적었습니다💬리뷰 요구사항(선택)
이슈 본문에는
SessionDataCleaner에 "동기화 완료 행만 지우는 연산"을 추가한다고 적었는데 구현에서 빼고 캐시를 아예 건드리지 않는 쪽으로 갔습니다. 동기화 완료 행은memberId스코프가 걸려 있고 다른 계정이 로그인하면 계정 전환 감지가 전부 지우므로 남겨도 무해합니다. 테이블별 삭제 쿼리를 만들 이유가 없었습니다.핵심은 회원ID를 남기는 쪽이었습니다.
AuthRepositoryImpl.replaceMemberId가spManager.getMemberId() != memberId로 계정 전환을 판정하는데, 강제 로그아웃에서 회원ID를 지우면 재로그인 때null != memberId가 참이 되어 캐시가 지워집니다. 대기 행을 남겨도 재로그인 한 번에 사라집니다. 회원ID를 남겨야 같은 계정으로 판정되어 보존이 실제로 유지됩니다.회원ID가 토큰 없이 기기에 남는 것이 걸리는 부분이 있으면 봐주시면 좋겠습니다. 평문 SharedPreferences에 이미 저장되던 값이고, 토큰이 없으면
EntryState.Login에서 막혀 화면에 도달하지 않습니다.✅검증
ktlintCheck,:domain:test,:data:testDebugUnitTest,:app:testDebugUnitTest,:feature:profile:testDebugUnitTest,:app:assembleDebug로컬 통과. base가dev이므로dev-ci도 함께 돕니다.ClearSessionUseCaseTest를 7건으로 재작성했습니다. 사용자 이탈 4건(전체 삭제, 캐시 삭제, 캐시를 지운 뒤 세션 정리, 캐시 삭제 실패해도 예약과 세션 정리), 강제 이탈 2건(캐시 미삭제, 토큰만 삭제), 공통 1건(이유와 무관한 예약 취소)입니다.