OrbyNode uses focused Rust tests, API-level integration tests and Bun-based web checks. Tests live beside the code they cover.
Run all checks before submitting a PR:
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
(cd web && bun run check)
(cd web && bun run build)
Equivalent full gate:
scripts/check.sh
| Area | File | Covers |
|---|---|---|
| Realtime | crates/realtime/src/lib.rs |
Multiplexing, replay, backpressure. |
| Realtime scale | crates/realtime/tests/load.rs |
100-subscriber bounded fan-out. |
| Database | crates/database/src/lib.rs |
Migrations and repositories. |
| Auth | crates/auth/src/lib.rs |
Passwords, sessions, throttling. |
| Terminal | crates/terminal/src/lib.rs |
PTY lifecycle and output. |
| Files | crates/files/src/lib.rs |
Root containment and file operations. |
| Files/Git | crates/files/src/git.rs |
Git status and commands. |
| Worktrees | crates/files/src/worktree.rs |
Worktree isolation. |
| Services | crates/services/src/lib.rs |
Port discovery and snapshots. |
| Nodes | crates/nodes/src/registry.rs |
Pairing and heartbeat. |
| Agents | crates/agents/src/lib.rs |
Detection and state transitions. |
| Attention | crates/agents/src/attention.rs |
Aggregation and resolution. |
| API | crates/api/src/*.rs |
HTTP behavior and embedded UI. |
| Workflows | crates/workflows/src/lib.rs |
Stages, approvals and cancellation. |
#[tokio::test]
async fn creates_project() {
let db = orbynode_database::Db::open("sqlite::memory:").await.unwrap();
let project = db.create_project("app", "/tmp/app").await.unwrap();
assert_eq!(project.name, "app");
}
let app = crate::build_router(AppState::default());
let response = app
.oneshot(Request::get("/health").body(Body::empty()).unwrap())
.await
.unwrap();
assert_eq!(response.status(), StatusCode::OK);
Use a unique temporary directory and clean it after the assertion. File tests must verify traversal and symlink containment behavior.
PTY tests spawn short-lived shell processes and assert stream, list and termination behavior. Keep output and timeout bounds explicit.
(cd web && bun run check)
(cd web && bun run build)
Current web gate is strict TypeScript and Vite build. Component and interaction tests may be added without introducing Next.js.
Every security-sensitive change should cover:
#[cfg(unix)].std::process::Command portability over shell-specific syntax.sh on Unix and cmd /C on Windows.crates/realtime/tests/load.rs publishes a bounded burst to 100 subscribers
and asserts delivery plus a five-second budget. Increase scale only when a
repeatable end-to-end harness exists.
/setup./health and /version.