Import packages as encrypted folders - #471
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe change adds package-directory imports as encrypted folder trees. It detects package types, traverses contents, caches files, rejects symbolic links, rolls back partial imports, and schedules staged uploads. Collision handling distinguishes root renaming from failures inside imported packages. Uploading folders no longer allow renaming or reparenting during upload. Tests cover package import, collisions, rollback, mocks, and permissions. Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 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: 3
🧹 Nitpick comments (1)
CryptomatorFileProvider/FileProviderAdapter.swift (1)
226-235: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low valueLog local import failures without cleartext names.
reportLocalImportFailureis called from both single-file and package import, and logsidentifierviafileURL.lastPathComponent. Package import elsewhere logs item ids for failures. Log the file extension or item id here instead of the cleartext name.🤖 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 `@CryptomatorFileProvider/FileProviderAdapter.swift` around lines 226 - 235, Update reportLocalImportFailure to stop logging the cleartext importing name in both filename-collision and local-import failure messages. Log a non-sensitive identifier instead, such as the file extension or relevant item id, while preserving the existing error handling and completion behavior.
🤖 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 `@CryptomatorFileProvider/FileProviderAdapter.swift`:
- Around line 544-553: Update markFolderAsUploadError to mark the failed folder
and all descendant metadata rows as .uploadError, not only the supplied
itemMetadata. Reuse the existing metadata-manager query/update mechanisms to
traverse the subtree, persist each descendant’s status, and signal updates for
every affected FileProviderItem so descendants become deletable and no longer
remain .isUploading.
In `@CryptomatorFileProvider/PermissionProvider.swift`:
- Line 31: Correct the Note documentation in PermissionProvider by replacing “an
running upload” with grammatically correct wording that clearly describes an
active folder upload or folder creation in the cloud, while preserving the
existing restrictions on renaming and reparenting.
In
`@CryptomatorFileProviderTests/FileProviderAdapter/FileProviderAdapterTestCase.swift`:
- Around line 92-121: The shared test doubles are not thread-safe under parallel
package execution. In
CryptomatorFileProviderTests/FileProviderAdapter/FileProviderAdapterTestCase.swift:92-121,
serialize virtualCloudFileSystem access in uploadFile and createFolder, and
protect CloudFileGraphHandler.createItem and getItem with a lock; in
CryptomatorFileProviderTests/Middleware/TaskExecutor/CloudTaskExecutorTestCase.swift:63-127,
use the same locking approach to guard MetadataManagerMock state:
cachedMetadata, updatedMetadata, getCloudPathForReceivedInvocations, and
persistedSnapshots.
---
Nitpick comments:
In `@CryptomatorFileProvider/FileProviderAdapter.swift`:
- Around line 226-235: Update reportLocalImportFailure to stop logging the
cleartext importing name in both filename-collision and local-import failure
messages. Log a non-sensitive identifier instead, such as the file extension or
relevant item id, while preserving the existing error handling and completion
behavior.
🪄 Autofix (Beta)
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: a3e62fc9-3ccf-4873-a43c-f6f2c6854fe6
📒 Files selected for processing (12)
CryptomatorFileProvider/CloudTask/CloudTask.swiftCryptomatorFileProvider/CloudTask/FolderCreationTask.swiftCryptomatorFileProvider/FileProviderAdapter.swiftCryptomatorFileProvider/FileProviderAdapterError.swiftCryptomatorFileProvider/Middleware/OnlineItemNameCollisionHandler.swiftCryptomatorFileProvider/PermissionProvider.swiftCryptomatorFileProviderTests/FileProviderAdapter/FileProviderAdapterImportDirectoryTests.swiftCryptomatorFileProviderTests/FileProviderAdapter/FileProviderAdapterImportDocumentTests.swiftCryptomatorFileProviderTests/FileProviderAdapter/FileProviderAdapterTestCase.swiftCryptomatorFileProviderTests/Middleware/OnlineItemNameCollisionHandlerTests.swiftCryptomatorFileProviderTests/Middleware/TaskExecutor/CloudTaskExecutorTestCase.swiftCryptomatorFileProviderTests/PermissionProviderImplTests.swift
…n PermissionProvider docs
Copying a package into a vault has never worked. Files hands packages to the File Provider extension as directories, and
createPlaceholderItemForFilerejects everytypeDirectorywithfolderUploadNotSupported, so an.rtfdor iWork bundle fails with "The file doesn't exist." Copying a folder that contains one is worse: the plain files land, the package is skipped, and the single error names only the enclosing folder.This imports packages recursively as ordinary encrypted folders. Inside the vault a package looks like a folder named
Design Notes.rtfd, which is what it is on disk. Copying it back out reconstitutes a working package, since a directory with a registered package extension is the package. Verified on device: copied in, browsed, copied back out, opened in Quick Look.Packages are not presented as documents inside the vault, so they can't be opened in place. Desktop does present them, since Finder derives package-ness from the extension and a mounted vault is an ordinary volume to it. Matching that here needs a package-level aggregate: one root item, one real on-disk package directory, one package operation. Shipping only the presentation half gives you something that looks like a document and opens empty, which is worse than just showing a folder.
Flow
The ordering matters. The completion handler fires with the root placeholder before any network work, and each node's task, upload record and workflow are built inside its parent's scheduled continuation. A folder that fails never lets its descendants reach the cloud, and sibling subtrees stay independent.
Four decisions worth flagging:
.rtfdPackage Files into Vault #430 reports moving packages in, and Files deletes the source once the handler returns, so any later failure marks the folder and keeps the local bytes.Closes #141, closes #430.