Skip to content

Comments

feat: 거대한 외침의 뿔피리 사용자 인증 메시지 추출기 구현#99

Merged
dev-ant merged 8 commits intodevfrom
feat/verfigy-message-filter
Feb 17, 2026
Merged

feat: 거대한 외침의 뿔피리 사용자 인증 메시지 추출기 구현#99
dev-ant merged 8 commits intodevfrom
feat/verfigy-message-filter

Conversation

@dev-ant
Copy link
Contributor

@dev-ant dev-ant commented Feb 17, 2026

📋 상세 설명

  • 특정 메시지 패턴 감지 시 사용자 인증 이벤트를 Kafka 발행 기능 구현
  • Elasticsearch 접근 방식을 Repository 패턴에서 ElasticsearchOperations 직접 사용으로 리팩터링
  • 150+ 파일의 import 순서를 static → java.* → third-party 규칙으로 일괄 정리

📊 체크리스트

  • PR 제목이 형식에 맞나요 e.g. feat: PR을 등록한다
  • 코드가 테스트 되었나요
  • 문서는 업데이트 되었나요
  • 불필요한 코드를 제거했나요
  • 이슈와 라벨이 등록되었나요

@github-actions
Copy link

✅ 테스트 결과 for PR

Build: success

🧪 테스트 실행 with Gradle
📈 Coverage: -0.00%

📁 테스트 결과
📁 커버리지 보고서 (HTML)

@codecov
Copy link

codecov bot commented Feb 17, 2026

@dev-ant dev-ant self-assigned this Feb 17, 2026
@dev-ant dev-ant added the ✨feature 새로운 기능 추가 label Feb 17, 2026
@dev-ant dev-ant requested a review from Copilot February 17, 2026 02:54
@dev-ant dev-ant changed the title Feat/verfigy message filter feat: 거대한 외침의 뿔피리 사용자 인증 메시지 추출기 구현 Feb 17, 2026
Copy link
Contributor

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 pull request implements a user verification message filter feature for the HornBugle (뿔피리/horn bugle) messaging system. The changes introduce Kafka event publishing to detect and process user verification codes embedded in horn bugle messages, along with comprehensive import reorganization across the entire codebase.

Changes:

  • Added Kafka integration for publishing user verification events when specific message patterns are detected
  • Refactored Elasticsearch operations from repository pattern to direct ElasticsearchOperations usage
  • Reorganized imports across 150+ files following a consistent pattern (static imports → java.* → third-party)

Reviewed changes

