Skip to content

[FEAT] OAuth 인가 요청 만료 데이터 삭제 배치 처리 - #166

Merged
ownue merged 1 commit into
developfrom
feat/#32-batch-delete-oauth-authorization-request
Sep 8, 2026
Merged

ownue merged 1 commit into
developfrom
feat/#32-batch-delete-oauth-authorization-request

Conversation

@ownue

@ownue ownue commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📌 관련 이슈

✨ 작업 내용

  • 만료 후 7일이 지난 oauth_authorization_request 데이터를 매일 새벽 3시에 삭제하도록 배치를 추가
  • LEGACY, ISSUED, SUCCEEDED, FAILED 상태만 삭제하고, 처리 중인 PROCESSING 상태는 보존하도록 구성
  • Blue/Green 환경에서 스케줄러가 동시에 실행되지 않도록 ShedLock을 적용
  • OAuth 요청 생성/검증/복구/정리 시각이 동일한 기준을 사용하도록 Clock 주입 방식으로 통일
  • 만료 경계값, 삭제 가능 상태, PROCESSING 상태 보존 및 7일 보존 기간을 검증하는 테스트를 추가

📸 UI 작업 시

X

✅ 체크 리스트

  • develop 브랜치를 pull 완료했는가?
  • Merge 하려는 브랜치가 올바른가?
  • Merge 하려는 PR 및 Commit들을 로컬에서 실행했을 때 에러가 발생하지 않았는가?

Summary by CodeRabbit

  • 새로운 기능

    • 만료된 OAuth 인증 요청을 매일 자동으로 정리합니다.
    • 7일 이상 지난 요청 중 지정된 상태의 요청만 삭제합니다.
    • 서울 시간대 기준으로 실행 시간을 설정할 수 있습니다.
  • 버그 수정

    • 만료 기준 시점에 해당하는 요청도 정리 대상에 포함됩니다.
  • 테스트

    • 만료 요청 정리 및 상태별 삭제 동작에 대한 검증을 추가했습니다.

@ownue ownue self-assigned this Sep 8, 2026
@ownue ownue added the ✨ Feat label Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: ad856e01-46c1-4b17-9e06-5b74807d6fd9

📥 Commits

Reviewing files that changed from the base of the PR and between 1f3c378 and 40d9d2b.

📒 Files selected for processing (6)
  • src/main/java/com/example/todayEng/domain/user/repository/OAuthAuthorizationRequestRepository.java
  • src/main/java/com/example/todayEng/domain/user/service/OAuthAuthorizationRequestCleanupScheduler.java
  • src/main/java/com/example/todayEng/domain/user/service/OAuthAuthorizationRequestRecoveryScheduler.java
  • src/main/java/com/example/todayEng/domain/user/service/OAuthAuthorizationRequestService.java
  • src/test/java/com/example/todayEng/domain/user/repository/OAuthAuthorizationRequestRepositoryTest.java
  • src/test/java/com/example/todayEng/domain/user/service/OAuthAuthorizationRequestCleanupSchedulerTest.java

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

OAuth 인가 요청 저장소에 상태 기반 만료 삭제 조건을 추가했습니다. 7일 보존 기준의 일일 정리 스케줄러를 추가했습니다. 서비스와 스케줄러의 시간 계산에 주입된 Clock을 사용합니다. 저장소 및 스케줄러 테스트를 추가했습니다.

Changes

OAuth 인가 요청 정리

Layer / File(s) Summary
저장소 삭제 조건과 검증
src/main/java/com/example/todayEng/domain/user/repository/OAuthAuthorizationRequestRepository.java, src/test/java/com/example/todayEng/domain/user/repository/OAuthAuthorizationRequestRepositoryTest.java
deleteExpiredRequests가 기준 시각을 포함하고, LEGACY, ISSUED, SUCCEEDED, FAILED 상태만 삭제합니다. 경계 시각, 각 상태, PROCESSING 상태 보존을 테스트합니다.
시간 소스 주입
src/main/java/com/example/todayEng/domain/user/service/OAuthAuthorizationRequestService.java, src/main/java/com/example/todayEng/domain/user/service/OAuthAuthorizationRequestRecoveryScheduler.java
OAuth 인가 요청 발급, 처리 시작, 실패 처리, 복구 스케줄러가 주입된 Clock으로 현재 시각을 계산합니다.
만료 요청 정리 스케줄러
src/main/java/com/example/todayEng/domain/user/service/OAuthAuthorizationRequestCleanupScheduler.java, src/test/java/com/example/todayEng/domain/user/service/OAuthAuthorizationRequestCleanupSchedulerTest.java
매일 기본 오전 3시에 7일 이상 지난 삭제 가능 요청을 정리합니다. 실행 시간대와 cron을 설정할 수 있으며, ShedLock으로 중복 실행을 제한합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 40d9d

Expired OAuth authorization requests are now removed daily after seven days only for terminal or legacy states, while processing requests remain preserved. The deletion scope and retention boundary are covered by the current implementation and tests.

Sequence Diagram(s)

sequenceDiagram
  participant OAuthAuthorizationRequestCleanupScheduler
  participant Clock
  participant OAuthAuthorizationRequestRepository
  participant OAuthAuthorizationRequestTable
  OAuthAuthorizationRequestCleanupScheduler->>Clock: 현재 시각 조회
  Clock-->>OAuthAuthorizationRequestCleanupScheduler: 기준 시각 반환
  OAuthAuthorizationRequestCleanupScheduler->>OAuthAuthorizationRequestRepository: 만료 요청 삭제 호출
  OAuthAuthorizationRequestRepository->>OAuthAuthorizationRequestTable: 기준 시각 및 상태 조건 적용
  OAuthAuthorizationRequestTable-->>OAuthAuthorizationRequestRepository: 삭제 건수 반환
  OAuthAuthorizationRequestRepository-->>OAuthAuthorizationRequestCleanupScheduler: 삭제 결과 반환
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 OAuth 인가 요청 만료 데이터 삭제 배치 처리라는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Linked Issues check ✅ Passed 직접 연결된 이슈 [#32]의 주기적 oauth_authorization_request 정리 요구를 충족합니다. 만료 후 7일이 지난 데이터를 정리하고, 배치 스케줄러와 삭제 조건을 구현했습니다. 7일 보존 기간은 이슈의 기간 요구를 구체화한 내용입니다.
Out of Scope Changes check ✅ Passed 변경 사항은 [#32]의 배치 삭제 목적과 직접 관련됩니다. 삭제 대상 상태 제한, ShedLock 적용, Clock 주입, 저장소 변경, 관련 테스트는 배치 동작의 정확성과 중복 실행 방지를 지원합니다.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#32-batch-delete-oauth-authorization-request

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.

@ownue
ownue merged commit 5cb9f9d into develop Sep 8, 2026
2 checks passed
@ownue
ownue deleted the feat/#32-batch-delete-oauth-authorization-request branch September 8, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [FEAT] oauth_authorization_request 테이블 삭제 배치 처리

1 participant