⚡ Bolt: FileSystemArtifactStore에서 불필요한 Files.exists() 호출 제거#191
⚡ Bolt: FileSystemArtifactStore에서 불필요한 Files.exists() 호출 제거#191seonghobae wants to merge 1 commit into
Conversation
파일 읽기 전 `Files.exists(pdfPath)` 호출을 제거하여 디스크 I/O를 반으로 줄이고, TOCTOU 경쟁 상태를 방지했습니다. 대신 `bytesReader.read(pdfPath)`에서 직접 `java.nio.file.NoSuchFileException`을 잡아 처리하도록 최적화했습니다.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
FileSystemArtifactStore#getPdf에서 파일 읽기 전 Files.exists()로 사전 확인하던 로직을 제거하고, 실제 읽기 시점에 NoSuchFileException을 처리하도록 변경해 불필요한 I/O(stat)와 TOCTOU 가능성을 줄이는 최적화 PR입니다.
Changes:
getPdf에서Files.exists()체크 제거 후NoSuchFileException기반으로 “파일 없음”을Optional.empty()로 처리- 실패 케이스(기타
IOException)는 기존대로IllegalStateException으로 래핑 - 변경 사항을
CHANGELOG.md및.jules/bolt.md에 기록
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/com/clearfolio/viewer/artifact/FileSystemArtifactStore.java | Files.exists() 제거 및 NoSuchFileException 처리로 I/O 최적화/TOCTOU 완화 |
| CHANGELOG.md | 위 최적화 내용을 Unreleased 변경 내역에 추가 |
| .jules/bolt.md | 최적화 학습/액션 항목을 지식 로그에 추가 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return Optional.of(loaded.clone()); | ||
| } catch (java.nio.file.NoSuchFileException ex) { | ||
| return Optional.empty(); |
💡 What:
FileSystemArtifactStore.getPdf메서드 내 불필요한Files.exists확인 로직을 제거하고,NoSuchFileException을 직접 처리하도록 개선했습니다.🎯 Why: 기존 코드에서는 파일 읽기 전에 존재하는지 확인하기 위해 추가적인 디스크 I/O 작업(stat)이 발생했으며, 확인(Check)과 사용(Use) 사이에 파일 상태가 변경될 수 있는 TOCTOU 경쟁 상태에 노출될 수 있었습니다.
📊 Impact: 디스크 I/O 오버헤드 감소 및 TOCTOU 방지로 인한 성능 및 안정성 향상.
🔬 Measurement:
mvn test를 통해 기존 파일 시스템 테스트가 문제없이 통과하는지 확인하여 동작을 검증할 수 있습니다.CHANGELOG.md업데이트 완료.jules/bolt.md에 관련된 지식 학습 내용 추가 완료PR created automatically by Jules for task 15358147149877394483 started by @seonghobae