Narrow the value-surface guarantee to exclude f32 #88
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!88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bsatn-f32-surface"
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?
Post-merge review of #87 and a decision memo on the default flip found one thing the repo was asserting untruthfully.
The value surface is not identical —
f32divergesREADME and four wiki locations claimed rows decode to the same Lua values on either protocol. That is true for every tag but one. Verified by running the codecs against each other:
v1 sends decimal text and
json.decodereturns the double nearest0.1; v2 carries the four bytes the server stored, so it widens to that single's exact value. v2 is the more faithful side — it hands back what the server actually holds, where v1 reconstructs a double from a decimal rendering of a single. The codec is not changed; the defect was undocumented, untested silence.Nothing caught this because every
f32fixture value in the repo is exactly representable — the differential test uses-1.5and0, and #87's census row used-1.5. The one tag where the guarantee is false was the one tag never tested with a lossy value.Now pinned two ways: the census asserts an
f32argument comes back narrowed, and a new cross-protocol check decodes one decimal literal through both codecs and asserts they differ for0.1while agreeing for-1.5. Both sides are pinned to their own exact double, so the assertion cannot be "fixed" by editing one expected value. Proven to bite: asserting the two codecs agree goes red, and so does changing the v2 expectation to0.1.Also corrected
resultandunknownare refused outright and are not rows — their coverage lives further down the file. Claim narrowed rather than rows duplicated.confirmed_readsresolves differently per protocol, and this was undocumented. When the caller passesnilthe SDK sends no parameter, and upstream then resolvesfalseon v1 buttrueon v2 (subscribe.rs:103-111, asserted upstream at:2838-2844). So a v2 caller who passes nothing already gets updates held until the transaction offset is durable, where a v1 caller gets them immediately. Documentation only, no behaviour change — but it is a real latency difference for anyone already opted in, and it is an input to the default-flip decision, so it is now stated in the roadmap text too.Verified: 11 suites green,
stylua --check stdb dev/testclean,stdb/untouched (0-line diff), wiki pushed asf12b893.