Verification: why the tests matter so much
If somebody publishes an LLM-generated library with barely any test coverage, I assume the code is slop until shown otherwise.
LLMs respond extremely well to objective verification. A failing test gives the agent a bounded problem with an observable correct outcome. Without that oracle, it can produce a confident implementation of a misunderstanding.
Early in development I sometimes asked for a numerical code-coverage target. Later I cared less about the percentage than the breadth and independence of the evidence.
The checked-in suite includes:
- schemas and cases ported from the upstream SBE project;
- decoding Java-produced official fixtures;
- exact comparisons of headers, fixed blocks, composites, groups, and variable data;
- checked-in Rust codecs generated by official
sbe-tool; - live dual encoding where
ergo-sbeand official Rust codecs must produce byte-identical messages; - a multi-schema official parity matrix;
- property-based round trips over scalars, arrays, groups, nested structures, and variable data;
- compile-fail proofs for illegal stage ordering and use-after-consume;
- exact encoded-length matrices compared with actual completed messages;
- malformed and truncated buffer tests;
- schema-version and acting-version tests;
- deterministic generated-source golden tests;
- zero-allocation checks using a counting allocator;
- upstream issue-regression schemas; and
- sample applications that exercise more complicated API combinations.
See:
sbe_tool_wire_parity_test.rssbe_tool_multi_schema_wire_parity_test.rsbaseline_test.rsproptest_roundtrip.rsallocation_count_test.rsordered_decoder_stages_test.rsl3_consuming_stages_test.rsencoded_length_api_test.rssbe_tool_reference/README.md
The strongest compatibility test is differential, not self-referential. For
the same schema and logical values, the suite encodes with both ergo-sbe and
the official sbe-tool Rust generator and requires identical bytes. A library
that only decodes its own encoded output can be consistently wrong on both
sides; an independent reference makes that much harder.
One concrete AI failure involved offsets around variable data. A generator change broke an existing test. The agent observed the failure, diagnosed it, and fixed the implementation without me having to identify the exact line. That was impressive, but the important fact is that the test existed. Without it, the wrong offset could have compiled and looked plausible.
Tests are still not enough to remove the experimental warning. They cover the cases we and upstream authors thought to encode. Production traffic eventually finds assumptions that a controlled suite did not.