Skip to content

Conversation

pilyang
Copy link
Member

@pilyang pilyang commented Apr 20, 2025

클로드 코드로 일단 그냥 바이브코딩 해봄
아래 내용도 클로드 시켜서 만든 PR 요약

ps. 난 그냥 어떤거 해야하는지 시키고, 대충봐도 보이는 잘못된부분들 좀 짚어주면서 만들라 시키고, 버그수정도 이친구보고 테스트코드 만들라하고 이친구가 자동으로 테스트 실행해보면서 거기 나오는 로그 분석해서 맞춰서 코드 수정하고 그냥 지 혼자 다함. 난 에디터에서 직접 코드 수정한거 이번 PR에서는 하나도 없게 한번 해봄.
필요한 dependency 설치 커맨드도, 테스트코드 실행도, 깃 커밋도 전부 다 클로드가 함, 난 claude code 내에서 시킨것만있음 진짜로

따라서 이거 나중에 좀 시간날때 나도 다시한번 잘 만들어진거 맞나 리뷰 나도 해봐야함ㅎㅎ

ps2. 총 소요시간 + api 요금

  • 3.37$ : 이건 초기에 프로젝트 다 검사시키면서 claude readme 만드는 비용도 소모 + 실수로 중간에 꺼서 컨텍스트 잃은것도 있고 함
  • 소요시간 : 유튭보면서 대충대충 + 처음 시도해본다고 이것저것 보는거 포함 1시간 약간 안걸린듯

느낀바 : 이번엔 그냥 무지성 해줘 바이브코딩에 약간 너무 이상한거 짚어주기정도였는데, 좀 내가 작업하면서 같이 사용하고 범위 특정해주고, 익숙해지면 좀 더 싸게도 처리할 수 있을듯. 소요 시간은 중간중간 더 자세히 좀 리뷰해주고 하는 시간들 들여보고 해야해서 불확실


RSS 피드 수집 및 포스팅 자동화 기능 추가

주요 변경사항

  • RSS 피드 파싱을 위한 기능 구현 (gofeed 라이브러리 사용)
  • 기업별 RSS 피드에서 포스팅을 가져와 DB에 저장하는 기능 구현
  • 주기적으로 자동 RSS 동기화를 위한 스케줄러 추가 (robfig/cron 사용)
  • RSS 동기화를 위한 REST API 엔드포인트 추가 (수동 동기화용)

구현 세부 내용

  • internal/rss: RSS 피드 파싱 및 포스팅 생성 로직 구현
  • internal/scheduler: 주기적인 RSS 피드 동기화를 위한 스케줄러 구현
  • internal/http/handler/rsshandler.go: RSS 관련 API 핸들러 구현
  • 설정 파일에 스케줄러 관련 환경 변수 추가 (활성화/비활성화, 실행 주기)

테스트

  • RSS 파서 기능에 대한 단위 테스트 추가
  • 트랜잭션 기반 DB 테스트로 실제 데이터 변경 없이 테스트 가능
  • Mock HTTP 서버를 통한 외부 의존성 테스트 구현

기타 개선사항

  • DB 연결 문자열 버그 수정 (Db -> DB)
  • 포스팅 태그 생성 헬퍼 함수 추가
  • CLAUDE.md 파일에 테스트 가이드 및 아키텍처 정보 업데이트

@pilyang pilyang requested review from Copilot and iamjooon2 April 20, 2025 15:14
@pilyang pilyang self-assigned this Apr 20, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces RSS feed parsing, automatic posting creation, and periodic synchronization via a scheduler. It also includes updates to configuration handling and database connection parameters for consistency.

  • Added RSS feed parsing using gofeed and posting creation logic.
  • Implemented a scheduler using robfig/cron for periodic RSS synchronization.
  • Updated configuration and database connection to use the standardized "DB" naming.

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/testutils/db.go Updated database connection parameter from "Db" to "DB".
internal/schemasupport/posting_tags.go Added helper function to create PostingTags from a string slice.
internal/scheduler/scheduler.go Implemented scheduler setup and RSS synchronization job.
internal/rss/rss_parser_test.go Added unit tests for syncing RSS feeds with mock server.
internal/rss/rss_parser.go Implemented RSS items fetching, processing, and posting creation.
internal/http/router/router.go Added new RSS sync endpoints.
internal/http/handler/rsshandler.go Implemented HTTP handlers for syncing RSS feeds.
internal/database/database.go Updated database connection parameter from "Db" to "DB".
config/config.go Updated configuration structs and environment variable handling.
cmd/main.go Integrated the scheduler startup/shutdown in the main app.
CLAUDE.md Added documentation for using Claude Code in the repo.
Files not reviewed (1)
  • go.mod: Language not supported

Copy link

report: Run #73

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
4 3 1 0 0 0 0 151ms

Some tests failed!

Name Failure Message
❌ TestSyncCompanyRSSFeed enttest.go:81: sql/schema: create "tags" table: pq: duplicate key value violates unique constraint "pg_class_relname_nsp_index" --- FAIL: TestSyncCompanyRSSFeed (0.04s)

Github Test Reporter

Copy link

report: Run #73

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
4 3 1 0 0 0 0 157ms

Some tests failed!

Name Failure Message
❌ TestSyncCompanyRSSFeed enttest.go:81: sql/schema: create "tags" table: pq: duplicate key value violates unique constraint "pg_class_relname_nsp_index" --- FAIL: TestSyncCompanyRSSFeed (0.04s)

Github Test Reporter

Copy link
Member Author

@pilyang pilyang left a comment

Choose a reason for hiding this comment

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

요거 로컬에서는 내가 따로 테스트 돌려도 성공하는데, 왜 액션에서 실패하는 이유 한번 따로 파악해봐야할듯....

바이브코딩이슈인지 먼가 내가 초기에 액션 설정이나 머 잘못한거 있는지 너무 오랜만에 이거 코드 보는거라 파악 필요....

Comment on lines +122 to +130
for _, company := range companies {
if company.RssURL != nil {
count, err := SyncCompanyRSSFeed(ctx, client, company.ID)
if err != nil {
log.Printf("Failed to sync RSS feed for company %s: %v", company.Name, err)
continue
}
totalCount += count
log.Printf("Synced %d new postings for %s", count, company.Name)
Copy link
Member

Choose a reason for hiding this comment

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

잘 모르고 남기는 걸수도 있음!!

rss 피드 수집하는거 순차적으로 도는 걸로 이해했는데
나중에 여기 고루틴 써볼 수 있을듯?!

log.Println("Starting RSS feed sync...")

// Create a context with timeout
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
Copy link
Member

Choose a reason for hiding this comment

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

타임아웃 👍

Comment on lines +24 to +29
c := cron.New(cron.WithSeconds())
return &Scheduler{
client: client,
cron: c,
config: config,
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
c := cron.New(cron.WithSeconds())
return &Scheduler{
client: client,
cron: c,
config: config,
}
c := cron.New(
cron.WithSeconds(),
cron.WithLogger(cron.VerbosePrintfLogger(log.Default())), // 상세히 찍히는 로그!
cron.WithChain(
cron.Recover(cron.DefaultLogger), // panic 복구
),
)
return &Scheduler{
client: client,
cron: c,
config: config,
}

찾아보니 요래 미들웨어형식으로 추가해줄 수 있다고 하네
withChain은 Job 돌아가다가 Panic이 발생해도 스케줄러는 계속 돌아가도록 하는 넘!

}

// Default to every hour if not specified
rssSyncCron := "0 0 * * * *"
Copy link
Member

Choose a reason for hiding this comment

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

상수화...?!

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.

2 participants