Skip to content

fix(tests): restore test-module imports broken by recent refactors#4759

Merged
M3gA-Mind merged 3 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/lib-test-compile-drift
Jul 9, 2026
Merged

fix(tests): restore test-module imports broken by recent refactors#4759
M3gA-Mind merged 3 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/lib-test-compile-drift

Conversation

@M3gA-Mind

@M3gA-Mind M3gA-Mind commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes the red Rust Core Coverage lane on main — the crate's lib-test target currently fails to compile (38 errors: E0405/E0425/E0432/E0433), so Rust Core Coverage fails on main HEAD and, via the PR merge-ref, on every open PR's coverage gate.
  • The breakage is pure test-module import drift: recent refactors moved helpers into submodules (or dropped the pub(crate) use re-exports the tests rely on) without updating the test modules.
  • All changes are re-exports / import-path fixes. No test logic and no production behaviour changes.

Problem

cargo llvm-cov ... -p openhuman --lib compiles the whole lib-test target, which no longer builds on main. The 38 errors cluster into 8 modules whose *_tests.rs reference symbols that still exist but are no longer in the test module's scope:

Module Unresolved symbols Root cause
channels/providers/web WebChatParams, required_string, optional_bool/f64/string/u64, json_output, compose_system_prompt_suffix, normalize_model_override, locale_reply_directive, provider_role_for_model_override, inference_budget_exceeded_user_message, is_inference_budget_exceeded_error (13) #4722 chat rework moved these into web/{schemas,session,types}.rs + web_errors.rs; the // Schema field helpers re-exported for tests block in web/mod.rs was left empty
config/schemas schemas (×4) lives in schema_defs.rs, not re-exported into the schemas test scope
config/schema/load EnvLookup, ACTION_DIR_ENV_VAR, MEMORY_SYNC_INTERVAL_SECS_ENV_VAR now in load/{env,dirs}.rs submodules
inference/provider StreamError in provider/traits.rs
mcp_server/tools list_tools_result_for_config in tools/specs.rs
memory/schema NAMESPACE in schema/definitions.rs
memory/chat DEFAULT_CLOUD_LLM_MODEL in config::schema
inference/.../ollama_admin interrupted_pull_settle_window_secs in ollama_admin/util.rs

Introduced by #4720 / #4722 / #4738. clippy doesn't catch it (cargo clippy -p openhuman skips test targets), so it only surfaces in the coverage lane — which is why it slipped onto main.

Solution

Restore the missing scope, matching each module's existing pattern:

  • web/mod.rs — fill in the empty "Schema field helpers re-exported for tests" block: pub(crate) use the 13 helpers from schemas / session / types / web_errors, gated #[cfg(any(test, debug_assertions))] with #[allow(unused_imports)] (identical to the adjacent web_errors re-export block).
  • config/schemas/mod.rs — add #[cfg(test)] use schema_defs::schemas; alongside the existing test re-exports.
  • the six remaining *_tests.rs — qualify each import to the submodule that now owns the symbol (e.g. use super::env::EnvLookup;, use super::specs::list_tools_result_for_config;).

No test bodies were changed; no tests removed.

Submission Checklist

  • Tests added or updated — N/A: this repairs the existing test suite so it compiles; no behaviour under test changes. The Rust Core Coverage lane going green is the verification.
  • Diff coverage ≥ 80% — N/A: changes are use/re-export statements (non-executable), excluded by diff-cover.
  • Coverage matrix updated — N/A: no feature added/removed/renamed.
  • All affected feature IDs listed — N/A.
  • No new external network dependencies introduced.
  • Manual smoke checklist updated — N/A: no user-facing change.
  • Linked issue closed — N/A: no tracking issue; this unblocks CI on main + the open PR queue.

Impact

Related


AI Authored PR Metadata

Commit & Branch

  • Branch: fix/lib-test-compile-drift
  • Base: main

Validation Run

  • pnpm --filter openhuman-app format:check — N/A: Rust-only change
  • pnpm typecheck — N/A: Rust-only change
  • Focused tests: N/A — import-only fix; verified by the CI Rust Core Coverage lane compiling the lib-test target
  • Rust fmt/check (if changed): see Validation Blocked
  • Tauri fmt/check (if changed): N/A — root core crate only

