Skip to content

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

docs(tests): add cross-links and see-also sections to test READMEs

Steven Enamakel4f2567be17d5
diff --git a/tests/README.md b/tests/README.md
index bbed1592ce..2001012055 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -1,33 +1,33 @@
# `tests/`
Rust integration and JSON-RPC E2E tests for the `openhuman` package
-(`crates/openhuman-core`). This directory lives at the repo root — not inside
-the crate — but every file here compiles against and links `openhuman_core::`
+([`crates/openhuman-core`](../crates/openhuman-core/README.md)). This directory lives at the repo root, not inside
+the crate, but every file here compiles against and links `openhuman_core::`
(the crate's `[lib]` name).
## Layout
| Path | Purpose |
| --- | --- |
-| `*.rs` | Integration/E2E targets, one Cargo `[[test]]` per file. `json_rpc_e2e.rs` is the canonical home for JSON-RPC behavior (see `AGENTS.md`). |
-| `raw_coverage/*.rs` | Coverage suites (~30 files, mostly `*_raw_coverage_e2e.rs` plus some `*_e2e.rs`) compiled as modules of a single `raw_coverage_all` target instead of standalone binaries. `raw_coverage/w4_shared/mod.rs` is a shared harness three of them pull in with `#[path]`, not a suite. |
-| `raw_coverage_all.rs` | Aggregator: includes every top-level `raw_coverage/*.rs` file as a module. The module list is generated by root `build.rs` into `$OUT_DIR/raw_coverage_mods.rs`, so a new `raw_coverage/` file is picked up automatically with no manual registration. A file's own `#![cfg(...)]` gate still applies to just that module, and suites that mutate process-global env serialize on `SHARED_ENV_LOCK`, since they now share one process instead of one per file (see the file's own doc comment for the full rationale). |
-| `in_process/*.rs` | The in-process router and public-API suites (~20 files, formerly one `[[test]]` each) compiled as modules of a single `in_process_all` target, globbed by `build.rs` into `$OUT_DIR/in_process_mods.rs` exactly like `raw_coverage/`. No `required-features`. They share one process, so env mutation holds `env_guard::env_lock()`, the RPC bearer comes from `rpc_auth::rpc_token()` (never a per-file constant: `RPC_TOKEN` is first-writer-wins), and the backend transport is installed once through `tinyhumans_boot::boot()`. CI runs one process per module (`-- <module>::`). Run one with `cargo test -p openhuman-cli --test in_process_all <module>::`. |
-| `support/` | Helpers pulled into targets with `#[path]` (`env_guard.rs` for `EnvVarGuard` + `env_lock`, `rpc_auth.rs`, `tinyhumans_boot.rs`, `noop_memory.rs`, `memory_module.rs`, ...) because integration targets can't see `pub(crate)` items from the crate under test. |
-| `fixtures/` | Test data: `composio_*.json` tool fixtures, `memory/`, `memory_golden/` (generated — see its own README, regenerate with `scripts/regen-memory-golden-fixture.sh`), `polymarket/`. |
+| `*.rs` | Integration/E2E targets, one Cargo `[[test]]` per file. [`json_rpc_e2e.rs`](./json_rpc_e2e.rs) is the canonical home for JSON-RPC behavior (see [`AGENTS.md`](../AGENTS.md)). |
+| [`raw_coverage/*.rs`](./raw_coverage) | Coverage suites (~30 files, mostly `*_raw_coverage_e2e.rs` plus some `*_e2e.rs`) compiled as modules of a single `raw_coverage_all` target instead of standalone binaries. `raw_coverage/w4_shared/mod.rs` is a shared harness three of them pull in with `#[path]`, not a suite. |
+| [`raw_coverage_all.rs`](./raw_coverage_all.rs) | Aggregator: includes every top-level `raw_coverage/*.rs` file as a module. The module list is generated by root [`build.rs`](../build.rs) into `$OUT_DIR/raw_coverage_mods.rs`, so a new `raw_coverage/` file is picked up automatically with no manual registration. A file's own `#![cfg(...)]` gate still applies to just that module, and suites that mutate process-global env serialize on `SHARED_ENV_LOCK`, since they now share one process instead of one per file (see the file's own doc comment for the full rationale). |
+| [`in_process/*.rs`](./in_process) | The in-process router and public-API suites (~20 files, formerly one `[[test]]` each) compiled as modules of a single `in_process_all` target, globbed by `build.rs` into `$OUT_DIR/in_process_mods.rs` exactly like `raw_coverage/`. No `required-features`. They share one process, so env mutation holds `env_guard::env_lock()`, the RPC bearer comes from `rpc_auth::rpc_token()` (never a per-file constant: `RPC_TOKEN` is first-writer-wins), and the backend transport is installed once through `tinyhumans_boot::boot()`. CI runs one process per module (`-- <module>::`). Run one with `cargo test -p openhuman-cli --test in_process_all <module>::`. |
+| [`support/`](./support) | Helpers pulled into targets with `#[path]` ([`env_guard.rs`](./support/env_guard.rs) for `EnvVarGuard` + `env_lock`, [`rpc_auth.rs`](./support/rpc_auth.rs), [`tinyhumans_boot.rs`](./support/tinyhumans_boot.rs), `noop_memory.rs`, `memory_module.rs`, ...) because integration targets can't see `pub(crate)` items from the crate under test. |
+| [`fixtures/`](./fixtures) | Test data: `composio_*.json` tool fixtures, `memory/`, [`memory_golden/`](./fixtures/memory_golden/README.md) (generated, see its own README), `polymarket/`. |
There is no `Cargo.toml` here and this directory is not a Cargo workspace
-member — don't add one.
+member, don't add one.
## Registering a new target (read this before adding a file)
-These targets belong to **`crates/openhuman-cli`** — the crate that owns the
+These targets belong to **[`crates/openhuman-cli`](../crates/openhuman-cli/README.md)**: the crate that owns the
`openhuman-core` binary and depends on `openhuman-tinyhumans` for the backend
transport the core library does not carry. Its manifest sets
`autotests = false` and `autoexamples = false`, because Cargo's autodiscovery
only scans beside the manifest and the tests live at the repo root instead.
That means `cargo test` silently runs **nothing** for a new `tests/<name>.rs`
-until it is declared in `crates/openhuman-cli/Cargo.toml`:
+until it is declared in [`crates/openhuman-cli/Cargo.toml`](../crates/openhuman-cli/Cargo.toml):
```toml
[[test]]
@@ -41,8 +41,8 @@ The same applies to `examples/*.rs` via `[[example]]`. Some targets carry
`raw_coverage_all` needs `voice` and `inference`); all of those are off in the
default contributor build, and a bare `cargo test` skips such targets silently
(root `build.rs` emits a `cargo::warning` naming them).
-`scripts/ci/list-feature-gated-rust-tests.mjs` enumerates them. Files under
-`tests/raw_coverage/` need no `[[test]]` entry — they ride in through
+[`scripts/ci/list-feature-gated-rust-tests.mjs`](../scripts/ci/list-feature-gated-rust-tests.mjs) enumerates them. Files under
+`tests/raw_coverage/` need no `[[test]]` entry, they ride in through
`raw_coverage_all`.
Run a target as `cargo test -p openhuman-cli --test <name>` (a bare
@@ -50,12 +50,12 @@ Run a target as `cargo test -p openhuman-cli --test <name>` (a bare
name is unique across members).
A suite that boots the core **in-process** and reaches the mock backend must
-call `tinyhumans_boot::boot()` (`tests/support/tinyhumans_boot.rs`) before
+call `tinyhumans_boot::boot()` ([`tests/support/tinyhumans_boot.rs`](./support/tinyhumans_boot.rs)) before
its first backend-touching call; the core answers `BACKEND_UNAVAILABLE:`
otherwise. Suites that spawn the binary (`CARGO_BIN_EXE_openhuman-core`) get
the transport from `main.rs`.
-`pnpm rust:layout` (`scripts/ci/check-openhuman-rust-layout.mjs`, run in CI
+`pnpm rust:layout` ([`scripts/ci/check-openhuman-rust-layout.mjs`](../scripts/ci/check-openhuman-rust-layout.mjs), run in CI
Lite) fails the build on:
- a `tests/*.rs` file with no matching `[[test]]` entry
@@ -66,29 +66,31 @@ Lite) fails the build on:
## Running
-- `pnpm test:rust` → `scripts/test-rust-with-mock.sh`: starts
- `scripts/mock-api-server.mjs` on `MOCK_API_PORT` (default `18505`), waits
+- `pnpm test:rust` → [`scripts/test-rust-with-mock.sh`](../scripts/test-rust-with-mock.sh): starts
+ [`scripts/mock-api-server.mjs`](../scripts/mock-api-server.mjs) on `MOCK_API_PORT` (default `18505`), waits
for `/__admin/health`, then runs `cargo test` with the product features plus
`bin-tools`. Pass `--test <name>` to scope to one target.
-- `pnpm test:rust:e2e` → `scripts/test-rust-e2e.sh`: runs the `ALL_E2E_SUITES`
+- `pnpm test:rust:e2e` → [`scripts/test-rust-e2e.sh`](../scripts/test-rust-e2e.sh): runs the `ALL_E2E_SUITES`
list serially against the same mock backend. `--suite <name>` runs one
suite; append `-- --ignored` for ignored tests.
-- `scripts/test-rust-inference-e2e.sh` → `tests/inference_provider_e2e.rs`,
+- [`scripts/test-rust-inference-e2e.sh`](../scripts/test-rust-inference-e2e.sh) → [`tests/inference_provider_e2e.rs`](./inference_provider_e2e.rs),
against wiremock upstreams (no live LLM).
- `pnpm debug rust [filter]` → summary-sized output, full logs under
- `target/debug-logs/` (see `scripts/debug/README.md`).
+ `target/debug-logs/` (see [`scripts/debug/README.md`](../scripts/debug/README.md)).
-Per `AGENTS.md`: never call real backend or third-party services from these
-tests; mock through `scripts/mock-api-core.mjs` routes; avoid time-based
+Per [`AGENTS.md`](../AGENTS.md): never call real backend or third-party services from these
+tests; mock through [`scripts/mock-api-core.mjs`](../scripts/mock-api-core.mjs) routes; avoid time-based
flakes.
## Related
- Domain unit tests live beside their modules as `*_tests.rs` under
- `crates/openhuman-core/src/<domain>/`, not here.
-- Coverage bookkeeping: `docs/TEST-COVERAGE-MATRIX.md`. PR changed-line
- coverage must be at least 80% (`scripts/ci/rust-coverage.sh`,
- `scripts/ci/assert-coverage-presence.sh`).
-- Frontend E2E lives in `app/test/e2e/`, using
- `app/test/e2e/helpers/element-helpers.ts` rather than raw platform element
+ `crates/openhuman-core/src/<domain>/` (see [`crates/README.md`](../crates/README.md)), not here.
+- Coverage bookkeeping: [`docs/TEST-COVERAGE-MATRIX.md`](../docs/TEST-COVERAGE-MATRIX.md). PR changed-line
+ coverage must be at least 80% ([`scripts/ci/rust-coverage.sh`](../scripts/ci/rust-coverage.sh),
+ [`scripts/ci/assert-coverage-presence.sh`](../scripts/ci/assert-coverage-presence.sh)).
+- Frontend E2E lives in [`app/test/e2e/`](../app/test/e2e), using
+ [`app/test/e2e/helpers/element-helpers.ts`](../app/test/e2e/helpers/element-helpers.ts) rather than raw platform element
types.
+- [Testing strategy](../gitbooks/developing/testing-strategy.md) and [E2E testing](../gitbooks/developing/e2e-testing.md) for which layer a change belongs in.
+- [`scripts/README.md`](../scripts/README.md) for the runners, and [`CONTRIBUTING.md`](../CONTRIBUTING.md).
diff --git a/tests/fixtures/memory_golden/README.md b/tests/fixtures/memory_golden/README.md
index 46200a1714..5b4e79da63 100644
--- a/tests/fixtures/memory_golden/README.md
+++ b/tests/fixtures/memory_golden/README.md
@@ -1,6 +1,6 @@
# Golden memory-workspace fixture
-**Generated — do not hand-edit.** Regenerate with
+**Generated, do not hand-edit.** Regenerate with
`scripts/regen-memory-golden-fixture.sh`.
| | |
@@ -12,7 +12,7 @@
## Contents
-`workspace/**.db` is a real memory workspace seeded through production write
+[`workspace/**.db`](./workspace) is a real memory workspace seeded through production write
paths and then `VACUUM`ed with `PRAGMA wal_checkpoint(TRUNCATE)`, so each
file is self-contained (no `-wal` / `-shm` siblings). It holds:
@@ -27,11 +27,11 @@ file is self-contained (no `-wal` / `-shm` siblings). It holds:
- a tinycortex leaf chunk with an embedding, and a summary tree sealed to an
L1 summary node with its own embedding
-`manifest.txt` is **derived from those DB files**, never written by hand.
+[`manifest.txt`](./manifest.txt) is **derived from those DB files**, never written by hand.
## Why this is committed as a binary
-`.gitattributes` marks `tests/fixtures/memory_golden/**/*.db binary`. Without
+[`.gitattributes`](../../../.gitattributes) marks `tests/fixtures/memory_golden/**/*.db binary`. Without
it the repo-wide `* text=auto eol=lf` rule would rewrite byte sequences inside
the blobs on checkout and corrupt them.
@@ -40,3 +40,9 @@ the blobs on checkout and corrupt them.
A diff that touches this directory is a **schema-migration review**, not a
test-data refresh. Ask for the migration that carries existing user workspaces
across, and check that the manifest diff matches the DDL diff.
+
+## See also
+
+- [`tests/README.md`](../../README.md), the layout of the Rust test targets.
+- [`memory` domain README](../../../crates/openhuman-core/src/memory/README.md) and [Memory architecture](../../../gitbooks/developing/architecture/memory.md).
+- [`vendor/tinymemory/`](../../../vendor/tinymemory), which owns the engine contracts and migrations.