Skip to content

fix(build): restore dropped #[cfg(test)] re-exports so the Rust libtest target compiles#4749

Closed
oxoxDev wants to merge 1 commit into
tinyhumansai:mainfrom
oxoxDev:fix/web-mod-test-reexports
Closed

fix(build): restore dropped #[cfg(test)] re-exports so the Rust libtest target compiles#4749
oxoxDev wants to merge 1 commit into
tinyhumansai:mainfrom
oxoxDev:fix/web-mod-test-reexports

Conversation

@oxoxDev

@oxoxDev oxoxDev commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Problem

#4720 / #4722 / #4725 restructured 10 modules into sub-modules but dropped the #[cfg(test)] re-export/import blocks that each module's test submodule (#[path] mod tests or inline mod tests, resolving via use super::* / super::…) depends on. The result is 37 cargo test --lib compile errors — e.g. in channels/providers/web:

error[E0432]: unresolved imports `super::compose_system_prompt_suffix`, `super::WebChatParams`, …
error[E0405]: cannot find trait `EnvLookup` in this scope
error[E0425]: cannot find value `MEMORY_SYNC_INTERVAL_SECS_ENV_VAR` / `ACTION_DIR_ENV_VAR`, function `schemas`

Because the libtest target compiles as one unit before test filtering, this blocks the rust-core-coverage job — and therefore the ≥80% diff-coverage merge gate — for all PRs, not just ones touching these modules. cargo check --lib (the product build) is unaffected; the breakage is test-only, which is why it slipped past the push checks (CI Full, which runs the full suite, only gates PRs targeting release).

Solution

