Skip to content

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

fix(modules): resolve tinyjuice test fixture in shared loader

Steven Enamakel68cedcc75255
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index 1e8a24b16d..42da1cff36 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -149,19 +149,7 @@ pub async fn install_from_config(config: &crate::config::Config) -> Result<(), S
/// Construct explicit access over the shared process-wide loader.
fn client(config: &crate::config::Config) -> crate::modules::client::ModuleClient {
- #[allow(unused_mut)] // Fixture overrides are compiled only into tests.
- let mut config = config.clone();
- #[cfg(test)]
- if let Some(path) = std::env::var_os("TINYJUICE_TEST_MODULE") {
- config
- .modules
- .overrides
- .push(crate::config::schema::ModuleOverride {
- id: "tinyjuice".into(),
- path: path.to_string_lossy().into_owned(),
- });
- }
- crate::modules::client::ModuleClient::new(config)
+ crate::modules::client::ModuleClient::new(config.clone())
}
/// Everything the module considers about one tool result.
diff --git a/crates/openhuman-core/src/modules/ops.rs b/crates/openhuman-core/src/modules/ops.rs
index 17900fd544..5040c40487 100644
--- a/crates/openhuman-core/src/modules/ops.rs
+++ b/crates/openhuman-core/src/modules/ops.rs
@@ -473,6 +473,14 @@ fn local_override(config: &Config, id: &str) -> Option<PathBuf> {
.flatten()
.map(PathBuf::from)
})
+ .or_else(|| {
+ // Integration tests compile the core as a dependency, without
+ // cfg(test), so fixture routing belongs in this shared loader.
+ (id == "tinyjuice")
+ .then(|| std::env::var_os("TINYJUICE_TEST_MODULE"))
+ .flatten()
+ .map(PathBuf::from)
+ })
.or_else(|| {
// TinyConnectors exposes its contract to the host, but has no
// host-side module namespace: it is resolved by its registry ID.
diff --git a/crates/openhuman-core/src/modules/ops_tests.rs b/crates/openhuman-core/src/modules/ops_tests.rs
index 9dfeae4be9..2cbbf6fac7 100644
--- a/crates/openhuman-core/src/modules/ops_tests.rs
+++ b/crates/openhuman-core/src/modules/ops_tests.rs
@@ -5,6 +5,7 @@
//! reachable without touching the network, which is what keeps them in the unit
//! suite instead of behind an ignore.
+use super::*;
use crate::config::Config;
use crate::modules::ops::{self, install_dir, list};
use crate::modules::registry;
@@ -548,3 +549,25 @@ async fn disabled_modules_are_reported_then_demoted_at_product_boundaries() {
&reason
));
}
+
+#[test]
+fn native_juice_fixture_is_resolved_without_a_unit_test_adapter() {
+ let fixture = std::path::PathBuf::from("fixture/libtinyjuice_module.so");
+ let _env = crate::config::test_env::EnvVarGuard::locked_set("TINYJUICE_TEST_MODULE", &fixture);
+ assert_eq!(
+ local_override(&Config::default(), "tinyjuice"),
+ Some(fixture)
+ );
+ let mut configured = Config::default();
+ configured
+ .modules
+ .overrides
+ .push(crate::config::schema::ModuleOverride {
+ id: "tinyjuice".into(),
+ path: "explicit/libtinyjuice_module.so".into(),
+ });
+ assert_eq!(
+ local_override(&configured, "tinyjuice"),
+ Some("explicit/libtinyjuice_module.so".into())
+ );
+}