feat: Judge0 부재 시 동작하는 StubJudgeService 추가 - #26
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
채점용 학교 VM(GSM SV
judge0인스턴스)이 만료되어 Judge0에 접근할 수 없는 상태입니다.12월 데모 직전(11월)에 VM을 재구축할 예정이며, 그때까지 백엔드/프론트 개발이
채점 엔진 부재로 막히지 않도록
JudgeService의 스텁 구현체를 추가합니다.JudgeService인터페이스 경계는 그대로 유지되어SubmissionService는Judge0/Stub 중 무엇이 주입됐는지 알지 못합니다.
변경 사항
infra/stub/StubJudgeService신규 — 기본 동작은 전체 통과(AC), 매직 주석으로 특정 verdict 강제infra/judge0/Judge0Config—judge0.urlblank 여부로 Stub/Judge0Adapter 분기 (ExecutorConfig와 동일 패턴)application.yml—JUDGE0_URL기본값을http://localhost:2358→ 빈 문자열로 변경CLAUDE.md— §8.5에 안내 추가, §11 백로그 섹션 신설StubJudgeServiceTest신규매직 주석
제출 코드 첫 줄에 아래 주석이 있으면 해당 verdict를 강제합니다. (
//,#모두 인식)//STUB:WAtotal - 1통과)//STUB:TLE//STUB:RE//STUB:CEVerdict.PENDING은Submission생성 시 초기값일 뿐judge()반환값이 될 수 없어 제외했습니다.점수는
SubmissionService.persist()에서verdict != AC면 이미 0으로 고정되므로스텁 쪽에 별도 처리를 넣지 않았습니다.
스텁 사용 사실 노출
예외를 성공으로 위장하지 않도록, 스텁 동작임을 명시적으로 드러냅니다.
미변경
JudgeRequest,SubmissionService,Judge0Adapter, Flyway 마이그레이션(스키마 변경 없음),API 응답 DTO(노션 명세가 단일 진실 공급원),
LocalProcessExecutor.LocalProcessExecutor는 문제 생성 시 정답 코드 검증용으로 Judge0과 무관하며,Railway Dockerfile에 gcc/python3가 설치되어 있어 23시 스케줄러는 정상 동작합니다.
Railway 환경변수에서
JUDGE0_URL삭제현재 죽은 Cloudflare Quick Tunnel URL이 남아 있습니다.
blank가 아니면
Judge0Adapter가 선택되어 프로덕션 제출이 502로 실패합니다.JUDGE0_TOKEN도 함께 제거하고, 11월 VM 재구축 시 재등록합니다.재배포 후 로그에 스텁 WARN 배너가 출력되는지 확인 필요.
팀 검토 필요 (임시 초안)
total - 1(테스트케이스가 1개면 0 통과가 되는 건 불가피)후속 (백로그)
Judge0Config가infra.stub을 참조하는 구조는 의존 방향이 역전되어 있습니다.12월 이후 자체 채점 엔진 도입 시
infra/judge/JudgeConfig같은 중립 설정 클래스로빈 팩토리를 옮기는 리팩터링이 필요합니다.
테스트
./gradlew compileJava compileTestJava통과StubJudgeServiceTest(신규),SubmissionServiceTest전체 통과