Files
Lumotia/crates/llm/tests/smoke.rs
Jake ce6dc1e728
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled
agent: lumotia-rebrand — fix QC blockers for phase 2
Phase 2 QC found three explicit blockers + a broader sweep needed:

Explicit (QC-named):
- crates/mcp/src/lib.rs:15 — SERVER_NAME public MCP wire identity
- crates/transcription/build.rs:59 — panic message prefix
- crates/llm/tests/content_tags_smoke.rs:7 — docstring -p flag

Swept (string literals + dev env vars + doc comments + test fixtures):
- crates/mcp/src/main.rs — eprintln log prefixes
- src-tauri/src/commands/diagnostics.rs — diagnostic filename + MAGNOTIA_VERSION
- src-tauri/src/commands/audio.rs — recording filename pattern lumotia-<secs>-...wav
- src-tauri/src/commands/fs.rs — test placeholder path
- crates/transcription/src/model_manager.rs — .lumotia-verified marker
- crates/storage/src/database.rs — lumotia-storage-ro-<pid> temp dirs + doc comments
- crates/cloud-providers/src/keystore.rs — LUMOTIA_API_KEY_<PROVIDER> env var
- crates/audio/src/{wav,decode}.rs — lumotia_test_* / lumotia_decode_* test fixtures
- crates/core/src/tuning.rs — LUMOTIA_INFERENCE_THREADS env var
- All MAGNOTIA_LLM_TEST_MODEL / MAGNOTIA_WHISPER_TEST_* env vars
- Doc comments referencing crate names

Excluded (intentional Phase 4/5 scope):
- magnotia_preferences, magnotia_history, magnotia_morning_triage_last_shown
  DB setting keys (Phase 5 paths.rs migration)
- magnotia_startup tracing target (Phase 4)
- crates/core/src/paths.rs (Phase 5 wholesale rewrite + migration shim)

cargo build --workspace passes. cargo test --workspace: 330 pass, 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 08:52:47 +01:00

63 lines
1.8 KiB
Rust

//! Smoke test: load a GGUF model and exercise the high-level wrappers.
//!
//! Verified against llama-cpp-2 `0.1.144` using:
//! - `llama_backend::LlamaBackend`
//! - `model::LlamaModel`
//! - `context::params::LlamaContextParams`
//! - `sampling::LlamaSampler`
//!
//! The test is gated behind `LUMOTIA_LLM_TEST_MODEL`.
use std::env;
use std::path::PathBuf;
use lumotia_llm::LlmEngine;
use lumotia_llm::LlmModelId;
#[test]
fn llama_cpp_2_smoke_generates_and_wraps() {
let model_path = match env::var("LUMOTIA_LLM_TEST_MODEL") {
Ok(path) => PathBuf::from(path),
Err(_) => {
eprintln!("LUMOTIA_LLM_TEST_MODEL not set — skipping");
return;
}
};
let engine = LlmEngine::new();
engine
.load_model(LlmModelId::Qwen3_5_2B_Q4, &model_path, true)
.expect("load model");
let completion = engine
.generate(
"Write exactly one short greeting.",
&lumotia_llm::GenerationConfig {
max_tokens: 32,
temperature: 0.0,
stop_sequences: vec!["\n".to_string()],
grammar: None,
},
)
.expect("generate");
assert!(!completion.trim().is_empty());
let cleaned = engine
.cleanup_text(
"You are a transcript cleanup assistant. Remove fillers and output only cleaned text.",
"um hello there like general kenobi",
)
.expect("cleanup_text");
assert!(!cleaned.trim().is_empty());
let tasks = engine
.extract_tasks("I need to call the plumber tomorrow and buy milk.")
.expect("extract_tasks");
assert!(!tasks.is_empty());
let steps = engine
.decompose_task("Plan a weekend trip to the coast")
.expect("decompose_task");
assert!((3..=7).contains(&steps.len()));
}