Skip to content

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

feat(source): add staged artifact lookup for published-module tests

Steven Enamakelaef9e322813c
diff --git a/crates/openhuman-core/src/modules/source.rs b/crates/openhuman-core/src/modules/source.rs
index 03fae7be35..e2e4938a8e 100644
--- a/crates/openhuman-core/src/modules/source.rs
+++ b/crates/openhuman-core/src/modules/source.rs
@@ -87,6 +87,16 @@ pub fn local_artifact(id: &str) -> Option<PathBuf> {
std::env::split_paths(&dirs).find_map(|dir| module_artifact_in(&dir, id))
}
+/// Find a staged release artifact for tests that must verify published-module
+/// behavior, without preferring a local source build.
+#[doc(hidden)]
+#[must_use]
+pub fn staged_artifact(id: &str) -> Option<PathBuf> {
+ super::registry::find(id)?;
+ let dirs = std::env::var_os("OPENHUMAN_MODULE_PATH")?;
+ std::env::split_paths(&dirs).find_map(|dir| released_artifact_in(&dir, id))
+}
+
/// Find either a locally built library or a released TinyBus module in one
/// directory. Source builds use the crate library name; release archives use
/// the module ABI name, which adds the `_module` suffix.
@@ -97,6 +107,12 @@ fn module_artifact_in(dir: &Path, id: &str) -> Option<PathBuf> {
return Some(source);
}
+ released_artifact_in(dir, id)
+}
+
+fn released_artifact_in(dir: &Path, id: &str) -> Option<PathBuf> {
+ super::registry::find(id)?;
+
let released_name = if cfg!(target_os = "windows") {
format!("{id}_module.dll")
} else if cfg!(target_os = "macos") {