Skip to content

Claude 코드 리뷰 동작 개선 및 코멘트 응답 기능 추가#102

Merged
jhan0121 merged 2 commits into
be/devfrom
feat/ai-code-review
May 23, 2026
Merged

Claude 코드 리뷰 동작 개선 및 코멘트 응답 기능 추가#102
jhan0121 merged 2 commits into
be/devfrom
feat/ai-code-review

Conversation

@jhan0121
Copy link
Copy Markdown
Collaborator

🚀 작업 내용

  • @claude 멘션 시 응답하는 comment-response.yml 워크플로우 추가
  • 중복 실행 방지를 위한 concurrency 설정 추가
  • 리액션이 달린 인라인 코멘트는 삭제 대상에서 제외하도록 로직 수정

📸 이슈 번호

  • close #

✍ 궁금한 점

  • X

- `@claude` 멘션 시 응답하는 comment-response.yml 워크플로우 추가
- 중복 실행 방지를 위한 concurrency 설정 추가
- 리액션이 달린 인라인 코멘트는 삭제 대상에서 제외하도록 로직 수정
@jhan0121 jhan0121 added this to the 1.1.* milestone May 23, 2026
@jhan0121 jhan0121 self-assigned this May 23, 2026
@jhan0121 jhan0121 added the ✨ feat 기능 추가 label May 23, 2026
name: Claude PR Comment Response

on:
issue_comment:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[버그] issue_comment 이벤트는 일반 이슈에서도 발생합니다

issue_comment 트리거는 PR뿐 아니라 일반 이슈의 코멘트에서도 발동됩니다. PR 전용으로 제한하려면 if 조건에 PR 컨텍스트 체크를 추가해야 합니다.

if: |
  github.event.comment.user.login != 'github-actions[bot]' &&
  contains(github.event.comment.body, '@claude') &&
  (github.event_name == 'pull_request_review_comment' || github.event.issue.pull_request != null)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

이슈에서도 사용 가능하도록 유연하게 설정하기 위한 의도였음.

Comment thread .github/workflows/comment-response.yml Outdated
respond:
if: |
github.event.comment.user.login != 'github-actions[bot]' &&
contains(github.event.comment.body, '@claude')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[보안] 임의 사용자가 Claude를 트리거할 수 있습니다

현재 조건은 봇이 아닌 모든 사용자가 @claude를 언급하면 Claude를 실행시킬 수 있습니다. 외부 기여자나 스팸성 코멘트로 인한 불필요한 실행과 토큰 소모가 발생할 수 있습니다.

author_association으로 멤버/콜라보레이터 이상으로 제한하는 것을 권장합니다:

if: |
  github.event.comment.user.login != 'github-actions[bot]' &&
  contains(github.event.comment.body, '@claude') &&
  (github.event.comment.author_association == 'MEMBER' ||
   github.event.comment.author_association == 'OWNER' ||
   github.event.comment.author_association == 'COLLABORATOR')

pull_request_review_comment:
types: [ created ]

jobs:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[개선] concurrency 설정 누락

code-review.yml과 달리 이 워크플로우에는 concurrency 설정이 없습니다. 짧은 시간에 여러 번 @claude를 멘션하면 다수의 Claude 인스턴스가 동시에 실행될 수 있습니다.

jobs: 블록 앞에 추가하는 것을 권장합니다:

concurrency:
  group: claude-comment-${{ github.event.issue.number }}-${{ github.event.comment.id }}
  cancel-in-progress: false

코멘트 응답은 각각 독립적으로 처리되어야 하므로 cancel-in-progress: false가 적합합니다.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 테스트 커버리지 리포트

Overall Project 96.74% 🍏

There is no coverage information present for the Files changed

types: [ created ]

