Verification
What we verify
- Single-language correctness. Each language has a test suite that covers the eight planner behaviours (insert layout, index bucket ordering, EQ → IndexScan, range → IndexScan, NE → SeqScan+Filter, projection-only collapse, deterministic row emission order, two- predicate selection of the most selective).
- Determinism within a language.
run_workload(cfg)is pure; the samecfgproduces identical bytes (test 10 in each suite). - Cross-language byte identity.
cross_test.shbuilds all threeqplanbinaries, runs scenarios A and B, asserts SHA-256 equality across the three outputs and equality with the frozen reference hashes (3918bc6e…and9313fe69…). - Sha256 implementation correctness. Rust and C++ ship their own
SHA-256; the empty-string and
"abc"known-answer vectors are checked in each unit-test suite. Go uses stdlibcrypto/sha256.
How to run
bash scripts/verify.sh # → "=== OK ==="
bash scripts/cross_test.sh # → "=== ALL OK ==="
verify.sh runs cargo test, go test, and ctest in turn; any failure
aborts with set -euo pipefail. cross_test.sh exits 1 on the first
mismatch or drift from the frozen golden hash.
Hand-checks before changing wire format
If dump_plan or dump_result is touched intentionally, the workflow is:
- Update both functions in all three languages in the same commit.
- Run
cross_test.sh— the outputs across languages must still match. - Capture the new SHA-256 for scenarios A and B.
- Update the
want_hash A/want_hash Blines incross_test.sh. - Update the test-11 anchor strings in
src/go/idx14_test.goandsrc/cpp/tests/test_idx14.cc. - Update the hash table in
docs/observation.mdand the wire-format section inCONCEPTS.md.
Skipping any step makes a future "did the wire format silently drift?" audit unreliable.
What we deliberately do NOT verify
- Performance. db-22 owns benchmarking; this lab targets correctness only.
- Concurrency. The structures are not thread-safe by design.
- Large inputs. Scenarios A and B are sized so
cross_test.shfinishes in well under a second on a laptop; the byte-identity property is size-invariant.