Testing and Safety Tooling π‘ BETA
The repository uses standard Cargo test targets plus explicit security and traceability rules; optional analyzers are additions, not gates defined in this book.
Test targets
| Command | Scope |
|---|---|
cargo test -p <library-crate> |
Unit tests in a library crate. |
cargo test -p botserver --bin botserver |
Unit tests in the binary crate; -p botserver alone has no library target. |
cargo test -p bottest |
Cross-crate integration suites. |
cargo clippy --workspace -- -D warnings |
Lint gate: zero warnings. |
cargo audit |
Weekly dependency vulnerability audit. |
Launch long checks in the background (nohup ... > /tmp/<crate>_check.log 2>&1 &) and continue other work; never block a review on a build.
Safety rules enforced in code
| Rule | Mechanism |
|---|---|
| No panics in production | Propagate through Result; no unwrap, expect, panic!, todo! or unimplemented!. |
| Safe subprocesses | SafeCommand instead of Command::new(). |
| Sanitized HTTP errors | log_and_sanitize, never a raw error string. |
| Valid SQL identifiers | sanitize_identifier / validate_table_name. |
| Rate limits and CSRF | Documented in the root AGENTS.md; Bearer-token API endpoints are exempt from CSRF. |
| Tenant isolation | bottest/tests/integration/tenant_isolation.rs must stay green. |
Optional analyzers
Miri, Kani, AddressSanitizer, ThreadSanitizer and fuzz targets are valid local investigations for unsafe code and concurrency. They are not wired as project-wide gates by any file cited here, so they are not claimed as release requirements.
Limits
| Claim | Status |
|---|---|
| Coverage thresholds | Not asserted; no percentage is set in the repository sources cited here. |
| Boteval runs | CI only (ci.yml); never run locally β it spends paid model calls. |
| Browser tests | Use Chrome CDP in the browser, never a direct WebSocket client. |
Related
- Building from Source β test commands and toolchain settings.
- Security Features β the guards behind the rules.
- System Limits β documented operational limits.