concurrency:
group: claude-comment-${{ github.event.issue.number }}-${{ github.event.comment.id }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[버그] pull_request_review_comment 이벤트에서 concurrency group 키가 불완전합니다.

github.event.issue.numberpull_request_review_comment 이벤트에서 null이 됩니다. comment.id가 전역 고유값이라 실제 충돌 가능성은 낮지만, 디버깅 시 group 키가 claude-comment-null-<id> 형태로 보여 혼란을 줄 수 있습니다.

Suggested change
group: claude-comment-${{ github.event.issue.number }}-${{ github.event.comment.id }}
group: claude-comment-${{ github.event.issue.number || github.event.pull_request.number }}-${{ github.event.comment.id }}

Comment on lines +15 to +20
if: |
github.event.comment.user.login != 'github-actions[bot]' &&
contains(github.event.comment.body, '@claude') &&
(github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'COLLABORATOR')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[제안] author_association 제한 범위 문서화 권장

현재 MEMBER, OWNER, COLLABORATOR@claude를 호출할 수 있어 외부 기여자(CONTRIBUTOR, FIRST_TIME_CONTRIBUTOR 등)는 사용할 수 없습니다. 의도된 보안 정책이라면 팀 문서나 PR 설명에 명시하는 것을 권장합니다.

또한 github.event.comment.user.login 대신 github.actor를 사용하면 이벤트 타입에 관계없이 일관되게 동작합니다.

issues: write
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[보안] claude-code-action 허용 툴 범위 미설정

allowed_tools 없이 실행하면 Claude가 git push, 파일 삭제 등 광범위한 작업을 수행할 수 있습니다. 의도한 사용 범위에 맞게 툴을 제한하는 것을 권장합니다.

Suggested change
- uses: anthropics/claude-code-action@v1
- uses: anthropics/claude-code-action@v1
        with:
          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
          github_token: ${{ secrets.GITHUB_TOKEN }}
          allowed_tools: "Bash,Read,Write,Edit"  # 필요한 툴만 허용

최소 권한 원칙(Principle of Least Privilege) 적용을 위해 실제 사용 패턴을 확인 후 범위를 좁히는 것을 추천합니다.

}
}' \
--jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | select([.comments.nodes[].author.login] | all(. == "github-actions")) | .comments.nodes[].databaseId' \
--jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | select([.comments.nodes[].author.login] | all(. == "github-actions")) | select([.comments.nodes[].reactions.totalCount] | add == 0) | .comments.nodes[].databaseId' \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[확인 필요] add == 0 조건은 스레드 단위로 동작합니다

현재 필터는 스레드 내 모든 코멘트의 리액션 합계가 0인 경우에만 삭제합니다. 즉, 스레드 안에서 어느 코멘트 하나라도 리액션이 달리면 스레드 전체가 보존됩니다.

  • 이것이 의도라면 (스레드 단위 보존): 현재 로직이 정확합니다. ✅
  • 코멘트 단위로 보존하고 싶다면: jq 파이프라인을 코멘트 레벨로 분리해야 합니다.

의도한 동작임을 명확히 하기 위해 PR 설명이나 주석으로 "스레드 단위 보존" 정책을 명시하는 것을 권장합니다.

@jhan0121 jhan0121 merged commit e4aced9 into be/dev May 23, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in recycle-study May 23, 2026
@jhan0121 jhan0121 deleted the feat/ai-code-review branch May 23, 2026 01:21
jhan0121 added a commit that referenced this pull request May 24, 2026
* init: 프로젝트 초기 설정 추가

