Testing
The six tiers of verification in the Vike Trader workspace — unit, property, conformance, gate, smoke and latency — and what each one is the only tier able to prove.
Verification in this workspace is layered, and the layers are not interchangeable. A unit test pins an example. A property test pins a law. A conformance harness pins a contract that spans crates and belongs to none of them. A gate pins a claim about the repository itself, including claims made in prose. A smoke test proves a real venue still answers the way the adapter believes. A latency gate proves a tail. Each tier catches a failure class the tier below it structurally cannot see, which is why all six exist rather than one very large test suite.
The tiers
| tier | what it proves | where it lives |
|---|---|---|
| unit | one example, one function | #[cfg(test)] modules beside the code |
| golden fixture | this arithmetic has not moved, bit-for-bit | fixtures/, replayed from the crate each round gates — r1/r3/r4 by crates/vike-backtest/tests/parity.rs, r0 by crates/vike-model/tests/fill_parity.rs, r5 by crates/vike-exec/tests/parity/r5_parity.rs, r6 by the bridge crates |
| property | a law over random inputs the examples never reach | the proptest suites |
| conformance | a contract every venue adapter must satisfy | crates/vike-bridge-core/tests/bridge_conformance.rs and its market-data twin |
| gate | a claim about the tree — rosters, layering, prose, generated artifacts | crates/vike-ops/tests/ and its siblings |
| smoke | the live venue still behaves as the adapter assumes | crates/bridges/<venue>/tests/*_smoke.rs |
| latency | the core hop's tail, in nanoseconds | crates/vike-core/tests/runtime_latency.rs |
Unit and golden
The bottom tier is ordinary: #[cfg(test)] modules next to the function they pin. Above them sit
the frozen golden fixtures — exported once, then frozen, with every exporter deleted from the tree,
so the committed bytes are the oracle and the comparisons stay exact. Floats are IEEE-754 hex bit
patterns, and the rule that governs them is a review rule rather than a mechanical one: never widen
a tolerance to make a test pass. The parity gate is what that means
in full, and adding to the parity suite is the procedure.
Property
Golden fixtures pin examples somebody chose. proptest suites pin the laws those examples were
supposed to illustrate, over inputs nobody chose. crates/vike-exec/tests/order_fsm_props.rs folds
arbitrary lifecycle-event sequences through the order FSM and asserts six laws including terminal
absorption and error purity; crates/vike-model/tests/scalar_props.rs asserts grid-rounding
idempotence with exact equality. The workspace convention is that a counterexample is a real
finding: stop, report, and commit the generated proptest-regressions/ seed so it reproduces.
See property tests.
Conformance
Two harnesses in crates/vike-bridge-core/tests/ machine-check the venue-adapter contract that no
single venue crate contains. The exec contract runs one
scenario table against every covered venue's real event mapper folded through the real
vike_exec::ManagedOrder FSM. The
market-data contract runs one invariant table
against every covered venue's real L2-book normalizer. Each carries a
roster gate so a new venue is either covered or
deferred with a written reason — never silently absent.
Gate
A gate is a test whose subject is the repository. Layering, the derived CI crate roster, the settings registry, the per-venue capability tables, the committed generated artifacts, and prose itself — citations, unrun commands, duplicated constants — all have one. The whole family, and how to read a failure from each, is the developer guide. Two gates belong to this section specifically: the wire quantizers source gate, and the smoke-lane credential guard described under live smokes.
Smoke
Every venue's *_smoke.rs is #[ignore]d, so an ordinary cargo test never runs one. Most are
credential-gated on top of that and self-skip unless demo credentials are present in the project
credential store. The keyless ones are not: where a smoke reaches no account — public streams and
REST, or a local accepting client — there is no credential to gate on and #[ignore] is the only
gate; Polymarket's Gamma catalog smoke gates on an explicit POLY_GAMMA_SMOKE=1 instead. Some place
real orders on demo accounts. They are the only tier that can catch a venue changing its wire, and
the only tier that touches an account, which is why they are never run casually.
Latency
crates/vike-core/tests/runtime_latency.rs holds both gates and measurements, and its header is
explicit that only three of its tests assert a derived ceiling. Everything else measures: the
submit, book and coid variants assert nothing about timing at all, and the snapshot-build one keeps
a 1 ms p50 sanity ceiling its own comment calls a liveness check rather than a budget. The split is
deliberate — as that file puts it, an uncalibrated ceiling is a flaky gate, "which is worse than no
gate at all because people learn to re-run it rather than read it." The meaning is
the latency gate; the procedure is
running the latency gate.
Two rules that cut across every tier
One owned double, behind a feature
Shared test doubles live in exactly one place each and sit behind a test-support cargo feature
that a default build never compiles. crates/vike-bridge-core/src/scripted.rs replaced roughly
eight private copies of the same scripted WS stream. See
test doubles.
A property suite may not join a grouped test binary
crates/vike-backtest's tests/ are grouped into shared binaries to cut link time, and the
admission rule for joining a group is: the file must be plain — no #![cfg]
feature gate, no #[ignore]d test, no proptest regression sidecar, and no process-global mutation
such as env::set_var, because one binary runs its tests as threads in one process. Property
suites, feature-gated files, store-backed files and #[ignore]d files each stay their own binary.
Decision records
One page per architectural verdict, what each field holds, and how to read a Status line — including which status may never be cited as settled.
The exec contract
One scenario table folded through the real order FSM against every covered venue's real event mapper — the machine-checked version of emitter-split, no-silent-vanish and exactly-one-terminal.