Validation Blocked

  • command: cargo test -p openhuman --lib / cargo llvm-cov
  • error: local builds are disabled on this worker (disk pressure); the fix is verified by inspection (every restored symbol's definition location is cited above) and by CI.
  • impact: low — re-export / import statements only; each restored name resolves to a confirmed pub/pub(crate) definition in the cited submodule.

Behavior Changes

  • Intended behavior change: none (test compile fix).
  • User-visible effect: none.

Parity Contract

  • Legacy behavior preserved: yes — no test bodies changed, no production code touched beyond adding #[cfg(test)]/#[cfg(any(test, debug_assertions))] re-exports.

Summary by CodeRabbit

  • Tests
    • Expanded unit tests for OpenHuman memory schema behavior, including namespace consistency and validation of unknown function and ingest schema inputs.
    • Improved test reliability by adding targeted imports across config loading, inference streaming, MCP tool listing, sandbox Docker policy checks, and local service helpers.
    • Added test/debug-only access to additional web-channel utilities and error helpers to support assertions around prompt/session behavior and inference-budget handling.

The lib-test target fails to compile on main (38 errors: E0405/E0425/E0432/
E0433), so the Rust Core Coverage CI lane is red — which blocks the coverage
gate on every open PR. Recent refactors (config schema tinyhumansai#4720, web chat rework
tinyhumansai#4722, orchestration tinyhumansai#4738) moved helpers into submodules or dropped the
re-exports the test modules rely on, without updating the tests.

Restore the missing imports/re-exports so the test target compiles again. No
test logic or production behaviour changes:

- channels/providers/web: re-export the 13 field/session/type/error helpers
  web_tests.rs pulls via use super::{..} (the 'Schema field helpers' block was
  left empty by tinyhumansai#4722).
- config/schemas: re-export schema_defs::schemas for schemas_tests.rs.
- config/schema/load, mcp_server/tools, memory/schema, inference/provider,
  inference/.../ollama_admin: qualify each test import to the submodule that
  now owns the symbol.
- memory/chat: import DEFAULT_CLOUD_LLM_MODEL from config::schema.
@M3gA-Mind M3gA-Mind requested a review from a team July 9, 2026 17:23
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a9cc16b7-1d63-472a-9b18-ddcaf3fda770

📥 Commits

Reviewing files that changed from the base of the PR and between b6245f3 and 6efa6a5.

📒 Files selected for processing (2)
  • src/openhuman/memory/tree_source/file.rs
  • src/openhuman/sandbox/docker.rs
✅ Files skipped from review due to trivial changes (1)
  • src/openhuman/memory/tree_source/file.rs

📝 Walkthrough

Walkthrough

This PR adds test/debug-only re-exports and missing test imports across several Rust modules, and introduces three new memory schema tests covering namespace consistency, error output shape, and ingest field requirements.

Changes

Test/debug support and schema validation

Layer / File(s) Summary
Test/debug import fixes
src/openhuman/channels/providers/web/mod.rs, src/openhuman/config/schema/load_tests.rs, src/openhuman/config/schemas/mod.rs, src/openhuman/inference/local/service/ollama_admin_tests.rs, src/openhuman/inference/provider/reliable_tests.rs, src/openhuman/mcp_server/tools_tests.rs, src/openhuman/memory/chat.rs, src/openhuman/memory/tree_source/file.rs, src/openhuman/sandbox/docker.rs
Adds cfg-gated re-exports and missing imports needed by existing test modules across web, config, inference, mcp server, memory, and sandbox code.
New memory schema unit tests
src/openhuman/memory/schema_tests.rs
Imports NAMESPACE and adds three tests covering controller/schema namespace sync, unknown function error output shape, and ingest schema required inputs.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: bug, rust-core

Poem

A rabbit hopped through crates so deep,
Fixing imports while others sleep. 🐇
Three new tests now stand on guard,
For namespace sync and ingest's shard.
Compile clean, no errors bite —
Thump-thump-thump, the build's alright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: restoring test-module imports and re-exports broken by recent refactors.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added bug rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. labels Jul 9, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 9, 2026
…dules

Second layer of the lib-test compile drift, previously masked behind the
first batch: sandbox/docker.rs tests use DockerOverrides (sandbox::types) and
memory/tree_source/file.rs tests use TreeKind/TreeStatus
(memory_store::trees::types) without importing them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant