Skip to content

fix: 예약 시각 판단을 서버 시간대가 아닌 한국 시간 Clock으로 한다 - #142

Merged
ff1451 merged 2 commits into
mainfrom
fix/reservation-timezone
Oct 16, 2026
Merged

ff1451 merged 2 commits into
mainfrom
fix/reservation-timezone

Conversation

@ff1451

@ff1451 ff1451 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

#141(테스트 인프라) 위에 쌓인 PR이다. #141이 머지되면 base가 main으로 바뀐다.

요약

예약 서비스가 LocalDate.now()·ZoneId.systemDefault()로 "지금"을 판단했다. 운영 컨테이너는 시간대 설정이 없어 UTC이므로 다음이 가능했다.

  • 한국 시각으로 이미 지난 시간을 최대 9시간까지 예약(예: 오전 10시에 같은 날 오전 8시 예약)
  • 이미 시작한 예약을 최대 9시간 뒤까지 취소
  • 00~09시(KST)에는 "오늘" 기준(단건 예약 가능 기간 14일, 내 예약의 지난/다가올 구분)이 하루 어긋남

변경

  • 장부에서만 쓰던 Asia/Seoul Clock 빈(ledger/config/LedgerTimeConfig)을 global/config/TimeConfig로 옮기고 ReservationService에 주입한다. 장부 서비스는 타입으로 주입받고 있어 영향 없음.
  • 테스트용 MutableClock을 공용 테스트 패키지로 옮기고, 예약 테스트의 날짜 계산을 한국 날짜로 바꿨다(UTC인 CI에서도 서버와 같은 "오늘").

테스트

  • 신규 ReservationTimeZoneIntegrationTest 3건: 한국 시각 09:30 기준 09:00 예약 거부(400), 10:00 예약 허용, 10:30에 10:00 예약 취소 거부(409).
    • 수정 전 코드로 돌리면 2건 실패(지난 시간 예약 200, 시작한 예약 취소 204)를 확인했다.
  • 로컬 전체 ./gradlew test: 535건 중 534 통과, 1 스킵.

예약 서비스가 LocalDate.now()와 ZoneId.systemDefault()를 써서, UTC인 운영 컨테이너에서는
한국 시각으로 이미 지난 시간을 최대 9시간까지 예약하거나, 시작한 예약을 취소할 수 있었다.
"오늘" 기준(예약 가능 기간, 지난/다가올 예약 구분)도 00~09시 사이에 하루 어긋났다.

- 장부용이던 Asia/Seoul Clock 설정을 global/config/TimeConfig로 옮기고 예약 서비스에 주입한다.
- 테스트용 MutableClock을 공용 테스트 패키지로 옮기고, 예약 테스트의 날짜도 한국 날짜로 계산한다.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next included review available in 56 minutes.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0a6ab68f-fc66-4e06-82e8-16d32e716c79
📥 Commits

Reviewing files that changed from the base of the PR and between 012c531 and 2471d2e.

📒 Files selected for processing: 13
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/global/config/TimeConfig.java
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/ledger/config/LedgerTimeConfig.java
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/reservation/service/ReservationService.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/MutableClock.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/ledger/LedgerIntegrationTestSupport.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/reservation/MyReservationIntegrationTest.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/reservation/ReservationCancelIntegrationTest.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/reservation/ReservationConcurrencyTest.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/reservation/ReservationCreateIntegrationTest.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/reservation/ReservationDetailIntegrationTest.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/reservation/ReservationRepeatCreateIntegrationTest.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/reservation/ReservationStatusIntegrationTest.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/reservation/ReservationTimeZoneIntegrationTest.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@ff1451
ff1451 changed the base branch from refactor/test-infra to main October 16, 2026 07:07
@ff1451
ff1451 merged commit ff8f676 into main Oct 16, 2026
2 checks passed
@ff1451
ff1451 deleted the fix/reservation-timezone branch October 16, 2026 07:20
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