feat(api,mobile): ADMIN 무제한 우회, Sentry 고도화, 알림 Lock dedup (#217)#218
feat(api,mobile): ADMIN 무제한 우회, Sentry 고도화, 알림 Lock dedup (#217)#218dydals3440 merged 3 commits intomainfrom
Conversation
Summary of ChangesHello @dydals3440, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 백엔드 API와 모바일 애플리케이션 전반에 걸쳐 중요한 기능 개선과 안정성 향상을 목표로 합니다. ADMIN 사용자를 위한 서비스 제한 우회 기능을 도입하여 관리 편의성을 높였고, Sentry 에러 모니터링을 고도화하여 에러 진단 및 디버깅 효율을 개선했습니다. 또한, 알림 시스템에 분산 잠금 기반의 중복 방지 메커니즘을 적용하여 알림의 정확성과 시스템 안정성을 확보했습니다. 마지막으로, 모바일 앱의 알림 라우팅을 조정하고 UI 요소를 다크 모드에 맞게 개선하여 사용자 경험을 향상시켰습니다. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
apps/api/src/instrument.ts
Outdated
| tracesSampleRate: | ||
| Number(process.env.SENTRY_TRACES_SAMPLE_RATE) || | ||
| (process.env.NODE_ENV === "production" ? 0.2 : 1.0), |
There was a problem hiding this comment.
환경변수 SENTRY_TRACES_SAMPLE_RATE가 0으로 설정된 경우, JS의 falsy 체크(||)로 인해 기본값(0.2 또는 1.0)으로 덮어씌워지는 버그가 있습니다. 샘플링을 완전히 끄고 싶은 경우(0)를 위해 환경변수 존재 여부를 먼저 확인하도록 수정해야 합니다.
| tracesSampleRate: | |
| Number(process.env.SENTRY_TRACES_SAMPLE_RATE) || | |
| (process.env.NODE_ENV === "production" ? 0.2 : 1.0), | |
| tracesSampleRate: | |
| process.env.SENTRY_TRACES_SAMPLE_RATE | |
| ? Number(process.env.SENTRY_TRACES_SAMPLE_RATE) | |
| : (process.env.NODE_ENV === "production" ? 0.2 : 1.0), |
| const userInfo = await this.nudgeRepository.getUserSubscriptionInfo(userId); | ||
| const isAdmin = userInfo?.role === "ADMIN"; |
…일관성 통일 - EntitlementService(@global) 생성: CHEER/NUDGE/AI_PARSE 기능별 제한을 역할/구독 상태 기반으로 통합 관리 - AI Parse: 고정 dailyLimit → EntitlementService 위임 (ADMIN/ACTIVE 무제한, FREE/EXPIRED/CANCELLED 5회) - Cheer/Nudge: 리포지토리 구독 조회 제거, EntitlementService로 위임 - AiService/EmailService spec: Test.createTestingModule → Suites TestBed.solitary 패턴 통일 - validators: AI_PARSE_LIMITS 상수 추가, UsageInfo.limit nullable 지원
📋 개요
ADMIN 역할 무제한 우회, Sentry 에러 모니터링 고도화, 알림 중복 방지 Lock 메커니즘 도입, 알림 라우팅 수정, 다크모드 UI 개선
🏷️ 변경 유형
feat- 새로운 기능 추가security- 보안 개선fix- 버그 수정📦 영향 범위
apps/api- NestJS 백엔드apps/mobile- Expo 모바일 앱📝 변경 내용
API (apps/api)
ADMIN 역할 무제한 우회
getUserSubscriptionInfo()메서드 추가 (구독 상태 + 역할 동시 조회)CachedSubscription에isAdmin필드 추가Sentry 고도화
GlobalExceptionFilter:withScope로 에러에 user/tags/extra 컨텍스트 추가instrument.ts:beforeSend콜백으로 민감 헤더(Authorization, Cookie, X-Forwarded-For) 및 token 파라미터 자동 제거main.ts: Graceful shutdown 시 Sentry 버퍼 flush (SIGTERM/SIGINT)SENTRY_TRACES_SAMPLE_RATE환경변수 추가 (동적 샘플링 비율 설정)알림 중복 방지 Lock
NotificationService:ILockProvider기반 분산 잠금으로 dedup race condition 해결Mobile (apps/mobile)
User모델에role필드 추가,isPremiumUser에 ADMIN 체크FOLLOW_ACCEPTED알림 라우팅을/feed로 변경dark:bg-gray-8,dark:border-gray-6,dark:text-gray-4)🧪 테스트
테스트 방법
pnpm test테스트 결과
✅ 체크리스트
작성자 확인
pnpm check(Biome) 검사를 통과했습니다pnpm test)pnpm typecheck)🔗 관련 이슈
Closes #217