Skip to content

Conversation

@thezz9
Copy link
Collaborator

@thezz9 thezz9 commented Jul 7, 2025

Summary by CodeRabbit

  • 신규 기능

    • 코드 제출 시 세션 키와 테스트케이스 ID 목록을 함께 반환하도록 개선되었습니다.
    • 제출 결과 화면에서 테스트케이스별로 고유 ID를 기반으로 채점 현황을 표시합니다.
  • 버그 수정

    • 테스트케이스 인덱싱 방식을 1-base에서 0-base로 일관성 있게 변경하여 혼동을 줄였습니다.
  • 리팩터링

    • 내부적으로 테스트케이스 식별자를 seqId에서 testcaseId(Long 타입)로 변경하였습니다.
    • 관련 메서드 및 파라미터 명칭을 index, testcaseId로 수정하였습니다.
  • 테스트

    • 서비스 테스트가 새로운 반환 타입(SubmitResponse)에 맞게 수정되었습니다.

@thezz9 thezz9 self-assigned this Jul 7, 2025
@thezz9 thezz9 added the enhancement New feature or request label Jul 7, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 7, 2025

Walkthrough

테스트케이스 식별 방식을 기존의 1-based seqId에서 실제 DB의 Long 타입 testcaseId로 전환하였고, 이에 따라 서비스, 컨트롤러, 프론트엔드, 레코드, DTO, 저장소 계층 등 전반에 걸쳐 관련 메서드 시그니처와 데이터 흐름이 수정되었습니다. 또한 제출 응답 구조가 sessionKey와 testcaseIds를 포함하는 형태로 확장되었습니다.

Changes

파일/경로 그룹 변경 요약
.../submission/dto/event/payload/TestcaseResultPayload.java seqId(int) → testcaseId(Long) 필드명 및 타입 변경, fromEvaluation 메서드 시그니처 수정
.../submission/dto/request/compile/CodeCompileRequest.java of 메서드 파라미터명 seqId → index, encodeBase64 메서드 및 관련 import 삭제
.../submission/dto/response/submission/SubmitResponse.java SubmitResponse 레코드 및 of 팩토리 메서드 신규 추가
.../submission/model/SubmissionContext.java getInput, getExpectedOutput 메서드 인자 seqId → index, 1-based → 0-based 인덱싱, getTestcaseId 추가
.../submission/service/JudgementService.java 테스트케이스 루프 및 관련 메서드 seqId → index, 0-based 인덱싱, testcaseId로 매핑
.../submission/service/SubmissionService.java enqueueCodeSubmission 반환타입 String → SubmitResponse, TestcaseDomainService 의존성 추가, init publish 제거
.../problem/repository/TestcaseRepository.java findAllByProblemId(Long) 신규 메서드 추가
.../problem/service/TestcaseDomainService.java getTestcaseListByProblemId(Long) 신규 메서드 추가
.../submission/model/TestcaseEvaluationInput.java from 메서드 인자 seqId → index, 내부 호출 수정
.../event/dto/submission/response/JudgeResultResponse.java seqId(int) → testcaseId(Long) 필드명 및 타입 변경, Swagger 문서 설명 수정
.../repository/problem/TestcaseJpaRepository.java findAllByProblem_Id(Long) 신규 메서드 추가, @entitygraph 적용
.../repository/problem/TestcaseRepositoryImpl.java findAllByProblemId(Long) 신규 메서드 추가
.../presentation/submission/SubmissionController.java submitCodeStream 반환타입 ResponseEntity<HashSet> → ResponseEntity
.../resources/templates/test-submit.html testcaseSlotMap 도입, submit 응답에서 testcaseIds 추출 및 슬롯 렌더링, WebSocket 구독/렌더링 방식 개선
.../SubmissionServiceTest.java TestcaseDomainService 목 추가, enqueueCodeSubmission 반환타입 및 검증 수정

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant SubmissionController
    participant SubmissionService
    participant TestcaseDomainService
    participant JudgeService

    User->>Frontend: 코드 제출
    Frontend->>SubmissionController: submitCodeStream(problemId, request, authUser)
    SubmissionController->>SubmissionService: enqueueCodeSubmission(problemId, request, authUser)
    SubmissionService->>TestcaseDomainService: getTestcaseListByProblemId(problemId)
    TestcaseDomainService-->>SubmissionService: List<Testcase>
    SubmissionService-->>SubmissionController: SubmitResponse(sessionKey, testcaseIds)
    SubmissionController-->>Frontend: SubmitResponse(sessionKey, testcaseIds)
    Frontend->>Frontend: testcaseSlotMap 생성 및 렌더링
    Frontend->>JudgeService: WebSocket 연결 및 구독 (sessionKey)
    JudgeService-->>Frontend: testcaseId별 채점 결과 전달
    Frontend->>Frontend: testcaseSlotMap 통해 UI 업데이트
