Skip to content

Bug/#66#68

Merged
Hgyeol merged 4 commits intodevelopfrom
bug/#66
Sep 4, 2025
Merged

Bug/#66#68
Hgyeol merged 4 commits intodevelopfrom
bug/#66

Conversation

@fixgramwork
Copy link
Member

@fixgramwork fixgramwork commented Sep 3, 2025

  • Test 코드 오류 수정

Summary by CodeRabbit

  • 테스트

    • 교실 목록 조회 테스트가 숫자 ID 대신 UUID를 사용하도록 정비하여 식별자 표현을 일관화했습니다. 토큰 추출과 사용자 식별, 서비스 호출, 응답 상태/본문/항목 검증 흐름은 그대로 유지됩니다.
  • Chores

    • 운영 환경에서 JPA의 스키마 자동 갱신을 비활성화했습니다. 애플리케이션 기동 시 자동으로 스키마가 변경되지 않도록 하여 배포 안정성과 예기치 않은 구조 변경을 방지합니다.

@coderabbitai
Copy link

coderabbitai bot commented Sep 3, 2025

Walkthrough

테스트에서 ClassRoomControllerTest가 Long ID 대신 UUID를 사용하도록 변경되었고, 프로덕션 설정에서 spring.jpa.hibernate.ddl-auto가 update에서 none으로 수정되었습니다.

Changes

Cohort / File(s) Summary of Changes
테스트: ID 타입을 UUID로 전환
src/test/java/.../ClassRoomControllerTest.java
테스트 데이터에서 classRoomId와 userId를 UUID로 생성/할당하도록 수정. 나머지 테스트 흐름(토큰 추출, userId 조회, 서비스 호출, 응답 검증)은 동일.
프로덕션 설정: Hibernate DDL 전략 수정
src/main/resources/application-prod.yml
spring.jpa.hibernate.ddl-auto 값을 update → none으로 변경하여 시작 시 자동 스키마 업데이트 비활성화.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Bug/#66 #67 — 전반적인 Long→UUID 마이그레이션을 포함하며, 해당 테스트 파일의 UUID 전환과 직접적으로 겹칩니다.

Suggested labels

개발, 버그

Poem

깡충! 토끼 발끝에 UUID가 반짝 ✨
숫자는 숲으로, 새 씨앗은 하늘로 퐁—
스키마는 잠들고(ddl none),
테스트는 깨어나 네모난 진실을 확인해요.
오늘도 깡총, 안정의 들판을 달려요. 🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bug/#66

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/test/java/hello/cluebackend/domain/classroom/presentation/ClassRoomControllerTest.java (2)

38-41: UUID 전환은 도메인 모델과 정합 — 테스트 재현성 향상을 위해 상수 UUID 사용 권장

랜덤 UUID 사용은 문제는 없지만, 고정 값을 쓰면 재현성과 가독성이 좋아집니다. 또한 상호작용 검증을 추가하면 테스트 의도가 더 명확해집니다.

-        UUID userId = UUID.randomUUID();
-
-        UUID classRoomId1 = UUID.randomUUID();
-        UUID classRoomId2 = UUID.randomUUID();
+        UUID userId = UUID.fromString("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa");
+        UUID classRoomId1 = UUID.fromString("11111111-1111-1111-1111-111111111111");
+        UUID classRoomId2 = UUID.fromString("22222222-2222-2222-2222-222222222222");

추가 권장(코드 참고용):

// then 이후에 상호작용 검증
// import static org.mockito.Mockito.verify;
verify(jwtUtil).getToken(mockRequest);
verify(jwtUtil).getUserId(token);
verify(classRoomService).findMyClassRoomById(userId);

49-57: DTO 빌더의 classRoomId 세팅은 적절 — 기본값(booleans)의 암묵성 줄이기

isActivation은 primitive boolean이라 기본값(false)로 들어갑니다. 테스트 의도를 드러내려면 명시하는 편이 좋습니다. 또한 두 카드의 name을 구분하면(예: "자바반 A"/"자바반 B") 순서·콘텐츠 검증이 더 견고해집니다.

                 ClassRoomCardDto.builder()
                         .classRoomId(classRoomId1)
-                        .name("자바를 자바라")
+                        .name("자바반 A")
                         .sort("JAVA")
                         .target("2-2")
                         .studentCount(2)
+                        .isActivation(true)
                         .build(),
                 ClassRoomCardDto.builder()
                         .classRoomId(classRoomId2)
-                        .name("자바를 자바라")
+                        .name("자바반 B")
                         .sort("JAVA")
                         .target("2-1")
                         .studentCount(2)
+                        .isActivation(true)
                         .build()

보강 검증(참고):

