Skip to content

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

test(modules): resolve test artifacts through local_artifact

Steven Enamakelfc71b60fabcd
diff --git a/crates/openhuman-core/src/hosting/README.md b/crates/openhuman-core/src/hosting/README.md
index d0a4e852a3..e602ae835a 100644
--- a/crates/openhuman-core/src/hosting/README.md
+++ b/crates/openhuman-core/src/hosting/README.md
@@ -36,10 +36,10 @@ test exercises the pinned artifact through OpenHuman's configured module loader
and real private TinyBus. It queries `Providers`, then sends a confidential
`PrepareBundle` for a temporary local HTML file and checks the returned typed
snapshot. This operation is local and does not contact a hosting provider. Run
-it with the released library at hand:
+it with a library built from the pinned submodule:
```bash
-OPENHUMAN_TINYHOSTS_TEST_MODULE=/path/to/libtinyhosts.so \
+eval "$(node scripts/modules/build.mjs tinyhosts --print-env)"
scripts/ci-cancel-aware.sh cargo +stable test --locked \
--manifest-path Cargo.toml -p openhuman --no-default-features \
--features 'hosting,crash-reporting' \
diff --git a/crates/openhuman-core/src/hosting/hosting_tests.rs b/crates/openhuman-core/src/hosting/hosting_tests.rs
index a91d3c2717..eb5f95a3f0 100644
--- a/crates/openhuman-core/src/hosting/hosting_tests.rs
+++ b/crates/openhuman-core/src/hosting/hosting_tests.rs
@@ -193,12 +193,12 @@ fn the_module_registry_pins_the_released_hosts_artifact_set() {
#[cfg(feature = "modules")]
#[tokio::test]
-#[ignore = "requires OPENHUMAN_TINYHOSTS_TEST_MODULE pointing to the released v0.3.0 native artifact"]
+#[ignore = "requires a TinyHosts library: node scripts/modules/build.mjs tinyhosts, then OPENHUMAN_MODULE_SOURCE_DIR"]
async fn released_artifact_serves_providers_and_confidential_local_preparation() {
use base64::Engine as _;
- let artifact = std::env::var_os("OPENHUMAN_TINYHOSTS_TEST_MODULE")
- .expect("set OPENHUMAN_TINYHOSTS_TEST_MODULE to the released TinyHosts v0.3.0 library");
+ let artifact = crate::modules::local_artifact("tinyhosts")
+ .expect("build tinyhosts with scripts/modules/build.mjs and set OPENHUMAN_MODULE_SOURCE_DIR");
let workspace = tempfile::tempdir().expect("workspace");
let site = workspace.path().join("site");
std::fs::create_dir(&site).expect("site directory");
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index ca7ce1e291..dc2a9fe16b 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -267,7 +267,7 @@ pub async fn compact_tool_output(call: ToolOutputCompaction<'_>) -> CompactedToo
},
};
#[cfg(test)]
- let config = if std::env::var_os("TINYJUICE_TEST_MODULE").is_some() {
+ let config = if crate::modules::local_artifact("tinyjuice").is_some() {
// The released-module regression must not inherit an operator's
// persisted compression thresholds or disabled router flags.
std::sync::Arc::new(crate::config::Config::default())
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
index d51c185abe..c0364842a4 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
@@ -10,14 +10,15 @@ fn recovery_tool_aliases_remain_stable() {
/// Exercise the configured on-demand mode through the real module bus. Even
/// with a registered model callback and a result above the summary threshold,
/// ingest must return a recovery handle without calling the model.
-/// Runs where CI builds the module (`TINYJUICE_TEST_MODULE`).
+/// Runs where a tinyjuice library is provided (`scripts/modules/build.mjs`
+/// or the staged release on `OPENHUMAN_MODULE_PATH`).
#[tokio::test]
async fn the_module_defers_a_summary_until_requested() {
- if std::env::var_os("TINYJUICE_TEST_MODULE").is_none() {
+ if crate::modules::local_artifact("tinyjuice").is_none() {
eprintln!(
- "SKIPPED (not run, not asserted): TINYJUICE_TEST_MODULE is not set. Build \
- vendor/tinyjuice and export TINYJUICE_TEST_MODULE=<path to libtinyjuice_module>, \
- or use scripts/test-rust-with-mock.sh"
+ "SKIPPED (not run, not asserted): no tinyjuice library. Run \
+ `node scripts/modules/build.mjs tinyjuice` and set OPENHUMAN_MODULE_SOURCE_DIR \
+ and OPENHUMAN_MODULE_SOURCE=source, or use scripts/test-rust-with-mock.sh"
);
return;
}
@@ -66,7 +67,7 @@ async fn the_module_defers_a_summary_until_requested() {
/// still says it is unsummarized, exactly as a module-side failure would.
#[tokio::test]
async fn an_unreachable_module_discloses_a_wanted_summary() {
- if std::env::var_os("TINYJUICE_TEST_MODULE").is_some() {
+ if crate::modules::local_artifact("tinyjuice").is_some() {
return; // A fixture forces the module on; this pins the host path.
}
let mut config = crate::config::Config::default();
@@ -262,8 +263,8 @@ fn install_request_summarizes_only_on_request_under_a_64k_cap() {
/// Run against the verified release with the host's pinned TinyBus loader.
#[tokio::test]
async fn released_queries_keep_cached_originals_in_the_module_and_accept_artifact_content() {
- if std::env::var_os("TINYJUICE_TEST_MODULE").is_none() {
- eprintln!("SKIPPED: released TinyJuice artifact not configured");
+ if crate::modules::local_artifact("tinyjuice").is_none() {
+ eprintln!("SKIPPED: no TinyJuice library provided");
return;
}
use tinyjuice_bus::{
diff --git a/crates/openhuman-core/src/tools/impl/network/host_tests.rs b/crates/openhuman-core/src/tools/impl/network/host_tests.rs
index 80a29436dd..6b7f25a3b0 100644
--- a/crates/openhuman-core/src/tools/impl/network/host_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/network/host_tests.rs
@@ -87,8 +87,8 @@ fn zero_limits_fall_back_to_the_http_request_config_defaults() {
#[tokio::test]
async fn tinyjuice_detects_and_converts_html() {
- if std::env::var_os("TINYJUICE_TEST_MODULE").is_none() {
- eprintln!("SKIPPED: released module fixture is not configured");
+ if crate::modules::local_artifact("tinyjuice").is_none() {
+ eprintln!("SKIPPED: no tinyjuice library (node scripts/modules/build.mjs tinyjuice)");
return;
}
let page = "<!DOCTYPE html><html><body><p>hi</p></body></html>";