Skip to content

fix: 팀원 모집 마감 배치의 모집별 트랜잭션 격리 - #2394

Merged
taejinn merged 1 commit into
developfrom
fix/2381-team-recruitment-deadline-batch-isolation
Sep 2, 2026
Merged

fix: 팀원 모집 마감 배치의 모집별 트랜잭션 격리#2394
taejinn merged 1 commit into
developfrom
fix/2381-team-recruitment-deadline-batch-isolation

Conversation

@taejinn

@taejinn taejinn commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🔍 개요

  • 팀원 모집 마감 배치에서 한 모집의 실패를 해당 모집 transaction으로 격리하고 다음 모집을 계속 처리합니다.

🚀 주요 변경 내용

  • 마감 후보를 ID 오름차순으로 최대 100개 조회합니다.
  • 별도 processor Bean이 모집별 REQUIRES_NEW transaction으로 처리합니다.
  • 실패한 모집은 해당 transaction을 rollback하고 recruitmentId를 로그에 기록합니다.
  • 다음 모집은 독립 transaction으로 마감 처리를 계속합니다.
  • 정상 모집의 CLOSED, 대기 지원서 REJECTED, 방 READ_ONLY, 알림·outbox 결과를 유지합니다.

💬 참고 사항

  • 영향
    • 심각도는 P3 운영 안정성 보강이며 클라이언트는 기존 API 계약을 그대로 사용합니다.
    • scheduler coordinator와 모집별 transaction processor를 분리합니다.
  • 검증
    • 손상 모집 A의 상태·지원서·채팅방·알림·outbox rollback과 같은 배치의 정상 모집 B commit을 확인했습니다.
    • ./gradlew check --no-daemon --max-workers=1 결과 총 1,056 tests, failures 0, errors 0, skipped 3입니다.

✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

Summary by CodeRabbit

  • Bug Fixes

    • Expired team recruitments are now processed reliably in batches.
    • A failure closing one recruitment no longer prevents other expired recruitments from being closed.
    • Each recruitment is handled independently, preserving successful updates while rolling back failed closures.
  • Tests

    • Added coverage for batch processing, failure isolation, rollback behavior, notifications, and room status updates.

@taejinn taejinn added 버그 정상적으로 동작하지 않는 문제상황입니다. 공통 백엔드 공통으로 작업할 이슈입니다. labels Aug 31, 2026
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 34101b84-ce80-4c49-86c9-33f9da9e8177

📥 Commits

Reviewing files that changed from the base of the PR and between 199149c and e81c2f7.

📒 Files selected for processing (6)
  • src/main/java/in/koreatech/koin/domain/team/recruitment/scheduler/TeamRecruitmentDeadlineCloseCoordinator.java
  • src/main/java/in/koreatech/koin/domain/team/recruitment/scheduler/TeamRecruitmentDeadlineCloseProcessor.java
  • src/main/java/in/koreatech/koin/domain/team/recruitment/scheduler/TeamRecruitmentDeadlineScheduler.java
  • src/test/java/in/koreatech/koin/acceptance/domain/TeamRecruitmentDeadlineCloseIntegrationTest.java
  • src/test/java/in/koreatech/koin/unit/domain/team/recruitment/scheduler/TeamRecruitmentDeadlineCloseCoordinatorTest.java
  • src/test/java/in/koreatech/koin/unit/domain/team/recruitment/scheduler/TeamRecruitmentDeadlineCloseProcessorTest.java

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


📝 Walkthrough

Walkthrough

Changes

The deadline close flow now uses a coordinator to find expired recruitments. The processor closes each recruitment in an independent transaction. Tests verify candidate ordering, failure isolation, rollback, and successful subsequent processing.

Team recruitment deadline closing

