test: pin the confirmed_reads resolution to peer-SDK parity #90

Merged
yuris merged 2 commits from flip-confirmed into main 2026-08-21 09:52:23 +00:00
Owner

Test-only. Gate 2 of #89.

stdb/init.lua already resolves confirmed_reads the way every official SpacetimeDB SDK does: nil omits the confirmed parameter so the server's own default applies (false on v1, true on v2), false is the explicit low-latency opt-out, true asks for it outright. No production change here.

What was missing is the pin. Nothing failed today if someone "helpfully" started writing the default out as confirmed=false, which would silently diverge from TS/C#/Rust/Unreal. Now three assertions cover the tri-state, and the message on each names the peer-parity decision it defends, so a future regression fails a test that explains itself.

The nil case was already pinned byte-for-byte and is the assertion the runner reaches first, so its message was strengthened rather than duplicated.

Proof the pin bites: patching init.lua to send confirmed=false for a nil on v2 fails with expected …?compression=None, got …?compression=None&confirmed=false; reverted, 11 passed 0 failed.

Touches only dev/test/**, which is not in &conformance_paths — ci.yml only, no conformance run expected.

Test-only. Gate 2 of #89. `stdb/init.lua` already resolves `confirmed_reads` the way every official SpacetimeDB SDK does: `nil` omits the `confirmed` parameter so the server's own default applies (false on v1, true on v2), `false` is the explicit low-latency opt-out, `true` asks for it outright. No production change here. What was missing is the pin. Nothing failed today if someone "helpfully" started writing the default out as `confirmed=false`, which would silently diverge from TS/C#/Rust/Unreal. Now three assertions cover the tri-state, and the message on each names the peer-parity decision it defends, so a future regression fails a test that explains itself. The nil case was already pinned byte-for-byte and is the assertion the runner reaches first, so its message was strengthened rather than duplicated. Proof the pin bites: patching `init.lua` to send `confirmed=false` for a nil on v2 fails with `expected …?compression=None, got …?compression=None&confirmed=false`; reverted, 11 passed 0 failed. Touches only `dev/test/**`, which is not in `&conformance_paths` — ci.yml only, no conformance run expected.
test: pin the confirmed_reads default to peer-SDK parity
All checks were successful
ci / ci (pull_request) Successful in 1m29s
9e918ec46c
A nil confirmed_reads omits the `confirmed` parameter, which leaves the server
to apply its own default -- false on v1, true on v2. That is what every official
SpacetimeDB SDK does: TypeScript, C#, Rust and Unreal all send nothing unless
asked, and spell the opt-out `withConfirmedReads(false)`. `stdb/init.lua` has
always behaved this way, and nothing failed if it stopped.

The gap is about to matter. Once v2 is the default protocol, spelling the
default out looks like a harmless cleanup -- send `confirmed=false` for a nil
instead of nothing -- and it would quietly make this the one SDK that opts its
defaulted callers out of confirmed reads, on the wire where the server default
is the opposite.

So the resolution is pinned on v2, where such a divergence would land:

- the byte-for-byte v2 URL assertion now names the absence and its reason in its
  own message, so that regression fails a test which explains the decision it
  breaks instead of one that talks about compression;
- `confirmed_reads = false` sends `confirmed=false`, the documented
  low-latency opt-out;
- `confirmed_reads = true` sends `confirmed=true` even though it agrees with
  the v2 server default.

Test-only; no production file changes. Verified by patching `subscribe_url` to
send `confirmed=false` for a nil on v2, which fails the suite on the message
above, then reverting: 11 passed, 0 failed, stylua clean.

Part of #89.
test: make the v2 confirmed=true pin reachable
All checks were successful
ci / ci (pull_request) Successful in 20s
c640eb5640
The composition case a few lines down already asserted a v2 URL with
`confirmed=true`, and it ran first, so the new tri-state assertion behind it
could never be the one that reported: dropping `confirmed` on v2 failed as
"compression composes ahead of confirmed and of the HTML5 token" -- a message
about parameter ordering, which is the opposite of what this pin is for. Moving
the tri-state block ahead of composition makes it fire first and name the
decision it defends.

Verified by swallowing a v2 `confirmed_reads = true` in subscribe_url: the
failure is now reported by the tri-state assertion's own message.
yuris merged commit b71a6a03f2 into main 2026-08-21 09:52:23 +00:00
yuris deleted branch flip-confirmed 2026-08-21 09:52:23 +00:00
Sign in to join this conversation.
No description provided.