rxdb icon indicating copy to clipboard operation
rxdb copied to clipboard

add test #7371 documents moving outside replication scope

Open calvinturbo opened this issue 3 months ago • 5 comments

This PR contains:

  • added test to Firestore Replication test file, tests if replication correctly notices docs moving outside of replication scope

Describe the problem you have without this PR

Missing test for issue with Firestore docs moving outside of replication scope https://github.com/pubkey/rxdb/issues/7371

calvinturbo avatar Oct 08 '25 22:10 calvinturbo

I understand the problem. But I see no way to fix this on the RxDB side atm. If there is no more permission to the doc, the sync will not know about the move-out-of-scope change to that document. Atm docs are expected to either stay inside or outside of the scope, not change that.

pubkey avatar Oct 09 '25 07:10 pubkey

I understand the problem. But I see no way to fix this on the RxDB side atm. If there is no more permission to the doc, the sync will not know about the move-out-of-scope change to that document. Atm docs are expected to either stay inside or outside of the scope, not change that.

This should be fixable, because Firestore sends a 'removed event', RxDB just needs to process that.

https://firebase.google.com/docs/firestore/query-data/listen#view_changes_between_snapshots shows an example how to correctly process these changes

If a document moves out of the replication scope because it no longer matches the filters, a 'removed' event is received by Firestore client. I have verified this myself with my application.

Image

calvinturbo avatar Oct 09 '25 08:10 calvinturbo

I'll check if I can make the necessary modifications to the Firestore Replication plugin, but I don't know if I am sufficiently qualified, will keep you posted

calvinturbo avatar Oct 09 '25 09:10 calvinturbo

Hi @calvinturbo This PR fails on the CI, please check.

pubkey avatar Oct 22 '25 14:10 pubkey

@pubkey I'll start working on it

calvinturbo avatar Oct 23 '25 11:10 calvinturbo