src/lib.rs: crate entry point; wires public modules.src/constants.rs: protocol constants and compile-time invariants.src/vsr/: Viewstamped Replication modules (wire primitives likeHeader,Command,Message, framing, pools).src/stdx/: no-heap data structures (RingBuffer,BitSet, intrusiveList/Queue).src/util/: small helpers (e.g., zero-check utilities).src/io/: async I/O backends (io_uringon Linux, GCD on macOS) guarded bycfg(target_os = ...)..github/workflows/ci.yml: CI definition (fmt, clippy, build/test, audit, Miri).target/: Cargo build output; don’t commit.
cargo build/cargo build --all-features: compile the library.cargo build --no-default-features: minimal build sanity check (mirrors CI).cargo test --all-features: run unit + property + doc tests.cargo fmt --all(CI:cargo fmt --all -- --check): format withrustfmt.cargo clippy --all-targets --all-features -- -D warnings: lint; warnings fail CI.cargo audit: dependency CVE scan (install viacargo install cargo-audit --locked).- Linux Tests (macOS):
orb cargo test --all-features --lib io::backend_linux(requires OrbStack) or use Docker. - Miri (nightly):
cargo +nightly miri setup && cargo +nightly miri test --all-features.
- Keep code
rustfmt-clean (4-space indentation; no hand-aligned columns). - Follow Rust naming:
snake_casemodules/functions,CamelCasetypes,SCREAMING_SNAKE_CASEconstants. - Prefer “Tiger style” invariants:
const _: () = assert!(...)for layout/size checks and runtimeassert!for pre/postconditions. - Wire protocol stability matters: don’t change existing
#[repr(u8)]discriminants or#[repr(C)]layouts; add new fields/variants compatibly and extend tests.
- Tests are colocated with code (
#[cfg(test)] mod tests); add coverage with the implementation. - Use
proptestfor round-trips and edge cases; tune locally withPROPTEST_CASES=32 cargo test. - Keep tests deterministic and fast enough for
cargo teston a laptop.
- Commit subjects are short and imperative (common prefixes: “Add”, “Fix”, “Refactor”, “Update”, “Remove”); avoid trailing periods.
- Keep commits focused and atomic; include rationale in the PR description.
- PRs should note protocol/safety impact (especially under
src/vsr/andsrc/io/), list how you tested (commands + platform), and ensure CI is green.