The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(ci): run module-gated Rust tests in CI
lorenzozaneef20d863c69ac
diff --git a/.github/ci-paths-filter.yml b/.github/ci-paths-filter.ymlindex 3ed696098d..7805fac8bf 100644--- a/.github/ci-paths-filter.yml+++ b/.github/ci-paths-filter.yml@@ -73,6 +73,8 @@ rust-core:- 'scripts/ci/check-ignored-tests.mjs'- 'scripts/ci/ignored-test-baseline.json'- 'scripts/ci/list-feature-gated-rust-tests.mjs'+ - 'scripts/ci/list-module-gated-tests.mjs'+ - 'scripts/ci/run-module-gated-tests.sh'- 'Cargo.toml'- 'crates/openhuman-core/**'- 'crates/openhuman-embed/**'@@ -146,6 +148,8 @@ scripts:# pin its clauses, or the counter's anchoring and its# cfg_attr guard can be loosened with nothing watching.- 'scripts/ci/check-ignored-tests.mjs'+ - 'scripts/ci/list-module-gated-tests.mjs'+ - 'scripts/ci/run-module-gated-tests.sh'# The web E2E build/session contract has script-level regression# tests; run them when either participant or Vite changes.- 'app/scripts/e2e-web-build.sh'diff --git a/.github/workflows/ci-lite.yml b/.github/workflows/ci-lite.ymlindex 46be12daca..7bae3743b3 100644--- a/.github/workflows/ci-lite.yml+++ b/.github/workflows/ci-lite.yml@@ -697,11 +697,8 @@ jobs:echo "TINYCONNECTORS_TEST_MODULE=$connectors_dir/libtinyconnectors.so" \>> "$GITHUB_ENV"- - name: Run TinyJuice host-module regression- run: |- cargo test --lib --features modules \- openhuman::agent::tinyagents::middleware::tests::tool_output_tabulates_a_large_graph_for_a_non_exempt_tool \- -- --ignored --exact+ - name: Run module-gated Rust tests+ run: bash scripts/ci/run-module-gated-tests.shenv:CARGO_BUILD_JOBS: "1"diff --git a/scripts/__tests__/module-test-runner.test.mjs b/scripts/__tests__/module-test-runner.test.mjsnew file mode 100644index 0000000000..5e589272fd--- /dev/null+++ b/scripts/__tests__/module-test-runner.test.mjs@@ -0,0 +1,60 @@+import assert from "node:assert/strict";+import { spawnSync } from "node:child_process";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";+import test from "node:test";+import { fileURLToPath } from "node:url";++const repoRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "..");+const runner = path.join(repoRoot, "scripts", "ci", "run-module-gated-tests.sh");++test("runs only the source-marked module tests in isolated processes", () => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "openhuman-module-tests-"));+ const bin = path.join(root, "bin");+ const log = path.join(root, "cargo.log");+ fs.mkdirSync(bin);+ fs.writeFileSync(+ path.join(bin, "node"),+ `#!/usr/bin/env bash+if [[ "$*" == *"--skipped"* ]]; then exit 0; fi+printf '%s\n' one two+`,+ { mode: 0o755 },+ );+ fs.writeFileSync(+ path.join(bin, "cargo"),+ `#!/usr/bin/env bash+printf '%s\n' "$*" >> "${log}"+if [[ "$*" == *"--list"* ]]; then+ printf '%s\n' 'openhuman::memory::tests::one: test' 'openhuman::memory::tests::two: test'+fi+`,+ { mode: 0o755 },+ );++ const result = spawnSync(runner, { cwd: repoRoot, env: { ...process.env, PATH: `${bin}:${process.env.PATH}` }, encoding: "utf8" });+ const calls = fs.readFileSync(log, "utf8");+ fs.rmSync(root, { recursive: true, force: true });++ assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);+ assert.match(result.stdout, /scheduled: 2/);+ assert.match(result.stdout, /skipped: 0/);+ assert.match(calls, /--ignored --list/);+ assert.match(calls, /openhuman::memory::tests::one -- --ignored --exact --test-threads=1/);+ assert.match(calls, /openhuman::memory::tests::two -- --ignored --exact --test-threads=1/);+});++test("rejects a vacuous ignored-test inventory", () => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "openhuman-module-tests-empty-"));+ const bin = path.join(root, "bin");+ fs.mkdirSync(bin);+ fs.writeFileSync(path.join(bin, "node"), "#!/usr/bin/env bash\nexit 0\n", { mode: 0o755 });+ fs.writeFileSync(path.join(bin, "cargo"), "#!/usr/bin/env bash\nexit 0\n", { mode: 0o755 });++ const result = spawnSync(runner, { cwd: repoRoot, env: { ...process.env, PATH: `${bin}:${process.env.PATH}` }, encoding: "utf8" });+ fs.rmSync(root, { recursive: true, force: true });++ assert.equal(result.status, 1);+ assert.match(result.stderr, /inventory is empty/);+});diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjsindex 8fb6ab726a..d9f52506af 100644--- a/scripts/__tests__/self-hosted-lanes.test.mjs+++ b/scripts/__tests__/self-hosted-lanes.test.mjs@@ -97,7 +97,7 @@ test("ex63 runs the core's unit tests under nextest; hosted keeps cargo's runner);});-test("doctests, tui coverage and the TinyJuice regression are left to pushes to main", () => {+test("doctests, tui coverage and module-gated tests are left to pushes to main", () => {for (const plan of plans()) {const cov = plan.lanes.find((l) => l.name === "rust-cov")@@ -116,10 +116,7 @@ test("doctests, tui coverage and the TinyJuice regression are left to pushes to"utf8",);assert.match(lite, /on:\s*\n\s*push:\s*\n\s*branches: \[main\]/);- assert.match(- lite,- /tool_output_tabulates_a_large_graph_for_a_non_exempt_tool/,- );+ assert.match(lite, /run: bash scripts\/ci\/run-module-gated-tests\.sh/);assert.match(lite, /run: bash scripts\/ci\/rust-coverage\.sh/);for (const cmd of ["cargo test -p openhuman-embed",diff --git a/scripts/ci/list-module-gated-tests.mjs b/scripts/ci/list-module-gated-tests.mjsnew file mode 100755index 0000000000..1990748292--- /dev/null+++ b/scripts/ci/list-module-gated-tests.mjs@@ -0,0 +1,42 @@+#!/usr/bin/env node+import fs from "node:fs";+import path from "node:path";++const root = process.cwd();+const sourceRoot = path.join(root, "crates", "openhuman-core", "src");+const run = [];+const skipped = [];++function visit(dir) {+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {+ const file = path.join(dir, entry.name);+ if (entry.isDirectory()) visit(file);+ else if (entry.name.endsWith(".rs")) scan(file);+ }+}++function scan(file) {+ const lines = fs.readFileSync(file, "utf8").split("\n");+ let pending = null;+ for (const line of lines) {+ if (line.includes('#[ignore = "needs a built tinymemory module')) pending = "run";+ else if (line.includes('#[ignore = "needs a built tinydocs')) pending = "tinydocs";++ const match = line.match(/^\s*(?:async\s+)?fn\s+([A-Za-z0-9_]+)/);+ if (!pending || !match) continue;+ (pending === "run" ? run : skipped).push(match[1]);+ pending = null;+ }+}++visit(sourceRoot);+const result = { run: run.sort(), skipped: skipped.sort() };++if (process.argv.includes("--json")) console.log(JSON.stringify(result));+else if (process.argv.includes("--skipped")) console.log(result.skipped.join("\n"));+else console.log(result.run.join("\n"));++if (result.run.length === 0) {+ console.error("module-gated test source inventory is empty");+ process.exit(1);+}diff --git a/scripts/ci/run-module-gated-tests.sh b/scripts/ci/run-module-gated-tests.shnew file mode 100755index 0000000000..291ae294e4--- /dev/null+++ b/scripts/ci/run-module-gated-tests.sh@@ -0,0 +1,39 @@+#!/usr/bin/env bash+# Run the ignored Rust tests whose source contract requires TinyMemory.+set -euo pipefail++ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+cd "$ROOT"++FEATURES="${MODULE_TEST_FEATURES:-modules}"+LIST_OUTPUT="$(mktemp)"+trap 'rm -f "$LIST_OUTPUT"' EXIT++mapfile -t TEST_NAMES < <(node scripts/ci/list-module-gated-tests.mjs)+mapfile -t SKIPPED_NAMES < <(node scripts/ci/list-module-gated-tests.mjs --skipped)+if [ "${#TEST_NAMES[@]}" -eq 0 ]; then+ echo "::error::module-gated test inventory is empty; refusing a vacuous pass" >&2+ exit 1+fi++bash scripts/ci-cancel-aware.sh cargo test -p openhuman --lib --features "$FEATURES" -- --ignored --list >"$LIST_OUTPUT"++run_count=0+for name in "${TEST_NAMES[@]}"; do+ matches="$(sed -n 's/: test$//p' "$LIST_OUTPUT" | grep -F "::${name}" || true)"+ match_count="$(printf '%s\n' "$matches" | sed '/^$/d' | wc -l | tr -d ' ')"+ if [ "$match_count" -eq 0 ]; then+ echo "::error::module-gated test '$name' resolved to $match_count tests" >&2+ exit 1+ fi+ while IFS= read -r test_path; do+ [ -n "$test_path" ] || continue+ echo "running module-gated test: $test_path"+ bash scripts/ci-cancel-aware.sh cargo test -p openhuman --lib --features "$FEATURES" "$test_path" -- \+ --ignored --exact --test-threads=1+ run_count=$((run_count + 1))+ done <<< "$matches"+done++echo "module-gated Rust tests scheduled: $run_count"+echo "module-gated Rust tests skipped: ${#SKIPPED_NAMES[@]} (tinydocs artifact is not staged in this lane)"