assertThat(response.getBody().get(0).getClassRoomId()).isNotNull();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 252006c and 6d30617.

📒 Files selected for processing (2)
  • src/main/resources/application-dep.yml (1 hunks)
  • src/test/java/hello/cluebackend/domain/classroom/presentation/ClassRoomControllerTest.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-13T16:08:21.631Z
Learnt from: Hgyeol
PR: EscapeFrame/clueBackend#36
File: src/main/java/hello/cluebackend/domain/classroom/presentation/ClassRoomController.java:34-39
Timestamp: 2025-07-13T16:08:21.631Z
Learning: In this Spring Boot application, JWT validation is handled at the filter level before requests reach the controllers, so JWT token extraction and user ID retrieval in controllers like ClassRoomController don't require additional exception handling for invalid or missing tokens.

Applied to files:

  • src/test/java/hello/cluebackend/domain/classroom/presentation/ClassRoomControllerTest.java
🧬 Code graph analysis (1)
src/test/java/hello/cluebackend/domain/classroom/presentation/ClassRoomControllerTest.java (3)
src/main/java/hello/cluebackend/domain/classroom/domain/ClassRoom.java (1)
  • Entity (15-86)
src/main/java/hello/cluebackend/domain/classroom/service/ClassRoomService.java (1)
  • findMyClassRoomById (40-47)
src/main/java/hello/cluebackend/domain/classroom/presentation/dto/ClassRoomCardDto.java (1)
  • Getter (7-19)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/resources/application-prod.yml (1)

7-9: application-prod.yml에서 프로필 활성화 키는 중복 설정입니다.

파일명이 이미 application-prod.yml이므로 spring.config.activate.on-profile: prod는 불필요하며 혼동 소지가 있습니다. 삭제를 권장합니다.

적용 패치:

   config:
     activate:
-      on-profile: prod
+      # (prod 전용 파일이므로 on-profile 키 불필요)

또는 아래 블록 자체를 제거해도 됩니다.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6d30617 and c326ca5.

📒 Files selected for processing (1)
  • src/main/resources/application-prod.yml (1 hunks)

jpa:
hibernate:
ddl-auto: update
ddl-auto: none
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

prod 환경에서 hbm2ddl 비활성화는 바람직. 다만 마이그레이션 경로(예: Flyway/Liquibase) 확보 필요.

  • ddl-auto: none은 운영에서 자동 스키마 변경을 막아 안전합니다. 단, 스키마 드리프트를 막으려면 Flyway/Liquibase 기반 배포 마이그레이션이 필수입니다.
  • 운영 실수 방지를 위해 none 대신 validate로 두면 스키마 불일치 시 애플리케이션이 즉시 실패하여 문제를 조기에 드러낼 수 있습니다. 선택지로 검토해주세요.

다음 스크립트로 마이그레이션 도구 사용 여부와 다른 프로필의 ddl-auto 설정을 점검해 주세요.

원하시면 validate로 바꾸는 간단 패치입니다:

-      ddl-auto: none
+      ddl-auto: validate

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Flyway/Liquibase 의존성 및 설정 탐지 =="
rg -n -C2 -g '!**/build/**' -g '!**/target/**' -e 'org\.flywaydb|flyway|liquibase' build.gradle* pom.xml || true
rg -n -C2 -g '!**/build/**' -g '!**/target/**' -e 'spring\.flyway|spring\.liquibase' -S src/main/resources || true

echo
echo "== 프로필별 ddl-auto 설정 확인 =="
rg -n -C1 -S 'ddl-auto' src/main/resources || true

Length of output: 980


prod 프로파일에서 마이그레이션 도구 추가 및 ddl-auto 설정 검토

  • application-prod.yml(src/main/resources)에서 ddl-auto: none은 운영에서 자동 스키마 변경을 막아 적절하지만, build.gradle 또는 pom.xml에 Flyway/Liquibase 의존성이 전혀 없습니다. 운영 스키마 관리를 위해 마이그레이션 도구를 도입해 주세요.
  • 참고: 다른 프로파일 설정
    • application-dev.yml: ddl-auto: validate
    • application-dep.yml: ddl-auto: none
  • 운영 중 스키마 불일치 탐지를 위해 none 대신 validate 설정 검토 가능(마이그레이션 적용 보장 필요).
-      ddl-auto: none
+      ddl-auto: validate
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ddl-auto: none
ddl-auto: validate

@Hgyeol Hgyeol merged commit 49ac0dd into develop Sep 4, 2025
1 check passed
@coderabbitai coderabbitai bot mentioned this pull request Sep 6, 2025
@fixgramwork fixgramwork deleted the bug/#66 branch November 19, 2025 06:49
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.

2 participants