Skip to content

fix: 세션 설정 정리 + 분석 결과 cascade soft delete + 질문 풀 토큰 절감#41

Merged
i3months merged 1 commit into
devfrom
fix/session-config-cleanup
Jun 1, 2026
Merged

fix: 세션 설정 정리 + 분석 결과 cascade soft delete + 질문 풀 토큰 절감#41
i3months merged 1 commit into
devfrom
fix/session-config-cleanup

Conversation

@i3months

@i3months i3months commented Jun 1, 2026

Copy link
Copy Markdown
Member

운영 코드 분석에서 발견된 4가지 이슈 일괄 패치.

F1. SessionCreateRequest Bean Validation 정리

  • maxQuestions @min(1) → @min(2). applyPool 자동 종료 검사 없고 applyFollowup 에서만 종료 → 1 설정해도 최소 첫질문+꼬리질문 2개. 최소값 2로 명시.
  • maxDurationMinutes 시간 기반 자동 종료 미구현 → @Min/@Max/@NotNull 제거, nullable 허용 (DB 저장만 유지, Sprint 4 에서 정식 분기).
  • SessionMode 사용처 entity·DTO 외 0건 → @NotNull 풀고 null 시 default ONLINE.

F2. Resume/GithubRepository 삭제 시 AnalyzedDocument cascade soft delete

  • Resume/Repository/AnalyzedDocument 에 markDeleted() 도메인 메서드 추가 (User.markDeleted() 동일 패턴).
  • ResumeService.delete / GithubRepositoryService.delete 가 entity.markDeleted() 호출 + ResumeDeletedEvent / RepositoryDeletedEvent 발화.
  • document.application.AnalyzedDocumentCascadeListener 가 두 이벤트 수신 → 관련 AnalyzedDocument soft delete.
  • 직접 의존 회피 (ArchUnit 도메인 cycle 차단 — resume/github 가 document import X).
  • 임베딩(document_embeddings) 은 컨텍스트 선택 시 deleted=false 만 노출되므로 별도 정리 불필요.

F3. AI 질문 풀 토큰 낭비 차단

  • Core QuestionsCallbackService.applyPool 이 questions[0] 만 INSERT 하고 나머지 폐기. envelope.max_questions=10 면 LLM 출력 9개 버려져 토큰 약 10배 낭비.
  • AI QuestionsConsumer 에 initial_pool_size (default 1) 추가, envelope 무시.
  • settings.questions_initial_pool_size = 1. 풀 저장 도입 시 늘리기 쉬움.

테스트

  • Backend BUILD SUCCESSFUL (ArchUnit 도메인 cycle 통과)
  • AI 144 passed (test_questions_consumer max_questions assertion 갱신)

변경 사항

운영 코드 분석에서 발견된 4가지 이슈 일괄 패치.

## F1. SessionCreateRequest Bean Validation 정리
- maxQuestions @min(1) → @min(2). applyPool 자동 종료 검사 없고 applyFollowup
  에서만 종료 → 1 설정해도 최소 첫질문+꼬리질문 2개. 최소값 2로 명시.
- maxDurationMinutes 시간 기반 자동 종료 미구현 → @Min/@Max/@NotNull 제거,
  nullable 허용 (DB 저장만 유지, Sprint 4 에서 정식 분기).
- SessionMode 사용처 entity·DTO 외 0건 → @NotNull 풀고 null 시 default ONLINE.

## F2. Resume/GithubRepository 삭제 시 AnalyzedDocument cascade soft delete
- Resume/Repository/AnalyzedDocument 에 markDeleted() 도메인 메서드 추가
  (User.markDeleted() 동일 패턴).
- ResumeService.delete / GithubRepositoryService.delete 가 entity.markDeleted()
  호출 + ResumeDeletedEvent / RepositoryDeletedEvent 발화.
- document.application.AnalyzedDocumentCascadeListener 가 두 이벤트 수신 →
  관련 AnalyzedDocument soft delete.
- 직접 의존 회피 (ArchUnit 도메인 cycle 차단 — resume/github 가 document import X).
- 임베딩(document_embeddings) 은 컨텍스트 선택 시 deleted=false 만 노출되므로
  별도 정리 불필요.

## F3. AI 질문 풀 토큰 낭비 차단
- Core QuestionsCallbackService.applyPool 이 questions[0] 만 INSERT 하고 나머지
  폐기. envelope.max_questions=10 면 LLM 출력 9개 버려져 토큰 약 10배 낭비.
- AI QuestionsConsumer 에 initial_pool_size (default 1) 추가, envelope 무시.
- settings.questions_initial_pool_size = 1. 풀 저장 도입 시 늘리기 쉬움.

## 테스트
- Backend BUILD SUCCESSFUL (ArchUnit 도메인 cycle 통과)
- AI 144 passed (test_questions_consumer max_questions assertion 갱신)
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stackup Ready Ready Preview, Comment Jun 1, 2026 7:23am

@i3months i3months merged commit 29f9054 into dev Jun 1, 2026
3 checks passed
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.

1 participant