Implement mitigations for "parent item identifier not found" errors#80
Merged
Conversation
…ntifier mitigation Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…anager Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…adata not found Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
… metadata if necessary Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…enumerator Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…ntifier method Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements fallback logic for missing parent item identifiers and refactors several APIs to use async/await, updating tests accordingly.
- Introduces
parentItemIdentifierWithRemoteFallbackinFilesDatabaseManagerto fetch parent metadata remotely when not found locally. - Converts many
Itemand error-handling methods to async, adding awaits on calls to file‐provider‐error helpers. - Extends
Enumeratorwith recovery paths for missing parent metadata and updates tests to cover these cases.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/NextcloudFileProviderKitTests/FilesDatabaseManagerTests.swift | Added test for parentItemIdentifierWithRemoteFallback. |
| Tests/NextcloudFileProviderKitTests/EnumeratorTests.swift | Updated await Item.storedItem calls and added missing-parent test. |
| Tests/NextcloudFileProviderKitTests/ChunkedArrayTests.swift | Updated tests to async throws for concurrentChunkedCompactMap. |
| Sources/NextcloudFileProviderKit/Utilities/ThumbnailFetching.swift | Unified Task usage in fetchThumbnails, removed nested Task. |
| Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata+Array.swift | Changed to async throws, throw on missing parent metadata. |
| Sources/NextcloudFileProviderKit/Item/Item.swift | Made storedItem async and use remote fallback for parent lookup. |
| Sources/NextcloudFileProviderKit/Item/Item+Trash.swift | Updated restoreFromTrash to use async parent-fallback calls. |
| Sources/NextcloudFileProviderKit/Item/Item+Modify.swift | Awaited fileProviderError calls for move/upload collisions. |
| Sources/NextcloudFileProviderKit/Item/Item+Fetch.swift | Switched parent lookup to parentItemIdentifierWithRemoteFallback. |
| Sources/NextcloudFileProviderKit/Item/Item+Create.swift | Awaited fileProviderError on collisions/read errors. |
| Sources/NextcloudFileProviderKit/Extensions/NKError+Extensions.swift | Made collision-handling fileProviderError async. |
| Sources/NextcloudFileProviderKit/Extensions/Array+Extensions.swift | Changed concurrentChunkedCompactMap to throwing and async. |
| Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift | Added catch/recovery for missing-parent errors in enumeration. |
| Sources/NextcloudFileProviderKit/Enumeration/Enumerator+Trash.swift | Added async error handling for trash enumeration. |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift | Added async remote-fallback, new error codes/userInfo for missing parent. |
Comments suppressed due to low confidence (1)
Sources/NextcloudFileProviderKit/Utilities/ThumbnailFetching.swift:36
- Add a unit test to cover the path where
Item.storedItemreturns nil, verifying that bothperThumbnailCompletionHandlerandcompletionHandlerare called as expected when an item is missing.
public func fetchThumbnails(
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #80 +/- ##
==========================================
+ Coverage 81.16% 81.50% +0.33%
==========================================
Files 62 63 +1
Lines 13549 13771 +222
==========================================
+ Hits 10997 11224 +227
+ Misses 2552 2547 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
No description provided.