Skip to content

refactor: 인터뷰 기능 개선#1644

Merged
jaeyeonling merged 5 commits intomainfrom
refactor/enhance-interview
May 9, 2025
Merged

refactor: 인터뷰 기능 개선#1644
jaeyeonling merged 5 commits intomainfrom
refactor/enhance-interview

Conversation

@jaeyeonling
Copy link
Contributor

이 Pull Request는 인터뷰 세션 기능에 대한 여러 개선 사항과 버그 수정을 포함합니다. 주요 변경 사항은 인터뷰 라운드 추적 개선, 세션 상태 처리 정교화, 인터뷰 진행 상황에 대한 UI 피드백 강화 등이며, 사용자 경험 향상과 시스템 안정성 확보를 목표로 합니다.

백엔드 변경 사항

인터뷰 라운드 추적 및 상태 관리:

  • InterviewSessionResponsecurrentRoundremainRound 필드를 추가하여 현재 인터뷰 라운드 및 남은 라운드를 추적합니다. remainRound는 동적으로 계산됩니다. ([1], [2], [3])
  • InterviewMessages에서 getRoundgetCurrentRound로 이름을 변경하고, 시작 라운드 오프셋을 반영하는 로직으로 수정했습니다. ([1], [2])
  • 인터뷰 종료 조건을 판단하는 canFinish 메서드를 수정하여, 빈 메시지 존재 여부나 인터뷰어의 종료 멘트 여부 등을 포함해 보다 명확한 종료 기준을 적용했습니다. (backend/src/main/java/wooteco/prolog/interview/domain/InterviewMessages.javaL53-R63)

트랜잭션 관리:

새로운 메서드 및 리팩터링:

프론트엔드 변경 사항

UI 개선:

타입 안정성과 상태 관리:

  • InterviewSessionData 인터페이스를 새로 정의하여 타입 안정성을 강화하고, 이를 InterviewPageInterviewSession의 상태 관리에 적용했습니다. ([1], [2])

입력 포커스 처리:

테스트 업데이트

- InterviewSession.answer():
  - 인터뷰이 메시지 생성 책임을 Interviewer 구현체로 이전.
  - AI 응답 후 업데이트된 전체 대화 기록으로 종료 조건 확인.

- AzureOpenAiInterviewer.followUp():
  - 인터뷰이 메시지 추가 후 AI 호출 전 불필요한 canFinish() 검사 제거.
  - AI 후속 질문 요청 로직 일관성 확보.
  - 누락된 checkFollowUpQuestion 메소드 복원.
- 인터뷰 종료 시 마지막 피드백 메시지 스타일 변경 시도 (진단용 스타일 적용 상태)
- 답변 제출 후 입력창에 포커스 유지 기능 추가
- Shift+Enter로 입력된 여러 줄의 메시지가 올바르게 표시되도록 white-space 속성 수정
- 인터뷰 종료 여부 확인 로직 간소화
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @jaeyeonling, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on improving the interview session functionality, covering both backend and frontend enhancements. The primary goals are to refine interview round tracking, improve session state management, and enhance UI feedback for a better user experience and system stability. Key changes include adding round tracking to the backend, improving the interview end condition logic, adding transaction management, displaying the remaining rounds in the UI, and emphasizing the last message upon interview completion. Additionally, there are updates to the frontend to improve type safety and input focus handling, as well as new tests to validate the round calculations and end conditions.

Highlights

  • Backend: Interview Round Tracking and State Management: The InterviewSessionResponse now includes currentRound and remainRound fields for tracking interview progress. The canFinish method has been updated to provide clearer termination criteria.
  • Backend: Transaction Management: The createSession method in InterviewService is now transactional to ensure that session creation errors are properly rolled back.
  • Frontend: UI Improvements: The interview header now displays the number of remaining rounds, and an EmphasizedFeedbackMessage component highlights the final message upon interview completion.
  • Frontend: Type Safety and State Management: An InterviewSessionData interface has been introduced to enhance type safety in the InterviewPage and InterviewSession components.
  • Frontend: Input Focus Handling: The input field now automatically focuses after submitting an answer, as long as the interview hasn't ended.
  • Tests: Added tests to InterviewMessagesTest to verify round calculations, empty message handling, and interview termination conditions.

Changelog

