Skip to content

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

test: restore isolated native document regressions with pinned fixtures

Steven Enamakelbde755455dbc
diff --git a/.github/workflows/test-reusable.yml b/.github/workflows/test-reusable.yml
index ab899bfeeb..5ccc7809c0 100644
--- a/.github/workflows/test-reusable.yml
+++ b/.github/workflows/test-reusable.yml
@@ -162,34 +162,13 @@ jobs:
workspaces: . -> target
cache-on-failure: true
key: core
- - name: Build native test modules
+ - name: Install checksum-pinned native test modules
run: |
- # Connector and other module tests exercise host/module seams. Supplying
- # local native fixtures keeps them independent of GitHub's release
- # metadata API and mirrors the Rust E2E and desktop-E2E jobs.
- # tinybus validates every directory ancestor, so a container-root
- # owned directory outside the runner-owned checkout is required.
+ # Module-loaded unit regressions execute in isolated test processes.
module_root="/opt/openhuman-test-modules/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
- juice_dir="$module_root/tinyjuice"
- connectors_dir="$module_root/tinyconnectors"
- search_dir="$module_root/tinysearch"
- rm -rf "$module_root"
- mkdir -p "$juice_dir" "$connectors_dir" "$search_dir"
- bash scripts/ci-cancel-aware.sh cargo build --release \
- --manifest-path vendor/tinyjuice/crates/tinyjuice-module/Cargo.toml
- cp vendor/tinyjuice/target/release/libtinyjuice_module.so \
- "$juice_dir/libtinyjuice_module.so"
- bash scripts/ci-cancel-aware.sh cargo build --release \
- --manifest-path vendor/tinyconnectors/crates/tinyconnectors/Cargo.toml
- cp vendor/tinyconnectors/target/release/libtinyconnectors.so \
- "$connectors_dir/libtinyconnectors.so"
- bash scripts/ci-cancel-aware.sh cargo build --release \
- --manifest-path vendor/tinysearch/crates/tinysearch/Cargo.toml
- cp vendor/tinysearch/target/release/libtinysearch.so \
- "$search_dir/libtinysearch.so"
- echo "TINYJUICE_TEST_MODULE=$juice_dir/libtinyjuice_module.so" >> "$GITHUB_ENV"
- echo "TINYCONNECTORS_TEST_MODULE=$connectors_dir/libtinyconnectors.so" >> "$GITHUB_ENV"
- echo "TINYSEARCH_TEST_MODULE=$search_dir/libtinysearch.so" >> "$GITHUB_ENV"
+ bash scripts/ci/self-hosted/install-test-modules.sh \
+ "$module_root" "$module_root/modules.env"
+ cat "$module_root/modules.env" >> "$GITHUB_ENV"
- name: Test core crate (openhuman)
# This script uses Bash-only process substitution below. Reusable
# workflows do not inherit the caller's `defaults.run.shell`, and
diff --git a/crates/openhuman-core/src/agent/artifacts/ops_tests.rs b/crates/openhuman-core/src/agent/artifacts/ops_tests.rs
index c6bf751c93..40a534a128 100644
--- a/crates/openhuman-core/src/agent/artifacts/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/artifacts/ops_tests.rs
@@ -266,8 +266,13 @@ async fn regenerate_errors_when_args_missing() {
#[cfg(feature = "documents")]
#[tokio::test]
-#[ignore = "needs a built tinydocs module and its own process; presentation module E2E covers generation"]
async fn regenerate_reruns_producer_and_reuses_id() {
+ if crate::util::module_test_process::run(
+ module_path!(),
+ "regenerate_reruns_producer_and_reuses_id",
+ ) {
+ return;
+ }
use crate::agent::artifacts::store::{create_artifact, get_artifact, save_artifact_args};
use crate::agent::artifacts::types::{ArtifactKind, ArtifactStatus};
let tmp = TempDir::new().unwrap();
diff --git a/crates/openhuman-core/src/memory/convert_tests.rs b/crates/openhuman-core/src/memory/convert_tests.rs
index 6c793a7684..120aad5cff 100644
--- a/crates/openhuman-core/src/memory/convert_tests.rs
+++ b/crates/openhuman-core/src/memory/convert_tests.rs
@@ -153,8 +153,10 @@ fn local_module_config() -> Config {
#[cfg(feature = "documents")]
#[tokio::test]
-#[ignore = "needs a built TinyDocs module and its own process; set OPENHUMAN_MODULE_PATH"]
async fn a_pdf_converts_to_its_text() {
+ if crate::util::module_test_process::run(module_path!(), "a_pdf_converts_to_its_text") {
+ return;
+ }
let raw = RawDocument::new(pdf_saying("The vendor code is PV-7023")).with_filename("brief.pdf");
let converted = converter(&local_module_config())
.convert(&raw)
@@ -171,8 +173,13 @@ async fn a_pdf_converts_to_its_text() {
#[cfg(feature = "documents")]
#[tokio::test]
-#[ignore = "needs the released TinyDocs module in OPENHUMAN_MODULE_PATH and its own process"]
async fn the_released_module_extracts_all_memory_office_formats() {
+ if crate::util::module_test_process::run(
+ module_path!(),
+ "the_released_module_extracts_all_memory_office_formats",
+ ) {
+ return;
+ }
let config = local_module_config();
let cases = [
(
@@ -279,8 +286,10 @@ async fn an_unknown_binary_is_still_refused_with_a_clear_error() {
#[cfg(feature = "documents")]
#[tokio::test]
-#[ignore = "needs a built TinyDocs module and its own process; set OPENHUMAN_MODULE_PATH"]
async fn brain_ingest_files_a_pdf_by_path() {
+ if crate::util::module_test_process::run(module_path!(), "brain_ingest_files_a_pdf_by_path") {
+ return;
+ }
let tmp = tempfile::tempdir().unwrap();
let config = config_in(&tmp);
let mut config = config;
diff --git a/crates/openhuman-core/src/tools/impl/document/document_tests.rs b/crates/openhuman-core/src/tools/impl/document/document_tests.rs
index db52a327b3..545b1189ad 100644
--- a/crates/openhuman-core/src/tools/impl/document/document_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/document/document_tests.rs
@@ -164,9 +164,13 @@ async fn execute_rejects_unknown_field() {
}
#[tokio::test]
-#[ignore = "needs a built tinydocs module (OPENHUMAN_MODULE_PATH) and its own process: \
-the module bus belongs to the runtime that creates it, so run this test alone"]
async fn execute_happy_path_returns_artifact_metadata() {
+ if crate::util::module_test_process::run(
+ module_path!(),
+ "execute_happy_path_returns_artifact_metadata",
+ ) {
+ return;
+ }
// End-to-end: drives the real docx-rs engine + artifact pipeline.
// Asserts the success contract — the artifact is finalised on disk and
// the markdown reply quotes the path + id.
diff --git a/crates/openhuman-core/src/tools/impl/presentation/presentation_tests.rs b/crates/openhuman-core/src/tools/impl/presentation/presentation_tests.rs
index 63b4c27450..d55fde1991 100644
--- a/crates/openhuman-core/src/tools/impl/presentation/presentation_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/presentation/presentation_tests.rs
@@ -158,15 +158,22 @@ async fn execute_rejects_too_many_slides() {
}
#[tokio::test]
-#[ignore = "needs a built tinydocs module (OPENHUMAN_MODULE_PATH) and its own process: \
-the module bus belongs to the runtime that creates it, so run this test alone"]
async fn execute_happy_path_returns_artifact_metadata() {
+ if crate::util::module_test_process::run(
+ module_path!(),
+ "execute_happy_path_returns_artifact_metadata",
+ ) {
+ return;
+ }
// End-to-end: drives the real ppt-rs engine and the artifact
// pipeline. Asserts the tool's success contract — `slide_count`
// excludes the synthetic title slide, the artifact is finalised
// on disk, and the markdown reply quotes the path + size.
let ws = workspace();
- let tool = make_tool(ws.path());
+ let mut config = crate::config::Config::default();
+ config.workspace_dir = ws.path().to_path_buf();
+ config.modules.allow_download = false;
+ let tool = make_tool_with_config(ws.path(), config);
let result = tool
.execute(minimal_input_json())
.await
@@ -240,9 +247,11 @@ fn pptx_entry_names(artifact_path: &str) -> Vec<String> {
}
#[tokio::test]
-#[ignore = "needs a built tinydocs module (OPENHUMAN_MODULE_PATH) and its own process: \
-the module bus belongs to the runtime that creates it, so run this test alone"]
async fn execute_embeds_file_image_into_deck() {
+ if crate::util::module_test_process::run(module_path!(), "execute_embeds_file_image_into_deck")
+ {
+ return;
+ }
let ws = workspace();
let img_path = ws.path().join("chart.png");
std::fs::write(&img_path, png_1x1()).expect("write png");
diff --git a/crates/openhuman-core/src/util/mod.rs b/crates/openhuman-core/src/util/mod.rs
index 9cf362c0da..fe41b3d8c4 100644
--- a/crates/openhuman-core/src/util/mod.rs
+++ b/crates/openhuman-core/src/util/mod.rs
@@ -40,3 +40,6 @@ pub use text::{
truncate_with_suffix, utf8_safe_prefix_at_byte_boundary,
};
pub use types::MaybeSet;
+
+#[cfg(test)]
+pub(crate) mod module_test_process;
diff --git a/crates/openhuman-core/src/util/module_test_process.rs b/crates/openhuman-core/src/util/module_test_process.rs
new file mode 100644
index 0000000000..3063313abc
--- /dev/null
+++ b/crates/openhuman-core/src/util/module_test_process.rs
@@ -0,0 +1,49 @@
+//! Process isolation for tests that load a native module onto a runtime-owned bus.
+use std::process::{Command, Stdio};
+use std::time::{Duration, Instant};
+
+/// Run the calling test once in a fresh process; return true in its parent.
+///
+/// The selected test must exist, and its real assertions must finish successfully.
+/// Child processes inherit the checksum-pinned module fixtures from the test runner.
+pub(crate) fn run(module: &str, name: &str) -> bool {
+ let module = module.split_once("::").expect("test has a crate prefix").1;
+ let name = format!("{module}::{name}");
+ if std::env::var("OPENHUMAN_NATIVE_TEST_CHILD").as_deref() == Ok(name.as_str()) {
+ return false;
+ }
+ let executable = std::env::current_exe().expect("test executable");
+ let listing = Command::new(&executable)
+ .args(["--exact", &name, "--list"])
+ .output()
+ .expect("list the isolated test");
+ assert!(listing.status.success(), "could not list {name}");
+ assert!(
+ String::from_utf8_lossy(&listing.stdout)
+ .lines()
+ .any(|line| line == format!("{name}: test")),
+ "isolated test {name} must exist; refusing a zero-test pass"
+ );
+ let mut child = Command::new(executable)
+ .args(["--exact", &name, "--nocapture"])
+ .env("OPENHUMAN_NATIVE_TEST_CHILD", &name)
+ .stdin(Stdio::null())
+ .spawn()
+ .expect("start the isolated native-module test");
+ let deadline = Instant::now() + Duration::from_secs(120);
+ loop {
+ if let Some(status) = child.try_wait().expect("wait for native-module test") {
+ assert!(
+ status.success(),
+ "isolated native-module test {name} failed: {status}"
+ );
+ return true;
+ }
+ if Instant::now() >= deadline {
+ let _ = child.kill();
+ let _ = child.wait();
+ panic!("isolated native-module test {name} exceeded its deadline");
+ }
+ std::thread::sleep(Duration::from_millis(20));
+ }
+}
diff --git a/scripts/__tests__/test-module-installation.test.mjs b/scripts/__tests__/test-module-installation.test.mjs
index daf1f91884..3062ae0970 100644
--- a/scripts/__tests__/test-module-installation.test.mjs
+++ b/scripts/__tests__/test-module-installation.test.mjs
@@ -11,6 +11,24 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import test from "node:test";
import { fileURLToPath } from "node:url";
+import {
+ readRegistrySource,
+ resolveTestModuleAssets,
+} from "../ci/self-hosted/test-module-assets.mjs";
+
+test("native document regressions receive a checksum-pinned module fixture", () => {
+ const assets = resolveTestModuleAssets(
+ readRegistrySource(),
+ "ubuntu-22.04-x86_64",
+ );
+ const documents = assets.find((asset) => asset.id === "tinydocs");
+ assert.ok(
+ documents,
+ "the full Rust suite must include its native document fixture",
+ );
+ assert.match(documents.url, /\/releases\/download\/v\d+\.\d+\.\d+\//);
+ assert.match(documents.sha256, /^[a-f0-9]{64}$/);
+});
const installer = fileURLToPath(
new URL("../ci/self-hosted/install-test-modules.sh", import.meta.url),
diff --git a/scripts/ci/self-hosted/install-test-modules.sh b/scripts/ci/self-hosted/install-test-modules.sh
index 96c5a5af69..ecea194273 100755
--- a/scripts/ci/self-hosted/install-test-modules.sh
+++ b/scripts/ci/self-hosted/install-test-modules.sh
@@ -83,6 +83,7 @@ cp "${conn_cached}" "${dest}/tinyconnectors/libtinyconnectors.so"
{
echo "TINYJUICE_TEST_MODULE=${dest}/tinyjuice/libtinyjuice_module.so"
echo "TINYSEARCH_TEST_MODULE=${dest}/tinysearch/libtinysearch.so"
+ echo "OPENHUMAN_MODULE_PATH=${dest}/tinydocs${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}"
echo "TINYCONNECTORS_TEST_MODULE=${dest}/tinyconnectors/libtinyconnectors.so"
} > "${env_file}"
log "wrote ${env_file}"
diff --git a/scripts/ci/self-hosted/test-module-assets.mjs b/scripts/ci/self-hosted/test-module-assets.mjs
index 7741faabda..c886839ea7 100644
--- a/scripts/ci/self-hosted/test-module-assets.mjs
+++ b/scripts/ci/self-hosted/test-module-assets.mjs
@@ -2,7 +2,7 @@
// Resolve the native test-module release assets the Rust coverage lane needs,
// straight from the compiled module registry (the authoritative pin).
//
-// Usage: node scripts/ci/self-hosted/test-module-assets.mjs [host_key]
+// Usage: node scripts/ci/self-hosted/test-module-assets.mjs [host_key] [id,...]
// Prints one line per module: `<id>\t<url>\t<archive>\t<sha256>`.
//
// Reading the registry instead of copying version + digest into a workflow
@@ -17,7 +17,7 @@ const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
const REGISTRY_DIR = join(ROOT, "crates/openhuman-core/src/modules");
/** Test modules the core suite loads, by registry record id. */
-export const TEST_MODULE_IDS = ["tinyjuice", "tinysearch"];
+export const TEST_MODULE_IDS = ["tinyjuice", "tinysearch", "tinydocs"];
/** Concatenate registry.rs and its `registry/records_*.rs` fragments. */
export function readRegistrySource(dir = REGISTRY_DIR) {
@@ -62,7 +62,11 @@ export function resolveTestModuleAssets(src, hostKey, ids = TEST_MODULE_IDS) {
if (process.argv[1] === fileURLToPath(import.meta.url)) {
const hostKey = process.argv[2] ?? "ubuntu-22.04-x86_64";
- for (const a of resolveTestModuleAssets(readRegistrySource(), hostKey)) {
+ for (const a of resolveTestModuleAssets(
+ readRegistrySource(),
+ hostKey,
+ process.argv[3]?.split(","),
+ )) {
console.log([a.id, a.url, a.archive, a.sha256].join("\t"));
}
}
diff --git a/scripts/test-rust-with-mock.sh b/scripts/test-rust-with-mock.sh
index d736681005..a218419a42 100755
--- a/scripts/test-rust-with-mock.sh
+++ b/scripts/test-rust-with-mock.sh
@@ -82,31 +82,25 @@ case "$(uname -s):$(uname -m)" in
module_ext=dylib
if [ "$(sw_vers -productVersion | cut -d. -f1)" -ge 26 ]; then
wallet_platform=macos-26-arm64
- wallet_sha256=6409e1bfcd542f4fba5d867bd6b06b094a24d8e9bd994aae46894dcd979d3291
else
wallet_platform=macos-15-arm64
- wallet_sha256=06d66492a7ba9b3793810ff9e644231deacf6fbdf9e32008fcef866f8228cbd2
fi
;;
Darwin:x86_64)
module_ext=dylib
if [ "$(sw_vers -productVersion | cut -d. -f1)" -ge 26 ]; then
wallet_platform=macos-26-x86_64
- wallet_sha256=3ad698d3f6ee549ee4c724717e78a2b16b5504ea4bea89af3ccf06cf3e7c88dc
else
wallet_platform=macos-15-x86_64
- wallet_sha256=db4e6b2dae244059ef9bf3401faadb6d58bd6f70bb6279135944a41bb5e3b4f5
fi
;;
Linux:x86_64)
module_ext=so
wallet_platform=ubuntu-22.04-x86_64
- wallet_sha256=4410a0d88d49f3553c01ef6f0ced3a2997388d698d57d08bc129b82807e57016
;;
Linux:aarch64|Linux:arm64)
module_ext=so
wallet_platform=ubuntu-22.04-arm64
- wallet_sha256=90e391b78ebb25650d7d9cff6440869e045298d1b4976e7d61b6b20b9ca8a3d4
;;
*)
echo "Unsupported native-module test host: $(uname -s) $(uname -m)" >&2
@@ -139,28 +133,42 @@ fi
# Wallet JSON-RPC E2E sends a recovery phrase only to an attested module. Build
# artifacts are deliberately not treated as release-pinned recipients, so use
# the checksum-pinned release archive and its accompanying `modules.toml`.
-# Keyed by version: the presence check below would otherwise keep serving a
+# Keyed by digest: the presence check below would otherwise keep serving a
# library from an earlier release after the pin moves, and the wallet only
# attests the pinned release's library.
-wallet_version="0.5.3"
-wallet_dir="$REPO_ROOT/target/test-modules/tinywallet/$wallet_version"
-wallet_archive="$wallet_dir/tinywallet-module-$wallet_version-$wallet_platform.tar.gz"
+wallet_asset="$(node scripts/ci/self-hosted/test-module-assets.mjs "$wallet_platform" tinywallet)"
+IFS=$'\t' read -r _wallet_id wallet_url wallet_filename wallet_sha256 <<< "$wallet_asset"
+wallet_dir="$REPO_ROOT/target/test-modules/tinywallet/$wallet_sha256"
+wallet_archive="$wallet_dir/$wallet_filename"
if [ ! -f "$wallet_dir/libtinywallet_module.$module_ext" ]; then
- echo "Downloading the pinned TinyWallet test module ..."
+ echo "Downloading the checksum-pinned TinyWallet test module ..."
mkdir -p "$wallet_dir"
- curl --fail --location --silent --show-error \
- "https://github.com/tinyhumansai/tinywallet/releases/download/v${wallet_version}/$(basename "$wallet_archive")" \
- --output "$wallet_archive"
- # macOS ships a `sha256sum` that does not accept GNU's stdin check mode.
+ curl --fail --location --silent --show-error "$wallet_url" --output "$wallet_archive"
if command -v shasum >/dev/null 2>&1; then
echo "${wallet_sha256} $wallet_archive" | shasum -a 256 -c
else
echo "${wallet_sha256} $wallet_archive" | sha256sum --check
fi
- tar -xzf "$wallet_archive" -C "$wallet_dir"
+ tar --no-same-owner -xzf "$wallet_archive" -C "$wallet_dir"
fi
export OPENHUMAN_MODULE_PATH="$wallet_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}"
+docs_asset="$(node scripts/ci/self-hosted/test-module-assets.mjs "$wallet_platform" tinydocs)"
+IFS=$'\t' read -r _docs_id docs_url docs_filename docs_sha256 <<< "$docs_asset"
+docs_dir="$REPO_ROOT/target/test-modules/tinydocs/$docs_sha256"
+docs_archive="$docs_dir/$docs_filename"
+if [ ! -f "$docs_dir/libtinydocs_module.$module_ext" ]; then
+ mkdir -p "$docs_dir"
+ curl --fail --location --silent --show-error "$docs_url" --output "$docs_archive"
+ if command -v shasum >/dev/null 2>&1; then
+ echo "${docs_sha256} $docs_archive" | shasum -a 256 -c
+ else
+ echo "${docs_sha256} $docs_archive" | sha256sum --check
+ fi
+ tar --no-same-owner -xzf "$docs_archive" -C "$docs_dir"
+fi
+export OPENHUMAN_MODULE_PATH="$docs_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}"
+
if [ -z "${TINYCONNECTORS_TEST_MODULE:-}" ]; then
connectors_manifest="vendor/tinyconnectors/crates/tinyconnectors/Cargo.toml"
connectors_module="$REPO_ROOT/vendor/tinyconnectors/target/release/libtinyconnectors.$module_ext"