[volume-2] 요구사항 문서, 시퀀스 다이어그램, 클래스 다이어그램, ERD 작성 #58
[volume-2] 요구사항 문서, 시퀀스 다이어그램, 클래스 다이어그램, ERD 작성 #58hyejin0810 merged 11 commits intoLoopers-dev-lab:hyejin0810from
Conversation
fix : 예제 테스트 코드 오류 해결을 위한 testcontainers 버전 업
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthrough의존성 관리에 TestContainers BOM을 추가한다. gradle.properties에 testcontainersVersion=2.0.2를 정의하고, build.gradle.kts의 dependencyManagement에 해당 BOM을 포함시킨다. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review 상품/브랜드/좋아요/주문 도메인이 모두 포함되어 있는가? 위 체크리스트에 맞게 구현되어있는지 확인해. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
build.gradle.kts (1)
67-70:⚠️ Potential issue | 🟠 MajorTestcontainers 2.0 마이그레이션 시 JUnit 5 통합 모듈의 아티팩트 ID 갱신이 필요하다.
Testcontainers 2.0에서 모든 모듈의 아티팩트 ID가
testcontainers-접두사를 갖도록 변경되었다. 라인 70의org.testcontainers:junit-jupiter는org.testcontainers:testcontainers-junit-jupiter로 수정되어야 한다. 올바른 아티팩트 좌표를 사용하지 않으면 BOM 해석 오류 또는 호환성 문제가 발생하여 런타임ClassNotFoundException으로 이어질 수 있다.🔧 2.0 호환 좌표로의 변경
// Testcontainers testImplementation("org.springframework.boot:spring-boot-testcontainers") testImplementation("org.testcontainers:testcontainers") - testImplementation("org.testcontainers:junit-jupiter") + testImplementation("org.testcontainers:testcontainers-junit-jupiter")
🤖 Fix all issues with AI agents
In `@build.gradle.kts`:
- Around line 44-46: Replace the incorrect Testcontainers artifact coordinate
"org.testcontainers:junit-jupiter" with the new Testcontainers 2.0 artifact id
"org.testcontainers:testcontainers-junit-jupiter" where the dependency is
declared (the dependency string "org.testcontainers:junit-jupiter"); update the
build.gradle.kts dependency block to use
"org.testcontainers:testcontainers-junit-jupiter" and then run the full
build+test pipeline (CI) to confirm the dependency resolution and tests pass.
| mavenBom("org.springframework.cloud:spring-cloud-dependencies:${project.properties["springCloudDependenciesVersion"]}") | ||
| mavenBom("org.testcontainers:testcontainers-bom:${project.properties["testcontainersVersion"]}") | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# 빌드 파일에서 testcontainers 관련 의존성 확인
echo "=== build.gradle.kts에서 testcontainers 의존성 확인 ==="
if [ -f "build.gradle.kts" ]; then
cat -n build.gradle.kts | grep -A2 -B2 "testcontainers"
fiRepository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 1146
🏁 Script executed:
#!/bin/bash
# Maven Central에 아티팩트 존재 여부 확인
echo "=== Maven Central 아티팩트 확인 ==="
echo "1. testcontainers-bom:2.0.2"
curl -s -o /dev/null -w "HTTP %{http_code}\n" "https://repo1.maven.org/maven2/org/testcontainers/testcontainers-bom/2.0.2/testcontainers-bom-2.0.2.pom"
echo "2. junit-jupiter:2.0.2 (구형 좌표)"
curl -s -o /dev/null -w "HTTP %{http_code}\n" "https://repo1.maven.org/maven2/org/testcontainers/junit-jupiter/2.0.2/junit-jupiter-2.0.2.pom"
echo "3. testcontainers-junit-jupiter:2.0.2 (신형 좌표)"
curl -s -o /dev/null -w "HTTP %{http_code}\n" "https://repo1.maven.org/maven2/org/testcontainers/testcontainers-junit-jupiter/2.0.2/testcontainers-junit-jupiter-2.0.2.pom"
echo "4. testcontainers (core):2.0.2"
curl -s -o /dev/null -w "HTTP %{http_code}\n" "https://repo1.maven.org/maven2/org/testcontainers/testcontainers/2.0.2/testcontainers-2.0.2.pom"Repository: Loopers-dev-lab/loop-pack-be-l2-vol3-java
Length of output: 286
🌐 Web query:
Testcontainers 2.0 artifact coordinates module naming changes
💡 Result:
In Testcontainers for Java 2.0.0, the groupId stays the same (org.testcontainers), but all non-core modules changed artifactIds to be prefixed with testcontainers-. (github.com)
Rule
- Before 2.0:
org.testcontainers:<module> - Since 2.0:
org.testcontainers:testcontainers-<module>(github.com)
Common examples
org.testcontainers:mysql→org.testcontainers:testcontainers-mysql(github.com)org.testcontainers:cratedb→org.testcontainers:testcontainers-cratedb(java.testcontainers.org)org.testcontainers:openfga→org.testcontainers:testcontainers-openfga(java.testcontainers.org)- JUnit Jupiter module is now published as
org.testcontainers:testcontainers-junit-jupiter(tessl.io)
Unchanged / notable
- The core artifact remains:
org.testcontainers:testcontainers(java.testcontainers.org)
Citations:
- 1: https://github.com/testcontainers/testcontainers-java/releases
- 2: https://github.com/testcontainers/testcontainers-java/releases
- 3: https://github.com/testcontainers/testcontainers-java/releases
- 4: https://java.testcontainers.org/modules/databases/cratedb/?utm_source=openai
- 5: https://java.testcontainers.org/modules/openfga/?utm_source=openai
- 6: https://tessl.io/registry/tessl/maven-org-testcontainers--testcontainers/2.0.0/files/docs/junit-jupiter-integration.md?utm_source=openai
- 7: https://java.testcontainers.org/?utm_source=openai
Line 70 아티팩트 좌표를 Testcontainers 2.0에 맞게 변경해야 한다.
Testcontainers 2.0에서 모든 비핵심 모듈의 아티팩트ID에 testcontainers- 접두사가 추가되었다. Line 70의 org.testcontainers:junit-jupiter는 Maven Central에 존재하지 않아(HTTP 404) 의존성 해석 실패로 인한 빌드 실패를 야기한다.
이는 테스트 단계에서 즉시 발견되는 문제로, 모든 CI 파이프라인이 중단된다. 운영 배포 전에 반드시 수정해야 한다.
변경 사항:
org.testcontainers:junit-jupiter → org.testcontainers:testcontainers-junit-jupiter
CI 파이프라인에서 전체 빌드 및 테스트 실행이 정상 통과하는지 반드시 확인해야 한다.
🤖 Prompt for AI Agents
In `@build.gradle.kts` around lines 44 - 46, Replace the incorrect Testcontainers
artifact coordinate "org.testcontainers:junit-jupiter" with the new
Testcontainers 2.0 artifact id "org.testcontainers:testcontainers-junit-jupiter"
where the dependency is declared (the dependency string
"org.testcontainers:junit-jupiter"); update the build.gradle.kts dependency
block to use "org.testcontainers:testcontainers-junit-jupiter" and then run the
full build+test pipeline (CI) to confirm the dependency resolution and tests
pass.
🧩 Analysis chain🏁 Script executed: Length of output: 359 🏁 Script executed: Length of output: 179 🏁 Script executed: Length of output: 1698 🏁 Script executed: Length of output: 311 🏁 Script executed: Length of output: 12313
✅ 체크리스트 검증 결과1. 상품/브랜드/좋아요/주문 도메인 포함 여부통과. Brand, Product, Like, Order, OrderItem 5개 핵심 도메인과 Cart(장바구니), User 도메인까지 총 7개 엔티티가 정의되어 있다. 2. 기능 요구사항의 유저 중심 정리통과. 01-requirements.md에 5개 유저 시나리오(회원 가입 후 상품 탐색, 관심 상품 저장, 장바구니 담기 및 관리, 상품 주문, 관리자 상품 및 주문 관리)가 흐름 기반으로 작성되었고, 기능 요구사항이 "사용자는...", "관리자는..." 형태로 명확히 정리되어 있다. 3. 시퀀스 다이어그램의 책임 객체 표현통과. 3개 시퀀스 다이어그램(좋아요 처리, 주문 생성, 주문 상태 변경) 모두 Auth Filter → API → Service → Repository 계층 구조가 명확히 드러나며, 각 객체의 책임(인증, API 처리, 비즈니스 로직, 영속성)이 분리되어 있다. 4. 클래스 구조의 도메인 설계 표현통과. 03-class-diagram.md에서 Entity 7개와 Service 2개가 정의되었고, Product.decreaseStock(), Order.approve() 등 비즈니스 로직이 엔티티 내부에 캡슐화되어 있어 도메인 주도 설계 원칙을 따르고 있다. 5. ERD의 데이터 정합성 고려부분 통과. 복합 유니크 제약(user_id+product_id), version 컬럼(낙관적 락), 스냅샷 저장(ORDER_ITEMS), soft delete 등 기본적인 정합성 메커니즘이 포함되어 있으나, 아래 운영 관점 개선이 필요하다.
|
📌 Summary
2개), ERD 7개 테이블 설계 완료.
💬 리뷰 포인트
충분한지
🧭 Context & Decision
선택지와 결정
Context: 상품 목록 조회 시 발생하는 N+1 쿼리와 DB 의존성 문제
Decision: 좋아요 수 비정규화 및 논리적 FK 채택
Why: 읽기 비중이 압도적인 커머스 특성상 COUNT 집계 비용을 줄여야 함. 또한 DB 물리 제약을 제거해 쓰기 성능을 높이고 향후 서비스 분리(MSA)나 Soft Delete 연동 시 유연함을 확보하기 위함.
Context: 동시 주문 폭주 및 Race Condition 발생 위험
Decision: 낙관적 락(@Version) 및 DB 복합 유니크 제약 적용
Why: 읽기 빈도가 높아 비관적 락보다 처리량이 좋은 낙관적 락을 선택하고 충돌 시 재시도함. 앱 레벨 체크만으로는 부족한 중복 데이터 방지는 DB 유니크 제약으로 최종 차단함.
Context: 상품 정보 변경에 따른 이력 오염 및 데이터 복구 필요성
Decision: 주문 스냅샷(복사) 저장 및 선택적 Soft Delete
Why: 주문 후 상품명이나 가격이 바뀌어도 거래 기록은 유지되어야 함. 유저/상품 등 주요 자산은 실수에 대비해 Soft Delete를 적용하고, 장바구니 등 휘발성 데이터는 Hard Delete로 용량을 관리함.
Context: 매출 규모 노출 위험 및 브랜드 삭제 시 데이터 정합성
Decision: 별도 주문번호 체계 구축 및 브랜드 삭제 시 상품 연쇄 처리
Why: PK 노출로 인한 보안 취약점을 막고 운영 편의를 위해 별도 번호를 생성함. 브랜드가 삭제되었는데 상품만 노출되는 논리적 오류를 막기 위해 소속 상품도 함께 처리함.
Context: 서비스 로직 비대화 및 중복 상품 담기 시나리오
Decision: 엔티티 내 비즈니스 로직 캡슐화 및 장바구니 수량 합산
Why: decreaseStock() 등을 엔티티가 직접 수행하게 하여 도메인 규칙을 강제함. 중복 상품 추가 시 에러를 뱉기보다 수량을 합쳐주는 것이 사용자 입장에서 자연스러운 흐름
🏗️ Design Overview
변경 범위
docs/design/01-requirements.md— 요구사항 정의서docs/design/02-sequence-diagrams.md— 시퀀스 다이어그램 3건docs/design/03-class-diagram.md— 클래스 다이어그램docs/design/04-erd.md— ERD (7개 테이블)주요 컴포넌트 책임
변경 요약
변경 목적: 기존 설계 문서(요구사항서, 시퀀스 다이어그램, 클래스 다이어그램, ERD)의 마크다운 형식을 개선하고 Mermaid 다이어그램의 참여자 별칭(actor, participant)을 정리하여 가독성 및 일관성 향상
핵심 변경점:
docs/design/01-requirements.md~04-erd.md마크다운 표기 정규화 및 Mermaid 시퀀스 다이어그램의 참여자명 정리(예: "좋아요 처리"에서 Auth Filter, Like API, Like Service, Product Repository 등으로 명확화)리스크/주의사항: 없음 (문서 포맷 정리만 해당)
테스트/검증 방법: 마크다운 린터로 문법 검증, Mermaid 다이어그램이 정상 렌더링되는지 GitHub/Wiki에서 확인, 설계 문서 검토자의 사전 승인 여부 확인 필요