Skip to content

Properly fix deadlocking when trying to access current capabilities#82

Merged
claucambra merged 15 commits into
mainfrom
bugfix/caps-sync
May 29, 2025
Merged

Properly fix deadlocking when trying to access current capabilities#82
claucambra merged 15 commits into
mainfrom
bugfix/caps-sync

Conversation

@claucambra
Copy link
Copy Markdown
Contributor

No description provided.

claucambra added 14 commits May 27, 2025 14:13
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…rface supports trash

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…e capabilities

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>
…ait for ongoing requests to finish before proceeding

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>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
@claucambra claucambra requested a review from Copilot May 28, 2025 08:19
@claucambra claucambra self-assigned this May 28, 2025
@claucambra claucambra added the bug Something isn't working label May 28, 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 fixes deadlocking when accessing current capabilities by switching from synchronous to asynchronous trash capability checks and refactoring the related APIs. Key changes include updating numerous functions and initializers to accept an asynchronous Boolean flag (remoteSupportsTrash) as well as removing legacy synchronous capabilities methods.

Reviewed Changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Tests/NextcloudFileProviderKit/EnumeratorTests.swift Updated rootContainer call to include an async trash support flag.
Tests/Interface/MockRemoteInterface.swift Removed legacy currentCapabilities sync methods and introduced directMockCapabilities.
Tests/Interface/MockEnumerator.swift Changed remoteInterface type to MockRemoteInterface and used directMockCapabilities for trash capability.
Sources/NextcloudFileProviderKit/* Updated multiple Item extension files to pass remoteSupportsTrash via async calls.
Sources/NextcloudFileProviderKit/Interface/RemoteInterface.swift Added async support for currentCapabilities and trash capability checking.
Sources/NextcloudFileProviderKit/Interface/NextcloudKit+RemoteInterface.swift Refactored capability fetching and removed synchronous methods.
Sources/NextcloudFileProviderKit/Enumeration/* Updated asynchronous calls in enumeration functions.
Package.swift Upgraded NextcloudCapabilitiesKit dependency version.
Comments suppressed due to low confidence (3)

Tests/Interface/MockRemoteInterface.swift:1142

  • [nitpick] The method name 'directMockCapabilities' may be misleading; consider renaming it to something like 'mockCapabilitiesData' to clearly indicate its purpose as a mock data provider.
return (account.ncKitAccount, directMockCapabilities(), capsData, .success)

Tests/Interface/MockEnumerator.swift:29

  • [nitpick] Ensure that the usage of 'directMockCapabilities' here aligns with its renamed or clarified purpose, so that it accurately reflects retrieving mock trash capability data.
let remoteSupportsTrash = remoteInterface.directMockCapabilities()?.files?.undelete ?? false

Sources/NextcloudFileProviderKit/Item/Item.swift:32

  • [nitpick] Consider whether caching the 'remoteSupportsTrash' value is optimal if capabilities rarely change; if not, verify that repeated async retrievals are not impacting performance.
private let remoteSupportsTrash: Bool

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 91.42442% with 59 lines in your changes missing coverage. Please review.

Project coverage is 82.15%. Comparing base (153ac57) to head (f73f20d).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
...oudFileProviderKitTests/RemoteInterfaceTests.swift 88.65% 37 Missing ⚠️
Sources/NextcloudFileProviderKit/Item/Item.swift 45.00% 11 Missing ⚠️
...erKit/Interface/NextcloudKit+RemoteInterface.swift 0.00% 7 Missing ⚠️
...oudFileProviderKit/Interface/RemoteInterface.swift 93.10% 2 Missing ⚠️
...es/NextcloudFileProviderKit/Item/Item+Create.swift 77.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
+ Coverage   81.49%   82.15%   +0.66%     
==========================================
  Files          63       68       +5     
  Lines       13771    14369     +598     
==========================================
+ Hits        11222    11805     +583     
- Misses       2549     2564      +15     

☔ 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 b73ca99 into main May 29, 2025
3 checks passed
@claucambra claucambra deleted the bugfix/caps-sync branch May 29, 2025 02:29
@claucambra claucambra modified the milestone: 3.0 May 30, 2025
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