From e2eb44903bb43d0c48c80b016a229b6b698fdb07 Mon Sep 17 00:00:00 2001 From: sanil-23 Date: Fri, 10 Jul 2026 00:07:18 +0530 Subject: [PATCH] fix(tests): repair repo-wide `cargo test --lib` build (stale test re-exports) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The lib `cfg(test)` build has been broken on `main` — `cargo test --lib` fails to compile with 38 errors across ~10 modules, which red-lines the "Rust Core Coverage" gate for every PR that touches Rust. A prior refactor split several modules into submodules and moved constants/types/helpers there, but the parent modules' `#[cfg(test)]` re-export blocks (and a few inline test imports) still referenced the old flat locations. The symbols exist — they were just no longer in the test modules' `use super::*` scope. Restore the missing re-exports / test-local imports. **No product code changes — test visibility only.** Modules fixed: config/schema/load, config/schemas, memory/schema, memory/chat, memory/tree_source/file, sandbox/docker, mcp_server/tools, inference/provider/reliable, inference/local/service/ollama_admin, channels/providers/web. Verified: `cargo test --lib --no-run` compiles clean. Co-Authored-By: Claude Opus 4.8 --- src/openhuman/channels/providers/web/mod.rs | 15 +++++++++++++++ src/openhuman/config/schema/load/mod.rs | 4 +++- src/openhuman/config/schemas/mod.rs | 4 ++++ .../inference/local/service/ollama_admin/mod.rs | 3 +++ src/openhuman/inference/provider/reliable.rs | 3 +++ src/openhuman/mcp_server/tools/mod.rs | 3 +++ src/openhuman/memory/chat.rs | 1 + src/openhuman/memory/schema/mod.rs | 2 ++ src/openhuman/memory/tree_source/file.rs | 1 + src/openhuman/sandbox/docker.rs | 1 + 10 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/openhuman/channels/providers/web/mod.rs b/src/openhuman/channels/providers/web/mod.rs index b629b4339e..b30299dbf9 100644 --- a/src/openhuman/channels/providers/web/mod.rs +++ b/src/openhuman/channels/providers/web/mod.rs @@ -108,8 +108,23 @@ pub mod test_support { } } +#[cfg(test)] +pub(crate) use schemas::{ + json_output, optional_bool, optional_f64, optional_string, optional_u64, required_string, +}; +#[cfg(test)] +pub(crate) use session::{ + compose_system_prompt_suffix, locale_reply_directive, normalize_model_override, + provider_role_for_model_override, +}; #[cfg(test)] pub(crate) use types::SessionCacheFingerprint; +#[cfg(test)] +pub(crate) use types::WebChatParams; +#[cfg(test)] +pub(crate) use web_errors::{ + inference_budget_exceeded_user_message, is_inference_budget_exceeded_error, +}; #[cfg(test)] #[path = "../web_tests.rs"] diff --git a/src/openhuman/config/schema/load/mod.rs b/src/openhuman/config/schema/load/mod.rs index 828e5d001c..2fb74a1587 100644 --- a/src/openhuman/config/schema/load/mod.rs +++ b/src/openhuman/config/schema/load/mod.rs @@ -32,7 +32,9 @@ pub(crate) use super::Config; #[cfg(test)] pub(crate) use dirs::ACTIVE_USER_STATE_FILE; #[cfg(test)] -pub(crate) use env::ProcessEnvWithoutWorkspace; +pub(crate) use dirs::{ACTION_DIR_ENV_VAR, MEMORY_SYNC_INTERVAL_SECS_ENV_VAR}; +#[cfg(test)] +pub(crate) use env::{EnvLookup, ProcessEnvWithoutWorkspace}; #[cfg(test)] pub(crate) use impl_load::parse_config_with_recovery; #[cfg(test)] diff --git a/src/openhuman/config/schemas/mod.rs b/src/openhuman/config/schemas/mod.rs index 1518fa7196..482606effa 100644 --- a/src/openhuman/config/schemas/mod.rs +++ b/src/openhuman/config/schemas/mod.rs @@ -29,6 +29,10 @@ use helpers::{ #[cfg(test)] use serde_json::{Map, Value}; +#[cfg(test)] +#[cfg(test)] +pub(crate) use schema_defs::schemas; + #[cfg(test)] #[path = "../schemas_tests.rs"] mod tests; diff --git a/src/openhuman/inference/local/service/ollama_admin/mod.rs b/src/openhuman/inference/local/service/ollama_admin/mod.rs index 391360255a..9c2153ec9b 100644 --- a/src/openhuman/inference/local/service/ollama_admin/mod.rs +++ b/src/openhuman/inference/local/service/ollama_admin/mod.rs @@ -9,6 +9,9 @@ mod util; // Re-export free functions that form the public/crate API of this module. pub(crate) use util::test_ollama_connection; +#[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..379726fa2b 100644 --- a/src/openhuman/inference/provider/reliable.rs +++ b/src/openhuman/inference/provider/reliable.rs @@ -908,6 +908,9 @@ impl Provider for ReliableProvider { } } +#[cfg(test)] +pub(crate) use super::traits::StreamError; + #[cfg(test)] #[path = "reliable_tests.rs"] mod tests; diff --git a/src/openhuman/mcp_server/tools/mod.rs b/src/openhuman/mcp_server/tools/mod.rs index da91c54dcc..ca5b289ac7 100644 --- a/src/openhuman/mcp_server/tools/mod.rs +++ b/src/openhuman/mcp_server/tools/mod.rs @@ -31,6 +31,9 @@ pub use serde_json::{json, Value}; #[cfg(test)] pub use types::{DEFAULT_LIMIT, MAX_LIMIT, TREE_TAG_MAX_TAGS, TREE_TAG_MAX_TAG_LENGTH}; +#[cfg(test)] +pub(crate) use specs::list_tools_result_for_config; + #[cfg(test)] #[path = "../tools_tests.rs"] mod tests; diff --git a/src/openhuman/memory/chat.rs b/src/openhuman/memory/chat.rs index 0f9016f4f1..981edd43c0 100644 --- a/src/openhuman/memory/chat.rs +++ b/src/openhuman/memory/chat.rs @@ -266,6 +266,7 @@ pub mod test_override { #[cfg(test)] mod tests { use super::*; + use crate::openhuman::config::schema::DEFAULT_CLOUD_LLM_MODEL; #[test] fn build_provider_returns_inference_wrapper_when_default() { 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..c7981150ab 100644 --- a/src/openhuman/memory/tree_source/file.rs +++ b/src/openhuman/memory/tree_source/file.rs @@ -134,6 +134,7 @@ fn write_atomic(path: &Path, bytes: &[u8]) -> Result<()> { #[cfg(test)] mod tests { use super::*; + use crate::openhuman::memory_store::trees::types::{TreeKind, TreeStatus}; use chrono::TimeZone; use tempfile::TempDir; diff --git a/src/openhuman/sandbox/docker.rs b/src/openhuman/sandbox/docker.rs index fcaea15888..1f3f69670a 100644 --- a/src/openhuman/sandbox/docker.rs +++ b/src/openhuman/sandbox/docker.rs @@ -288,6 +288,7 @@ pub fn validate_docker_policy(policy: &SandboxPolicy) -> Result<(), Vec> #[cfg(test)] mod tests { use super::*; + use crate::openhuman::sandbox::types::DockerOverrides; use std::path::PathBuf; fn test_policy() -> SandboxPolicy {