Skip to content

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

refactor(channels): adjust test support visibility and access

Steven Enamakelba50f61dbfb8
diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rs
index faf154447d..69df8f4f2e 100644
--- a/crates/openhuman-core/src/channels/mod.rs
+++ b/crates/openhuman-core/src/channels/mod.rs
@@ -45,8 +45,8 @@ pub(crate) use system_prompt::ChannelSystemPrompt;
#[cfg(all(feature = "channels", test))]
mod tests;
-#[cfg(all(feature = "channels", test))]
-pub use runtime::test_support;
+#[cfg(all(feature = "channels", any(test, feature = "e2e-test-support")))]
+pub mod test_support;
#[cfg(feature = "channels")]
// Channel system-prompt assembly lives in
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs b/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
index 5d542132aa..6bbe526a77 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/helpers.rs
@@ -54,7 +54,7 @@ pub(super) fn spawn_typing_task(
/// Reminders and scheduled tasks created from this chat are delivered back to
/// it automatically (the job records its origin), so the model is told only
/// that, not a target to copy.
-pub(super) fn build_channel_context_block(msg: &traits::ChannelMessage) -> String {
+pub(crate) fn build_channel_context_block(msg: &traits::ChannelMessage) -> String {
let channel = msg.channel.trim();
if channel.is_empty()
|| channel.eq_ignore_ascii_case("web")
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
index cbb559129d..80a4ef1447 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/mod.rs
@@ -32,7 +32,7 @@ use processor::channel_has_approval_surface;
// Re-export internal helpers accessed by test_support (cfg(any(test,
// debug_assertions))) and the inline #[cfg(test)] modules via `super::*`.
-#[cfg(any(test, debug_assertions))]
+#[cfg(test)]
use helpers::build_channel_context_block;
#[cfg(test)]
use helpers::select_acknowledgment_reaction;
@@ -40,10 +40,10 @@ use helpers::select_acknowledgment_reaction;
#[cfg(test)]
use routing::{build_visible_tool_set, AgentScoping};
-#[cfg(any(test, debug_assertions))]
+#[cfg(test)]
use tinychannels_bus as traits;
-#[cfg(any(test, debug_assertions))]
+#[cfg(test)]
#[path = "mod_test_support_tests.rs"]
pub mod test_support;
diff --git a/crates/openhuman-core/src/channels/test_support.rs b/crates/openhuman-core/src/channels/test_support.rs
new file mode 100644
index 0000000000..553f9799a4
--- /dev/null
+++ b/crates/openhuman-core/src/channels/test_support.rs
@@ -0,0 +1,6 @@
+//! Narrow helpers exposed to the raw-coverage integration target.
+
+/// Build the host-owned channel context block for a bus message.
+pub fn build_channel_context_block_for_test(msg: &tinychannels_bus::ChannelMessage) -> String {
+ crate::channels::runtime::dispatch::helpers::build_channel_context_block(msg)
+}