Loading

Possibly related PRs

Suggested reviewers

  • Kimminu7
  • NCookies
  • pokerbearkr
  • minjee2758
  • chat26666

Poem

🐇

테스트케이스 번호여, 안녕!
이제는 Long id로 인사해요.
슬롯마다 고유한 자리 찾아
토끼도 헷갈리지 않아요.
sessionKey와 testcaseIds
깔끔하게 바뀐 흐름 속에
오늘도 채점은 hop-hop-hop!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ad7143 and 073589d.

📒 Files selected for processing (15)
  • src/main/java/org/ezcode/codetest/application/submission/dto/event/payload/TestcaseResultPayload.java (2 hunks)
  • src/main/java/org/ezcode/codetest/application/submission/dto/request/compile/CodeCompileRequest.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/submission/dto/response/submission/SubmitResponse.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/submission/model/SubmissionContext.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/submission/service/JudgementService.java (3 hunks)
  • src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java (3 hunks)
  • src/main/java/org/ezcode/codetest/domain/problem/repository/TestcaseRepository.java (1 hunks)
  • src/main/java/org/ezcode/codetest/domain/problem/service/TestcaseDomainService.java (1 hunks)
  • src/main/java/org/ezcode/codetest/domain/submission/model/TestcaseEvaluationInput.java (1 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/event/dto/submission/response/JudgeResultResponse.java (2 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/TestcaseJpaRepository.java (1 hunks)
  • src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/TestcaseRepositoryImpl.java (1 hunks)
  • src/main/java/org/ezcode/codetest/presentation/submission/SubmissionController.java (3 hunks)
  • src/main/resources/templates/test-submit.html (4 hunks)
  • src/test/java/org/ezcode/codetest/application/submission/SubmissionServiceTest.java (6 hunks)
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: thezz9
PR: ezcode-my/backend#30
File: src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java:44-46
Timestamp: 2025-06-04T13:12:17.636Z
Learning: SubmissionService에서 "2 10" 입력값과 "12" 기대출력이 하드코딩되어 있는 것은 테스트 단계의 의도적인 구현이며, 추후 Problem 엔티티의 실제 테스트케이스로 대체 예정입니다.
Learnt from: thezz9
PR: ezcode-my/backend#30
File: src/main/java/org/ezcode/codetest/domain/problem/model/dto/SubmissionData.java:42-53
Timestamp: 2025-06-04T13:12:16.729Z
Learning: 사용자 thezz9는 개발 시 기능적 정확성을 먼저 달성한 후 세부 리팩터링을 나중에 하는 접근 방식을 선호한다. 테스트 단계에서는 하드코딩된 값도 허용한다.
Learnt from: thezz9
PR: ezcode-my/backend#36
File: src/main/java/org/ezcode/codetest/domain/submission/dto/SubmissionData.java:47-58
Timestamp: 2025-06-06T07:59:41.806Z
Learning: SubmissionData.withAggregatedStats() 메서드에서 testCaseList는 상위 프로세스(base() 메서드의 problemInfo.testcaseList())에서 이미 null 체크가 처리되어 오므로 추가적인 null 체크가 불필요함
Learnt from: thezz9
PR: ezcode-my/backend#73
File: src/main/resources/templates/submit-test.html:135-135
Timestamp: 2025-06-18T11:41:58.457Z
Learning: src/main/resources/templates/submit-test.html 파일은 테스트용 파일로, isCorrect 값의 하드코딩은 의도적이며 사용자가 UI 요소를 통해 정답/오답 상태를 선택할 수 있도록 개선 예정입니다.
Learnt from: chat26666
PR: ezcode-my/backend#8
File: src/main/java/org/ezcode/codetest/presentation/chattingmanagement/chatting/ChatRoomController.java:24-24
Timestamp: 2025-05-31T01:09:28.818Z
Learning: ChatRoomController, ChatController, EventHandleController에서 사용되는 하드코딩된 사용자 ID (1L)는 임시 구현입니다. 사용자 인증 시스템이 완료되기 전까지 채팅 기능 개발에 집중하기 위한 임시 조치입니다.
Learnt from: thezz9
PR: ezcode-my/backend#75
File: src/main/java/org/ezcode/codetest/application/submission/aop/CodeReviewLockAspect.java:25-41
Timestamp: 2025-06-19T06:37:57.845Z
Learning: User thezz9 tends to skip validation for scenarios they consider unlikely to occur, but is willing to implement defensive programming practices when suggested for code robustness.
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:93-96
Timestamp: 2025-06-28T02:04:24.957Z
Learning: User thezz9 sometimes temporarily uses less secure or inconsistent exception handling (like RuntimeException with raw error bodies) for debugging purposes when error messages are being hidden in the normal application flow, but acknowledges this as technical debt and fixes it once debugging is complete.
Learnt from: thezz9
PR: ezcode-my/backend#132
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubContentBuilder.java:72-72
Timestamp: 2025-07-02T09:39:31.475Z
Learning: User thezz9 prefers to proceed with breaking changes to path structures when it improves the organization, rather than maintaining backward compatibility or implementing migration strategies.
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:159-165
Timestamp: 2025-06-28T02:03:38.693Z
Learning: User thezz9's service (ezcode) targets Korean users exclusively ("찐 한국인밖에 안 옴"), so Korean language hardcoding in commit messages and UI elements is intentional and appropriate for their use case.
src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/TestcaseJpaRepository.java (3)
Learnt from: Kimminu7
PR: ezcode-my/backend#133
File: src/test/java/org/ezcode/codetest/domain/problem/service/ProblemDomainServiceTest.java:92-99
Timestamp: 2025-07-02T12:05:54.895Z
Learning: ProblemDomainService의 removeProblem 메서드는 DB에서 Problem을 삭제한 후 Elasticsearch에서도 해당 ProblemSearchDocument를 찾아서 삭제합니다. 만약 Elasticsearch에서 문서를 찾지 못하면 ProblemException(PROBLEM_NOT_FOUND)을 던지므로, 테스트에서는 problem.getId()와 searchRepository.findById() 모두 적절하게 mock해야 합니다.
Learnt from: chat26666
PR: ezcode-my/backend#67
File: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/game/mysql/skill/GameCharacterSkillJpaRepository.java:15-17
Timestamp: 2025-06-17T14:46:51.206Z
Learning: GameCharacterSkillJpaRepository에서 findByCharacterId 메서드는 skill 참조를 하지 않기 때문에 @EntityGraph를 사용하지 않는다. 실제 사용 패턴에 따라 선택적으로 eager loading을 적용하는 것이 성능상 더 효율적이다.
Learnt from: chat26666
PR: ezcode-my/backend#64
File: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/game/EncounterChoiceRepositoryImpl.java:0-0
Timestamp: 2025-06-15T04:37:29.231Z
Learning: EncounterChoiceRepositoryImpl in src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/game/EncounterChoiceRepositoryImpl.java is intentionally a skeleton implementation that is work-in-progress and will be completed later.
src/main/java/org/ezcode/codetest/presentation/submission/SubmissionController.java (1)
Learnt from: thezz9
PR: ezcode-my/backend#73
File: src/main/resources/templates/submit-test.html:135-135
Timestamp: 2025-06-18T11:41:58.457Z
Learning: src/main/resources/templates/submit-test.html 파일은 테스트용 파일로, isCorrect 값의 하드코딩은 의도적이며 사용자가 UI 요소를 통해 정답/오답 상태를 선택할 수 있도록 개선 예정입니다.
src/main/java/org/ezcode/codetest/domain/submission/model/TestcaseEvaluationInput.java (1)
Learnt from: thezz9
PR: ezcode-my/backend#30
File: src/main/java/org/ezcode/codetest/domain/problem/service/SubmissionDomainService.java:24-33
Timestamp: 2025-06-04T13:12:28.354Z
Learning: The submission evaluation system is currently in testing phase, so hardcoded expected output values like "12" are intentionally used for testing purposes rather than being a production issue.
src/main/java/org/ezcode/codetest/infrastructure/event/dto/submission/response/JudgeResultResponse.java (1)
Learnt from: thezz9
PR: ezcode-my/backend#36
File: src/main/java/org/ezcode/codetest/application/submission/dto/request/compile/CodeCompileRequest.java:5-9
Timestamp: 2025-06-06T07:52:58.941Z
Learning: CodeCompileRequest 레코드의 필드명(source_code, language_id)은 Java camelCase 컨벤션 대신 snake_case를 사용하는데, 이는 Judge0 API의 반환 값 형식에 맞추기 위한 의도적인 설계 결정이다.
src/main/java/org/ezcode/codetest/domain/problem/service/TestcaseDomainService.java (2)
Learnt from: Kimminu7
PR: ezcode-my/backend#133
File: src/test/java/org/ezcode/codetest/domain/problem/service/ProblemDomainServiceTest.java:92-99
Timestamp: 2025-07-02T12:05:54.895Z
Learning: ProblemDomainService의 removeProblem 메서드는 DB에서 Problem을 삭제한 후 Elasticsearch에서도 해당 ProblemSearchDocument를 찾아서 삭제합니다. 만약 Elasticsearch에서 문서를 찾지 못하면 ProblemException(PROBLEM_NOT_FOUND)을 던지므로, 테스트에서는 problem.getId()와 searchRepository.findById() 모두 적절하게 mock해야 합니다.
Learnt from: thezz9
PR: ezcode-my/backend#36
File: src/main/java/org/ezcode/codetest/domain/submission/dto/SubmissionData.java:47-58
Timestamp: 2025-06-06T07:59:41.806Z
Learning: SubmissionData.withAggregatedStats() 메서드에서 testCaseList는 상위 프로세스(base() 메서드의 problemInfo.testcaseList())에서 이미 null 체크가 처리되어 오므로 추가적인 null 체크가 불필요함
src/main/java/org/ezcode/codetest/domain/problem/repository/TestcaseRepository.java (2)
Learnt from: Kimminu7
PR: ezcode-my/backend#133
File: src/test/java/org/ezcode/codetest/domain/problem/service/ProblemDomainServiceTest.java:92-99
Timestamp: 2025-07-02T12:05:54.895Z
Learning: ProblemDomainService의 removeProblem 메서드는 DB에서 Problem을 삭제한 후 Elasticsearch에서도 해당 ProblemSearchDocument를 찾아서 삭제합니다. 만약 Elasticsearch에서 문서를 찾지 못하면 ProblemException(PROBLEM_NOT_FOUND)을 던지므로, 테스트에서는 problem.getId()와 searchRepository.findById() 모두 적절하게 mock해야 합니다.
Learnt from: chat26666
PR: ezcode-my/backend#64
File: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/game/EncounterChoiceRepositoryImpl.java:0-0
Timestamp: 2025-06-15T04:37:29.231Z
Learning: EncounterChoiceRepositoryImpl in src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/game/EncounterChoiceRepositoryImpl.java is intentionally a skeleton implementation that is work-in-progress and will be completed later.
src/main/java/org/ezcode/codetest/application/submission/dto/request/compile/CodeCompileRequest.java (1)
Learnt from: thezz9
PR: ezcode-my/backend#36
File: src/main/java/org/ezcode/codetest/application/submission/dto/request/compile/CodeCompileRequest.java:5-9
Timestamp: 2025-06-06T07:52:58.941Z
Learning: CodeCompileRequest 레코드의 필드명(source_code, language_id)은 Java camelCase 컨벤션 대신 snake_case를 사용하는데, 이는 Judge0 API의 반환 값 형식에 맞추기 위한 의도적인 설계 결정이다.
src/main/java/org/ezcode/codetest/application/submission/model/SubmissionContext.java (1)
Learnt from: thezz9
PR: ezcode-my/backend#30
File: src/main/java/org/ezcode/codetest/domain/problem/service/SubmissionDomainService.java:24-33
Timestamp: 2025-06-04T13:12:28.354Z
Learning: The submission evaluation system is currently in testing phase, so hardcoded expected output values like "12" are intentionally used for testing purposes rather than being a production issue.
src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/TestcaseRepositoryImpl.java (2)
Learnt from: chat26666
PR: ezcode-my/backend#64
File: src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/game/EncounterChoiceRepositoryImpl.java:0-0
Timestamp: 2025-06-15T04:37:29.231Z
Learning: EncounterChoiceRepositoryImpl in src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/game/EncounterChoiceRepositoryImpl.java is intentionally a skeleton implementation that is work-in-progress and will be completed later.
Learnt from: Kimminu7
PR: ezcode-my/backend#133
File: src/test/java/org/ezcode/codetest/domain/problem/service/ProblemDomainServiceTest.java:92-99
Timestamp: 2025-07-02T12:05:54.895Z
Learning: ProblemDomainService의 removeProblem 메서드는 DB에서 Problem을 삭제한 후 Elasticsearch에서도 해당 ProblemSearchDocument를 찾아서 삭제합니다. 만약 Elasticsearch에서 문서를 찾지 못하면 ProblemException(PROBLEM_NOT_FOUND)을 던지므로, 테스트에서는 problem.getId()와 searchRepository.findById() 모두 적절하게 mock해야 합니다.
src/test/java/org/ezcode/codetest/application/submission/SubmissionServiceTest.java (6)
Learnt from: thezz9
PR: ezcode-my/backend#30
File: src/main/java/org/ezcode/codetest/domain/problem/service/SubmissionDomainService.java:24-33
Timestamp: 2025-06-04T13:12:28.354Z
Learning: The submission evaluation system is currently in testing phase, so hardcoded expected output values like "12" are intentionally used for testing purposes rather than being a production issue.
Learnt from: thezz9
PR: ezcode-my/backend#36
File: src/main/java/org/ezcode/codetest/domain/submission/dto/SubmissionData.java:47-58
Timestamp: 2025-06-06T07:59:41.806Z
Learning: SubmissionData.withAggregatedStats() 메서드에서 testCaseList는 상위 프로세스(base() 메서드의 problemInfo.testcaseList())에서 이미 null 체크가 처리되어 오므로 추가적인 null 체크가 불필요함
Learnt from: Kimminu7
PR: ezcode-my/backend#133
File: src/test/java/org/ezcode/codetest/domain/problem/service/ProblemDomainServiceTest.java:92-99
Timestamp: 2025-07-02T12:05:54.895Z
Learning: ProblemDomainService의 removeProblem 메서드는 DB에서 Problem을 삭제한 후 Elasticsearch에서도 해당 ProblemSearchDocument를 찾아서 삭제합니다. 만약 Elasticsearch에서 문서를 찾지 못하면 ProblemException(PROBLEM_NOT_FOUND)을 던지므로, 테스트에서는 problem.getId()와 searchRepository.findById() 모두 적절하게 mock해야 합니다.
Learnt from: chat26666
PR: ezcode-my/backend#31
File: src/main/java/org/ezcode/codetest/domain/problem/service/ProblemDomainService.java:25-27
Timestamp: 2025-06-04T15:11:19.343Z
Learning: In ProblemDomainService, when saving problems to both database and Elasticsearch, maintain transactional consistency by allowing rollback if either save operation fails. Data integrity between DB and ES is prioritized over availability - if Elasticsearch save fails, the entire transaction should roll back to prevent data inconsistency.
Learnt from: thezz9
PR: ezcode-my/backend#30
File: src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java:44-46
Timestamp: 2025-06-04T13:12:17.636Z
Learning: SubmissionService에서 "2 10" 입력값과 "12" 기대출력이 하드코딩되어 있는 것은 테스트 단계의 의도적인 구현이며, 추후 Problem 엔티티의 실제 테스트케이스로 대체 예정입니다.
Learnt from: chat26666
PR: ezcode-my/backend#31
File: src/main/java/org/ezcode/codetest/domain/problem/model/entity/ProblemSearchDocument.java:49-56
Timestamp: 2025-06-05T00:52:54.460Z
Learning: ProblemSearchDocument.from() 메서드는 트랜잭션 내에서 DB에서 실제로 조회한 Problem 엔티티만 사용하므로 null 체크가 불필요함. 이 컨텍스트에서는 null Problem이 있을 경우 이미 이전 단계에서 예외가 발생함.
src/main/java/org/ezcode/codetest/application/submission/service/JudgementService.java (1)
Learnt from: thezz9
PR: ezcode-my/backend#30
File: src/main/java/org/ezcode/codetest/domain/problem/service/SubmissionDomainService.java:24-33
Timestamp: 2025-06-04T13:12:28.354Z
Learning: The submission evaluation system is currently in testing phase, so hardcoded expected output values like "12" are intentionally used for testing purposes rather than being a production issue.
src/main/resources/templates/test-submit.html (1)
Learnt from: thezz9
PR: ezcode-my/backend#73
File: src/main/resources/templates/submit-test.html:135-135
Timestamp: 2025-06-18T11:41:58.457Z
Learning: src/main/resources/templates/submit-test.html 파일은 테스트용 파일로, isCorrect 값의 하드코딩은 의도적이며 사용자가 UI 요소를 통해 정답/오답 상태를 선택할 수 있도록 개선 예정입니다.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (26)
src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/TestcaseRepositoryImpl.java (1)

30-33: 구현이 깔끔하고 일관성 있습니다.

새로 추가된 findAllByProblemId 메서드가 JPA 레포지토리에 적절히 위임하고 있으며, 기존 패턴을 잘 따르고 있습니다.

src/main/java/org/ezcode/codetest/infrastructure/persistence/repository/problem/TestcaseJpaRepository.java (1)

15-16: JPA 네이밍 컨벤션과 성능 최적화가 잘 적용되었습니다.

findAllByProblem_Id 메서드명은 JPA 네이밍 컨벤션을 올바르게 따르고 있으며, @EntityGraph 어노테이션을 통한 eager loading도 적절합니다.

src/main/java/org/ezcode/codetest/infrastructure/event/dto/submission/response/JudgeResultResponse.java (2)

12-13: 타입 변경이 리팩터링 목적과 일치합니다.

seqId에서 testcaseId로의 필드명 변경과 int에서 Long으로의 타입 변경이 데이터베이스 ID 사용에 적합합니다.


33-33: 팩토리 메서드가 올바르게 업데이트되었습니다.

payload.testcaseId() 사용으로 변경된 필드명에 맞게 적절히 수정되었습니다.

src/main/java/org/ezcode/codetest/domain/problem/repository/TestcaseRepository.java (1)

14-14: 인터페이스 메서드 추가가 적절합니다.

새로운 findAllByProblemId 메서드가 기존 패턴을 따르며 명확한 시그니처를 가지고 있습니다.

src/main/java/org/ezcode/codetest/domain/problem/service/TestcaseDomainService.java (1)

37-39: getTestcaseListByProblemId 호출 위치 및 검증 처리 여부 확인 요청

현재 코드베이스에서 getTestcaseListByProblemId를 호출하는 곳을 찾을 수 없어, 해당 메서드를 호출하는 상위 레이어에서 Problem의 null 체크나 삭제 상태 검증이 이뤄지는지 불확실합니다.
다음 사항을 확인해 주세요:

  • getTestcaseListByProblemId를 실제로 호출하는 위치
  • 호출 전 또는 후에 Problem의 존재(null) 및 삭제 여부 검증이 수행되는지
  • 검증이 누락되었다면 메서드 내부에 아래 로직 추가 고려
    • problemRepository.findById(problemId).orElseThrow(...)
    • if (problem.isDeleted()) throw new ProblemException(...)

위 검증이 보장되지 않는다면, 일관성을 위해 해당 메서드에 직접 검증 로직을 추가해 주세요.

src/main/java/org/ezcode/codetest/domain/submission/model/TestcaseEvaluationInput.java (1)

25-27: 매개변수 이름 변경이 일관성 있게 적용되었습니다.

seqId에서 index로의 매개변수 이름 변경이 메서드 시그니처와 사용 부분에 일관성 있게 적용되어 0-based 인덱싱으로의 전환을 명확히 반영하고 있습니다.

src/main/java/org/ezcode/codetest/application/submission/dto/request/compile/CodeCompileRequest.java (1)

14-18: 매개변수 이름 변경이 적절하게 적용되었습니다.

seqId에서 index로의 매개변수 이름 변경이 일관성 있게 적용되어 전체 리팩터링과 일치합니다.

src/main/java/org/ezcode/codetest/application/submission/dto/response/submission/SubmitResponse.java (1)

7-17: 새로운 응답 DTO가 잘 설계되었습니다.

SubmitResponse 레코드 클래스는 적절한 필드 타입과 팩토리 메서드를 사용하여 테스트케이스 ID 리스트를 포함한 응답 구조를 깔끔하게 구현했습니다. 스트림 연산을 통한 ID 추출도 효율적입니다.

src/main/java/org/ezcode/codetest/application/submission/dto/event/payload/TestcaseResultPayload.java (2)

7-7: 테스트케이스 식별자 타입 변경이 적절합니다.

int seqId에서 Long testcaseId로의 변경은 데이터베이스 ID 사용에 더 적합하며, 시퀀스 기반에서 실제 ID 기반 식별로의 전환을 명확히 반영합니다.


20-22: 팩토리 메서드가 일관성 있게 업데이트되었습니다.

매개변수 타입과 사용 부분이 새로운 Long testcaseId 타입과 일관성 있게 업데이트되어 올바른 구현을 보여줍니다.

src/test/java/org/ezcode/codetest/application/submission/SubmissionServiceTest.java (4)

70-72: 새로운 의존성 모킹이 적절하게 추가되었습니다.

TestcaseDomainService 모킹 추가는 새로운 서비스 의존성을 적절히 반영하고 있습니다.


137-137: 테스트 스텁 설정이 적절합니다.

testcaseDomainService.getTestcaseListByProblemId에 대한 스텁 설정으로 새로운 서비스 호출을 올바르게 모킹하고 있습니다.


140-149: 반환 타입 변경에 따른 테스트 업데이트가 정확합니다.

String에서 SubmitResponse로의 반환 타입 변경과 sessionKey() 속성 검증으로의 어설션 업데이트가 프로덕션 코드 변경사항과 일치합니다.


168-170: 검증 로직 단순화가 적절합니다.

ArgumentCaptor 사용을 제거하고 any(SubmissionContext.class)를 사용한 검증 단순화는 테스트 가독성을 향상시키면서도 필요한 검증을 유지하고 있습니다.

src/main/java/org/ezcode/codetest/presentation/submission/SubmissionController.java (1)

58-66: 리팩터링이 잘 수행되었습니다.

컨트롤러 메서드의 반환 타입이 HashSet<String>에서 의미 있는 SubmitResponse로 개선되어 API 응답 구조가 명확해졌습니다. 구현도 더 간결해졌습니다.

src/main/java/org/ezcode/codetest/application/submission/model/SubmissionContext.java (1)

105-115: 인덱싱 방식 변경이 일관성 있게 적용되었습니다.

1-based seqId에서 0-based index로의 전환이 올바르게 수행되었으며, 새로운 getTestcaseId 메서드를 통해 실제 테스트케이스 ID에 접근할 수 있게 되었습니다. 파라미터 명도 seqId에서 index로 명확하게 변경되었습니다.

src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java (2)

49-49: 새 의존성 주입이 올바르게 추가되었습니다.

TestcaseDomainService 의존성이 추가되어 테스트케이스 조회 기능을 지원합니다.


58-73: 서비스 메서드 개선이 적절합니다.

반환 타입이 SubmitResponse로 변경되어 sessionKey와 testcaseIds를 포함한 구조화된 응답을 제공합니다. 이는 프론트엔드에서 즉시 테스트케이스 슬롯을 초기화할 수 있게 해줍니다.

src/main/java/org/ezcode/codetest/application/submission/service/JudgementService.java (2)

51-52: 인덱싱 방식 변경이 올바릅니다.

IntStream.rangeClosed(1, ...)에서 IntStream.range(0, ...)로 변경하여 0-based 인덱싱을 일관성 있게 적용했습니다.


70-97: 테스트케이스 ID 사용으로 개선되었습니다.

메서드 파라미터명이 seqId에서 index로 변경되고, ctx.getTestcaseId(index)를 사용하여 실제 테스트케이스 ID를 페이로드에 전달하는 방식으로 개선되었습니다. 이는 클라이언트에서 테스트케이스 식별을 더 명확하게 해줍니다.

src/main/resources/templates/test-submit.html (5)

329-329: 테스트케이스 슬롯 매핑 구조가 적절합니다.

testcaseSlotMap을 통해 테스트케이스 ID를 UI 슬롯 인덱스에 매핑하는 방식이 명확하고 효율적입니다.


401-403: 응답 구조 변경이 올바르게 반영되었습니다.

서버 응답에서 sessionKeytestcaseIds를 분리하여 추출하고 즉시 슬롯을 초기화하는 방식으로 개선되었습니다.


410-423: 즉시 슬롯 초기화로 사용자 경험 개선

renderInitSlots 함수를 통해 제출 즉시 테스트케이스 슬롯들을 초기화하여 사용자가 채점 진행 상황을 바로 확인할 수 있게 되었습니다. WebSocket 초기화 메시지를 기다릴 필요가 없어져 응답성이 향상되었습니다.


492-493: WebSocket 구독 최적화

불필요한 /init 토픽 구독이 제거되고 /case/final 토픽만 구독하도록 최적화되었습니다.


510-520: 테스트케이스 ID 기반 슬롯 업데이트 개선

testcaseSlotMap을 사용하여 테스트케이스 ID로 올바른 슬롯을 찾아 업데이트하는 방식이 시퀀스 ID 방식보다 안정적이고 명확합니다.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@chat26666 chat26666 merged commit 606cd1b into dev Jul 7, 2025
2 checks passed
@chat26666 chat26666 deleted the refactor/fetch-init branch July 7, 2025 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants