[SOU-647] FCM 토큰 API 연동#75
Conversation
|
Warning Review limit reached
More reviews will be available in 52 minutes and 43 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (40)
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.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0e87720. Configure here.
| } | ||
|
|
||
| private func registerIfNeeded(fcmToken: String) async { | ||
| guard await checkFullAuthentication.execute() else { return } |
There was a problem hiding this comment.
No FCM sync after login
Medium Severity
FCM server registration runs only when the token stream emits or on sceneDidBecomeActive. If the FCM token is already known while the user is logged out, registerIfNeeded returns early and nothing retries after login or auto-login until the app backgrounds or the token changes.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0e87720. Configure here.
| func makePushTokenSyncer() -> PushTokenSyncing { | ||
| let deviceIdStore = DeviceIdStore( | ||
| keychain: keychainFactory.makeKeychainStorage() | ||
| ) |
There was a problem hiding this comment.
Split device ID stores desync
Medium Severity
Registration reads deviceId from a DeviceIdStore created in AppFactory, while logout deactivation uses a separate cached store in DataFactory. Two actors can each mint a UUID before either writes Keychain, so register and deactivate may use different IDs.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0e87720. Configure here.
| } | ||
|
|
||
| public func execute() async throws { | ||
| try? await deactivateFCMToken.execute() |
There was a problem hiding this comment.
Logout races FCM registration
Medium Severity
LogoutUseCase deactivates the FCM token then clears auth, but an in-flight registerFCMToken started earlier can still complete with a valid bearer token and re-register the device after deactivation.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0e87720. Configure here.


📌 변경 요약
SOU-647 FCM 토큰 API 연동 Story입니다.
로그인 사용자의 FCM 토큰을 서버에 등록·갱신하고, 로그아웃 시 디바이스 토큰을 비활성화하는 Domain/Data/App 연결을 추가했습니다.
📌 변경 내용
POST /api/users/me/fcm-tokens,DELETE /api/users/me/fcm-tokens?deviceId=Endpoint, DTO, RemoteDataSource, Repository 구현을 추가했습니다.deviceId를 Keychain에 저장하고 FCM 등록 요청 메타데이터에 연결했습니다.tuist test에서 누락되지 않도록VERIFY_TEST_SCHEME지정 시xcodebuild test경로를 사용하게 검증 스크립트를 보강했습니다.📌 기타 참고 사항
검증:
VERIFY_TEST_SCHEME="Domain" docs/harness/scripts/verify.sh story수집-Debugbuild 통과DomainTests: 86 tests, 0 failuresdevelop 변경 확인:
e7210e9base_commit..origin/develop변경 파일: 없음base_commit..HEAD변경 파일: 40개관련 문서:
docs/goals/fcm/goal.mddocs/goals/fcm/stories/fcm-token-api/story.mddocs/goals/fcm/stories/fcm-token-api/plans/2026-06-07-token-api/plan.mdNote
Medium Risk
Touches authenticated API calls, logout ordering, and app-wide DI/bootstrap; failures are mostly logged or swallowed on deactivate, so server/device token state could drift without blocking logout.
Overview
로그인 사용자 FCM 토큰을 서버에 등록·갱신하고, 로그아웃 시 디바이스 토큰 비활성화까지 Domain → Data → App으로 연결합니다. 기존
DeferredPushTokenSyncer(로그만)는 제거되고, 인증 상태·KeychaindeviceId·기기 메타데이터를 포함해POST/DELETE/api/users/me/fcm-tokens를 호출하는 경로로 바뀝니다.Domain에
FCMRegistration, register/deactivate UseCase,FCMRepository가 추가되고 로그아웃 UseCase는 FCM 비활성화를 먼저 시도하되(try?) 실패해도 auth logout은 그대로 진행합니다. App은AppContainer부트스트랩으로 FCM·DefaultPushTokenSyncer를 묶고, 토큰 스트림 구독과 씬 활성화 시 재동기화를 넣습니다.검증 하네스는 모듈 스킴(
VERIFY_TEST_SCHEME)일 때 **tuist test대신xcodebuild test**를 쓰도록verify.sh와 관련 문서·스킬을 맞춥니다. Domain FCM·로그아웃 단위 테스트가 추가됩니다.Reviewed by Cursor Bugbot for commit 0e87720. Configure here.