Unsubscribe + UnsubscribeMulti coverage #10
Labels
No labels
area:defold
area:docs
area:infra
area:protocol
area:testing
kind:bug
kind:chore
phase:breadth
phase:core
phase:hardening
phase:slice
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
yuris/spacetimedb-defold#10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Unsubscribe with SendDroppedRows flag; UnsubscribeMulti for query-set groups. Cache drop logic exists (
cache.drop_query_set), untested against a live server.Closed in
3528c2bThe legacy
Subscribereplaces the entire subscription set and cannot be undone one query at a time, so until now a client could only ever add.SubscribeMulti/UnsubscribeMultiare query-id-keyed and can be dropped.What the wire actually does
Captured against
clockworklabs/spacetime:v2.8.2and pinned intest/fixtures/session.jsonl(now 17 frames), so a server bump breaks the test rather than a game:1. Unsubscribe replies carry the rows back as DELETES. The same cache path that fills on subscribe empties on unsubscribe — no special casing.
2. The server computes the real delta. This was the load-bearing question, since upstream's own comment says clients "would need to track which rows exist in which queries". Two identical live subscriptions, dropped in turn:
So the client needs no query-to-row bookkeeping. Both directions are asserted.
3. An overlapping subscribe returns
tables: []. Subscribe twice to the same query and the second reply is empty — those rows were already sent on this connection. Upstream's doc comment claims the opposite ("the client will receive multiple copies of rows that appear in multiple queries"). A UI that clears a list and repopulates it from a subscribe payload would render empty. Read the cache instead.4. Single and multi forms nest differently.
SubscribeMultiAppliedcarries.update(a DatabaseUpdate with atablesarray);SubscribeAppliedcarries.rows.table_rows, a bare TableUpdate with no array. Decoding one as the other silently applies nothing — normalised in one place, with its own test.Reconnect interaction
Query sets are replayed under their original
query_id, so a handle the caller is still holding keeps addressing the same subscription. A set the server rejected is dropped from the replay list (SubscriptionErrorcarries an optionalquery_id).Proof
Unit tests cover the shapes, but the engine is what matters — conformance now runs a third phase against a live server:
Not done
SubscribeSinglehas no dedicated API — the multi form with a one-element set covers it, and both server replies are handled. Reopen if a single-query send path is actually wanted.