Verification

What we verify

  1. 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).
  2. Determinism within a language. run_workload(cfg) is pure; the same cfg produces identical bytes (test 10 in each suite).
  3. Cross-language byte identity. cross_test.sh builds all three qplan binaries, runs scenarios A and B, asserts SHA-256 equality across the three outputs and equality with the frozen reference hashes (3918bc6e… and 9313fe69…).
  4. 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 stdlib crypto/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:

  1. Update both functions in all three languages in the same commit.
  2. Run cross_test.sh — the outputs across languages must still match.
  3. Capture the new SHA-256 for scenarios A and B.
  4. Update the want_hash A / want_hash B lines in cross_test.sh.
  5. Update the test-11 anchor strings in src/go/idx14_test.go and src/cpp/tests/test_idx14.cc.
  6. Update the hash table in docs/observation.md and the wire-format section in CONCEPTS.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.sh finishes in well under a second on a laptop; the byte-identity property is size-invariant.