Skip to content

test: ParsingValidationService 테스트 시그니처 정합화#19

Open
coldmans wants to merge 1 commit into
mainfrom
test/fix-parsing-validation-signatures
Open

test: ParsingValidationService 테스트 시그니처 정합화#19
coldmans wants to merge 1 commit into
mainfrom
test/fix-parsing-validation-signatures

Conversation

@coldmans

Copy link
Copy Markdown
Owner

배경

./gradlew test 실패 원인이 리팩토링 코드가 아니라 ParsingValidationServiceTest의 구버전 시그니처 참조였습니다.

변경 사항

  • ParsingValidationService 생성자 변경 반영
    • (pdfParseService, excelParseService, subjectRepository) -> (excelParseService, subjectRepository)
  • ExcelParseService.parseWithoutSaving(file, maxChunks) 시그니처 반영
  • validateExcelParsing(file, semester, maxChunks) 시그니처 반영
  • 현재 구현 상태에 맞춰 PDF 검증 테스트를 기본 리포트 검증으로 조정

검증

  • 로컬 실행: ./gradlew test --no-daemon ✅ 통과

충돌 영향

  • 테스트 파일 1개만 수정하여 기존 PR16/17/18 코드 변경과 충돌 가능성 낮음

Copilot AI review requested due to automatic review settings February 14, 2026 06:13
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @coldmans, 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!

이 Pull Request는 ParsingValidationServiceTest의 테스트 시그니처를 최신 서비스 변경 사항에 맞춰 업데이트하여 테스트 실패를 해결합니다. PdfParseService 의존성 제거 및 ExcelParseService 메서드 시그니처 변경을 반영하고, PDF 검증 테스트를 현재 서비스의 미구현 상태에 맞게 조정하여 테스트의 정합성을 확보했습니다.

Highlights

  • ParsingValidationService 생성자 변경 반영: ParsingValidationService 생성자 변경 사항을 테스트 코드에 반영하여 PdfParseService 의존성을 제거했습니다.
  • ExcelParseService 메서드 시그니처 변경 반영: ExcelParseService.parseWithoutSaving 및 ParsingValidationService.validateExcelParsing 메서드의 시그니처 변경(maxChunks 파라미터 추가)을 테스트 코드에 적용했습니다.
  • PDF 검증 테스트 조정: validatePdfParsing 테스트를 현재 구현 상태에 맞춰 PDF 검증이 아직 구현되지 않았음을 반영하는 기본 리포트 검증으로 조정했습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/test/java/inu/timetable/service/ParsingValidationServiceTest.java
    • ParsingValidationService 생성자 호출을 업데이트했습니다.
    • ExcelParseService.parseWithoutSaving 및 ParsingValidationService.validateExcelParsing 메서드 호출에 maxChunks 파라미터를 추가했습니다.
    • validatePdfParsing 테스트 로직을 PDF 검증이 미구현 상태임을 반영하도록 수정했습니다.
    • 사용되지 않는 PdfParseService 목 객체와 assertTrue import를 제거했습니다.
Activity
  • 이 Pull Request에 대한 활동은 아직 없습니다.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

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.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

이 PR은 ParsingValidationService의 시그니처 변경에 따라 ParsingValidationServiceTest의 테스트 코드를 수정하는 것을 주 내용으로 합니다. PdfParseService 의존성 제거, validatePdfParsing 테스트 로직 변경, validateExcelParsing 테스트의 메서드 시그니처 업데이트 등이 포함되어 있습니다. 전반적으로 변경 사항은 명확하며, 리팩토링된 코드에 맞춰 테스트를 성공적으로 정합시켰습니다. 한 가지 개선점으로, Map<String, Object> 대신 DTO를 사용하여 타입 안정성을 높이는 방안을 제안했습니다.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

ParsingValidationServiceTest가 최신 ParsingValidationService/ExcelParseService 메서드 시그니처를 참조하도록 업데이트해 ./gradlew test 실패를 해소하는 PR입니다.

Changes:

  • ParsingValidationService 생성자 변경에 맞춰 테스트에서 PdfParseService 의존성 제거
  • ExcelParseService.parseWithoutSaving(file, maxChunks)validateExcelParsing(file, semester, maxChunks) 시그니처에 맞게 테스트 수정
  • PDF 검증 테스트를 “미구현 기본 리포트” 반환 검증으로 단순화

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

