Skip to content

Fix capabilities throttling approach#65

Merged
claucambra merged 5 commits into
mainfrom
bugfix/nckit-sub
Apr 24, 2025
Merged

Fix capabilities throttling approach#65
claucambra merged 5 commits into
mainfrom
bugfix/nckit-sub

Conversation

@claucambra
Copy link
Copy Markdown
Contributor

No description provided.

@claucambra claucambra added this to the 2.1 milestone Apr 24, 2025
@claucambra claucambra requested a review from Copilot April 24, 2025 16:44
@claucambra claucambra self-assigned this Apr 24, 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 updates the capabilities throttling approach by replacing the use of capabilitiesString with a new property named capabilities, and integrates caching using a dedicated actor. Key changes include updating test files to use the new property, refactoring the MockRemoteInterface accordingly, and modifying the NextcloudKit+RemoteInterface logic to cache capabilities.

Reviewed Changes

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

Show a summary per file
File Description
Tests/NextcloudFileProviderKitTests/UploadTests.swift Replaces "capabilitiesString" with "capabilities" in upload tests.
Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift Updates capability assignments to reflect the new property naming.
Tests/NextcloudFileProviderKitTests/ItemDeleteTests.swift & ItemCreateTests.swift Adjusts string checks and reassignments for capabilities in delete and create tests.
Tests/Interface/MockRemoteInterface.swift Removes the capabilitiesString property in favor of capabilities and updates associated logic.
Sources/NextcloudFileProviderKit/Interface/RemoteInterface.swift & NextcloudKit+RemoteInterface.swift Refactors capability fetching to leverage a caching actor and removes the direct setting of capabilities.
Comments suppressed due to low confidence (2)

Tests/Interface/MockRemoteInterface.swift:562

  • [nitpick] The property 'capabilities' has been renamed from 'capabilitiesString'. Please ensure that its type (a string) is clearly documented to avoid any confusion with a potential Capabilities object used elsewhere.
public var capabilities = mockCapabilities

Sources/NextcloudFileProviderKit/Interface/NextcloudKit+RemoteInterface.swift:422

  • [nitpick] Consider refactoring the caching condition to improve clarity. Using a positive measure of elapsed time (e.g., Date().timeIntervalSince(lastRetrieval.retrievedAt)) may make the logic more intuitive.
guard let lastRetrieval = await RetrievedCapabilitiesActor.shared.data[ncKitAccount], lastRetrieval.retrievedAt.timeIntervalSince(Date()) > -CapabilitiesFetchInterval else {

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2025

Codecov Report

Attention: Patch coverage is 45.45455% with 24 lines in your changes missing coverage. Please review.

Project coverage is 81.64%. Comparing base (d9bfcb0) to head (6578b2a).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...erKit/Interface/NextcloudKit+RemoteInterface.swift 0.00% 24 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
- Coverage   81.78%   81.64%   -0.14%     
==========================================
  Files          61       61              
  Lines       12689    12696       +7     
==========================================
- Hits        10378    10366      -12     
- Misses       2311     2330      +19     

☔ 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 815c3ea into main Apr 24, 2025
1 of 3 checks passed
@Rello Rello deleted the bugfix/nckit-sub branch August 15, 2025 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants