Skip to content

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

fix(ci): isolate module unit regressions

Steven Enamakel5edc3ea7b9d1
diff --git a/.github/workflows/test-reusable.yml b/.github/workflows/test-reusable.yml
index e647bd7c40..b3a325824b 100644
--- a/.github/workflows/test-reusable.yml
+++ b/.github/workflows/test-reusable.yml
@@ -230,6 +230,14 @@ jobs:
FEATURES="$(bash scripts/ci/product-features.sh)"
CORE_FEATURES="$(bash scripts/ci/product-features.sh --core)"
CLI_FEATURES="${FEATURES},bin-tools"
+ MODULE_TESTS=(
+ inference::tokenjuice::repl_module_tests::a_large_result_becomes_a_handle_the_repl_tools_can_query
+ inference::tokenjuice::tests::the_module_defers_a_summary_until_requested
+ inference::tokenjuice::tests::released_queries_keep_cached_originals_in_the_module_and_accept_artifact_content
+ tools::implementations::network::host::tests::tinyjuice_detects_and_converts_html
+ )
+ STAGED_MODULE_PATH="${OPENHUMAN_MODULE_PATH:-}"
+ STAGED_MODULE_SOURCE_DIR="${OPENHUMAN_MODULE_SOURCE_DIR:-}"
echo "[test-reusable] feature set: ${FEATURES} (cli: ${CLI_FEATURES})"
# `--features bin-tools` is load-bearing, not cosmetic: the
@@ -237,7 +245,31 @@ jobs:
# `required-features = ["http-server", "bin-tools"]`, so without it
# `--bins` silently skips it and this lane goes green having compiled
# none of it. Its tests would vanish too, with no error.
+ # The regular libtest process runs tests in parallel. Keep the
+ # process-global, never-unloaded TinyBus modules out of that shared
+ # test process, then run each module-backed regression in its own
+ # process below. Boot and parallel resolver tests can otherwise race
+ # while attaching the same released library to the one module host.
+ unset OPENHUMAN_MODULE_PATH OPENHUMAN_MODULE_SOURCE_DIR
bash scripts/ci-cancel-aware.sh cargo test -p openhuman --lib --features "${CORE_FEATURES}"
+ if [ -n "$STAGED_MODULE_PATH" ]; then
+ export OPENHUMAN_MODULE_PATH="$STAGED_MODULE_PATH"
+ fi
+ if [ -n "$STAGED_MODULE_SOURCE_DIR" ]; then
+ export OPENHUMAN_MODULE_SOURCE_DIR="$STAGED_MODULE_SOURCE_DIR"
+ fi
+ for module_test in "${MODULE_TESTS[@]}"; do
+ echo "[test-reusable] isolated module test: ${module_test}"
+ module_test_output="$(bash scripts/ci-cancel-aware.sh cargo test -p openhuman --lib --features "${CORE_FEATURES}" "${module_test}" -- --exact --test-threads=1)"
+ printf '%s\n' "$module_test_output"
+ case "$module_test_output" in
+ *"test result: ok. 1 passed; 0 failed;"*) ;;
+ *)
+ echo "::error::module test ${module_test} did not run exactly one passing test"
+ exit 1
+ ;;
+ esac
+ done
# The core binary and developer bins live in the CLI crate.
bash scripts/ci-cancel-aware.sh cargo test -p openhuman-cli --bins --features "${CLI_FEATURES}"
bash scripts/ci-cancel-aware.sh cargo test -p openhuman --doc --features "${CORE_FEATURES}"
diff --git a/scripts/__tests__/hosted-json-rpc-enumeration.test.mjs b/scripts/__tests__/hosted-json-rpc-enumeration.test.mjs
index 2e1a58d0ac..3e1c054423 100644
--- a/scripts/__tests__/hosted-json-rpc-enumeration.test.mjs
+++ b/scripts/__tests__/hosted-json-rpc-enumeration.test.mjs
@@ -28,6 +28,7 @@ function runCoreStep(mode) {
"scripts/ci",
"tests/raw_coverage",
"tests/in_process",
+ "modules",
])
mkdirSync(join(root, directory), { recursive: true });
writeFileSync(join(root, "tests/json_rpc_e2e.rs"), "fixture");
@@ -54,6 +55,22 @@ if [[ "$*" == *"test -p openhuman --lib"* ]]; then
echo "core tests need separate private XDG cache and data directories" >&2
exit 13
}
+ if [[ "$*" == *"inference::tokenjuice::"* || "$*" == *"tinyjuice_detects_and_converts_html"* ]]; then
+ [[ "\${OPENHUMAN_MODULE_PATH:-}" == "$MODULE_FIXTURE_PATH" ]] || {
+ echo "module-backed core tests need the staged module path" >&2
+ exit 15
+ }
+ echo "ISOLATED-MODULE-TEST:$*"
+ echo "test result: ok. 1 passed; 0 failed; 0 ignored"
+ elif [[ "$*" == *"--test-threads=1"* ]]; then
+ [[ "\${OPENHUMAN_MODULE_PATH:-}" == "$MODULE_FIXTURE_PATH" ]] || exit 15
+ else
+ [[ -z "\${OPENHUMAN_MODULE_PATH:-}" ]] || {
+ echo "parallel core unit tests must not load process-global modules" >&2
+ exit 14
+ }
+ echo CORE-TESTS-WITHOUT-MODULE-PATH
+ fi
echo PRIVATE-XDG-CACHE
fi
`,
@@ -66,6 +83,8 @@ fi
...process.env,
PATH: `${join(root, "bin")}:${process.env.PATH}`,
FIXTURE_MODE: mode,
+ MODULE_FIXTURE_PATH: join(root, "modules"),
+ OPENHUMAN_MODULE_PATH: join(root, "modules"),
},
});
} finally {
@@ -76,6 +95,9 @@ fi
test("hosted JSON-RPC tests are listed and executed with product features", () => {
const result = runCoreStep("normal");
assert.equal(result.status, 0, result.stdout + result.stderr);
+ assert.match(result.stdout, /CORE-TESTS-WITHOUT-MODULE-PATH/);
+ assert.match(result.stdout, /ISOLATED-MODULE-TEST/);
+ assert.equal((result.stdout.match(/ISOLATED-MODULE-TEST:/g) ?? []).length, 4, result.stdout);
assert.match(result.stdout, /PRIVATE-XDG-CACHE/);
assert.match(result.stdout, /EXECUTED-JSON-RPC/);
});