Comment on lines +63 to +68
when(excelParseService.parseWithoutSaving(file, 10))
.thenReturn(List.of(parsedOne, parsedTwo));
when(subjectRepository.findAll())
.thenReturn(List.of(dbOne, dbTwo));

Map<String, Object> report = service.validateExcelParsing(file, "");
Map<String, Object> report = service.validateExcelParsing(file, "", 10);

Copilot AI Feb 14, 2026

Copy link

Choose a reason for hiding this comment

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

테스트에서 maxChunks10을 하드코딩해 stubbing/호출에 중복 사용하고 있습니다. 향후 값 변경 시 한쪽만 수정해도 테스트가 의미 없이 깨질 수 있으니, 상수로 추출하거나 지역 변수로 한 번만 선언해 재사용하는 형태가 더 안전합니다.

Copilot uses AI. Check for mistakes.
Comment on lines +38 to 46
void validatePdfParsing_notImplementedReturnsDefaultReport() {
MockMultipartFile file = mockFile("timetable.pdf", "application/pdf");

Subject parsedMismatch = subject("Data Structures", "Kim",
schedule("Mon", 1.0, 3.0));
Subject parsedOnly = subject("Operating Systems", "Lee",
schedule("Wed", 2.0, 4.0));
Subject parsedMatch = subject("Algorithms", "Park",
schedule("Fri", 2.0, 3.0));

Subject dbMismatch = subject("Data Structures", "Kim",
schedule("Mon", 1.0, 2.0));
Subject dbOnly = subject("Networks", "Choi",
schedule("Tue", 1.0, 2.0));
Subject dbMatch = subject("Algorithms", "Park",
schedule("Fri", 2.0, 3.0));

when(pdfParseService.parseWithoutSaving(file))
.thenReturn(List.of(parsedMismatch, parsedOnly, parsedMatch));
when(subjectRepository.findAll())
.thenReturn(List.of(dbMismatch, dbOnly, dbMatch));

Map<String, Object> report = service.validatePdfParsing(file, "");

assertEquals("PDF", report.get("sourceType"));
assertEquals(3, report.get("parsedCount"));
assertEquals(3, report.get("dbCount"));

List<String> onlyInParsed = (List<String>) report.get("onlyInParsed");
assertEquals(1, onlyInParsed.size());
assertTrue(onlyInParsed.contains("Operating Systems"));

List<String> onlyInDb = (List<String>) report.get("onlyInDb");
assertEquals(1, onlyInDb.size());
assertTrue(onlyInDb.contains("Networks"));

List<Map<String, Object>> differences = (List<Map<String, Object>>) report.get("differences");
assertEquals(1, differences.size());
Map<String, Object> diff = differences.get(0);
assertEquals("Data Structures", diff.get("subjectName"));
assertTrue(diff.containsKey("schedule"));

Map<String, Object> scheduleDiff = (Map<String, Object>) diff.get("schedule");
assertEquals("Mon 1.0-3.0", scheduleDiff.get("parsed"));
assertEquals("Mon 1.0-2.0", scheduleDiff.get("db"));

Map<String, Object> summary = (Map<String, Object>) report.get("summary");
assertEquals("HAS_DIFFERENCES", summary.get("status"));
assertEquals(3, summary.get("totalIssues"));
assertEquals(0, report.get("parsedCount"));
assertEquals(0, report.get("dbCount"));
assertEquals("Not implemented", report.get("message"));
}

Copilot AI Feb 14, 2026

Copy link

Choose a reason for hiding this comment

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

validatePdfParsing 기본 리포트 테스트가 parsedCount/dbCount/message만 검증하고 있는데, 현재 admin/validate-result.html에서는 report.sourceType, report.accuracy, report.summary.status/totalIssues, onlyInParsedCount 등 여러 키를 전제로 렌더링합니다. PDF 검증 기능이 노출돼 있다면(컨트롤러에서도 동일 템플릿 사용) 최소한 기본 리포트에도 동일한 스키마(기본값 포함)를 넣어 템플릿/클라이언트가 깨지지 않도록 하고, 테스트도 그 계약을 검증하는 편이 안전합니다.

