Repository navigation
[Feat] 장소 설명 자동 생성 및 재시도 구현 - #437
Conversation
|
Warning Review limit reachedYou'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 21 minutes. View limit details
|
| Layer / File(s) | Summary |
|---|---|
Overview state and place writes src/main/java/com/yeogido/backend/domain/place/entity/Place.java, src/main/java/com/yeogido/backend/domain/place/enums/PlaceOverviewStatus.java, src/main/java/com/yeogido/backend/domain/place/service/PlaceServiceImpl.java, src/main/resources/db/migration/V41__add_place_overview.sql, src/main/resources/db/migration/V42__add_place_overview_retry.sql, src/test/java/com/yeogido/backend/domain/place/migration/PlaceOverviewRetryMigrationTest.java, src/test/java/com/yeogido/backend/domain/place/service/PlaceOverviewWriteIntegrationTest.java |
Place records gain overview content, source, status, and retry fields. Course and content writes update existing place details and reset enrichment state when relevant details change. Migrations and integration tests cover these fields and write behavior. |
Enrichment and result persistence src/main/java/com/yeogido/backend/domain/place/repository/PlaceRepository.java, src/main/java/com/yeogido/backend/domain/placeenrichment/service/PlaceOverviewEnrichmentService.java, src/main/java/com/yeogido/backend/domain/placeenrichment/service/PlaceOverviewEnrichmentServiceImpl.java, src/main/java/com/yeogido/backend/domain/placeenrichment/service/TourRegionCodeMapper.java, src/test/java/com/yeogido/backend/domain/placeenrichment/service/* |
The enrichment service claims places, checks Tour results before verified Gemini results, and persists results for the current attempt. Region-code resolution uses separate transactions around database reads and writes. |
Scheduled pending and retry processing src/main/java/com/yeogido/backend/domain/place/repository/PlaceRepository.java, src/main/java/com/yeogido/backend/domain/placeenrichment/scheduler/*, src/main/resources/application.yml, src/test/java/com/yeogido/backend/domain/place/repository/PlaceOverviewRetryRepositoryTest.java, src/test/java/com/yeogido/backend/domain/placeenrichment/scheduler/* |
Repository queries return eligible pending and retryable place IDs. Configured scheduled jobs process each result independently and continue after a per-place runtime exception. |
Estimated code review effort: 4 (Complex) | ~55 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Scheduler as Pending or retry scheduler
participant Repository as PlaceRepository
participant Enrichment as PlaceOverviewEnrichmentServiceImpl
participant Tour as TourPlaceEnrichmentService
participant Gemini as GeminiPlaceEnrichmentService
Scheduler->>Repository: Query eligible place IDs
Scheduler->>Enrichment: Enrich each place ID
Enrichment->>Repository: Lock and claim place
Enrichment->>Tour: Retrieve Tour overview
alt Tour overview is not usable
Enrichment->>Gemini: Retrieve Gemini overview
end
Enrichment->>Repository: Save result for current attempt
Possibly related PRs
- yeogido/backend#425: Adds the Gemini enrichment service and verified-result handling used by this PR.
- yeogido/backend#414: Adds Tour enrichment contracts and region mapping used by this PR.
Suggested reviewers: seoyeon-park0103
Merge Risk: 
High · previous review 24e9a
-
Requests can change place details and descriptions shared by other users, while interrupted enrichment can remain stuck. Protect shared place data and restore recovery before merging.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Directly linked issue
#431has four coding requirements. Each is supported by the PR summary and the reviewed code evidence.- [
#431] TourAPI first, then Gemini fallback. PlaceOverviewEnrichmentServiceImpl uses a matched Tour API overview first. It accepts a nonblank Gemini overview only when its match status is VERIFIED. Otherwise it marks NO_OVERVIEW. - [
#431] Store overview and source per place. Place gains overview, overviewSource, and overviewStatus fields. V41 and V42 migrations add the matching columns and an index. - [
#431] Treat new or overview-less places as enrichment targets on create and update. New places default to PENDING. PlaceServiceImpl.getOrCreatePlace now calls updatePlace for existing places on both overloads. Place.updateTourData resets overview state when name, address, or coordinates change. PlaceRepository pending candidates select PENDING places with null or blank overview. Existing rows migrate to PENDING, so they become candidates. - [
#431] Asynchronous enrichment after save, without affecting create or update. External calls run in the PlaceOverviewPendingScheduler and PlaceOverviewRetryScheduler flows, not in the create or update request. Enrichment runs in REQUIRES_NEW transactions. Per-place RuntimeException is caught and logged.
Limitation: places already in NO_OVERVIEW are not re-targeted when linked again without metadata changes. This is a design choice of the terminal no-overview state. It is not a coding requirement of
#431as written.The review relied on the PR summary and one focused diff of PlaceServiceImpl. The new tests were not executed during this review.
- [
Full details: Out of Scope Changes check
-
Explanation
All changed areas support the overview enrichment objective of
#431.- Place entity, PlaceOverviewStatus enum, V41 and V42 migrations: store overview state and source. Required by
#431. - PlaceRepository lookup and candidate queries: select pending and retryable places. Required by
#431. - PlaceServiceImpl updatePlace and getOrCreatePlace changes: mark places for enrichment on create and update. Required by
#431. - PlaceOverviewPendingScheduler, PlaceOverviewRetryScheduler, PlaceOverviewEnrichmentService(Impl), application.yml: run asynchronous enrichment and retries. Required by
#431. - TourRegionCodeMapper transaction split and TourRegionCodeMapperTest update: remove class-wide transaction so that external region-code calls run outside transactions. Supports the enrichment transaction design needed by
#431. - Tests (migration, repository, write integration, scheduler, enrichment service, region mapper): verify the changes above. Supporting tests are in scope.
No unrelated change was found in the summary.
- Place entity, PlaceOverviewStatus enum, V41 and V42 migrations: store overview state and source. Required by
Full details: Description check
-
Explanation
The pull request description includes all required sections: change summary, linked issue, review requirements, and test results. It clearly describes the overview enrichment flow, retry policy, transaction separation, and completed tests.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 3.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 27 functions across 16 files. (3 skipped: 3 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- 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.
chans20
left a comment
There was a problem hiding this comment.
예약 작업 스레드 설정이 없어 기본 1개로 돌 것 같습니다. 설명 생성 배치가 길어지면 정각 랭킹 갱신과 04시 동기화가 혹시나 그만큼 늦게 실행될 수 있으니, 풀 크기 설정이나 전용 스레드 검토 부탁드립니닷
There was a problem hiding this comment.
TOUR API 값이 8자리 이상이면 좌표가 같아도 바뀐 것으로 판단해서, 동기화 때마다 설명이 지워지고 다시 생성될 것 같습니다. 비교 전에 setScale(7, RoundingMode.HALF_UP)으로 자릿수를 맞추면 좋을것같습니다.
There was a problem hiding this comment.
확인해보니 API 원본과 DB에 저장된 좌표의 소수점 정밀도가 달라서, 같은 좌표인데도 설명이 초기화되는 문제가 재현됐습니다. 말씀해주신 대로 소수점 7자리로 반올림해서 저장하도록 수정했고, 동일 좌표에서는 설명이 유지되는 테스트까지 확인했습니다. 꼼꼼한 리뷰 감사합니다!
|
말씀해주신 대로 기본 스레드 1개를 공유하고 있어서, 설명 생성 및 재시도를 전용 스케줄러로 분리했고, 설명 배치가 대기 중이어도 기본 예약 작업이 실행되는 테스트까지 확인했습니다. 리뷰 감사합니다! |
📌 PR 설명
장소 저장 후 외부 API를 통해 장소 설명을 자동으로 생성하고 저장하도록 연결했습니다.
🔗 연관된 이슈
Resolves: #431
📝 리뷰 요구사항
💻 테스트 결과
Summary by CodeRabbit