Skip to content

[fix] 모르는 서버 enum 값을 기본값으로 덮지 않고 실패시키기 - #157

Merged
UiHyeon-Kim merged 4 commits into
developfrom
fix/unknown-enum-fails-loudly
Sep 18, 2026
Merged

UiHyeon-Kim merged 4 commits into
developfrom
fix/unknown-enum-fails-loudly

Conversation

@UiHyeon-Kim

@UiHyeon-Kim UiHyeon-Kim commented Sep 17, 2026

Copy link
Copy Markdown
Member

작업 요약

서버가 모르는 enum 값을 보낼 때 앱이 조용히 기본값으로 바꿔 보여주던 두 곳을 도메인 예외로 실패하게 바꿨습니다. docs/conventions/mapper.md의 "필수·제어 값은 실패, 선택 값은 drop" 규칙에서 벗어나 있던 마지막 2건입니다.

라이브 Swagger 대조 (2026-09-18)

https://api.stillstar.store/v3/api-docs 기준으로 서버 enum과 도메인 enum이 정확히 일치합니다.

  • MyPageResponse.level, OnboardingRequest.level, PracticeVisitResponse.newLevel: SEED, ROOKIE, OWNER, EXPLORER, NAVIGATOR = OnboardingLevel
  • PracticeItem.status, PracticeRegisterResponse.status: PLANNED, VISITED, NOT_VISITED = PracticeStatus
  • OnboardingRequest.soloParkingLevel은 서버가 WIDE_ONLY/FAMILIAR_PLACE로 앱과 이름이 다른데, OnboardingMapper가 이미 명시적 when으로 변환하고 있어 문제 없습니다

지금 깨지는 값은 없고, 서버가 값을 추가했을 때 조용히 틀리는 구조를 고치는 변경입니다.

주요 변경사항

  • MemberMapper: 모르는 레벨 → SEED 대체를 없애고 AuthException.Unknown으로 실패 (member 계층이 이미 쓰는 예외)
  • PracticeMapper: 모르는 연습 상태 → PLANNED 대체를 없애고 PracticeException.Unexpected로 실패
  • 두 곳 모두 원래 값은 Timber 경고로 남기고, 화면에는 안내 문구만 보여줍니다
  • 폴백을 검증하던 테스트 2개를 실패 검증으로 바꾸고, 정상 레벨 매핑 테스트를 추가
  • docs/BACKLOG.md: 이 항목 완료 처리, 새로 발견한 문제 1건 기록

사용자에게 보이는 모습 (크래시 아님)

모르는 값이 오면 앱이 죽지 않고 해당 화면이 에러 안내로 바뀝니다. 경로별로 확인했습니다.

  • 마이페이지 프로필(레벨): 화면 상단 스낵바 "프로필을 불러오지 못했어요. 잠시 후 다시 시도해 주세요."
  • 마이페이지 연습기록(상태): 연습기록 영역에 인라인 에러 + 다시 시도
  • 연습 등록·방문 인증(상태): 홈 스낵바 "연습 정보를 불러오지 못했어요. 잠시 후 다시 시도해 주세요."

member API 경로에서 PracticeException을 던지면 AuthErrorMapper가 "알 수 없는 오류가 발생했습니다."로 덮어써서, 마이페이지 경로만 member 계층 예외(AuthException)로 던지도록 맞췄습니다.

리뷰 포인트

  • 동작이 바뀝니다. 서버가 새 레벨이나 새 연습 상태를 추가하면, 예전에는 잘못된 값으로 화면이 그려졌고 이제는 해당 화면이 에러로 표시됩니다. 사용자에게는 "프로필을 불러오지 못했어요" / "연습 기록을 불러오지 못했어요"가 보입니다
  • 연습 기록 목록은 항목 하나가 모르는 상태면 목록 전체가 실패합니다. 규칙(제어 값은 실패)을 그대로 따른 결과입니다. 항목만 빼고 나머지를 보여주는 쪽이 낫다고 보시면 그렇게 바꾸겠습니다
  • 새로 발견한 별개 문제: MyPageResponsenickname: String = "", level: String = "" 같은 기본값을 갖고 있어 서버가 필드를 빼먹어도 파싱이 성공합니다. 이번 스코프에서 빼고 BACKLOG에 적었습니다

검증

  • assembleDebug, 전체 test --rerun-tasks 통과 (:core:data 152개 실패 0)
  • check-conventions.sh BLOCK 통과, WARN 8건(변경 없음)
  • 화면 동작은 서버가 모르는 값을 보내야 재현되므로 기기 확인은 하지 않았습니다

🤖 Generated with Claude Code

- MyPage 레벨은 SEED, 연습 상태는 PLANNED로 대체하던 폴백을 제거하고 도메인 예외를 던진다
- 두 값 모두 화면 분기를 결정하는 제어 값이라 조용히 틀리면 사용자가 잘못된 정보를 믿게 된다
- 폴백을 검증하던 테스트를 실패 검증으로 바꾸고 레벨 매핑 테스트를 추가
- 응답 DTO 기본값이 누락 필드를 가리는 별개 문제를 BACKLOG에 기록

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ca260c25-1522-4a19-a971-3a72aa32cf46

📥 Commits

Reviewing files that changed from the base of the PR and between b660305 and 37cb09a.

📒 Files selected for processing (5)
  • core/data/src/main/java/com/dororong/rodi/core/data/mapper/MemberMapper.kt
  • core/data/src/main/java/com/dororong/rodi/core/data/mapper/PracticeMapper.kt
  • core/data/src/test/java/com/dororong/rodi/core/data/mapper/MemberMapperTest.kt
  • core/data/src/test/java/com/dororong/rodi/core/data/mapper/PracticeMapperTest.kt
  • docs/BACKLOG.md

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.

UiHyeon-Kim and others added 3 commits September 18, 2026 20:12
PracticeException을 던지면 AuthErrorMapper가 "알 수 없는 오류"로 덮어써서 사용자에게
원인이 안 보인다. 같은 규칙을 member 경로에서는 AuthException으로 적용한다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@UiHyeon-Kim
UiHyeon-Kim merged commit 3018390 into develop Sep 18, 2026
3 checks passed
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.

1 participant