test(rust): expand coverage for state, threads, and channel prompts#1969
Conversation
📝 WalkthroughWalkthroughThis PR adds comprehensive test coverage across multiple functional modules: app-state filesystem and identity operations, config settings normalization with trimming, channel routing and model switching, context configuration and prompt building, memory store operations, thread title generation and lifecycle, and end-to-end integration scenarios. One behavior change normalizes whitespace handling in settings. ChangesTest Coverage Expansion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/openhuman/config/ops_tests.rs (1)
845-855: ⚡ Quick winAssert all provider fields in the set-phase.
Right now the set-phase only verifies a subset of provider fields. If trimming regresses for
agentic_provider,coding_provider,memory_provider,embeddings_provider,heartbeat_provider, orlearning_provider, this test can still pass because the clear-phase assertsNonefor all fields.Suggested assertion additions
assert_eq!(cfg.primary_cloud.as_deref(), Some("provider-a")); assert_eq!( cfg.reasoning_provider.as_deref(), Some("provider-reasoning") ); + assert_eq!(cfg.agentic_provider.as_deref(), Some("provider-agentic")); + assert_eq!(cfg.coding_provider.as_deref(), Some("provider-coding")); + assert_eq!(cfg.memory_provider.as_deref(), Some("provider-memory")); + assert_eq!(cfg.embeddings_provider.as_deref(), Some("provider-embed")); + assert_eq!(cfg.heartbeat_provider.as_deref(), Some("provider-heartbeat")); + assert_eq!(cfg.learning_provider.as_deref(), Some("provider-learning")); assert_eq!(cfg.subconscious_provider.as_deref(), Some("provider-sub"));🤖 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/ops_tests.rs` around lines 845 - 855, The set-phase assertions currently check only inference_url, primary_cloud, reasoning_provider, and subconscious_provider on cfg; extend that block to assert that cfg.agentic_provider, cfg.coding_provider, cfg.memory_provider, cfg.embeddings_provider, cfg.heartbeat_provider, and cfg.learning_provider (using as_deref() and Some("<expected>")) are set to the expected provider strings so regressions trimming those fields will fail the test; locate the existing assertions around cfg.inference_url / cfg.primary_cloud / cfg.reasoning_provider / cfg.subconscious_provider and add analogous assert_eq! lines for each of the listed provider fields.
🤖 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/ops_tests.rs`:
- Around line 845-855: The set-phase assertions currently check only
inference_url, primary_cloud, reasoning_provider, and subconscious_provider on
cfg; extend that block to assert that cfg.agentic_provider, cfg.coding_provider,
cfg.memory_provider, cfg.embeddings_provider, cfg.heartbeat_provider, and
cfg.learning_provider (using as_deref() and Some("<expected>")) are set to the
expected provider strings so regressions trimming those fields will fail the
test; locate the existing assertions around cfg.inference_url /
cfg.primary_cloud / cfg.reasoning_provider / cfg.subconscious_provider and add
analogous assert_eq! lines for each of the listed provider fields.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b94f822f-91b7-4d2a-a3fb-64a655419729
📒 Files selected for processing (9)
src/openhuman/app_state/ops_tests.rssrc/openhuman/channels/routes_tests.rssrc/openhuman/config/ops.rssrc/openhuman/config/ops_tests.rssrc/openhuman/context/channels_prompt.rssrc/openhuman/context/manager_tests.rssrc/openhuman/memory/conversations/store_tests.rssrc/openhuman/threads/ops_tests.rstests/json_rpc_e2e.rs
Summary
app_state,threads,config,context, and memory conversation-store edge cases.app_state_update_local_statesnapshot round-trips and the current thread-title fallback path.config.primary_cloudtrimming to match the rest of the provider-selector settings.Problem
Solution
*_tests.rsfiles for the affected domains instead of widening the runtime surface.primary_cloudtrimming so provider-selector normalization is coherent across config update paths.Submission Checklist
diff-cover) meet the gate enforced by.github/workflows/coverage.yml. Runpnpm test:coverageandpnpm test:rustlocally; PRs below 80% on changed lines will not merge. N/A: full merged diff-cover could not be re-run locally because unrelated existing test failures blocked a completecargo llvm-covpass, but the changed Rust slices and JSON-RPC additions were validated directly.docs/TEST-COVERAGE-MATRIX.mdreflect this change (orN/A: behaviour-only change) N/A: behaviour-only test coverage change.## RelatedN/A: no matrix row changes; targeted coverage only.docs/RELEASE-MANUAL-SMOKE.md) N/A: test-only/core-config coverage work, no release-cut UI surface change.Closes #NNNin the## Relatedsection N/A: no linked GitHub issue was provided for this branch.Impact
primary_cloudnow trims surrounding whitespace on update.Related
threads_generate_title; the current minimal JSON-RPC config still falls back before mock completions are hit.cargo llvm-cov/ diff-cover pass once unrelated suite failures are addressed.AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
test/smarter-mock-harness-coveragea0026ea9Validation Run
pnpm --filter openhuman-app format:checkpnpm typecheckcargo test --lib --no-runcargo test --lib 'openhuman::app_state::ops::tests::'cargo test --lib 'openhuman::threads::ops::tests::'cargo test --lib 'openhuman::context::manager::tests::'cargo test --lib 'openhuman::config::ops::tests::'cargo test --lib 'openhuman::context::channels_prompt::tests::'cargo test --lib 'openhuman::channels::routes::tests::'cargo test --test json_rpc_e2e json_rpc_thread_generate_title_falls_back_when_provider_path_is_unavailablecargo test --test json_rpc_e2e json_rpc_app_state_update_local_state_round_trips_into_snapshotcargo fmt --manifest-path Cargo.toml --all --checkcargo check --manifest-path app/src-tauri/Cargo.toml(via push hookpnpm rust:check)Validation Blocked
command:LLVM_COV=$HOME/.rustup/toolchains/1.93.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin/llvm-cov LLVM_PROFDATA=$HOME/.rustup/toolchains/1.93.0-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin/llvm-profdata cargo llvm-cov --lib --json --output-path /tmp/openhuman-lib-cov.jsonerror:unrelated existing failures inopenhuman::channels::tests::runtime_dispatch::message_dispatch_processes_messages_in_parallel,openhuman::composio::ops::tests::composio_sync_gmail_via_mock_archives_raw_email_and_updates_outcome,openhuman::local_ai::paths::tests::resolve_tts_voice_path_appends_onnx_for_voice_ids,openhuman::local_ai::service::ollama_admin::*, andopenhuman::meet_agent::rpc::tests::push_then_poll_returns_audio_after_brain_turnimpact:full repo-wide llvm-cov/diff-cover could not be completed locally; changed slices were validated directly instead.Behavior Changes
config.primary_cloudnow trims surrounding whitespace when updated.Parity Contract
Duplicate / Superseded PR Handling
Summary by CodeRabbit
Bug Fixes
Tests