test: a census of the type-tag grammar #87

Merged
yuris merged 1 commit from bsatn-tag-matrix into main 2026-08-21 08:27:26 +00:00
Owner

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_* and vec_* form except the few the all_types row happens to use.

Most of that gap was low risk (opt_X is a tag byte plus decode-X, vec_X is 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 — identity reverses its wire bytes, connection_id/uuid become exact decimal digit strings, schedule_at becomes 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:len refuses by design) stay in the table as expected-raise rows.

Also folds in the two smaller gaps the reviews named: sum_Kind's tagged variant (a sum with a scalar payload) is now decoded, and a new product_Mixed covers 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.jsonl and the hex they must decode to is the JWT's own hex_identity claim 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/test clean. Mutation-proven to bite — dropping the identity byte reversal and swapping the Option ordinals each go red naming the failing tag, and a vec_ decode mutation goes red in this suite only, which is direct proof the matrix is the sole cover for those composites.

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_*` and `vec_*` form except the few the `all_types` row happens to use. Most of that gap was low risk (`opt_X` is a tag byte plus decode-X, `vec_X` is 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 — `identity` reverses its wire bytes, `connection_id`/`uuid` become exact decimal digit strings, `schedule_at` becomes 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:len` refuses by design) stay in the table as expected-raise rows. Also folds in the two smaller gaps the reviews named: `sum_Kind`'s `tagged` variant (a sum with a scalar payload) is now decoded, and a new `product_Mixed` covers 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.jsonl` and the hex they must decode to is the JWT's own `hex_identity` claim 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/test` clean. Mutation-proven to bite — dropping the identity byte reversal and swapping the Option ordinals each go red naming the failing tag, and a `vec_` decode mutation goes red in *this suite only*, which is direct proof the matrix is the sole cover for those composites.
test: a census of the type-tag grammar
All checks were successful
ci / ci (pull_request) Successful in 20s
d162198b5a
41 of the 69 base and composite tags were referenced by no test and by
no fixture column -- every opt_ and vec_ form except the handful the
all_types row happens to use. Most of that gap was low risk, since an
opt_ is a tag byte plus its payload and a vec_ is a count plus a loop,
both already proven by the string and product cases. The part that was
not low risk is a composite wrapping a type that does NOT take the
generic path: an identity reverses its wire bytes, a connection_id or
uuid becomes an exact decimal digit string, a schedule_at becomes a
tagged table. A bug there would have had nothing watching it.

One table of 26 base rows drives 130 round-trips -- each tag by itself,
its Option in both states, and its vec at length zero and two -- and the
row count is asserted, so deleting a row fails rather than silently
shrinking the census. Tags that legitimately cannot encode stay in the
table as expected-raise rows, because a census with holes in it reads as
an oversight rather than a decision.

The identity case is anchored to the captured session rather than to
this codec: the bytes come from frame 1 of session_v2.jsonl and the hex
they must decode to is the JWT's own hex_identity claim, so neither side
of that equality is something the decoder computed.
yuris merged commit 0d5cc9eb34 into main 2026-08-21 08:27:26 +00:00
yuris deleted branch bsatn-tag-matrix 2026-08-21 08:27:26 +00:00
Sign in to join this conversation.
No description provided.