[Feat] 교통 카테고리 세분화 (TRANSPORTATION_HUB/TRANSIT) 및 공항/역 장소 검색 지원#49
[Feat] 교통 카테고리 세분화 (TRANSPORTATION_HUB/TRANSIT) 및 공항/역 장소 검색 지원#49
Conversation
📝 WalkthroughWalkthroughCategory 열거형을 TRANSPORTATION에서 TRANSPORTATION_HUB와 TRANSPORTATION_TRANSIT으로 분리하고, 관련 판정/재시도 로직, 저장소 기본값, AI 프롬프트·파싱, DB 컬럼 길이, 및 테스트를 일관되게 업데이트했습니다. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
linktrip-application/src/test/kotlin/com/linktrip/application/domain/video/TravelItineraryItemTest.kt (1)
35-36:TRANSPORTATION_HUB양성 케이스 테스트도 같이 추가하는 것을 권장합니다.Line 35-36은 TRANSIT 제외 규칙을 잘 검증하지만, 분리의 핵심인 “HUB는 재검색 가능” 케이스가 없어 회귀 방어가 약합니다.
테스트 보강 예시
+ `@Test` + fun `교통 허브 카테고리는_장소 검색 대상이므로_재검색 가능할 수 있다`() { + val item = createItem( + placeId = null, + category = Category.TRANSPORTATION_HUB, + placeSearchCount = 0, + ) + + assertTrue(item.isRetryable()) + assertFalse(item.isResolved()) + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@linktrip-application/src/test/kotlin/com/linktrip/application/domain/video/TravelItineraryItemTest.kt` around lines 35 - 36, 현재 TRANSPORTATION_TRANSIT 케이스만 검증하고 있어 회귀 방어가 약하므로 TravelItineraryItemTest에 TRANSPORTATION_HUB 양성 케이스를 추가하세요: createItem를 사용해 category = Category.TRANSPORTATION_HUB(예: placeId = null, placeSearchCount = 0)인 항목을 생성하고, 기존 TRANSPORTATION_TRANSIT 테스트에서 사용한 동일한 판정 로직(같은 assertion)을 반대로 적용하여 허브 항목은 재검색 가능(또는 제외되지 않음)을 확인하도록 추가 검증을 작성하세요; 즉 createItem 및 Category.TRANSPORTATION_HUB/TRANSPORTATION_TRANSIT를 참조해 동일한 테스트 구조로 허브 케이스를 검증하도록 만드세요.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@linktrip-application/src/main/kotlin/com/linktrip/application/domain/video/Category.kt`:
- Around line 7-8: The enum value TRANSPORTATION_TRANSIT (21 chars) exceeds the
DB column length for TravelItineraryItemEntity.category (defined with length=20)
and will cause truncation/errors; update the JPA mapping on
TravelItineraryItemEntity for the field category (annotated with
`@Enumerated`(EnumType.STRING)) to increase its length to at least 21 (recommended
32) so enum names like TRANSPORTATION_TRANSIT fit, or alternatively rename the
enum to a shorter value—apply the change to the column length attribute where
category is declared.
In
`@linktrip-output-http/src/main/kotlin/com/linktrip/output/http/adapter/VideoAnalyzeAdapter.kt`:
- Around line 183-184: AiApiResponse.parseCategory() currently silently maps
unknown categories to Category.EAT which hides misclassifications; update
parseCategory() to explicitly map the legacy "TRANSPORTATION" string to
Category.TRANSPORTATION_TRANSIT and remove the silent fallback to EAT so
invalid/unknown category strings throw an exception (e.g.,
IllegalArgumentException) instead of being swallowed; add unit tests for
parseCategory() covering: valid categories, the legacy "TRANSPORTATION" ->
TRANSPORTATION_TRANSIT mapping, and an invalid value that must cause an
exception to ensure edge-case validation.
---
Nitpick comments:
In
`@linktrip-application/src/test/kotlin/com/linktrip/application/domain/video/TravelItineraryItemTest.kt`:
- Around line 35-36: 현재 TRANSPORTATION_TRANSIT 케이스만 검증하고 있어 회귀 방어가 약하므로
TravelItineraryItemTest에 TRANSPORTATION_HUB 양성 케이스를 추가하세요: createItem를 사용해
category = Category.TRANSPORTATION_HUB(예: placeId = null, placeSearchCount = 0)인
항목을 생성하고, 기존 TRANSPORTATION_TRANSIT 테스트에서 사용한 동일한 판정 로직(같은 assertion)을 반대로 적용하여
허브 항목은 재검색 가능(또는 제외되지 않음)을 확인하도록 추가 검증을 작성하세요; 즉 createItem 및
Category.TRANSPORTATION_HUB/TRANSPORTATION_TRANSIT를 참조해 동일한 테스트 구조로 허브 케이스를
검증하도록 만드세요.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b6450ae0-05bd-4655-a3d5-5b78419d89ee
📒 Files selected for processing (6)
linktrip-application/src/main/kotlin/com/linktrip/application/domain/video/Category.ktlinktrip-application/src/main/kotlin/com/linktrip/application/domain/video/PlaceStatus.ktlinktrip-application/src/main/kotlin/com/linktrip/application/domain/video/TravelItineraryItem.ktlinktrip-application/src/test/kotlin/com/linktrip/application/domain/video/TravelItineraryItemTest.ktlinktrip-output-http/src/main/kotlin/com/linktrip/output/http/adapter/VideoAnalyzeAdapter.ktlinktrip-output-persistence/mysql/src/main/kotlin/com/linktrip/output/persistence/mysql/repository/TravelItineraryItemQuerydslRepository.kt
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: 자동 검증 (ktlint + test)
🔇 Additional comments (3)
linktrip-application/src/main/kotlin/com/linktrip/application/domain/video/PlaceStatus.kt (1)
14-14: TRANSIT만NOT_REQUIRED로 분기한 조건이 의도와 정확히 맞습니다.Line 14 변경으로 HUB는 검색 대상에 남고, TRANSIT만 제외되어 정책 반영이 일관됩니다.
linktrip-application/src/main/kotlin/com/linktrip/application/domain/video/TravelItineraryItem.kt (1)
23-23:isRetryable()에서 TRANSIT만 제외한 변경은 적절합니다.Line 23 기준으로 HUB는 검색 흐름을 타고, TRANSIT만 제외되어 도메인 규칙과 일치합니다.
linktrip-output-persistence/mysql/src/main/kotlin/com/linktrip/output/persistence/mysql/repository/TravelItineraryItemQuerydslRepository.kt (1)
59-60: 기본 제외 카테고리를 TRANSIT으로 맞춘 변경은 좋습니다.Line 59, Line 78 변경으로 조회 쿼리 기본 동작이 도메인 재검색 규칙과 일관됩니다.
Also applies to: 78-79
linktrip-application/src/main/kotlin/com/linktrip/application/domain/video/Category.kt
Show resolved
Hide resolved
linktrip-output-http/src/main/kotlin/com/linktrip/output/http/adapter/VideoAnalyzeAdapter.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 Nitpick comments (1)
linktrip-output-http/src/main/kotlin/com/linktrip/output/http/dto/AiApiResponse.kt (1)
69-77: 레거시 "TRANSPORTATION" 하위 호환성 처리가 적절합니다.기존 데이터와의 호환성을 위해
"TRANSPORTATION"을TRANSPORTATION_TRANSIT으로 매핑하는 것은 PR 목적(단순 이동수단은 장소 검색 제외)에 부합합니다.다만, 공백 문자열 처리를 명시적으로 추가하면 가독성이 향상됩니다. 현재
" "과 같은 공백 문자열은trim()후 빈 문자열이 되어valueOf("")예외를 거쳐 EAT로 폴백되는데, 이를 조기 반환으로 처리하면 의도가 더 명확해집니다.♻️ 공백 문자열 조기 반환 제안
private fun parseCategory(category: String?): Category { - val normalized = category?.trim()?.uppercase() ?: return Category.EAT + val normalized = category?.trim()?.uppercase() + if (normalized.isNullOrEmpty()) return Category.EAT if (normalized == "TRANSPORTATION") return Category.TRANSPORTATION_TRANSIT return try { Category.valueOf(normalized) } catch (_: IllegalArgumentException) { Category.EAT } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@linktrip-output-http/src/main/kotlin/com/linktrip/output/http/dto/AiApiResponse.kt` around lines 69 - 77, The parseCategory function should explicitly handle blank-only strings: after trimming (in parseCategory) if the result is null or empty return Category.EAT immediately; keep the existing special-case mapping of "TRANSPORTATION" to Category.TRANSPORTATION_TRANSIT, and only call Category.valueOf(normalized) for non-empty, non-TRANSPORTATION values, falling back to Category.EAT on IllegalArgumentException. Update parseCategory to check normalized.isEmpty() and return EAT early so blank strings are handled clearly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@linktrip-output-http/src/main/kotlin/com/linktrip/output/http/dto/AiApiResponse.kt`:
- Around line 69-77: The parseCategory function should explicitly handle
blank-only strings: after trimming (in parseCategory) if the result is null or
empty return Category.EAT immediately; keep the existing special-case mapping of
"TRANSPORTATION" to Category.TRANSPORTATION_TRANSIT, and only call
Category.valueOf(normalized) for non-empty, non-TRANSPORTATION values, falling
back to Category.EAT on IllegalArgumentException. Update parseCategory to check
normalized.isEmpty() and return EAT early so blank strings are handled clearly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 71e01340-602b-45c0-b4e9-bf358bf3347b
📒 Files selected for processing (2)
linktrip-output-http/src/main/kotlin/com/linktrip/output/http/dto/AiApiResponse.ktlinktrip-output-persistence/mysql/src/main/kotlin/com/linktrip/output/persistence/mysql/entity/TravelItineraryItemEntity.kt
✅ Files skipped from review due to trivial changes (1)
- linktrip-output-persistence/mysql/src/main/kotlin/com/linktrip/output/persistence/mysql/entity/TravelItineraryItemEntity.kt
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: 자동 검증 (ktlint + test)
관련 이슈
변경 내용
교통 카테고리 세분화
TRANSPORTATION카테고리를TRANSPORTATION_HUB와TRANSPORTATION_TRANSIT으로 분리장소 검색 로직 수정
PlaceEnrichService쿼리에서 TRANSIT만 제외, HUB는 정상 검색 수행PlaceStatus에서 TRANSIT만NOT_REQUIRED처리, HUB는FOUND/NOT_FOUND표시TravelItineraryItem.isRetryable()에서 TRANSIT만 재시도 제외체크리스트
Summary by CodeRabbit