For each of the 10 modules, restore the missing test-facing re-exports/imports in the module root, pointing at the sub-module that now defines the symbol. Every re-export is gated (#[cfg(test)], or #[cfg(any(test, debug_assertions))] + #[allow(unused_imports)] where a sibling uses that pattern) so nothing widens the non-test build or trips -D warnings.

Module Symbols restored Now defined in
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, optional_bool, optional_f64, optional_u64, json_output; inference_budget_exceeded_user_message, is_inference_budget_exceeded_error web/types.rs, web/session.rs, web/schemas.rs, web/web_errors.rs
config/schema/load/mod.rs EnvLookup; ACTION_DIR_ENV_VAR, MEMORY_SYNC_INTERVAL_SECS_ENV_VAR load/env.rs, load/dirs.rs
config/schemas/mod.rs schemas (fn) config/schemas/schema_defs.rs
inference/local/service/ollama_admin/mod.rs interrupted_pull_settle_window_secs ollama_admin/util.rs
inference/provider/reliable.rs StreamError inference/provider/traits.rs
mcp_server/tools/mod.rs list_tools_result_for_config mcp_server/tools/specs.rs
memory/chat.rs DEFAULT_CLOUD_LLM_MODEL config (storage_memory)
memory/schema/mod.rs NAMESPACE memory/schema/definitions.rs
memory/tree_source/file.rs TreeKind, TreeStatus memory_store/trees/types.rs
sandbox/docker.rs DockerOverrides sandbox/types.rs

No visibility changes were needed — every symbol was already pub/pub(crate).

Submission Checklist

  • Tests added or updated — N/A: restores compilation of existing tests; no behaviour change. The 37-error libtest target now compiles; the previously-broken web tests run (93 passed) and all restored modules' tests link again.
  • Diff coverage ≥ 80%N/A: changed lines are #[cfg(test)] re-export statements (no executable product lines to cover). This PR is what makes the coverage job runnable again for everyone.
  • Coverage matrix updated — N/A: build fix, no feature change
  • All affected feature IDs listed under ## RelatedN/A
  • No new external network dependencies introduced
  • Manual smoke checklist updated if release-cut surfaces touched — N/A: test-only re-exports
  • Linked issue closed via Closes #NNNN/A: no tracking issue; fixes the main-branch libtest regression from #4720/#4722/#4725

Impact

  • CI: cargo test --lib --no-run goes from 37 errors → clean (Finished in ~4m); unblocks rust-core-coverage / the coverage gate for every open PR.
  • Product: none — all changes are #[cfg(test)]-gated re-exports; release builds are byte-identical.
  • Risk: minimal — additive, test-gated, no product or test logic touched.

Validation

  • cargo test --lib --no-runcompiles clean, 0 errors (was 37)
  • cargo check --lib → clean · cargo fmt --check → clean · cargo clippy --lib → no new warnings
  • Ran the previously-broken web tests: 93 passed, 0 failed, 0 ignored

Related

Summary by CodeRabbit

  • New Features

    • Added a new public tools helper, making it easier for clients to list available tools from the server layer.
  • Bug Fixes

    • Improved module compatibility after refactoring by restoring several test/debug-only exports and imports.
    • Cleaned up re-export structure in the web channel provider without changing behavior.
    • Expanded test coverage support across config, memory, inference, and sandbox modules to keep validation working smoothly.

…compiles

The orchestration merge (tinyhumansai#4720/tinyhumansai#4722/tinyhumansai#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
@oxoxDev oxoxDev requested a review from a team July 9, 2026 14:22
@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: 0c5e4def-5e27-46ff-bf79-c88118fa78a6

📥 Commits

Reviewing files that changed from the base of the PR and between 7659c75 and 82d1729.

📒 Files selected for processing (10)
  • src/openhuman/channels/providers/web/mod.rs
  • src/openhuman/config/schema/load/mod.rs
  • src/openhuman/config/schemas/mod.rs
  • src/openhuman/inference/local/service/ollama_admin/mod.rs
  • src/openhuman/inference/provider/reliable.rs
  • src/openhuman/mcp_server/tools/mod.rs
  • src/openhuman/memory/chat.rs
  • src/openhuman/memory/schema/mod.rs
  • src/openhuman/memory/tree_source/file.rs
  • src/openhuman/sandbox/docker.rs

📝 Walkthrough

Walkthrough

This PR adds cfg(test) or cfg(any(test, debug_assertions))-gated re-exports and imports across ten Rust files (web channels, config schemas, inference, mcp_server, memory, sandbox) to restore symbol visibility for test submodules after module splits, plus one permanent public re-export and a formatting-only change.

Changes

Test visibility restoration

Layer / File(s) Summary
Web channel provider re-exports
src/openhuman/channels/providers/web/mod.rs
Reformats the web_errors re-export to multi-line and adds a cfg(any(test, debug_assertions)) block re-exporting schema helpers, session/prompt helpers, and WebChatParams.
Config schema/schemas re-exports
src/openhuman/config/schema/load/mod.rs, src/openhuman/config/schemas/mod.rs
Adds cfg(test) re-exports of env var constants, EnvLookup, and schemas for test module access.
Inference module test imports
src/openhuman/inference/local/service/ollama_admin/mod.rs, src/openhuman/inference/provider/reliable.rs
Adds cfg(test) re-export of interrupted_pull_settle_window_secs and import of StreamError.
MCP tools public re-export
src/openhuman/mcp_server/tools/mod.rs
Adds a permanent public re-export of specs::list_tools_result_for_config.
Memory module test imports
src/openhuman/memory/chat.rs, src/openhuman/memory/schema/mod.rs, src/openhuman/memory/tree_source/file.rs
Adds cfg(test) imports/re-exports of DEFAULT_CLOUD_LLM_MODEL, NAMESPACE, TreeKind, and TreeStatus.
Sandbox docker test import
src/openhuman/sandbox/docker.rs
Restricts DockerOverrides import to cfg(test) only.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • tinyhumansai/openhuman#4501: Overlaps with load_tests.rs assertions and env locking related to the same config schema test file touched here.

Suggested labels: rust-core, bug

Suggested reviewers: sanil-23, M3gA-Mind

Poem

A rabbit hops through modules split,
Restoring paths that tests once knit,
cfg(test) tags like carrot seeds,
Grown just where the checker needs,
Hop, compile, and pass — hooray! 🐇✨

🚥 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 clearly matches the main change: restoring dropped test-only re-exports/imports so libtest compiles again.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
@oxoxDev

oxoxDev commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #4759 (merged 2026-07-09, @M3gA-Mind), which restores the same 10 test modules' imports. Closing as duplicate — main's libtest target is fixed there. Thanks @M3gA-Mind.

@oxoxDev oxoxDev closed this Jul 9, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in Team Openhuman Jul 9, 2026
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