Everything is in English: code, comments, doc comments, commit messages, PR descriptions.
The README is the public API documentation. Keep it up to date.
- Any addition or change to the public API (Rust, WASM, Extism) must be reflected in
README.mdbefore the work is considered done. - Doc comments (
///) on every public item — functions, structs, methods, type aliases — are mandatory. Explain why and what, not just how. - Module-level
//!comments explain the role of the file in the overall architecture.
Simple and readable beats clever and optimised.
- Prefer the straightforward implementation. Only optimise when a benchmark or profiler identifies a real bottleneck.
- Short functions with a single clear purpose. If a function needs a long comment to explain what it does, it should probably be split.
- No unnecessary abstractions: helpers and traits earn their place only when used in at least two distinct call sites.
Follow idiomatic Rust — standard library types, ownership, Result-based error handling:
- Use
thiserrorfor error types (already the pattern inerror.rs). - Prefer
?over explicitmatch/unwrapfor error propagation inside library code. - Secret material must be wrapped in
zeroize::Zeroizingwherever it lives on the heap. Follow the existing pattern inwasm.rsandextism.rs. unwrap()andexpect()are only acceptable in tests and inmain()for truly unrecoverable conditions; never in library code.- No
unsafewithout an explicit safety comment explaining the invariant that makes it sound.
Every behaviour must be covered by a test.
- New public functions get at least one unit test in a
#[cfg(test)]block in the same file. - New API entry points (WASM, Extism) get a corresponding integration test in
tests/. - Test both the happy path and the documented error cases (wrong length, bad encoding, zero scalar, etc.).
- Frozen protocol vectors belong in
tests/upgrade_vectors.rs; add an entry whenever a new serialisation format is stabilised. - Run
cargo testbefore marking work as done. All tests must pass.
cargo check # fast type-check
cargo test # full test suite
cargo fmt --all -- --check # formatting — must produce no diff
cargo clippy --all-targets -- -D warnings # lint, default features
cargo clippy --no-default-features --features wasm \
--target wasm32-unknown-unknown --lib -- -D warnings # lint, WASM featureThese are the exact commands the CI lint job runs. All must pass before marking work as done.