Skip to content

Asynchronously check for changes within remote change observer rather than enumerator, signal changes only when necessary#105

Merged
claucambra merged 42 commits into
mainfrom
feature/async-working-set-change-check
Jul 8, 2025
Merged

Asynchronously check for changes within remote change observer rather than enumerator, signal changes only when necessary#105
claucambra merged 42 commits into
mainfrom
feature/async-working-set-change-check

Conversation

@claucambra

Copy link
Copy Markdown
Contributor

No description provided.

claucambra added 17 commits July 1, 2025 16:24
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
… manager

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
We will run clean up later after enumerating working set changes

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>
…king set

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

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 added this to the 3.0 milestone Jul 2, 2025
@claucambra claucambra requested a review from Copilot July 2, 2025 04:40
@claucambra claucambra self-assigned this Jul 2, 2025
@claucambra claucambra added the enhancement New feature or request label Jul 2, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 moves working set change detection out of Enumerator into RemoteChangeObserver, adds syncTime/deleted metadata flags, and updates tests to inject and validate against the database manager asynchronously.

  • Add syncTime and deleted properties to item metadata and persist them in Realm.
  • Implement pendingWorkingSetChanges in FilesDatabaseManager and simplify Enumerator to use it.
  • Refactor RemoteChangeObserver to perform async working-set checks on notifications; update tests to pass and verify via injected dbManager.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata.swift Add syncTime and deleted fields and constructors.
Sources/NextcloudFileProviderKit/Metadata/RealmItemMetadata.swift Persist new metadata fields.
Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift Extend protocol with new properties.
Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift Mark deleted items instead of removing, add pendingWorkingSetChanges.
Sources/NextcloudFileProviderKit/Enumeration/RemoteChangeObserver.swift Replace immediate notifications with async working-set checks.
Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift Simplify change enumeration using DB-driven pending changes.
Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift Inject dbManager, update setup & assertions.
Tests/NextcloudFileProviderKitTests/FilesDatabaseManagerTests.swift Adjust tests to validate deleted flag counts.
Tests/NextcloudFileProviderKitTests/EnumeratorTests.swift Switch to using sync anchors and local DB queries.
Tests/Interface/MockChangeObserver.swift Support new enumerateChanges(from:) signature.
Comments suppressed due to low confidence (4)

Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift:164

  • Remove leftover debugPrint(db) calls to reduce noise in test output.
        debugPrint(db)

Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift:337

  • Remove leftover debugPrint(db) calls to keep tests clean.
        debugPrint(db)

Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift:462

  • Remove leftover debugPrint(db) calls to reduce unnecessary output.
        debugPrint(db)

Tests/NextcloudFileProviderKitTests/FilesDatabaseManagerTests.swift:1260

  • Remove the print(updatedIds) debug statement from the test; use assertions to verify behavior instead of printing.
        print(updatedIds)

Comment thread Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift
Comment thread Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift Outdated
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>
…d folders

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 added 17 commits July 2, 2025 21:10
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>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
…vation change check

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>
…rialised

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 force-pushed the feature/async-working-set-change-check branch from 963be0d to 67de21f Compare July 8, 2025 09:30
@claucambra claucambra merged commit 1c7d2c8 into main Jul 8, 2025
2 checks passed
@claucambra claucambra deleted the feature/async-working-set-change-check branch July 8, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants