fix(tests): repair repo-wide cargo test --lib build (stale test re-exports)#4767
fix(tests): repair repo-wide cargo test --lib build (stale test re-exports)#4767sanil-23 wants to merge 1 commit into
Conversation
…exports) 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 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR adds cfg(test)-gated re-exports and test-module imports across ten files in the openhuman crate, exposing additional helper types, functions, and constants (e.g., WebChatParams, EnvLookup, NAMESPACE, DockerOverrides, StreamError) so existing test code compiles. No production logic or public APIs change. ChangesTest-only visibility fixes
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openhuman/config/schemas/mod.rs (1)
32-34: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicate
#[cfg(test)]attribute.Lines 32-33 apply
#[cfg(test)]twice to the sameusestatement. Harmless at compile time but clearly an accidental duplication.🧹 Proposed fix
#[cfg(test)] -#[cfg(test)] pub(crate) use schema_defs::schemas;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/openhuman/config/schemas/mod.rs` around lines 32 - 34, The `schemas` re-export in `mod.rs` has a duplicated `#[cfg(test)]` attribute on the same `use` statement. Remove the extra `#[cfg(test)]` so the conditional import is declared only once, keeping the `schema_defs::schemas` re-export gated for tests via the existing attribute on that symbol.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/openhuman/config/schemas/mod.rs`:
- Around line 32-34: The `schemas` re-export in `mod.rs` has a duplicated
`#[cfg(test)]` attribute on the same `use` statement. Remove the extra
`#[cfg(test)]` so the conditional import is declared only once, keeping the
`schema_defs::schemas` re-export gated for tests via the existing attribute on
that symbol.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b16d6044-d7f1-4ddf-81c2-d51ea0955146
📒 Files selected for processing (10)
src/openhuman/channels/providers/web/mod.rssrc/openhuman/config/schema/load/mod.rssrc/openhuman/config/schemas/mod.rssrc/openhuman/inference/local/service/ollama_admin/mod.rssrc/openhuman/inference/provider/reliable.rssrc/openhuman/mcp_server/tools/mod.rssrc/openhuman/memory/chat.rssrc/openhuman/memory/schema/mod.rssrc/openhuman/memory/tree_source/file.rssrc/openhuman/sandbox/docker.rs
Summary
Repair the repo-wide
cargo test --libbuild. It has been broken onmain— the libcfg(test)build fails to compile with 38 errors across ~10 modules, which red-lines the "Rust Core Coverage" gate on every PR that touches Rust (e.g. #4753; andmain's own tipe5c6507cis red on it).Problem
A prior refactor split several modules into submodules and moved constants / types / helpers there (
config/schema/load→dirs.rs/env.rs,channels/providers/web→types.rs/session.rs/schemas.rs/web_errors.rs, etc.), but the parent modules'#[cfg(test)]re-export blocks — and a few inline test imports — were left referencing the old flat locations. The symbols exist; they were just no longer in the test modules'use super::*scope, so the whole lib test build fails to compile.Solution (scope: core, test visibility only)
Restore the missing
#[cfg(test)] pub(crate) use …re-exports on the parent modules, and add the missing test-local imports to the inline test modules. No product code changes.Modules fixed:
config/schema/load—ACTION_DIR_ENV_VAR,MEMORY_SYNC_INTERVAL_SECS_ENV_VAR,EnvLookupconfig/schemas—schemasmemory/schema—NAMESPACEmemory/chat—DEFAULT_CLOUD_LLM_MODELmemory/tree_source/file—TreeKind,TreeStatussandbox/docker—DockerOverridesmcp_server/tools—list_tools_result_for_configinference/provider/reliable—StreamErrorinference/local/service/ollama_admin—interrupted_pull_settle_window_secschannels/providers/web— 13 helpers (WebChatParams,compose_system_prompt_suffix, schema field helpers, budget-error helpers, …)Acceptance criteria
cargo test --lib --no-runcompiles clean — verified locally (0 errors; only pre-existing unused-import warnings).#[cfg(test)]re-exports / test-localuses.Impact
Rust Core Coverage/PR CI Gatechecks for every Rust PR (they've been failing at compile since the refactor).Related
Summary by CodeRabbit