Contributing
Changes must be reproducible, wire-compatible and honest about what was verified.
Work from behaviour
For a generator or protocol change:
- Add a focused behavioural, compile-fail, wire-parity or allocation test.
- Run it and see it fail.
- Make the smallest coherent change.
- Run the focused test and the affected crate’s full checks.
- Run the benchmark gate when a generated or cluster hot path changes.
A substring test on generated source can supplement a behaviour test. It does not prove wire correctness, type-state order, error propagation or allocation behaviour.
Checks
| Command | What it runs |
|---|---|
just policy | test-lane ownership and the suppression rules below, plus their self-tests |
just preflight | stale-lock check, fmt, clippy, policy self-tests, book fences, golden and reference --check |
just check-products | ergo-sbe and ergo-aeron-cluster only |
just check-local | repository hygiene, fmt, clippy, the tests that need no Aeron jars (building ergo-aeron-tools still needs a JDK 17 or newer), and the exchange-example, cluster-ha-orderbook and cluster-rfq samples |
just test | the full suite: fetches the pinned Aeron release jars and runs the Java cluster lifecycle, recovery and HA lanes. A missing dependency fails |
just test-all | just test plus Miri and fuzz replay |
just check-coverage | coverage against the checked-in baseline |
just check-mutation | mutation testing over parser, resolver, sizing and dynamic-tail code |
just policy (so also just test), just preflight and CI first fail on a stale gitignored Cargo.lock (samples/*, sbe/fuzz, sbe/miri-fixtures): one that locks a crate older than the root Cargo.lock does, or resolves a crate’s dependency to a semver line the root lock does not have. CI resolves those locks fresh, so it never sees them. The message names the lock and the fix, cargo update --manifest-path <dir>/Cargo.toml.
scripts/check-ignored-locks.sh is a root-lock parity heuristic, not full Cargo freshness. It does not check crates that exist only in a nested lock, git or path sources, or whether a manifest and its lock agree. A nested lock that resolves fewer dependency lines than the root lock is not stale.
RUSTDOCFLAGS="-D warnings" cargo doc -p ergo-sbe --all-features --no-deps
RUSTDOCFLAGS="-D warnings" cargo doc -p ergo-aeron-cluster --no-deps
Test policy
test-lanes.tsv assigns every tracked test-bearing Rust file to exactly one
lane. scripts/check-test-policy.sh rejects:
| Pattern | Where it looks |
|---|---|
#[ignore] | .rs files |
an ignore doc fence | .rs doc comments (Markdown rust,ignore is allowed) |
a test printing SKIP or Skipped: | .rs files |
--skip, --ignored, --include-ignored | justfile, just/*.just, scripts/*.sh, workflows |
if … cargo test/bench | the same control files |
cargo test … || true, ; exit 0 | the same control files |
[skip ci]-style markers, continue-on-error: true, any if: other than always() | workflows |
The policy cannot see a test that returns Ok early without printing those
words. The RLValidator leg is not such a test. It is compiled only with
--cfg ergon_rlvalidator (scripts/run-fix-sbe-conformance.sh). With that
cfg, a missing suite, class directory or classpath fails the test, and so does
a suite that is not at the commit in scripts/fix-sbe-conformance-pin.txt.
just test does not pass the cfg, so the leg is absent from the default suite;
just release and the weekly nightly.yml run it
(just test-fix-sbe-conformance).
A failure seen while changing the repository is not a pass because it looks pre-existing. Fix it, or stop and report it as a blocker. Never make a lane green by filtering, ignoring, conditionally bypassing or only logging the failure.
CI
| Workflow | What it runs |
|---|---|
ci.yml | policy; lint and test jobs on ubuntu-24.04 (x86_64) and ubuntu-24.04-arm (arm64); Rust 1.99.0; Java 25 for the Aeron jobs; the coverage ratchet; the fixture crate as ordinary tests; benches compiled with --no-run, none run |
cluster-compatibility.yml | the cluster harness against Aeron 1.46.8 on Java 21, when the cluster crate, the harness, sbe/src/, a manifest, Cargo.lock, the toolchain pin, the Aeron jar pins or fetch script, or the recipes it runs change (scripts/check-workflow-paths.sh fails if the filter drops one) |
nightly.yml | weekly (Sunday): the six ergo-sbe fuzz targets for 600 s (not inspect_bytes or inspect_filter), the fixture crate under Miri, and the FIX SBE conformance suite with the Java RLValidator (just test-fix-sbe-conformance, suite pinned in scripts/fix-sbe-conformance-pin.txt) |
release.yml | just release-check, then just bench and just bench-cluster on ubuntu-latest, blocking |
Mutation testing is manual; CI checks only its configuration, and the ratchet fails when mutation output is missing or empty. 32-bit x86 and big-endian s390x codec tests are not run in CI.
Performance
just bench # after a change that can affect generated hot paths
just bench-cluster # after a cluster session codec, offer, claim or egress change
just bench-cluster takes every invocation twice, arms in registration order
and then reversed, because whichever arm of a Criterion group runs first is
measured differently from the one after it. The gate combines the two orders,
so with the default BENCH_REPEATS=5 expect 20 cargo bench runs. It then
prints, for every arm, the sample count, mean, and the min, p50, p99, p99.99
and max of the batch means pooled over all of them
(scripts/bench-cluster-report.py; a sample is one 10,000-operation batch’s
mean, so these are not per-message tails), and every pair’s gate verdict as
PASS, INCONCLUSIVE or FAIL. An inconclusive pair passes the gate but is not
parity. Quote a ratio only beside that table, and give each max a cause.
The target is ergon / sbe-tool ≤ 1.00 on equal work. Ceilings, the gate’s
pass/inconclusive/fail rules and the fairness rules:
sbe/BENCHMARKS.md. Do not raise a ceiling. Do not copy
benchmark numbers into docs by hand: book/src/project/performance.md is
generated from benchmark artifacts (just perf-page). A docs-only change
needs no benchmark run.
fairness_policy_test requires the SBE and cluster parity suites to use
std::hint::black_box, assert correctness before timing, and keep the
benchmark disclosure. Treat a large result as suspect until the benchmark is
re-audited.
Error and example style
- Public library APIs use crate-specific typed errors.
- Tests and binaries may return
Result<(), Box<dyn std::error::Error>>. - Prefer
?tounwraporexpect. - Treat schema-declared text strictly; keep binary fields as bytes.
- Size message buffers from generated constants or length helpers.
- Use the high-level cluster facade in consumer examples.
Documentation
- The root README orients; crate usage goes in that crate’s README.
- One sample inventory:
samples/README.md. No per-sample READMEs. - A page that describes how the software behaves describes current, verified behaviour. A superseded number is not the current result.
- Keep the record in the tree. The AI-assistance account, benchmark round write-ups, screenshots and release notes stay. Git history is not a substitute for that record. Dated plans and scratch task trees do not belong in the tree.
- One page owns a fact; other pages link to it.
- A book diagram (
book/src/diagrams/) lists inbook/diagrams.tsvevery source its facts were checked against. A change to a listed source failsscripts/check-book-diagrams.sh: re-verify the diagram against the change, then--restampit.
Versioning
Every crate is 0.x alpha. Any release may break the API, with no deprecation
period and no compatibility shim. CHANGELOG.md records each break. This does
not cover the wire: official SBE wire compatibility still outranks API
convenience.
scripts/check-generated-public-api.sh (in just preflight and CI) diffs
generated codec surfaces against api/generated/*.txt, so a surface change is
reviewed, not forbidden. After a reviewed change:
UPDATE_GENERATED_PUBLIC_API=1 cargo test -p ergo-sbe --test generated_public_api_test.
Package boundaries
The publication candidates are ergo-sbe, ergo-aeron-cluster,
ergon-tune, ergo-sbe-inspect and ergo-aeron-tools
(api/public-api-baseline.toml). Publish ergo-sbe first, then
ergo-sbe-inspect, then ergo-aeron-tools.
scripts/check-publish-set.sh (in just policy) fails when a published crate
depends on an unpublished one, on a path without a version, or on an older
version than a published sibling’s, or when the release recipe, workflow, dry
runs or API manifest leave a crate out or publish it before its
dependencies. A version bump therefore updates every version beside a
workspace path with [workspace.package]: ergo-sbe and
ergo-sbe-inspect in [workspace.dependencies].
Inspect the payloads before a release:
cargo package -p ergo-sbe --list --allow-dirty
cargo package -p ergo-aeron-cluster --list --allow-dirty
cargo package -p ergon-tune --list --allow-dirty
cargo package -p ergo-sbe-inspect --list --allow-dirty
cargo package -p ergo-aeron-tools --list --allow-dirty
Packages exclude integration tests, fixtures not needed at build time,
benchmarks, Java harness code, application protocols, samples and internal
plans. ergon-tune ships its library, the ergon-tune command and its README.
ergo-sbe-inspect and ergo-aeron-tools ship src/, their README and the
licence. Building ergo-aeron-tools with its default features (the publish
verify build does) needs CMake, a C compiler, libclang and a JDK 17 or newer.
Publishing, tagging and announcing a release need explicit maintainer
authorisation. Before an authorised release, a maintainer runs just release-check
(see Verification & Release);
the release workflow runs the same command before cargo release.
Git hygiene
- Preserve unrelated working-tree changes and a dirty submodule.
- Stage paths explicitly; do not use
git add -A. - Do not rename the
sbe,clusterorsamplesdirectories. - Use a short one-line conventional commit subject.