Skip to content

Move all enumeration pagination-related state into page data#89

Merged
claucambra merged 5 commits into
mainfrom
bugfix/paginate-pt5
Jun 11, 2025
Merged

Move all enumeration pagination-related state into page data#89
claucambra merged 5 commits into
mainfrom
bugfix/paginate-pt5

Conversation

@claucambra
Copy link
Copy Markdown
Contributor

Fixes instances where the system passes page data into new enumerator instance rather than reusing existing enumerator

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…struct, make token optional

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…of the EnumeratorPageResponse

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

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
@claucambra claucambra added this to the 3.0 milestone Jun 11, 2025
@claucambra claucambra requested a review from Copilot June 11, 2025 09:21
@claucambra claucambra self-assigned this Jun 11, 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 refactors pagination-related state in the enumerator by moving all enumeration pagination details into the page data and updating both tests and production code to handle the new state model. Key changes include updating pagination token handling in tests, modifying the EnumeratorPageResponse model to support optional tokens and additional URLs, and refactoring the Enumerator’s pagination logic and logging.

Reviewed Changes

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

File Description
Tests/NextcloudFileProviderKitTests/EnumeratorTests.swift Updates test logic for paginated enumeration and token handling.
Tests/Interface/MockEnumerationObserver.swift Adjusts async handling and visibility of properties in the observer for better state management.
Sources/NextcloudFileProviderKit/Enumeration/EnumeratorPageResponse.swift Refactors page response data model to support optional tokens and additional URL queues.
Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift Refactors pagination state management and logging in the enumerator.
Comments suppressed due to low confidence (3)

Tests/NextcloudFileProviderKitTests/EnumeratorTests.swift:621

  • The force unwrap of 'token' may lead to a runtime crash if 'token' is nil. Consider adding safety checks or handling the nil case explicitly.
let followUpPage = NSFileProviderPage(initialNextPage!.token!.data(using: .utf8)!)

Sources/NextcloudFileProviderKit/Enumeration/EnumeratorPageResponse.swift:15

  • Changing 'token' to an optional requires ensuring that all consumers of EnumeratorPageResponse properly handle the nil case to avoid potential runtime issues.
let token: String?   // Required by server to serve the next page of items

Tests/Interface/MockEnumerationObserver.swift:47

  • [nitpick] Invoking an async function within the initializer can lead to unexpected behavior. Consider moving asynchronous operations outside the initializer to ensure proper error handling and initialization flow.
try await enumerateItemsPage(page: page)

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 98.54369% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.97%. Comparing base (3423917) to head (102940c).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...tcloudFileProviderKit/Enumeration/Enumerator.swift 93.47% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
+ Coverage   83.83%   83.97%   +0.14%     
==========================================
  Files          70       70              
  Lines       15603    15749     +146     
==========================================
+ Hits        13080    13225     +145     
- Misses       2523     2524       +1     

☔ 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 a869466 into main Jun 11, 2025
3 checks passed
@claucambra claucambra deleted the bugfix/paginate-pt5 branch June 11, 2025 09:36
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