Skip to content

Correct Remote Change Propagation to File Provider Framework - #10252

Merged
i2h3 merged 4 commits into
masterfrom
i2h3/fix/new-remote-item-discovery
Jun 25, 2026
Merged

Correct Remote Change Propagation to File Provider Framework#10252
i2h3 merged 4 commits into
masterfrom
i2h3/fix/new-remote-item-discovery

Conversation

@i2h3

@i2h3 i2h3 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Community and paying-support reports describe server-side changes that intermittently fail to appear in the macOS File Provider domains, with no reliable reproduction. This PR pins down three concrete derivation bugs in the file-provider extension that silently drop remote changes, fixes them, and adds deterministic reproducers. Scope is macOS File Provider only (Windows / Linux / classic sync folders are unaffected).

The branch has two logically separate commits and can be reviewed (or split) accordingly:

1. Fix: remote changes silently dropped during working-set change enumeration

Because a change notification only ever signals .workingSet, working-set change enumeration is the path that drives remote updates into the framework. Three issues there caused changes to be discovered but never reported:

  • Depth-1 / non-materialised subtrees. The materialised-items scan read each visited folder only one level deep and never recursed into changed subdirectories, so a change to an item under a non-materialised subfolder surfaced the subfolder but never the item — even when the server propagated ETags correctly. The scan now walks a work queue that descends into changed subdirectories, while still skipping unchanged subtrees (the existing optimisation is preserved).
  • Discovered-but-discarded changes. The scan persisted discovered changes to the database but the report was then reconstructed purely from a syncTime > anchor query, which excludes non-materialised items and items whose parent directory did not itself change. The scan now returns the discovered creations/updates/deletions, which are reported directly, merged and de-duplicated with the database-derived pending local changes.
  • Content change with unchanged ETag. isInSameDatabaseStoreableRemoteState did not compare size, so a content change carrying a stale/unchanged ETag + date was treated as "no change." It now also compares size.

Adds RemoteChangePropagationTests — deterministic reproducers driven through the real working-set path via the existing mock harness. Three reproduced the drops above and now pass as regression guards; one documents that the notify_push fileId gate correctly matches on the parent folder id (the server propagates the changed ETag up to the user's root, so the gate is not a source of dropped new items — see #6430).

2. Refactor (behavior-preserving): make the enumerator legible

No behavior change — guarded by the unchanged, fully-passing test suite:

  • Replaced the positional 6-tuple returned by readServerUrl with a named RemoteReadResult, and the three parallel new/updated/deleted arrays with a ChangeSet value type.
  • Split the ~850-line Enumerator.swift (now ~135 lines) into focused, documented Enumerator+*.swift extensions by concern (item enumeration, change enumeration, working-set scan, observer reporting, sync anchor; trash beside the existing trash code). The two NSFileProviderEnumerator methods are now thin dispatchers.
  • Renamed opaque locals and checkMaterializedItemsOnServerscanMaterialisedItemsForRemoteChanges; added doc comments throughout.

Checklist

AI (if applicable)

@i2h3 i2h3 added this to the 34.0.0 milestone Jun 25, 2026
@i2h3
i2h3 requested a review from Copilot June 25, 2026 12:39
@i2h3 i2h3 self-assigned this Jun 25, 2026
@i2h3 i2h3 added the bug label Jun 25, 2026
@i2h3 i2h3 added os: 🍎 macOS Apple macOS, formerly also known as OS X feature: 📁 file provider macOS File Provider Extension, more general also known as virtual file system. labels Jun 25, 2026
@github-project-automation github-project-automation Bot moved this to 🧭 Planning evaluation (don't pick) in 💻 Desktop Clients team Jun 25, 2026
@i2h3

i2h3 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

/backport to stable-34.0

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@i2h3

i2h3 commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

A (partial) backport to stable-33.0 requires manual and separate work.

@i2h3 i2h3 moved this from 🧭 Planning evaluation (don't pick) to 🏗️ In progress in 💻 Desktop Clients team Jun 25, 2026
@i2h3
i2h3 marked this pull request as ready for review June 25, 2026 13:16
@github-actions

Copy link
Copy Markdown
Contributor

Artifact containing the AppImage: nextcloud-appimage-pr-10252.zip

Digest: sha256:90813f0757733a7fb44d41f537f94c0e37684c3a0f36dd8b933b390d7cef7879

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@sonarqubecloud

Copy link
Copy Markdown

@i2h3
i2h3 merged commit 6763ae9 into master Jun 25, 2026
23 checks passed
@i2h3
i2h3 deleted the i2h3/fix/new-remote-item-discovery branch June 25, 2026 14:06
@github-project-automation github-project-automation Bot moved this from 🏗️ In progress to ☑️ Done in 💻 Desktop Clients team Jun 25, 2026
i2h3 added a commit that referenced this pull request Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug feature: 📁 file provider macOS File Provider Extension, more general also known as virtual file system. os: 🍎 macOS Apple macOS, formerly also known as OS X

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants