test: prove the light-mode claim on two sockets, and stop a codec swap in silence #104
No reviewers
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!104
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "light-two-client"
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?
Closes the last actionable item on #77.
The gap
smoke.scriptsaid so itself, in the header: "Proving light mode is honoured for OTHER clients' transactions still needs a second connection and is not attempted here." Phase 1 only ever checked the caller's own transaction. The cross-client behaviour was established by a hand-run four-observer measurement and written into the wiki as fact, with nothing re-checking it.Phase 8
v1 only — v2 has no light mode to produce a light frame. An ordinary observer, no light flag anywhere, watches a commit caused by the main socket. One commit, two sockets, asserted to differ:
Both halves against the same transaction, because either alone is consistent with a server that ignores
lightentirely. Failable by construction — with the observer making the call instead:The observer is closed before phase 6, which times a frame budget and would otherwise pay for a second socket decoding its own copy of every insert.
The defect it found
stdb.protocolis pure and holds its JSON codec in a module local.connection.newinjects per connection, so a second connection with a different implementation re-pointed the codec for every connection already running.It surfaced the way this class of bug does — as a wrong number rather than an error. The observer passed an uninstrumented codec, and the measurement on the other socket reported
10000 row(s) cost 0 json.decode call(s).Guarded in
connection.new, notprotocol.init. Instrumenting the codec on purpose is a considered act through a documented door andtest_protocol.luadoes exactly that; two connections disagreeing by accident is the bug. The guard is mutation-proven: relaxing the condition turns the new test red.Verification
12 passed, 0 failed, stylua clean