Skip to content

Implement mitigations for "parent item identifier not found" errors#80

Merged
claucambra merged 17 commits into
mainfrom
bugfix/mitigate-no-parentitemidentifier
May 27, 2025
Merged

Implement mitigations for "parent item identifier not found" errors#80
claucambra merged 17 commits into
mainfrom
bugfix/mitigate-no-parentitemidentifier

Conversation

@claucambra
Copy link
Copy Markdown
Contributor

No description provided.

claucambra added 17 commits May 23, 2025 23:35
…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>
@claucambra claucambra added this to the 2.1 milestone May 26, 2025
@claucambra claucambra requested a review from Copilot May 26, 2025 04:43
@claucambra claucambra self-assigned this May 26, 2025
@claucambra claucambra added the bug Something isn't working label May 26, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 parentItemIdentifierWithRemoteFallback in FilesDatabaseManager to fetch parent metadata remotely when not found locally.
  • Converts many Item and error-handling methods to async, adding awaits on calls to file‐provider‐error helpers.
  • Extends Enumerator with 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.storedItem returns nil, verifying that both perThumbnailCompletionHandler and completionHandler are called as expected when an item is missing.
public func fetchThumbnails(

Comment thread Sources/NextcloudFileProviderKit/Utilities/ThumbnailFetching.swift
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2025

Codecov Report

Attention: Patch coverage is 80.86124% with 80 lines in your changes missing coverage. Please review.

Project coverage is 81.50%. Comparing base (fac7cf3) to head (63eb9a4).
Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
...tcloudFileProviderKit/Enumeration/Enumerator.swift 68.03% 39 Missing ⚠️
...dFileProviderKit/Utilities/ThumbnailFetching.swift 0.00% 21 Missing ⚠️
...ileProviderKit/Database/FilesDatabaseManager.swift 71.42% 10 Missing ⚠️
...es/NextcloudFileProviderKit/Item/Item+Create.swift 0.00% 3 Missing ⚠️
...FileProviderKit/Enumeration/Enumerator+Trash.swift 83.33% 2 Missing ⚠️
...ileProviderKit/Extensions/NKError+Extensions.swift 0.00% 2 Missing ⚠️
...es/NextcloudFileProviderKit/Item/Item+Modify.swift 71.42% 2 Missing ⚠️
...ces/NextcloudFileProviderKit/Item/Item+Trash.swift 85.71% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@claucambra claucambra merged commit 153ac57 into main May 27, 2025
2 of 3 checks passed
@claucambra claucambra deleted the bugfix/mitigate-no-parentitemidentifier branch May 27, 2025 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants