test: a census of the type-tag grammar #87
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!87
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bsatn-tag-matrix"
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 coverage hole measured after the v2 stack landed: 41 of 69 base and composite type tags were referenced by no test and by no fixture column — every
opt_*andvec_*form except the few theall_typesrow happens to use.Most of that gap was low risk (
opt_Xis a tag byte plus decode-X,vec_Xis a count plus a loop, both proven by the existing string and product cases). The part that was not low risk is a composite wrapping a type that does not take the generic path —identityreverses its wire bytes,connection_id/uuidbecome exact decimal digit strings,schedule_atbecomes a{tag=,value=}table. Nothing was watching those.One table of 26 base rows drives 130 round-trips covering 78 tags: each tag alone, its Option in both states, and its vec at length 0 and 2. The row count is asserted, so deleting a row fails the suite rather than quietly shrinking the census. Tags that legitimately cannot encode (a vec of a zero-width element, which
Reader:lenrefuses by design) stay in the table as expected-raise rows.Also folds in the two smaller gaps the reviews named:
sum_Kind'staggedvariant (a sum with a scalar payload) is now decoded, and a newproduct_Mixedcovers a product whose fields are not all i32 — string / timestamp / identity / bool, i.e. a special type nested three layers deep beside a negative timestamp of a different width.The identity assertion is anchored to reality, not to the codec agreeing with itself. The bytes come from frame 1 of
session_v2.jsonland the hex they must decode to is the JWT's ownhex_identityclaim from that same frame — neither side of the equality is computed by the decoder.No production bug surfaced. Every tag round-trips; the composite paths were correct. No production code changed, no assertion weakened.
Verified: 11 suites / 1849+ assertions green,
stylua --check stdb dev/testclean. Mutation-proven to bite — dropping the identity byte reversal and swapping the Option ordinals each go red naming the failing tag, and avec_decode mutation goes red in this suite only, which is direct proof the matrix is the sole cover for those composites.