stdb: default to the v2 BSATN wire, and ship it as 2.0.0 #94
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!94
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "flip-default"
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?
Gate 5 of #89. The flip, the version and the docs in one commit.
stdb/init.luanow resolvesopts.protocol or "v2",game.projectreads2.0.0, and both harnesses default to v2 so a hand-run agrees with what ships.connect({ protocol = "v1" })keeps the JSON wire, unchanged and run against a live server on every conformance trigger —stdb/protocol.luahas an empty diff againstmain.A real bug the flip exposed.
subscribe_urlcomposed the query string fromopts.protocolrather than from the wireconnecthad actually resolved. That was invisible while the default was v1 and the two always agreed. Under a v2 default a defaulted caller leavesopts.protocolnil, so the socket negotiated BSATN with nocompression=None— and the codec then refuses the compressed frame — whilelight = trueslipped past the v2 guard and went out on the wire. It is how the new default assertion andtest_slicingfirst failed.subscribe_urlnow takes the resolved protocol as a parameter, and both halves are pinned:native_url({})must equalbase .. "?compression=None", andnative_url({ light = true })must raise.Test sweep was wider than one line.
native_urldrivesconnect, so every assertion built on it inherited the default. The whole URL-composition block is the v1 surface —lightexists only there, and part of it is explicitly "the pre-1.0 URLs, byte for byte" — so it now names its wire on every call. Those assertions test composition, not whichever protocol happens to be default; leaving them implicit would have silently converted them into default-tracking tests. The default assertions invert, and theprotocol = "v1"case inherits the invariant that the default must stay reachable by name — it now protects v1.Docs: the
connectdocstring, both SUBPROTOCOL comments, theon_appliedandout_of_energyqualifiers inconnection.lua, and the README's two-wire paragraph, which now leads with the loud breaks a reader hits first (lightraises, calling anything needsreducers/procedures, legacysubscriberaises, tables need generatedtypes) before the quieter behavioural ones. Thef32paragraph survives unchanged in substance — still the one type whose value differs, and v2 is the more faithful side.Verified locally, all five engine runs: native default names v2, native
STDB_PROTOCOL=v1names v1, sliced (50000 rows over 6 frames at 8.0ms), HTML5 default asserts thev2.bsatn.spacetimedbhandshake, HTML5v1passes. Unit suite 11/11, stylua clean.The README's install pin points at
v2.0.0.zip, tagged immediately after this merges.