Skip to content

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

test(modules): cover module source reporting and use override constructor

Steven Enamakel30316ca5b08f
diff --git a/crates/openhuman-core/src/hosting/hosting_tests.rs b/crates/openhuman-core/src/hosting/hosting_tests.rs
index 2c8cdfe469..a91d3c2717 100644
--- a/crates/openhuman-core/src/hosting/hosting_tests.rs
+++ b/crates/openhuman-core/src/hosting/hosting_tests.rs
@@ -210,10 +210,10 @@ async fn released_artifact_serves_providers_and_confidential_local_preparation()
config
.modules
.overrides
- .push(crate::config::schema::ModuleOverride {
- id: "tinyhosts".to_owned(),
- path: artifact.to_string_lossy().into_owned(),
- });
+ .push(crate::config::schema::ModuleOverride::with_path(
+ "tinyhosts",
+ artifact.to_string_lossy().into_owned(),
+ ));
let account = Account::connect_with_config("vercel", "fixture-api-key", None, config)
.expect("account configuration");
let workspace = workspace
diff --git a/crates/openhuman-core/src/modules/accessibility_tests.rs b/crates/openhuman-core/src/modules/accessibility_tests.rs
index 404c14aff2..0637b1eec5 100644
--- a/crates/openhuman-core/src/modules/accessibility_tests.rs
+++ b/crates/openhuman-core/src/modules/accessibility_tests.rs
@@ -228,10 +228,10 @@ async fn released_module_serves_permissions_and_confidential_target_validation()
config
.modules
.overrides
- .push(crate::config::schema::ModuleOverride {
- id: "tinycomputer".into(),
- path: std::path::PathBuf::from(artifact).to_str().unwrap().into(),
- });
+ .push(crate::config::schema::ModuleOverride::with_path(
+ "tinycomputer",
+ std::path::PathBuf::from(artifact).to_str().unwrap(),
+ ));
let client = AccessibilityClient::new(&config);
let permissions = client.permissions().await.expect("native permission query");
assert_eq!(permissions.accessibility, PermissionState::Unsupported);
diff --git a/crates/openhuman-core/src/modules/channel_runtime_tests.rs b/crates/openhuman-core/src/modules/channel_runtime_tests.rs
index 54ec59b8db..c42bbb03de 100644
--- a/crates/openhuman-core/src/modules/channel_runtime_tests.rs
+++ b/crates/openhuman-core/src/modules/channel_runtime_tests.rs
@@ -147,10 +147,10 @@ async fn released_runtime_scopes_callbacks_and_replays_one_final_send() {
std::env::var("OPENHUMAN_CHANNELS_TEST_ARTIFACT").expect("verified artifact path");
let mut config = crate::config::Config::default();
config.modules.allow_download = false;
- config.modules.overrides = vec![crate::config::schema::ModuleOverride {
- id: "tinychannels".into(),
- path: artifact,
- }];
+ config.modules.overrides = vec![crate::config::schema::ModuleOverride::with_path(
+ "tinychannels",
+ artifact,
+ )];
// This content fits the module state budget but exceeds the former
// 128 KiB serialized-request limit after JSON escaping.
let final_text = "\"\\".repeat(192 * 1024);
diff --git a/crates/openhuman-core/src/modules/ops_tests.rs b/crates/openhuman-core/src/modules/ops_tests.rs
index 2cbbf6fac7..6eb9b1bade 100644
--- a/crates/openhuman-core/src/modules/ops_tests.rs
+++ b/crates/openhuman-core/src/modules/ops_tests.rs
@@ -551,23 +551,43 @@ async fn disabled_modules_are_reported_then_demoted_at_product_boundaries() {
}
#[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
+fn status_reports_the_source_that_serves_a_module() {
+ use crate::config::schema::ModuleSourceMode;
+ use crate::modules::types::ModuleSource;
+
+ let mut config = Config::default();
+ let status = |config: &Config| {
+ list(config)
+ .into_iter()
+ .find(|m| m.id == "tinyjuice")
+ .expect("tinyjuice is registered")
+ };
+ if let Some(source) = status(&config).source {
+ assert_eq!(source, ModuleSource::Release);
+ }
+ assert_eq!(status(&config).detail, None);
+
+ // A linked request in a binary with no linked factory is served by the
+ // release, and the status says why without naming a path.
+ config.modules.source = ModuleSourceMode::Linked;
+ let fallback = status(&config);
+ assert_ne!(fallback.source, Some(ModuleSource::Linked));
+ let detail = fallback.detail.expect("fallback is visible in detail");
+ assert!(detail.contains("release"), "{detail}");
+ assert!(!detail.contains('/'), "{detail}");
+
+ // A path override is reported as a local file.
+ let mut config = Config::default();
+ config
.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())
- );
+ .push(crate::config::schema::ModuleOverride::with_path(
+ "tinyjuice",
+ "/dev/libtinyjuice_module.so",
+ ));
+ let local = status(&config);
+ assert_ne!(local.source, Some(ModuleSource::Release));
+ if let Some(source) = local.source {
+ assert_eq!(source, ModuleSource::LocalFile);
+ }
}
diff --git a/tests/mcp_registry_e2e.rs b/tests/mcp_registry_e2e.rs
index 1658da1c81..fcfc2568fb 100644
--- a/tests/mcp_registry_e2e.rs
+++ b/tests/mcp_registry_e2e.rs
@@ -25,10 +25,10 @@ fn fresh_workspace_config() -> (tempfile::TempDir, Config) {
modules: openhuman_core::config::schema::ModulesConfig {
enabled: true,
allow_download: false,
- overrides: vec![ModuleOverride {
- id: "tinymcp".into(),
- path: artifact.to_string_lossy().into_owned(),
- }],
+ overrides: vec![ModuleOverride::with_path(
+ "tinymcp",
+ artifact.to_string_lossy().into_owned(),
+ )],
..Default::default()
},
..Config::default()