Skip to content

fix: JVM 시간대 ≠ JDBC 연결 시간대면 기동 거부 + 테스트 JVM 을 Asia/Seoul 로 (#846) - #847

Merged
Khyojae merged 1 commit into
mainfrom
fix/846-jvm-timezone
Nov 8, 2026
Merged

Khyojae merged 1 commit into
mainfrom
fix/846-jvm-timezone

Conversation

@Khyojae

@Khyojae Khyojae commented Nov 8, 2026

Copy link
Copy Markdown
Member

Closes #846

원인

같은 «세션 시작 시각» 을 두 경로가 다르게 쓴다.

  • exercise_sessions.start_time: Hibernate 가 JVM 시간대 → URL serverTimezone=Asia/Seoul 로 변환해서 쓴다
  • pose_data.created_at: PoseDataService 의 JdbcTemplate setObject(LocalDateTime) 가 변환 없이 쓴다

JVM 이 KST 가 아니면 두 값이 9시간 어긋난다. 그러면 완료 집계(findRepSummaries, created_at = 시작 시각)가 rep 을 못 찾아 싱크 통계·세트·리포트가 오류 없이 빈다. CI 러너(JVM UTC)에서 RejectedAttemptRaceTest 가 이 이유로만 실패했다. 재현과 값은 #846 댓글에 있다.

운영·dev 는 컨테이너 TZ=Asia/Seoul 로 이미 맞아 있어 지금 영향은 없다. 다만 그 전제가 어디에도 강제돼 있지 않았다.

변경

  • build.gradle: 테스트 JVM -Duser.timezone=Asia/Seoul (운영과 같게)
  • JvmTimezoneStartupCheck (새 빈): URL 의 connectionTimeZone/serverTimezone 과 JVM 시간대 규칙이 다르면 기동 거부. URL 에 시간대가 없거나 LOCAL 이면 통과(드라이버가 변환하지 않는다). MySQL 이 아니면 건너뜀

저장 코드를 시간대와 무관하게 바꾸는 근본 수정은 범위 밖이다. 같은 패턴이 RejectedAttemptService·FeedbackLogService·PoseDataOrphanMonitor 에도 있어, 분기 문서가 필요한 크기다.

검증

  • JVM UTC 호스트(JAVA_TOOL_OPTIONS=-Duser.timezone=UTC, CI 조건)에서 RejectedAttemptRaceTest 5/5. 수정 전 같은 조건에서 70.67 ≠ 42.0 재현
  • 판정 단위 테스트 5/5 · ShadowfitApplicationTests(H2) · BinlogFormatStartupCheckRaceTest(실 MySQL 컨텍스트) 통과
  • 로컬 compose: TZ=Asia/Seoul → JVM 시간대 확인 — Asia/Seoul 후 UP. TZ=UTC 로 띄우면 BeanCreationException 으로 기동 중단
  • CI 전체 스위트 — 다른 테스트가 UTC JVM 에 기대고 있었는지는 이 PR 의 CI 로 확인

🤖 Generated with Claude Code

세션 시작 시각은 Hibernate 가 JVM→serverTimezone 으로 변환해 쓰고, pose_data.created_at 은
JdbcTemplate setObject(LocalDateTime) 로 변환 없이 쓴다. 두 시간대가 다르면 9시간 어긋나
완료 집계(findRepSummaries 의 created_at = 시작 시각)가 rep 을 못 찾고 통계·세트·리포트가 오류 없이 빈다.
CI(JVM UTC)에서 RejectedAttemptRaceTest 가 처음부터 이 이유로만 실패했다(로컬 KST 는 통과).

- build.gradle: 테스트 JVM -Duser.timezone=Asia/Seoul (운영 컨테이너 TZ 와 같게)
- JvmTimezoneStartupCheck: URL 의 connectionTimeZone/serverTimezone 과 JVM 시간대 규칙이 다르면 기동 거부.
  운영은 TZ=Asia/Seoul 로 이미 맞아 있어 동작 변화 없음 — 숨은 전제를 강제하는 것

검증: UTC 호스트에서 RejectedAttemptRaceTest 5/5(전엔 같은 조건에서 70.67≠42.0 재현) · 판정 단위 5/5 ·
H2 컨텍스트 · 실 MySQL 컨텍스트 통과. 로컬 compose: TZ=Asia/Seoul 이면 «JVM 시간대 확인» 후 UP,
TZ=UTC 로 띄우면 BeanCreationException 으로 기동 중단.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Khyojae

Khyojae commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 8, 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 10 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

Commits

Reviewing files that changed from the base of the PR and between 5aca94f and 0da707f.

Files selected for processing: 3

  • backend/build.gradle
  • backend/src/main/java/com/shadowfit/global/config/JvmTimezoneStartupCheck.java
  • backend/src/test/java/com/shadowfit/global/config/JvmTimezoneStartupCheckTest.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

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Khyojae
Khyojae merged commit f876c08 into main Nov 8, 2026
3 checks passed
@Khyojae
Khyojae deleted the fix/846-jvm-timezone branch November 8, 2026 05:55
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.

test: RejectedAttemptRaceTest 가 추가된 날부터 실패 — avg_sync_rate 기대 70.67, 실제 42.0 (main CI 빨간불)

1 participant