Click here to see the changelog
  • backend/src/main/java/wooteco/prolog/interview/application/InterviewService.java
    • Added @Transactional annotation to createSession method to ensure rollback on errors (line 37).
  • backend/src/main/java/wooteco/prolog/interview/application/InterviewSessionMapper.java
    • Added interviewSession.getRound() to the mapToResponse method (line 28).
  • backend/src/main/java/wooteco/prolog/interview/application/InterviewSessionResponse.java
    • Added currentRound field to the record (line 12).
    • Added remainRound property to calculate remaining rounds (line 18).
  • backend/src/main/java/wooteco/prolog/interview/domain/InterviewMessage.java
    • Added getOriginalContent method to retrieve the original message content (line 144).
  • backend/src/main/java/wooteco/prolog/interview/domain/InterviewMessages.java
    • Added START_ROUND constant (line 19).
    • Renamed getRound to getCurrentRound and updated logic to reflect the starting round offset (line 43).
    • Modified canFinish method to include checks for empty messages and interviewer closing summary (line 57).
    • Added getMessages method to return an unmodifiable list of messages (line 89).
  • backend/src/main/java/wooteco/prolog/interview/domain/InterviewSession.java
    • Modified answer method to handle empty messages and ensure it's the interviewer's turn (line 60).
    • Added getRound method to return the current round (line 88).
  • backend/src/main/java/wooteco/prolog/interview/infrastructure/AzureOpenAiInterviewer.java
    • Updated followUp method to use getCurrentRound and ensure the interview is not over (line 123).
    • Updated finish method to use getCurrentRound to check if the interview is not finished (line 167).
  • backend/src/test/java/wooteco/prolog/interview/domain/InterviewMessagesTest.java
    • Added tests for round calculation, empty message handling, and interview termination conditions (lines 51-102).
  • frontend/src/pages/InterviewPage/InterviewPage.tsx
    • Added RoundInfo component to display remaining rounds (line 118).
    • Defined InterviewSessionData interface for type safety (lines 69-81).
    • Updated handleSessionStart and handleSessionUpdate to use the new InterviewSessionData type (lines 86, 90).
  • frontend/src/pages/InterviewPage/InterviewSession.tsx
    • Added EmphasizedFeedbackMessage component to highlight the last message on interview completion (line 36).
    • Defined InterviewSessionData interface for type safety (lines 164-176).
    • Updated InterviewSessionProps to use the new InterviewSessionData type (line 179).
    • Added logic to focus the input field after submitting an answer if the interview is not finished (line 239).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A session's state,
With rounds to track and show,
UX made better.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot 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

This pull request introduces several improvements to the interview session feature, including better round tracking, refined session state handling, and enhanced UI feedback. The changes aim to improve user experience and system stability. Overall, the changes look good, but there are a few areas that could be improved.

Summary of Findings

  • Inconsistent use of START_ROUND constant: The START_ROUND constant is defined in both InterviewSessionResponse and InterviewMessages. It should be defined in a single place to avoid inconsistency.
  • Clarity of canFinish method: The canFinish method in InterviewMessages could be more readable by extracting the conditions into separate, well-named methods.
  • Duplicated Interface: The InterviewSessionData interface is defined in both InterviewPage.tsx and InterviewSession.tsx. It should be defined in a single place and imported where needed.

Merge Readiness

The pull request is almost ready to be merged. However, there are a few issues that should be addressed before merging, particularly the inconsistent use of the START_ROUND constant and the duplicated interface. Addressing these issues will improve the code's maintainability and reduce the risk of errors. I am unable to approve this pull request, and recommend that others review and approve this code before merging.

Comment on lines +19 to 20
private static final int START_ROUND = 1;
private static final int MAX_ROUND = 10;

Choose a reason for hiding this comment

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

medium

Consider defining START_ROUND as a constant in a single, shared location (e.g., a configuration class or interface) to avoid duplication and potential inconsistencies with InterviewSessionResponse.java.

Comment on lines 57 to +63
public boolean canFinish() {
return getRound() >= MAX_ROUND && !hasInterviewerClosingSummary();
if (values.isEmpty()) {
return false;
}
return getCurrentRound() > MAX_ROUND &&
lastMessage().isByInterviewer() &&
!hasInterviewerClosingSummary();

Choose a reason for hiding this comment

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

medium

This canFinish method could be more readable. Consider extracting the conditions into separate, well-named methods to improve clarity. For example, isMaxRoundReached() and isLastMessageByInterviewer().

Comment on lines +69 to +81
interface InterviewSessionData {
id: number;
memberId: number;
finished: boolean;
messages: {
sender: 'SYSTEM' | 'INTERVIEWER' | 'INTERVIEWEE';
content: string;
hint: string;
createdAt: string;
}[];
currentRound: number;
remainRound: number;
}

Choose a reason for hiding this comment

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

medium

This InterviewSessionData interface is also defined in InterviewSession.tsx. Define it in a single place (e.g., a separate file like src/types/interview.ts) and import it in both components to avoid duplication and ensure type consistency.

Comment on lines +164 to +176
interface InterviewSessionData {
id: number;
memberId: number;
finished: boolean;
messages: {
sender: 'SYSTEM' | 'INTERVIEWER' | 'INTERVIEWEE';
content: string;
hint: string;
createdAt: string;
}[];
currentRound: number;
remainRound: number;
}

Choose a reason for hiding this comment

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

medium

This InterviewSessionData interface is also defined in InterviewPage.tsx. Define it in a single place (e.g., a separate file like src/types/interview.ts) and import it in both components to avoid duplication and ensure type consistency.

@jaeyeonling jaeyeonling merged commit cc263e5 into main May 9, 2025
1 of 2 checks passed
@jaeyeonling jaeyeonling deleted the refactor/enhance-interview branch May 9, 2025 08:13
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