Copilot reviewed 154 out of 155 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
HornBugleKafkaProducerService.java New Kafka producer service for user verification events
UserVerificationVerifyEvent.java New DTO for verification event data
HornBugleScheduler.java Added regex pattern matching and event publishing for verification codes
HornBugleService.java Added method to return saved entities for event publishing
HornBugleIndexService.java Replaced repository with direct ElasticsearchOperations calls
HornBugleElasticsearchConfig.java Removed @EnableElasticsearchRepositories annotation
HornBugleIndexRunner.java Updated conditional activation to require both ES flags
KafkaTopicConstant.java New constants class for Kafka topic names
application.yml Added Kafka configuration (bootstrap servers, serializers, topics)
application-sample.yml Added sample Kafka configuration
docker-compose-local.yml Added Kafka bootstrap servers and hostname resolution
build.gradle.kts Added spring-kafka dependency
140+ other files Import reorganization (static first, then java.*, then third-party)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +8
public class KafkaTopicConstant {

public static final String USER_VERIFICATION_VERIFY_EVENT = "USER_VERIFICATION_VERIFY_EVENT";

private KafkaTopicConstant() {}
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The constructor for KafkaTopicConstant is private, which is correct for a utility class. However, the class should be declared as final to prevent inheritance and make the design intent clearer that this is purely a constants holder class.

Copilot uses AI. Check for mistakes.
Comment on lines +68 to +70
for (HornBugleDocument document : batch) {
elasticsearchOperations.save(document, IndexCoordinates.of(INDEX_NAME));
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The batch indexing logic has changed from repository.saveAll(batch) to iterating and calling elasticsearchOperations.save() individually for each document. This is less efficient than a true bulk operation. Consider using elasticsearchOperations.bulkIndex() or elasticsearchOperations.save() with a collection parameter if available, to maintain the performance benefits of batch operations.

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +24
public void sendUserVerificationVerifyEvent(UserVerificationVerifyEvent event) {
kafkaTemplate.send(userVerificationVerifyTopic, event);
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The method sendUserVerificationVerifyEvent in HornBugleKafkaProducerService does not handle the asynchronous result returned by kafkaTemplate.send(). The send operation returns a CompletableFuture that should be checked for success or failure. Consider adding error handling with a callback to log failures, for example using .whenComplete() or .exceptionally().

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +58
kafka:
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The Kafka bootstrap servers configuration uses an environment variable without a default value. If KAFKA_BOOTSTRAP_SERVERS is not set, the application will fail to start. Consider providing a default value (e.g., localhost:9092) for local development or add validation to fail gracefully with a clear error message.

Copilot uses AI. Check for mistakes.
# 로컬 개발 시 설정 파일 마운트 (선택사항)
# - ./config:/app/config:ro
extra_hosts:
- "devnogi.ddns.net:119.194.235.11" # Kafka advertised hostname 임시 해석
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The extra_hosts configuration maps devnogi.ddns.net to a specific IP address. This is hardcoded and environment-specific, which could cause issues in other deployment environments. Consider using environment variables for both the hostname and IP address to make this configuration more flexible and portable across different environments.

Suggested change
- "devnogi.ddns.net:119.194.235.11" # Kafka advertised hostname 임시 해석
- "${KAFKA_ADVERTISED_HOSTNAME:-devnogi.ddns.net}:${KAFKA_ADVERTISED_IP:-119.194.235.11}" # Kafka advertised hostname 임시 해석 (env-overridable)

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +25
@Service
@RequiredArgsConstructor
public class HornBugleKafkaProducerService {

private final KafkaTemplate<String, Object> kafkaTemplate;

@Value(
"${app.kafka.topics.user-verification-verify:"
+ KafkaTopicConstant.USER_VERIFICATION_VERIFY_EVENT
+ "}")
private String userVerificationVerifyTopic;

public void sendUserVerificationVerifyEvent(UserVerificationVerifyEvent event) {
kafkaTemplate.send(userVerificationVerifyTopic, event);
}
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The new Kafka producer service HornBugleKafkaProducerService and the verification event publishing logic in HornBugleScheduler.publishVerificationEvents() lack test coverage. Given that other services in the codebase have comprehensive test coverage (e.g., AuctionHistoryServiceTest, ItemInfoServiceTest), these new critical features should also have unit tests to ensure reliability.

Copilot uses AI. Check for mistakes.
Comment on lines +6 to 9
/** Elasticsearch 설정 클래스. elasticsearch.enabled=true일 때만 관련 구성을 활성화한다. */
@Configuration
@ConditionalOnProperty(name = "elasticsearch.enabled", havingValue = "true", matchIfMissing = false)
@EnableElasticsearchRepositories(
basePackages = "until.the.eternity.hornBugle.infrastructure.elasticsearch")
public class HornBugleElasticsearchConfig {}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The configuration annotation @EnableElasticsearchRepositories has been removed from this config class. Since HornBugleElasticsearchRepository is still present in the codebase (at src/main/java/until/the/eternity/hornBugle/infrastructure/elasticsearch/HornBugleElasticsearchRepository.java), it appears this repository interface should either be deleted or this configuration should remain. As the repository is no longer being used in HornBugleIndexService, the repository interface should be deleted to maintain consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +117 to +141
private void publishVerificationEvents(List<HornBugleWorldHistory> savedHistories) {
for (HornBugleWorldHistory history : savedHistories) {
Matcher matcher = CERTIFICATE_PATTERN.matcher(history.getMessage());

while (matcher.find()) {
String verificationValue = matcher.group(1);

UserVerificationVerifyEvent event =
new UserVerificationVerifyEvent(
history.getCharacterName(),
history.getServerName(),
verificationValue,
history.getMessage(),
history.getDateSend());

hornBugleKafkaProducerService.sendUserVerificationVerifyEvent(event);

log.info(
"[HornBugle] Verification event published. characterName={}, serverName={}, verificationValue={}",
history.getCharacterName(),
history.getServerName(),
verificationValue);
}
}
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The new method publishVerificationEvents lacks error handling. If the Kafka producer fails to send an event, the exception will propagate and potentially disrupt the scheduler. Consider wrapping the sendUserVerificationVerifyEvent call in a try-catch block to handle Kafka failures gracefully and log errors without stopping the entire scheduler execution.

Copilot uses AI. Check for mistakes.
private final HornBugleKafkaProducerService hornBugleKafkaProducerService;

private static final long RATE_LIMIT_DELAY_MS = 1000L;
private static final Pattern CERTIFICATE_PATTERN = Pattern.compile("메모노기_([A-Z0-9]{20})");
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The regex pattern 메모노기_([A-Z0-9]{20}) assumes verification codes are exactly 20 characters of uppercase letters and digits. Consider validating this assumption and documenting it. If the verification code format might change in the future, consider making the pattern configurable via application properties rather than hard-coding it.

Copilot uses AI. Check for mistakes.
Comment on lines 24 to 27
@ConditionalOnProperty(
name = "elasticsearch.index.enabled",
name = {"elasticsearch.enabled", "elasticsearch.index.enabled"},
havingValue = "true",
matchIfMissing = false)
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

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

The @ConditionalOnProperty condition has been changed to require both elasticsearch.enabled and elasticsearch.index.enabled to be true. This is a breaking change in behavior. Previously, only elasticsearch.index.enabled was required. Now, if only elasticsearch.index.enabled is set to true without elasticsearch.enabled, this runner won't activate. This should be documented or reconsidered to maintain backward compatibility.

Copilot uses AI. Check for mistakes.
@dev-ant dev-ant merged commit 5d66219 into dev Feb 17, 2026
7 of 8 checks passed
@dev-ant dev-ant deleted the feat/verfigy-message-filter branch February 17, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨feature 새로운 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant