Skip to content

215 feat: 스크래핑 콜백 트랜잭션 경계 재구성 및 job 상태 전이 정비 - #217

Merged
pp8817 merged 10 commits into
devfrom
feat/215
Apr 28, 2026
Merged

215 feat: 스크래핑 콜백 트랜잭션 경계 재구성 및 job 상태 전이 정비#217
pp8817 merged 10 commits into
devfrom
feat/215

Conversation

@pp8817

@pp8817 pp8817 commented Apr 11, 2026

Copy link
Copy Markdown
Member

변경 사항

  • /internal/scrape-results의 긴 단일 트랜잭션 구조를 분리했습니다.
  • callback 접수, S3 조회, 후처리, 상태 반영 경계를 정리했습니다.
  • scrape_jobs 상태에 POST_PROCESSING을 추가해 worker 실행과 backend 후처리를 구분했습니다.
  • callback 단계별 로그/메트릭을 추가해 병목 구간을 추적할 수 있게 했습니다.
  • outbox publish 후 RUNNING 전이, stale timeout 판정 기준도 함께 정리했습니다.

참고 사항

P1: 꼭 반영해주세요 (Request changes)
P2: 적극적으로 고려해주세요 (Request changes)
P3: 웬만하면 반영해 주세요 (Comment)
P4: 반영해도 좋고 넘어가도 좋습니다 (Approve)
P5: 그냥 사소한 의견입니다 (Approve)

🔗 Related Issue

Closes #215

@pp8817
pp8817 requested a review from kimhoeyun April 11, 2026 06:55
@pp8817 pp8817 self-assigned this Apr 11, 2026
@pp8817
pp8817 requested a review from hoooonshub as a code owner April 11, 2026 06:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the scraping callback mechanism to fetch result payloads from S3 using a provided key instead of receiving them directly in the request body. Key additions include the ScrapeResultResultStoreClient for S3 interaction, ScrapeResultCallbackTxService for transactional state management, and a new POST_PROCESSING status for ScrapeJob. Review feedback identifies a security risk where the request body is parsed before HMAC verification, a logic error in performing checksum validation on normalized rather than raw S3 data, and redundant error handling between the callback service and the post-processor.

@hoooonshub hoooonshub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

코드 보기가 조금 어려워서 일단 보이는데만 달았어.
코드 머지하며는 IDE로 봐볼게.

확실히 ai 코드는 읽기가 어렵다,,,ㅋㅋㅋ 머지해주면 나도 ai로 분석해야될 것 같아 ㅋㅋㅋㅋㅋ

이게 지금 요청부터 끝까지 다 동기 처리로 작업하는거지?
비동기로 처리하게 되며는 executor로 쓰지 말고 아예 SQS로 하나의 메시지로 넘겨버리는 방식도 있을 것 같은데 일단 고려해줘

Comment on lines +22 to +23
@RequiredArgsConstructor
public class ScrapeResultResultStoreClient {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

이거 클래스 이름 'Result' 중복됐어. 의도된거야?

## Checklist
- [ ] Domain tests: job 상태 전이/멱등 로직 추가
- [ ] Application layer: 콜백 서비스 DTO/상태 저장/후처리 트리거 구현
- [ ] Infrastructure layer: S3 client + 어댑터 + 설정 추가

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s3 관련된 설정 클래스는 따로 없는데, 어떻게 설정돼?

Comment on lines +45 to +55
@Bean
public S3Client scrapeResultS3Client() {
ScrapingProperties.ResultStore store = scrapingProperties.getResultStore();
return S3Client.builder()
.region(Region.of(store.getRegion()))
.overrideConfiguration(ClientOverrideConfiguration.builder()
.apiCallTimeout(java.time.Duration.ofSeconds(store.getApiCallTimeoutSeconds()))
.apiCallAttemptTimeout(java.time.Duration.ofSeconds(store.getApiCallAttemptTimeoutSeconds()))
.build())
.build();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

아 s3 관련 파일 이거구나, 요거랑 ScrapingProperties,

이거 아예 s3 config로 빼버리는게 더 직관적일 것 같아.

@pp8817

pp8817 commented Apr 17, 2026

Copy link
Copy Markdown
Member Author

@hoooonshub AI로 하다보니 놓친 이슈나 실수가 많았네요.. 더 철저하게 더블 체크하겠습니다
feat/218에서 리뷰 반영도 같이 하겠습니다.

Base automatically changed from feat/213 to dev April 28, 2026 02:49
@pp8817
pp8817 merged commit d2e2e1a into dev Apr 28, 2026
3 of 4 checks passed
@pp8817
pp8817 deleted the feat/215 branch April 28, 2026 02: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.

스크래핑 결과 수신 방식을 직접 payload 수신에서 S3 key 기반 조회 구조로 변경

2 participants