SweetGrass is part of the ecoPrimals sovereign computing ecosystem. Contributions that respect the ecosystem's design principles are welcome.
- Rust 1.87+ (stable, Edition 2024)
- Docker (optional, for PostgreSQL integration tests)
cargo-llvm-cov(optional, for coverage)
-
Read
specs/PRIMAL_SOVEREIGNTY.md— SweetGrass owns its own types and communicates with other primals exclusively via JSON-RPC 2.0 at runtime. No compile-time coupling to other primals. -
Read
specs/ARCHITECTURE.mdfor the 11-crate workspace structure. -
Familiarize yourself with the wateringHole standards, particularly
STANDARDS_AND_EXPECTATIONS.md.
# Build
cargo build --release
# Run all tests
cargo test --all-features
# Clippy (pedantic + nursery, zero warnings required)
cargo clippy --all-features --all-targets -- -D warnings
# Format check
cargo fmt --all -- --check
# Doc check (zero warnings required)
cargo doc --all-features --no-deps
# Coverage
cargo llvm-cov --all-features --workspace
# Dependency audit
cargo deny checkThese are enforced at the workspace level and by CI:
| Rule | Enforcement |
|---|---|
No unsafe code |
#![forbid(unsafe_code)] on all crates |
No .unwrap() in production |
clippy::unwrap_used = "deny" |
No .expect() in production |
clippy::expect_used = "deny" |
| No files over 1000 lines | Split into mod.rs + domain modules |
| No TODO/FIXME/HACK in source | Track in ROADMAP or issues |
| No commented-out code | Git remembers |
Result<T, E> everywhere |
thiserror for typed errors |
#![warn(missing_docs)] |
On all 10 crates |
SPDX header on every .rs file |
// SPDX-License-Identifier: AGPL-3.0-or-later |
| Named constants | No magic numbers, ports, or primal names as string literals |
-
Pure Rust: Zero C/C++ dependencies in production.
cargo-denybansopenssl,ring,tonic,prost,reqwest, andprovenance-trio-types. -
Primal Sovereignty: SweetGrass knows only itself. Other primals are discovered at runtime via capability-based discovery. No shared type crates.
-
JSON-RPC + tarpc first: All inter-primal communication uses JSON-RPC 2.0. tarpc is optional for Rust-native high-performance paths.
-
Zero-copy where possible:
Arc<str>for identifiers (BraidId,Did,ContentHash,ActivityId,mime_type),Cow<'static, str>for static values,bytes::Bytesfor wire payloads. -
DI over environment mutation: Use
*_with_reader()functions for testable environment access. Nostd::env::set_varin tests.
-
cargo test --all-features— zero failures -
cargo clippy --all-features --all-targets -- -D warnings— zero warnings -
cargo doc --all-features --no-deps— zero doc warnings -
cargo fmt --all -- --check— passes - No TODO/FIXME/HACK in committed code
- No files over 1000 lines
- SPDX header on any new
.rsfiles - Tests for new functionality
-
CHANGELOG.mdupdated -
CONTEXT.mdmetrics current (test count, coverage, if version bump)
By contributing, you agree that your contributions will be licensed under AGPL-3.0-or-later. See LICENSE.