fix: make FileSystem init directory creation race-safe - #35
Merged
VenkataKrishnaGarapati merged 2 commits intoJun 4, 2026
Merged
Conversation
Collaborator
|
lgtm! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the blob cache’s filesystem-backed storage initialization to avoid a check-then-create race during concurrent startup access, and adds targeted regression tests to cover the initialization scenarios.
Changes:
- Updated
FileSysteminitialization to use idempotent directory creation (avoiding the prior check-then-create race). - Added XCTest coverage for initialization when directory creation reports “file exists” and when the directory already exists.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
Sources/Kumo/Blobs/Storage/FileSystem.swift |
Makes cache directory setup idempotent to prevent concurrent initialization crashes. |
Tests/KumoTests/Fixtures/Blobs/FileSystemInitializationTests.swift |
Adds regression tests for initialization behavior around directory creation/existence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
VenkataKrishnaGarapati
force-pushed
the
hotfix/filesystem-init-race
branch
from
June 4, 2026 03:35
7d85334 to
f28e291
Compare
Comment on lines
+34
to
+35
| throw NSError(domain: NSCocoaErrorDomain, code: 516) | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
VenkataKrishnaGarapati
merged commit Jun 4, 2026
1767665
into
DuetHealth:main
15 of 20 checks passed
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.
Technical Changes
FileSystem.initwith idempotent directory creation.try!trap risk during concurrent cache initialization by usingtry? createDirectory(..., withIntermediateDirectories: true, ...).Tests/KumoTests/Fixtures/Blobs/FileSystemInitializationTests.swiftfor:Reason
This addresses launch-time crashes caused by a race in cache directory creation (
BlobCache/FileSysteminit) under concurrent first access.Validation
swift test --filter FileSystemInitializationTests