From 82d172969cf2c06ef5e5cfdc544fb5385c011a18 Mon Sep 17 00:00:00 2001 From: oxoxDev Date: Thu, 9 Jul 2026 19:50:48 +0530 Subject: [PATCH] fix(channels/web): restore dropped test-facing re-exports so libtest compiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The orchestration merge (#4720/#4722/#4725) restructured several domains into sub-modules but dropped the `#[cfg(test)]` re-export / import blocks that their `#[path] mod tests` (and inline `mod tests`) resolve against via `use super::*` / `super::`. This broke the whole Rust libtest target (main CI Lite red) and, because the coverage job compiles libtest, every open PR's coverage gate. The referenced symbols still exist — they only moved into the new sub-modules. This restores the test-facing re-exports/imports (no product change, no tests deleted or ignored): - channels/providers/web/mod.rs: WebChatParams, compose_system_prompt_suffix, locale_reply_directive, normalize_model_override, provider_role_for_model_override, required_string, optional_{string,bool,f64,u64}, json_output, inference_budget_exceeded_user_message, is_inference_budget_exceeded_error - config/schema/load/mod.rs: EnvLookup, ACTION_DIR_ENV_VAR, MEMORY_SYNC_INTERVAL_SECS_ENV_VAR - config/schemas/mod.rs: schemas - inference/local/service/ollama_admin/mod.rs: interrupted_pull_settle_window_secs - inference/provider/reliable.rs: StreamError - mcp_server/tools/mod.rs: list_tools_result_for_config - memory/chat.rs: DEFAULT_CLOUD_LLM_MODEL - memory/schema/mod.rs: NAMESPACE - memory/tree_source/file.rs: TreeKind, TreeStatus - sandbox/docker.rs: DockerOverrides --- src/openhuman/channels/providers/web/mod.rs | 20 +++++++++++++++++-- src/openhuman/config/schema/load/mod.rs | 4 ++++ src/openhuman/config/schemas/mod.rs | 2 ++ .../local/service/ollama_admin/mod.rs | 5 +++++ src/openhuman/inference/provider/reliable.rs | 5 +++++ src/openhuman/mcp_server/tools/mod.rs | 2 ++ src/openhuman/memory/chat.rs | 4 ++++ src/openhuman/memory/schema/mod.rs | 2 ++ src/openhuman/memory/tree_source/file.rs | 4 ++++ src/openhuman/sandbox/docker.rs | 4 ++++ 10 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/openhuman/channels/providers/web/mod.rs b/src/openhuman/channels/providers/web/mod.rs index b629b4339e..0390f12568 100644 --- a/src/openhuman/channels/providers/web/mod.rs +++ b/src/openhuman/channels/providers/web/mod.rs @@ -16,8 +16,10 @@ pub(crate) use web_errors::classify_inference_error; #[allow(unused_imports)] pub(crate) use web_errors::{ extract_provider_error_detail, extract_provider_name, generic_inference_error_user_message, - is_action_budget_exhausted, is_fallback_chain_exhausted, is_non_retryable_rate_limit_text, - parse_retry_after_secs_from_str, retry_after_hint, with_provider_detail, ClassifiedError, + inference_budget_exceeded_user_message, is_action_budget_exhausted, + is_fallback_chain_exhausted, is_inference_budget_exceeded_error, + is_non_retryable_rate_limit_text, parse_retry_after_secs_from_str, retry_after_hint, + with_provider_detail, ClassifiedError, }; // Public API — event bus @@ -50,6 +52,20 @@ pub(crate) use ops::{event_session_id_for, key_for}; pub(crate) use progress_bridge::spawn_progress_bridge; // Schema field helpers re-exported for tests +#[cfg(any(test, debug_assertions))] +#[allow(unused_imports)] +pub(crate) use schemas::{ + json_output, optional_bool, optional_f64, optional_string, optional_u64, required_string, +}; +#[cfg(any(test, debug_assertions))] +#[allow(unused_imports)] +pub(crate) use session::{ + compose_system_prompt_suffix, locale_reply_directive, normalize_model_override, + provider_role_for_model_override, +}; +#[cfg(any(test, debug_assertions))] +#[allow(unused_imports)] +pub(crate) use types::WebChatParams; // Test helpers (debug/test builds only) #[cfg(any(test, debug_assertions))] diff --git a/src/openhuman/config/schema/load/mod.rs b/src/openhuman/config/schema/load/mod.rs index 828e5d001c..210942b2d0 100644 --- a/src/openhuman/config/schema/load/mod.rs +++ b/src/openhuman/config/schema/load/mod.rs @@ -32,6 +32,10 @@ pub(crate) use super::Config; #[cfg(test)] pub(crate) use dirs::ACTIVE_USER_STATE_FILE; #[cfg(test)] +pub(crate) use dirs::{ACTION_DIR_ENV_VAR, MEMORY_SYNC_INTERVAL_SECS_ENV_VAR}; +#[cfg(test)] +pub(crate) use env::EnvLookup; +#[cfg(test)] pub(crate) use env::ProcessEnvWithoutWorkspace; #[cfg(test)] pub(crate) use impl_load::parse_config_with_recovery; diff --git a/src/openhuman/config/schemas/mod.rs b/src/openhuman/config/schemas/mod.rs index 1518fa7196..9981018657 100644 --- a/src/openhuman/config/schemas/mod.rs +++ b/src/openhuman/config/schemas/mod.rs @@ -27,6 +27,8 @@ use helpers::{ DEFAULT_ONBOARDING_FLAG_NAME, }; #[cfg(test)] +use schema_defs::schemas; +#[cfg(test)] use serde_json::{Map, Value}; #[cfg(test)] diff --git a/src/openhuman/inference/local/service/ollama_admin/mod.rs b/src/openhuman/inference/local/service/ollama_admin/mod.rs index 391360255a..e97d792da1 100644 --- a/src/openhuman/inference/local/service/ollama_admin/mod.rs +++ b/src/openhuman/inference/local/service/ollama_admin/mod.rs @@ -9,6 +9,11 @@ mod util; // Re-export free functions that form the public/crate API of this module. pub(crate) use util::test_ollama_connection; +// Test-facing re-export: `ollama_admin_tests.rs` resolves `super::…` against +// this module. Dropped during the sub-module split; restored so libtest compiles. +#[cfg(test)] +pub(crate) use util::interrupted_pull_settle_window_secs; + #[cfg(test)] #[path = "../ollama_admin_tests.rs"] mod tests; diff --git a/src/openhuman/inference/provider/reliable.rs b/src/openhuman/inference/provider/reliable.rs index 526bc41a19..be25604913 100644 --- a/src/openhuman/inference/provider/reliable.rs +++ b/src/openhuman/inference/provider/reliable.rs @@ -23,6 +23,11 @@ use super::traits::{ ChatMessage, ChatRequest, ChatResponse, StreamChunk, StreamOptions, StreamResult, }; +// Test-facing: `reliable_tests.rs` (included via `use super::*`) constructs +// `StreamError::Provider(..)` directly. Prod code uses the fully-qualified +// path, so gate this to test builds to avoid an unused-import warning. +#[cfg(test)] +use super::traits::StreamError; use super::Provider; use crate::openhuman::inference::provider::record_resolved_provider_route; use async_trait::async_trait; diff --git a/src/openhuman/mcp_server/tools/mod.rs b/src/openhuman/mcp_server/tools/mod.rs index da91c54dcc..a7f3865943 100644 --- a/src/openhuman/mcp_server/tools/mod.rs +++ b/src/openhuman/mcp_server/tools/mod.rs @@ -29,6 +29,8 @@ pub use params::{build_rpc_params, slug_from}; #[cfg(test)] pub use serde_json::{json, Value}; #[cfg(test)] +pub use specs::list_tools_result_for_config; +#[cfg(test)] pub use types::{DEFAULT_LIMIT, MAX_LIMIT, TREE_TAG_MAX_TAGS, TREE_TAG_MAX_TAG_LENGTH}; #[cfg(test)] diff --git a/src/openhuman/memory/chat.rs b/src/openhuman/memory/chat.rs index 0f9016f4f1..6b1fd1ee3c 100644 --- a/src/openhuman/memory/chat.rs +++ b/src/openhuman/memory/chat.rs @@ -12,6 +12,10 @@ use anyhow::Result; use async_trait::async_trait; use crate::openhuman::config::Config; +// Test-facing: the inline `mod tests` (via `use super::*`) asserts against the +// managed summarization model constant. Restored after the module refactor. +#[cfg(test)] +use crate::openhuman::config::DEFAULT_CLOUD_LLM_MODEL; use crate::openhuman::inference::provider::{ create_chat_model_with_model_id, provider_for_role, UsageInfo, }; diff --git a/src/openhuman/memory/schema/mod.rs b/src/openhuman/memory/schema/mod.rs index 21c62c7645..575578e932 100644 --- a/src/openhuman/memory/schema/mod.rs +++ b/src/openhuman/memory/schema/mod.rs @@ -27,6 +27,8 @@ pub use registry::{all_controller_schemas, all_registered_controllers}; // Re-export the NAMESPACE constant so schema_tests.rs can reference it via // `super::NAMESPACE` the same way the original flat module did. +#[cfg(test)] +pub(crate) use definitions::NAMESPACE; #[cfg(test)] #[path = "../schema_tests.rs"] diff --git a/src/openhuman/memory/tree_source/file.rs b/src/openhuman/memory/tree_source/file.rs index b91ada7351..d63997e464 100644 --- a/src/openhuman/memory/tree_source/file.rs +++ b/src/openhuman/memory/tree_source/file.rs @@ -33,6 +33,10 @@ use chrono::{DateTime, Utc}; use crate::openhuman::config::Config; use crate::openhuman::memory_store::content::raw::raw_source_dir; use crate::openhuman::memory_store::trees::types::Tree; +// Test-facing: the inline `mod tests` builds sample `Tree`s using these enums. +// Restored after the tree_source refactor dropped the imports. +#[cfg(test)] +use crate::openhuman::memory_store::trees::types::{TreeKind, TreeStatus}; /// Filename of the per-source registry mirror inside `raw//`. pub const SOURCE_FILE_NAME: &str = "_source.md"; diff --git a/src/openhuman/sandbox/docker.rs b/src/openhuman/sandbox/docker.rs index fcaea15888..dbf214d47c 100644 --- a/src/openhuman/sandbox/docker.rs +++ b/src/openhuman/sandbox/docker.rs @@ -16,6 +16,10 @@ use super::types::{ SandboxBackendHandle, SandboxBackendKind, SandboxExecRequest, SandboxExecResult, SandboxPolicy, SandboxStatus, }; +// Test-facing: the inline `mod tests` builds `DockerOverrides` values. Prod code +// here doesn't reference the type, so gate to test builds. Restored post-refactor. +#[cfg(test)] +use super::types::DockerOverrides; use std::process::Stdio; use tokio::process::Command;