Skip to content

feat: notify-dalroot 콜백 자동화 — task 완료 시 호스트 알림#544

Merged
dalsoop merged 1 commit intomainfrom
issue-540/dalops
Mar 30, 2026
Merged

feat: notify-dalroot 콜백 자동화 — task 완료 시 호스트 알림#544
dalsoop merged 1 commit intomainfrom
issue-540/dalops

Conversation

@dalsoop
Copy link
Copy Markdown
Owner

@dalsoop dalsoop commented Mar 30, 2026

Summary

  • DALCENTER_NOTIFY_URL 환경변수로 HTTP push 알림 지원 (polling 불필요)
  • task 완료/실패 시 자동으로 호스트에 알림 전송 (--callback-pane 없이도 동작)
  • 성공 시 PR URL 포함, 실패 시 에러 내용 포함한 풍부한 페이로드
  • handleTaskFinish API에서도 자동 알림 전송
  • 기존 notify-dalroot CLI 하위호환 유지

Closes #540

Test plan

  • go build ./... 성공
  • go test ./internal/daemon/ 전체 통과
  • NotifyPayload 직렬화/역직렬화 테스트
  • extractPRUrl 다양한 케이스 테스트
  • sendNotifyHTTP httptest 서버 테스트

🤖 Generated with Claude Code

- DALCENTER_NOTIFY_URL 환경변수로 HTTP push 알림 지원
- --callback-pane 없이도 기본 알림 경로 설정 가능
- 성공 시 PR URL 포함, 실패 시 에러 내용 포함
- handleTaskFinish API에서도 자동 알림 전송
- 기존 notify-dalroot CLI 하위호환 유지

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Owner Author

@dalsoop dalsoop left a comment

Choose a reason for hiding this comment

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

코드 리뷰 — notify-dalroot 콜백 자동화

전반적으로 깔끔하고 잘 구조화된 PR입니다. 기존 notifyDalroot 함수를 새로운 notifyTaskComplete로 대체하면서 HTTP push 알림을 추가하고, 하위호환성도 잘 유지하고 있습니다.

구조 및 설계

  • notify.go로 알림 관련 로직을 별도 파일로 분리한 것은 좋은 판단입니다.
  • 3단계 채널 (HTTP → CLI → log only) 우선순위 구조가 명확합니다.
  • buildNotifyPayload / sendNotifyHTTP / sendNotifyCLI로 책임이 잘 분리되어 있습니다.

테스트

  • httptest를 활용한 HTTP 전송 테스트, payload 직렬화 테스트, extractPRUrl 다양한 케이스 테스트 등 충분한 커버리지입니다.

사소한 개선 사항 (blocking 아님)

  1. NotifyPayload.Output 필드 미사용 (notify.go:24): struct에 Output 필드가 선언되어 있으나 buildNotifyPayload에서 값을 채우지 않습니다. 의도적으로 output을 제외한 것이라면 필드를 제거하는 것이 깔끔하고, 포함 의도라면 p.Output = truncateStr(tr.Output, 500) 등으로 채워주면 좋겠습니다.

  2. goroutine에서의 *taskResult 접근 (notify.go:40,45): sendNotifyHTTP은 payload를 값 복사로 받아서 안전하지만, sendNotifyCLI*taskResult 포인터를 goroutine으로 전달합니다. execTaskInContainer에서는 notifyTaskComplete 호출 후 더 이상 tr 수정이 없어 현재는 문제없지만, handleTaskFinish에서는 notifyTaskComplete 호출 후 respondJSON(w, http.StatusOK, tr)에서 tr을 읽으므로 이론적으로 경합이 가능합니다. sendNotifyCLItr의 필드를 읽기만 하므로 실질적 위험은 낮지만, 방어적으로 메시지를 미리 만들어 goroutine에 문자열만 넘기는 것도 고려할 수 있습니다.

  3. DALCENTER_NOTIFY_URL 스키마 검증 부재 (notify.go:39): 환경변수 값이 유효한 URL인지 검증 없이 바로 client.Post로 전달됩니다. 잘못된 값 설정 시 디버깅이 어려울 수 있으므로, 시작 시 한 번 url.Parse로 검증하거나, 에러 로그에 힌트를 추가하면 좋겠습니다.

  4. HTTP 응답 상태 코드 미검증 (notify.go:93-94): 4xx/5xx 응답도 성공으로 로깅됩니다. resp.StatusCode >= 400일 때 경고 레벨 로그를 남기면 문제 추적이 쉬워집니다.

위 사항들은 모두 개선 제안이며, 현재 코드도 기능적으로 올바르게 동작합니다. LGTM 👍

Copy link
Copy Markdown
Owner Author

@dalsoop dalsoop left a comment

Choose a reason for hiding this comment

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

[Code Review] APPROVE — 알림 리팩토링 깔끔. HTTP 10s timeout, 3단계 fallback, extractPRUrl() 견고. #543과 extractPRUrl 중복 — #543 rebase 필요.

@dalsoop dalsoop merged commit d438531 into main Mar 30, 2026
1 check passed
@dalsoop dalsoop deleted the issue-540/dalops branch March 30, 2026 20:30
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.

notify-dalroot 콜백 자동화 — task 완료 시 호스트 알림

1 participant