Layer / File(s) Summary
Isolated close processing
src/main/java/.../TeamRecruitmentDeadlineCloseProcessor.java, src/test/java/.../TeamRecruitmentDeadlineCloseProcessorTest.java
The processor exposes closeIfExpired(Integer, LocalDate) with REQUIRES_NEW. Processor tests use locked recruitment fixtures and the updated method.
Coordinated candidate processing
src/main/java/.../TeamRecruitmentDeadlineCloseCoordinator.java, src/main/java/.../TeamRecruitmentDeadlineScheduler.java, src/test/java/.../TeamRecruitmentDeadlineCloseCoordinatorTest.java
The coordinator queries up to 100 expired recruitments in ascending ID order, computes the KST date, and continues after individual failures. The scheduler delegates to the coordinator.
Database failure isolation validation
src/test/java/.../TeamRecruitmentDeadlineCloseIntegrationTest.java
The integration test verifies rollback for a failed recruitment and successful closure of a subsequent recruitment, including related applications, chat rooms, notifications, and outbox events.

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

Merge Risk: 🟡 Moderate · up to e81c2

The change isolates failures between recruitments, but repeatedly retrying only the first 100 eligible records can leave later expired recruitments—and their chat rooms—open beyond the deadline when early records fail persistently. Merge should wait for a progress mechanism or explicit owner acceptance of this bounded risk.

Sequence Diagram(s)

sequenceDiagram
  participant Scheduler
  participant Coordinator
  participant Repository
  participant CloseProcessor
  Scheduler->>Coordinator: closeExpiredRecruitments()
  Coordinator->>Repository: Query expired recruiting recruitments
  Repository-->>Coordinator: Return recruitment page
  Coordinator->>CloseProcessor: closeIfExpired(recruitmentId, today)
  CloseProcessor-->>Coordinator: Complete or throw exception
  Coordinator->>CloseProcessor: Process next recruitment
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 22 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 The title clearly describes the main change: isolating transactions per recruitment in the team recruitment deadline batch.
Linked Issues check ✅ Passed The changes satisfy issue #2381. The coordinator processes up to 100 candidates in ID order, each recruitment runs in a separate REQUIRES_NEW transaction, failures log the recruitmentId and do not sto…
Out of Scope Changes check ✅ Passed All production and test changes support the linked issue. The PR adds the coordinator, isolates per-recruitment transactions, updates the scheduler dependency, and verifies rollback and continued proc…
Full details: Linked Issues check

Explanation

The changes satisfy issue #2381. The coordinator processes up to 100 candidates in ID order, each recruitment runs in a separate REQUIRES_NEW transaction, failures log the recruitmentId and do not stop later processing, failed data rolls back, valid data commits, and no room recreation or client/schema change is introduced.

Full details: Out of Scope Changes check

Explanation

All production and test changes support the linked issue. The PR adds the coordinator, isolates per-recruitment transactions, updates the scheduler dependency, and verifies rollback and continued processing without unrelated changes.

  • 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 fix/2381-team-recruitment-deadline-batch-isolation

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.

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown

Unit Test Results

1 112 tests   1 109 ✔️  2m 32s ⏱️
   249 suites         3 💤
   249 files           0

Results for commit e81c2f7.

♻️ This comment has been updated with latest results.

@taejinn
taejinn force-pushed the fix/2381-team-recruitment-deadline-batch-isolation branch from 1d56b91 to 1f165f5 Compare September 2, 2026 06:44
@taejinn
taejinn marked this pull request as ready for review September 2, 2026 12:58
@github-actions
github-actions Bot requested review from dh2906 and kih1015 September 2, 2026 12:59
@taejinn
taejinn requested review from dnjswldnd-3513 and insik03 and removed request for dh2906 and kih1015 September 2, 2026 13:03
@taejinn
taejinn force-pushed the fix/2381-team-recruitment-deadline-batch-isolation branch from 1f165f5 to e81c2f7 Compare September 2, 2026 15:20
@taejinn
taejinn merged commit 2004995 into develop Sep 2, 2026
7 checks passed
@taejinn
taejinn deleted the fix/2381-team-recruitment-deadline-batch-isolation branch September 2, 2026 15:29
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.

[공통] 팀원 모집 마감 배치의 모집별 실패 격리

2 participants