{ "Existence filter mismatch triggers re-run of query": { "describeName": "Existence Filters:", "itName": "Existence filter mismatch triggers re-run of query", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/1", 1000, { "v": 1 } ], [ "collection/2", 1000, { "v": 2 } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ], "watchSnapshot": 1000, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/1", 1000, { "v": 1 } ], [ "collection/2", 1000, { "v": 2 } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "watchFilter": [ [ 2 ], "collection/1" ], "watchSnapshot": 2000, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/1", 1000, { "v": 1 } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-2000" ], "watchSnapshot": 2000, "stateExpect": { "limboDocs": [ "collection/2" ], "activeTargets": { "1": { "query": { "path": "collection/2", "filters": [], "orderBys": [] }, "resumeToken": "" }, "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 1 ] }, { "watchCurrent": [ [ 1 ], "resume-token-2000" ], "watchSnapshot": 2000, "stateExpect": { "limboDocs": [], "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "removed": [ [ "collection/2", 1000, { "v": 2 } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Existence filter mismatch will drop resume token": { "describeName": "Existence Filters:", "itName": "Existence filter mismatch will drop resume token", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/1", 1000, { "v": 1 } ], [ "collection/2", 1000, { "v": 2 } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "existence-filter-resume-token" ], "watchSnapshot": 1000, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/1", 1000, { "v": 1 } ], [ "collection/2", 1000, { "v": 2 } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "watchStreamClose": { "error": { "code": 14, "message": "Simulated Backend Error" }, "runBackoffTimer": true }, "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "existence-filter-resume-token" } } } }, { "watchAck": [ 2 ] }, { "watchFilter": [ [ 2 ], "collection/1" ], "watchSnapshot": 2000, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/1", 1000, { "v": 1 } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-2000" ], "watchSnapshot": 2000, "stateExpect": { "limboDocs": [ "collection/2" ], "activeTargets": { "1": { "query": { "path": "collection/2", "filters": [], "orderBys": [] }, "resumeToken": "" }, "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 1 ] }, { "watchCurrent": [ [ 1 ], "resume-token-2000" ], "watchSnapshot": 2000, "stateExpect": { "limboDocs": [], "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "removed": [ [ "collection/2", 1000, { "v": 2 } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Existence filter limbo resolution is denied": { "describeName": "Existence Filters:", "itName": "Existence filter limbo resolution is denied", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/1", 1000, { "v": 1 } ], [ "collection/2", 1000, { "v": 2 } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ], "watchSnapshot": 1000, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/1", 1000, { "v": 1 } ], [ "collection/2", 1000, { "v": 2 } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "watchFilter": [ [ 2 ], "collection/1" ], "watchSnapshot": 2000, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/1", 1000, { "v": 1 } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-2000" ], "watchSnapshot": 2000, "stateExpect": { "limboDocs": [ "collection/2" ], "activeTargets": { "1": { "query": { "path": "collection/2", "filters": [], "orderBys": [] }, "resumeToken": "" }, "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchRemove": { "targetIds": [ 1 ], "cause": { "code": 7 } }, "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } }, "limboDocs": [] }, "watchSnapshot": 3000, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "removed": [ [ "collection/2", 1000, { "v": 2 } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] } }