* 이메일 기반 멀티 디바이스 인증 및 관리 기능 구현 (#3)

* build: JPA 의존성 추가

* feat: BaseEntity 추가

* feat: NullValidator 추가

* feat: docker compose 파일 추가

* feat: Email 추가

* feat: DeviceIdentifier 추가

* test: BaseEntity equals 검증 테스트 추가

* feat: Member 추가

* feat: Device 추가

* style: 불필요한 개행 제거

* feat: DeviceIdentifier 추가

* feat: email에 toString 추가

* feat: Device 정적 팩터리 메서드 구조 수정

- isActive 추가

* feat: RecyclestudyApplication에 비동기 설정 추가

* feat: 이메일 전송 기능을 위한 의존성 추가

* feat: 전역 예외 처리용 ControllerAdvice 추가

* feat: EmailService  추가

* feat: IdentifierCreator 추가

* feat: 멤버 저장 기능 추가

- 멤버 저장
- 디바이스 id 발급

* feat: 멤버의 디바이스 전체 조회 기능 추가

* feat: 디바이스 이메일 인증 메일 발송 기능 추가

* feat: 이메일 인증 기능 추가

* test: MemberServiceTest 불필요한 검증 로직 제거

* feat: GlobalControllerAdvice 예외 처리 로직 추가

* test: MemberControllerTest 추가

* test: DeviceControllerTest 추가

* chore: DeviceControllerTest 패키지 위치 수정

* refactor: Member 이메일 유니크 제약 조건 설정

* refactor: Device 내 Member에 JoinColumn 추가

* refactor: Device identifier 유니크 제약 조건 설정

* refactor: DeviceController 패키지 위치 수정 및 파라미터명 변경

* feat: ActivationExpiredDateTime 추가

* refactor: EmailService 구조 개선

- 로그 추가
- 메서드 분리

* feat: Member 이메일 검증 기능 추가

* feat: Device 소유 검증 기능 추가

* feat: GlobalControllerAdvice  내 DeviceActivationExpiredException 처리 추가

* refactor: 이메일 인증 제한 시간 로직 추가

* jacoco 기반 테스트 커버리지 CI 구축 (#6)

* feat: jacoco 기반 테스트 커버리지 CI 스크립트 추자

* test: 테스트 환경 DB H2 사용하도록 변경

* 디바이스 삭제 기능 추가 (#7)

* feat: 디바이스 삭제 기능 추가

* chore: final 키워드 누락 수정

* fix: 대상 디바이스를 제거하도록 기능 수정

* 등록한 디바이스 조회 기능 응답 형식 수정 (#9)

* fix: 등록한 디바이스 조회 기능 응답 형식 수정

* chore: 실행 sql 로그 출력 기능 활성화

* 복습할 URL 저장 기능 추가 (#10)

* feat: 리뷰 대상 url 저장 기능 추가

* fix: ReviewService 트랜잭션 누락 수정

* swagger 기반 API 문서 작성 (#12)

* feat: swagger 기반 api 문서 기능 추가

* refactor: 불필요한 로그 출력 제거

* refactor: 누락된 타입 명시 로직 추가

* CI 대상 branch 설정 추가 (#13)

* 복습 대상 URL 이메일 전송 스케줄러 구현 (#19)

* feat: Review 엔티티에 Member 연관 관계 추가

* feat: 주기적 복습 이메일 전송 기능 추가

- 공통 이메일 전송 기능 별도 분리 리팩터링 진행

* test: ReviewCycleServiceTest 추가

* refactor: ReviewSendOutput collect 내 불변 리스트를 사용하도록 수정

* refactor: html 태그에 lang 추가

* feat: 이메일 전송 이력 관리 기능 추가

* style: 코드 구조 정리

* refactor: ReviewEmailSender 타임존 설정 추가

* test: 메일 발송 실패 처리 검증 추가

* 로그 기능 추가 (#21)

* feat: 로그 기능 추가

* chore: 신규 유저 이메일 등록 시작 로그 태그명 수정

* feat: 이메일 마스킹 기능 적용

* refactor: 복습 주기 저장 로그 포맷 수정

* refactor: 이메일 전송 기능 도메인 객체 파라미터로 변경

* test: MemberServiceTest#authenticateDevice 테스트 커버리지 보완 (#22)

* flyway 기반 db 마이그레이션 의존성 추가 (#24)

* feat: flyway 기반 db 마이그레이션 의존성 추가

- 환경별 jpa sql 출력 여부 분리

* fix: ReviewCycle#scheduledAt not null 누락 수정

* test: 테스트 환경에서 flyway 비활성화

* 로그 기능 추가 (#21)

* feat: 로그 기능 추가

* chore: 신규 유저 이메일 등록 시작 로그 태그명 수정

* feat: 이메일 마스킹 기능 적용

* refactor: 복습 주기 저장 로그 포맷 수정

* refactor: 이메일 전송 기능 도메인 객체 파라미터로 변경

* test: MemberServiceTest#authenticateDevice 테스트 커버리지 보완 (#22)

* 배포 스크립트 추가 (#31)

* feat: 배포 스크립트 추가

* refactor: docker-compose.yaml env 설정 수정

* chore: 태그 검증 로그 메시지 수정

* feat: 모니터링을 위한 alloy 설정 추가 (#34)

* 배포 최적화 적용 (#36)

* 배포 스크립트 오류 수정 (#38)

* fix: 배포 스크립트 오류 수정

* fix: trace 연결 문제 수정

* 모니터링 설정 불일치 수정 (#40)

* feat: 모니터링 설정 추가

* fix: 로그 경로 불일치 수정

* 모니터링 연결 오류 수정 (#43)

* fix: loki, tempo 연결 오류 수정

* refactor: 모니터링용 컨테이너 설정 코드 병합

* 디바이스 인증 방식 헤더 마이그레이션 (Phase 1) (#46)

* feat: 디바이스 인증 기능 ArgumentResolver 추가

* refactor: 디바이스 id를 헤더를 활용하도록 마이그레이션 과정 추가

* 디바이스 인증 방식 헤더 마이그레이션 (Phase 3) (#49)

* hotfix: prod - dev 불일치 수정 (#51)

* 사용자 커스텀 복습 주기 관리 및 커스텀 주기 기반 리뷰 저장 기능 구현 (#53)

* chore: 불필요한 메서드 제거

* feat: 복습 주기 엔티티 추가

* feat: 커스텀 복습 주기 조회 기능 추가

* feat: 커스텀 복습 주기 저장 기능 추가

* feat: 커스텀 복습 주기 수정/삭제 기능 추가

* feat: 기본 복습 주기 처리 로직 수정

* style: 코드 컨벤션 정리

* style: 코드 컨벤션 정리

* feat: 주기별 리뷰 저장 기능 주기 옵션 설정 로직 추가

* refactor: 주기별 리뷰 저장 기능 주기 하위 호환성 분기 처리 추가

* refactor: ReviewService#calculateScheduledAts 초 단위 절삭 적용

* style: 불필요한 개행 제거

* LocalDateTime 초 단위 절삭 적용 (#54)

* 이메일 전송 실패 재시도 로직 구현 (#56)

* refactor: 리뷰 이메일 전송 기능 비동기 처리

* feat: 메일 전송 실패 재시도 로직 추가

* refactor: 리뷰 메일 재전송 로직 보완

- PENDING 데이터 고려
- 테스트 코드 추가 보완

* test: 불필요한 테스트 코드 제거

* 멤버 알림 시간 설정 변경 기능 추가 (#59)

* feat: 사용자 선호 알림 시간 설정 및 적용 기능 구현

- 리뷰 생성 시 1일 이상의 주기는 사용자 설정 시간에 맞춰 스케줄링되도록 로직 수정

* style: 테스트 코드 포맷팅 수정

* fix: 멤버 알림 시간 변경 로그의 이전 시간 표기 오류 수정

- 알림 시간 업데이트 후 로깅 시 변경 전 시간이 아닌 변경 후 시간이 기록되는 문제 수정

* 복습 주기 하위 호환성 로직 제거 (#61)

* style: 코드 컨벤션 정리

- 불필요한 import 제거
- 코드 포맷팅 수정

* refactor: 복습 주기 하위 호환성 로직 제거

- 프런트엔드 마이그레이션 완료에 따라 null 입력 시 기본 주기로 변환하는 로직 제거

* test: 불필요한 테스트 시나리오 제거

* test: 불필요한 테스트 시나리오 제거

* feat: 멤버 알림 시간 조회 API 추가 (#63)

- 멤버 조회 API에서 알림 시간 조회 기능 분리

* 로그 패턴에 스레드 정보 추가 (#65)

* chore: 콘솔 로그 패턴에 스레드 정보 추가

* chore: 파일 로그 패턴에 스레드 정보 추가

* 복습 주기 조회 쿼리 성능 개선 (#66)

* refactor: 복습 주기 조회 쿼리 성능 개선

- review_cycle 테이블 scheduled_at 컬럼 인덱스 추가
- findAllByScheduledAt 조회 시 fetch join 적용

* chore: 파일 개행 누락 수정

* 본인 소유 검증 누락으로 인한 멤버/디바이스 권한 문제 수정 (#69)

* refactor: 디바이스 인증 기능 마이그레이션

- 멤버 디바이스 조회 기능 수정
- RequestParam email 제거
- 인증된 디바이스 식별자로 멤버 조회하도록 변경

- 디바이스 삭제 기능 수정
- 인증된 디바이스 식별자로 요청자 식별
- 삭제 대상 디바이스 소유권 검증 로직 추가

- Service Input DTO 이메일 필드 제거
- MemberFindInput, DeviceDeleteInput

* refactor: 리뷰 저장 시 커스텀 주기 소유권 검증 로직 수정

- MemberServiceTest 예외 메시지 검증 구체화
- MemberControllerTest 불필요한 테스트 및 파라미터 제거

* test: 멤버 디바이스 조회 테스트 설명 수정

- 이메일 파라미터 누락 시 200 응답 반환에 맞춰 테스트 설명 수정

* feat: 리뷰 저장 시 커스텀 복습 주기 소유권 검증 로직 추가 (#71)

* 코드 리뷰 actions 스크립트 추가 (#72)

* Virtual Thread 적용을 통한 이메일 발송 처리량 개선 (#75)

* chore: virtual thread 설정 추가

- application.yaml VT 설정 추가
- Dockerfile 런타임 JDK 25버전으로 상향 조정

* chore: Docker 이미지 태그 버전 고정

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* 이메일 발송 로직 notification_history outbox 패턴 전환 (#77)

* refactor: 이메일 전송 로직 재구성

- notification_history를 outbox 패턴 전환: append-only INSERT → 단건 UPDATE 방식
- fail_count, last_attempted_at 컬럼 추가
- 스케줄러 조회를 정확 일치에서 범위 조회로 변경해 서버 다운 시 PENDING 누락 방지
- findAllRetryableCycles에 cutoffDateTime으로 단기 주기 재시도 제외

* refactor: 불필요한 트랜잭션 annotation 제거

* refactor: clearAutomatically 적용

* refactor: 벌크 update 결과 검증 로직 추가

* style: 단기 주기 판단 기준 주석화

* refactor: NotificationHistoryService#updateStatus 로직 최적화

* 다음 리뷰 전송 예정 정보 조회 API 구현 (#79)

* feat: 다음 리뷰 주기 조회 기능 추가

* refactor: NotificationHistoryRepository#findAllByMemberAndStatus로 메서드명 수정

* Gmail SMTP에서 AWS SES SDK v2로 이메일 발송 인프라 교체 (#81)

* chore: Gmail SMTP에서 AWS SES SDK v2로 이메일 발송 인프라 교체

* refactor: 이메일 전송 예외 처리 및 테스트 보완

* 이메일 재전송 포기 기준을 maxRetry 횟수 -> deadline 기반으로 전환 (#84)

* refactor: 전송 실패 이메일 재전송 기능 정리

* test: 테스트 회귀 문제 수정

* notification_history.review_cycle_id unique constraint 추가 (#86)

* chore: NotificationHistory review_cycle_id에 유니크 제약 조건 추가

* refactor: NotificationHistory 유니크 제약 조건명 명시

* style: NotificationHistory 테이블 설정 개행 정리

* deadline을 PENDING 생성 시점에 결정하도록 NotificationHistory 설계 개선 (#89)

* refactor: NotificationHistory deadline 계산 로직 변경
  - 새로운 복습 주기가 추가될 때, 계산하도록 수정

* README.md 설명 추가 (#90)

* docs: README.md 설명 추가

- 프로젝트 소개 추가
- 서비스 기능 설명 추가
- 기술 스택 추가
- 아키텍처 다이어그램 추가

* docs: README 문서 이미지 및 뱃지 수정

- 이미지 너비 100% 설정
- 기술 스택 뱃지 줄바꿈 추가

* docs: README 뱃지 색상 수정

- Loki, Tempo 뱃지 색상 변경

* 서버 및 DB 시간 처리 정책 UTC로 통일 (#93)

* fix: 서버 타임존 처리 UTC로 통일

* fix: 서버 타임존 처리 UTC로 통일

* refactor: UTC 변환로직을 도메인 레이어로 이동

* refactor: Jackson 설정 application.yaml 설정으로 변경

* notification_history 테이블에 status, deadline 복합 인덱스 추가 (#96)

* db 커넥션 풀 및 jvm 설정 추가 (#99)

- 컨테이너 별 메모리 제한
- jvm 힙 메모리 한도
- hikaricp 누수 감지 시간

* Claude 코드 리뷰 동작 개선 및 코멘트 응답 기능 추가 (#102)

* feat: Claude 코드 리뷰 동작 개선 및 코멘트 응답 기능 추가

- `@claude` 멘션 시 응답하는 comment-response.yml 워크플로우 추가
- 중복 실행 방지를 위한 concurrency 설정 추가
- 리액션이 달린 인라인 코멘트는 삭제 대상에서 제외하도록 로직 수정

* fix: Claude 댓글 응답 워크플로우 접근 권한 및 동시성 제어 추가

* review_cycle에 notification_history 병합 및 복합 인덱스 적용 (#104)

* refactor: NotificationHistory 도메인을 ReviewCycle로 병합

- status, failCount, lastAttemptedAt, deadline 필드를 ReviewCycle 엔티티로 이동
- 불필요해진 NotificationHistory 도메인, 리포지토리, 서비스 클래스 제거
- 이메일 전송 상태 업데이트 및 조회 쿼리를 ReviewCycleRepository로 통합
- SingleReviewEmailSender에서 발송 결과 처리 시 ReviewCycleService를 사용하도록 변경
- ReviewService에서 ReviewCycle 엔티티를 생성할 때 발송 상태(PENDING)와 deadline을 함께 설정하도록 구조 변경
- 분리되어 있던 NotificationHistory 저장 로직 제거
- 기존 notification_history 테이블의 데이터를 review_cycle 테이블로 이전 및 제약조건 추가
- 발송 대상 및 재시도 조회를 위한 최적화 복합 인덱스(status, scheduled_at / status, deadline) 추가

* refactor: ReviewCycleRepository 조회 및 벌크 연산 쿼리 개선

- ReviewCycle 조회 쿼리에 Member 엔티티 fetch join 추가
- 상태 업데이트 벌크 연산(@Modifying) 실행 전 영속성 컨텍스트 동기화를 위해 flushAutomatically = true 옵션 추가

* test: ReviewCycleService updateStatus 테스트 추가

- ReviewCycleService updateStatus 관련 테스트 시나리오 추가
- ReviewCycleTest 내 불필요한 import 제거

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feat 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant