fix(reliability): roll back partial filesystem artifact writes - #355
fix(reliability): roll back partial filesystem artifact writes#355seonghobae wants to merge 11 commits into
Conversation
|
Warning Review limit reached
Next review available in: 24 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
Changes아티팩트 부분 쓰기 처리
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/com/clearfolio/viewer/artifact/FileSystemArtifactStore.java`:
- Around line 116-121: Update rollbackPartialWrite so metadataPath(docId) and
pdfPath(docId) deletion each runs in its own try/catch, adding every IOException
to writeFailure as a suppressed exception while always attempting both
deletions. Add a regression test that makes the metadata path a non-empty
directory, verifies that deletion fails, and confirms the PDF file is still
deleted.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5bba0ea4-d76d-4fe6-9773-98c479c8930b
📒 Files selected for processing (2)
src/main/java/com/clearfolio/viewer/artifact/FileSystemArtifactStore.javasrc/test/java/com/clearfolio/viewer/artifact/FileSystemArtifactStorePartialWriteTest.java
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/test/java/com/clearfolio/viewer/artifact/FileSystemArtifactStorePartialWriteTest.java (1)
53-78: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win복원된 메타데이터 바이트도 비교하십시오.
현재 테스트는 메타데이터 파일의 존재만 확인합니다. 롤백이 잘못된 메타데이터를 복원해도 이 테스트는 통과합니다.
첫
putPdf뒤에 메타데이터 바이트를 저장하십시오. 실패한 교체 뒤에 해당 바이트와 현재 메타데이터 바이트를assertArrayEquals로 비교하십시오.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/clearfolio/viewer/artifact/FileSystemArtifactStorePartialWriteTest.java` around lines 53 - 78, Update failedReplacementPreservesPreviouslyCommittedArtifactAcrossRestart to capture the original .meta.properties bytes immediately after the initial putPdf, then read the current metadata file after the failed replacement and compare them with assertArrayEquals. Keep the existing existence and PDF-content assertions unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/com/clearfolio/viewer/artifact/FileSystemArtifactStore.java`:
- Around line 69-70: Validate docId as the first operation in each public method
putPdf, getPdf, and deletePdf. If docId is null, throw IllegalArgumentException
with a message containing "docId is required"; otherwise preserve the existing
operation flow.
In
`@src/test/java/com/clearfolio/viewer/artifact/FileSystemArtifactStorePartialWriteTest.java`:
- Around line 184-195: FileSystemArtifactStore에 package-private 정적 메서드
resolveArtifactPath를 추가하고, 경로를 정규화한 뒤 configured root 내부에 남는지 검증하여 이탈 시 지정된
IllegalArgumentException을 발생시키십시오. 저장 경로를 계산하는 pdfPath와 metadataPath도 해당 메서드를
사용하도록 변경하십시오.
---
Nitpick comments:
In
`@src/test/java/com/clearfolio/viewer/artifact/FileSystemArtifactStorePartialWriteTest.java`:
- Around line 53-78: Update
failedReplacementPreservesPreviouslyCommittedArtifactAcrossRestart to capture
the original .meta.properties bytes immediately after the initial putPdf, then
read the current metadata file after the failed replacement and compare them
with assertArrayEquals. Keep the existing existence and PDF-content assertions
unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 424ef934-e324-4e65-b058-ad8dbd644a72
📒 Files selected for processing (2)
src/main/java/com/clearfolio/viewer/artifact/FileSystemArtifactStore.javasrc/test/java/com/clearfolio/viewer/artifact/FileSystemArtifactStorePartialWriteTest.java
Pull request was converted to draft
Pull request was closed
Objective
Prevent the standalone filesystem artifact store from leaving buyer-visible PDF bytes on disk when the matching metadata sidecar fails to persist. Protected main currently writes the PDF first and, on a later metadata write failure, throws while leaving the PDF readable after restart.
Test-first state
This Draft starts intentionally RED at exact test-only head
f49825645e516a378219af1f328cef7c82441e07.FileSystemArtifactStorePartialWriteTestuses the existing injectable writer seam to persist the PDF and fail only the metadata write, then requires both files to be absent andgetPdfto return empty. Protected main leaves the PDF behind, so this regression must fail before the production repair.Scope
This is a bounded
FileSystemArtifactStoreintegrity/reliability repair. It does not implement durable deletion receipts, lifecycle locking, distributed fencing, Office conversion, credential/OIDC work, viewer JavaScript, or canonical cross-cutting documentation. Stale broad PR #268 also mentions this artifact-store path, but its only file-local delta is already present on protected main; this PR introduces a new current-base partial-write invariant rather than copying stale ancestry.Acceptance
Observe exact-head RED -> smallest production rollback fix -> focused regression GREEN -> exact-head
mvn -B --no-transfer-progress verify, zero missed owned production coverage and public Javadocs -> CI/Security Scan/SAST/fuzz -> current reviews/threads/live-base refetch. Keep Draft until exact-head GREEN evidence exists. Qualifying independent write-authorized approval remains a separate protected-merge gate.Summary by CodeRabbit
버그 수정
테스트