Copilot uses AI. Check for mistakes.
coldmans added a commit that referenced this pull request Jun 28, 2026
- 위시리스트/시간표 중복검사를 (userId,subjectId,semester) 기준으로 변경 — 다른 학기에 같은 과목 추가 가능, semester null 구분(#14)
- update/remove를 '해당 과목의 모든 학기' 처리로 전환해 NonUniqueResultException 위험 제거(#14)
- 시간표 전체 비우기를 멱등 처리 + @transactional(빈 학기 404 오발생 제거)(#19)
- 회원가입/프로필에서 PRIMARY(주전공) 2개 이상 저장되던 정규화 누락 차단(#13)
- 활동기록: 캐시 add 후 저장 실패 시 캐시 복구, 동시 요청 unique 위반을 멱등 흡수, 컨트롤러에서 기록 실패가 가입/로그인을 막지 않게 처리(#6/#7)
coldmans added a commit that referenced this pull request Jul 1, 2026
* feat: 재오픈 운영 프로파일 보안 설정 강화

- 세션 쿠키 Secure/SameSite=None + forward-headers-strategy(prod)
- Swagger/OpenAPI 운영 비활성화, actuator info.env 비노출 및 metrics 개별 노출 제거
- CORS 허용 오리진을 환경변수로 외부화(운영은 localhost 제외)
- multipart 업로드 크기 상한 명시(20MB)
- 프로필 활성 변수를 표준 SPRING_PROFILES_ACTIVE로 통일
- .dockerignore에 .env/덤프 배제, .gitignore에 db/baseline 예외 추가

* fix: 재오픈 대비 동시성·입력검증·예외처리 보강

- 온라인/시간미지정 과목 시간표 추가 시 NPE(요일·시간 null) 가드
- DataIntegrityViolationException을 409로 매핑, 가입/위시리스트/시간표 추가에 @transactional
- 비밀번호 길이 정책(8~72자)·아이디 길이 상한, 조합 maxCombinations/targetCredits 및 페이지 size 상한, 검색어 최소 길이
- 파싱 컨트롤러의 내부/외부 예외 메시지 응답 노출 제거(로깅으로 대체)
- 로그인 레이트리밋의 X-Forwarded-For 직접 신뢰 제거(프록시 보정 IP 사용)

* feat: Flyway 핵심 테이블 베이스라인 스키마 초안 추가

- users/subjects/schedules/user_timetables/wishlist_items 생성 마이그레이션 부재로
  빈 DB(신규/DR/스테이징) 기동 불가 → 엔티티 역산 베이스라인 초안 제공
- db/migration 자동 스캔 경로 밖(db/baseline)에 두어 기존 운영 배포 흐름 불변
- 운영 pg_dump 대조 및 빈 DB 리허설 절차를 스크립트 상단에 명시

* fix: 코드리뷰 반영 — 베이스라인 인덱스·비밀번호 바이트 검증·유니크 위반 한정 409

- 베이스라인에 subjects 조회/필터 인덱스 9종 추가(신규 DB 풀스캔 방지)
- 비밀번호 상한을 글자 수 → UTF-8 바이트(72) 검증으로 변경(bcrypt silent truncation 대응)
- DataIntegrityViolationException 중 유니크 위반(SQLState 23505)만 409, 그 외는 400으로 구분

* fix: 조합·공식임포트·PDF 파싱 로직 버그 수정

- 공식 엑셀 임포트가 학수번호 없는 레거시(PDF/AI 파싱) 과목을 매번 전량 비활성화하던 문제 차단 (#1)
- 조합 생성: 빈 시간표([]) 추천 제외(#5), 필수 학점이 목표+tolerance 초과 시 필수 시간표 최소 1개 보장(#3), dedup이 필수 분반을 버려 필수 제약이 소실되던 문제(#4)
- PDF parseTime: 비-범위 연속교시의 마지막 A/B 접미사를 무시해 종료시간이 0.5교시 길어지던 오류(#9)

* fix: 학기 처리·전공 정규화·활동기록 상태 버그 수정

- 위시리스트/시간표 중복검사를 (userId,subjectId,semester) 기준으로 변경 — 다른 학기에 같은 과목 추가 가능, semester null 구분(#14)
- update/remove를 '해당 과목의 모든 학기' 처리로 전환해 NonUniqueResultException 위험 제거(#14)
- 시간표 전체 비우기를 멱등 처리 + @transactional(빈 학기 404 오발생 제거)(#19)
- 회원가입/프로필에서 PRIMARY(주전공) 2개 이상 저장되던 정규화 누락 차단(#13)
- 활동기록: 캐시 add 후 저장 실패 시 캐시 복구, 동시 요청 unique 위반을 멱등 흡수, 컨트롤러에서 기록 실패가 가입/로그인을 막지 않게 처리(#6/#7)
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