Should currentSyncAnchor(completionHandler:) return a global version number of the backend, or one scoped to the enumerator's container identifier? What should we return if the backend has no per-container version?
Also, how does the system use this anchor? It appears to be followed by enumerateItems(for:startingAt:), but nothing seems to guarantee the anchor hasn't changed in between. Is there an atomicity expectation here?
The anchor is associated with the enumerator, and enumerators are created per container (enumeratorForContainerItemIdentifier: in NSFileProviderEnumerating.h). Conceptually it bounds "what this container knew at this point in time."
The system treats the anchor as opaque user-defined data. A global backend version is fine to return as long as your enumerateChanges(for:from:) can answer "what changed in this container between that anchor and now."
There is no atomicity guarantee and the framework doesn't provide one. The header lays out the sequence: request anchor A, enumerate items, then later enumerate changes from A.
The safety invariant is one-directional: the anchor you return must be at or before the state delivered in the subsequent page enumeration. Then any change that landed after A will be picked up by the change enumeration that uses A as its starting point — even if that change also affected the page enumeration (you'll just re-deliver it, which is harmless).
You should not return an anchor newer than your page snapshot or you would silently skip changes that happened in between.