[REFAC#396] SeedPublisher interface 를 publisher 측으로 이동 + 원칙 명문화 - #397
Conversation
#385 (Publisher 통합 모듈화 메타) 의도 정합성 — PR #395 (Sub 2) 직후 발견된 책임 분리 위배 정리. 배경: - PR #395 에서 SeedPublisher 를 scheduler/source.go 에 정의 (Go idiomatic consumer-defined interface 패턴) - 그러나 메타 #385 의 "Kafka I/O 단일 책임 hub = publisher" 의도와 정합 깨짐: - PublishSeed 시그니처/계약을 정의하는 인터페이스가 scheduler 측에 있음 - publisher 가 "우연히" 만족하는 형태 → 단일 진실 원천 깨짐 변경: - internal/scheduler/source.go 에서 SeedPublisher 제거 (자리에 reference 코멘트) - internal/publisher/seed.go 에 SeedPublisher 정의 + 이유 doc 추가 - scheduler.Scheduler 의 필드 / 생성자 시그니처가 publisher.SeedPublisher 사용 - 호출 시그니처 무변경 (PublishSeed(ctx, *core.CrawlJob) error) 후속 (메타 #385 코멘트에 명시): - Sub 3 (#388) UpgradePublisher - Sub 4 (#389) RetryPublisher - Sub 5/7/8 도 모두 publisher 측 인터페이스 정의 (단일 원칙 적용) 검증: - go build + go vet 통과 - 전체 38 패키지 race test 통과
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR moves the ChangesSeedPublisher Interface Relocation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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.
Code Review
This pull request moves the SeedPublisher interface from the scheduler package to the publisher package to centralize Kafka I/O responsibilities and adhere to the Single Responsibility Principle. The Scheduler struct and its constructor have been updated to use the interface from the new location. Review feedback suggests refining the interface documentation to avoid referencing specific callers, maintaining better abstraction, and removing a dangling comment left in the scheduler package after the relocation.
There was a problem hiding this comment.
Pull request overview
이 PR은 SeedPublisher 인터페이스의 정의 위치를 scheduler → publisher로 이동해, “Kafka I/O 단일 책임 hub = publisher”라는 메타(#385)의 책임 분리 원칙에 맞게 계약(시그니처/의미)의 단일 진실 원천(SSOT) 을 publisher 측으로 정렬합니다.
Changes:
internal/publisher/seed.go에SeedPublisher인터페이스를 추가해 publisher 패키지에서 계약을 소유하도록 변경internal/scheduler/source.go에서 기존SeedPublisher정의 제거 및 이동 안내 주석으로 대체internal/scheduler/scheduler.go에서SeedPublisher타입 참조를publisher.SeedPublisher로 갱신(필드/생성자 시그니처)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/scheduler/source.go | scheduler 측 SeedPublisher 인터페이스 제거 및 이동 안내 주석 추가 |
| internal/scheduler/scheduler.go | publisher.SeedPublisher로 타입 참조를 변경해 의존 계약을 publisher로 정렬 |
| internal/publisher/seed.go | publisher 패키지에 SeedPublisher 인터페이스 정의를 추가해 SSOT 확립 |
gemini + Copilot 3건 (모두 수용):
1) seed.go:29 (gemini) — 인터페이스 doc 에 "scheduler" 같은 구체 호출자 언급
- publisher 패키지는 인터페이스가 제공하는 기능(계약)에 집중해야 함, 누가
쓰는지(scheduler) 는 알 필요 없음
- "caller (scheduler) 가 의존성으로 받는" → "시드 CrawlJob 발행 책임을 정의"
- 영문도 "The scheduler / caller" → "Callers" 로 일반화
2) seed.go:22 (Copilot) — `publisher.*Publisher` 표기 모호
- Go 타입/패키지 표기 관점에서 의미 불분명
- `publisher.Publisher` 로 정정 (정확한 타입명)
3) source.go:39 (gemini) — 인터페이스 제거 자리에 남긴 reference 코멘트 dangling
- 어떤 코드 요소에도 연결되지 않는 dangling comment
- 단순 삭제 — 이슈 #396 / 메타 #385 코멘트에서 충분히 관리
검증:
- go build + go vet 통과
- publisher / scheduler race test 통과
연관 이슈
구현 내용
PR #395 (Sub 2 — 머지됨) 진행 중 발견된 책임 분리 위배 정리. 메타 #385 의 "Kafka I/O 단일 책임 hub = publisher" 의도 정합성 회복.
배경
PR #395 에서 `SeedPublisher` 인터페이스를 `internal/scheduler/source.go` 에 정의 — Go idiomatic consumer-defined interface 패턴. 그러나:
변경
메타 #385 코멘트 — 원칙 명문화
코멘트 추가:
후속 Sub 3 (#388 — UpgradePublisher) 부터 본 원칙 적용.
CI / 머지 게이트 점검
변경 영향 범위
검증
Required Status Checks
롤백 계획
TODO
논의 사항
🤖 Generated with Claude Code
Summary by CodeRabbit