Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(scripts): add test coverage matrix and CI documentation

Steven Enamakelc2ea77fb7a68
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md
index aa8c6095fc..6c2543b29c 100644
--- a/docs/TEST-COVERAGE-MATRIX.md
+++ b/docs/TEST-COVERAGE-MATRIX.md
@@ -15,7 +15,7 @@ Canonical mapping of every product feature to its test source(s). Drives gap-fil
| Code | Layer |
| ---- | ------------------------------------------------------------------------------------ |
-| `RU` | Rust unit (`#[cfg(test)]` inside `src/`) |
+| `RU` | Rust unit (sibling `*_tests.rs` files under `crates/openhuman-core/src/`) |
| `RI` | Rust integration (`tests/*.rs`) |
| `VU` | Vitest unit (`app/src/**/*.test.ts(x)`) |
| `WD` | WDIO E2E (`app/test/e2e/specs/*.spec.ts`) — Linux `tauri-driver` + macOS Appium Mac2 |
diff --git a/scripts/ci/README.md b/scripts/ci/README.md
new file mode 100644
index 0000000000..e9d505a325
--- /dev/null
+++ b/scripts/ci/README.md
@@ -0,0 +1,35 @@
+# `scripts/ci/`
+
+Merge-gate scripts run by `.github/workflows/ci-lite.yml` and `ci-full.yml`,
+plus the data files some of them read. Each script's header comment is the
+authoritative spec; this is an index so a CI failure log points somewhere.
+
+| File | Checks |
+| --- | --- |
+| `check-openhuman-rust-layout.mjs` (`pnpm rust:layout`) | Every file under `crates/openhuman-core/src` (except `api`, `bin`, `core`, `lib.rs`, `main.rs`, `rpc`) stays under a 750-line ceiling, with pinned legacy exceptions; forbids inline `#[cfg(test)] mod` blocks and `tests.rs`/`test.rs` filenames; and asserts every root `tests/*.rs` / `examples/*.rs` has a matching `[[test]]`/`[[example]]` entry in `crates/openhuman-core/Cargo.toml`. |
+| `check-feature-forwarding.mjs` | The Tauri shell (`crates/openhuman-app/Cargo.toml`, which sets `default-features = false`) forwards exactly the gates in `product-features.txt` — no more, no less. Logic lives in `scripts/lib/feature-forwarding.mjs` (openhuman#4919). |
+| `product-features.txt` / `product-features.sh` | Source of truth for the shipped desktop product's Cargo feature gates, distinct from `[features] default` (the contributor build). The `.sh` prints them comma-separated for `cargo --features "$(scripts/ci/product-features.sh)"`. |
+| `check-module-pins.mjs` + `module-pin-exemptions.json` | A loadable module's registry pin (`crates/openhuman-core/src/modules/registry.rs`) and its `vendor/*` submodule pin must describe the same release (openhuman#5727). The exemptions file records known, expected drift — not a way to silence the gate. Logic lives in `scripts/lib/module-pins.mjs`. |
+| `check-submodule-monotonic.mjs` | A `vendor/*` submodule pin may never move backwards onto a commit that is an ancestor of what the base branch already has. |
+| `check-toolchain-image.mjs` | The CI image's toolchain, the version-pinned `dtolnay/rust-toolchain@<version>` workflow steps, and `.github/Dockerfile` all match the channel pinned in `rust-toolchain.toml`. |
+| `rust-coverage-changed.sh` | PR fast-lane: runs `cargo-llvm-cov` scoped to only the domains/tests a PR touched instead of the full suite, and escalates to the full suite when scoping selects zero tests. |
+| `vitest-changed-coverage.sh` | Frontend counterpart — runs `vitest related` against changed files instead of the full unit suite. |
+| `assert-coverage-presence.sh` + `coverage-presence-allowlist.txt` | Fails when a changed Rust file produced no lcov records at all, meaning no lane even compiled it (openhuman#5593). Allowlist entries must document, inline, which gate excludes the file and why that's intended. |
+| `list-feature-gated-rust-tests.mjs` | Enumerates tests under `crates/openhuman-core/src` gated behind a Cargo feature, for cross-checking against what the coverage lanes actually exercise. |
+| `orch-ip-gate.sh` | Blocks the server-side orchestration "brain" (reasoning/wake graph, its prompts, per-agent model-selection metadata) from re-entering this open client repo. |
+
+`rust-coverage-changed.sh` and `vitest-changed-coverage.sh` both feed the PR
+CI Gate's changed-line diff-cover check (>= 80%) in `ci-lite.yml`.
+
+## Running locally
+
+Only `check-openhuman-rust-layout.mjs` is wired to a pnpm script
+(`pnpm rust:layout`); the rest are invoked directly, e.g.
+`node scripts/ci/check-feature-forwarding.mjs` or
+`bash scripts/ci/orch-ip-gate.sh`, and can be run the same way locally. All of
+them are invoked from `.github/workflows/ci-lite.yml` and, for the full
+suites, `ci-full.yml` — grep those workflows for a script's name to see its
+exact invocation and any required environment.
+
+Long-running CI commands (the coverage lanes) go through
+`scripts/ci-cancel-aware.sh`, which lives directly under `scripts/`, not here.