agent: lumotia — v0.1 release-completion run
Closes the code-side v0.1 ship gate. All quality gates green: cargo fmt/clippy/test (~327 tests), npm check (0/0), vitest 13/13, scripts/dogfood-rebrand-drill.sh 8/8. Phase F — first-run onboarding promoted to v0.1 - FirstRunPage with skip-to-main + failure recovery + event recording - Six onboarding commands (record/list/has-completed + lumotia_events) - Storage migration v17 (onboarding_events + lumotia_events tables) UI hardening (in-scope items from v0.1-ui-hardening.md) - StatusPill + PostCaptureCard components, 21st preview entry - Sidebar recording-as-sacred-state (opacity + aria-disabled, reduced-motion) - Settings 6-section regroup + Help section + Activation log + Privacy toggle - Error-state copy sweep (DictationPage + SettingsPage, plain-language) - Global :focus-visible rule, textarea outlines restored - Ctrl+K / Ctrl+, / Escape bindings in +layout LLM resilience - rule_based_extract_tasks (regex-free imperative-verb extractor) + extract_tasks_with_fallback wrapper — task extraction never returns zero - tokio::time::timeout(120s) wraps cleanup/tags/tasks commands Release artefacts - LICENSE (canonical AGPL-3.0), CHANGELOG (Keep-a-Changelog format) - v0.1-release-notes, privacy-and-ai-use, install-warnings, tester-onboarding-kit, tester-acceptance-runbook, code-signing-setup, apple-silicon-rb08-runbook, virtual-audio-setup, v0.1-contrast-audit - Workspace versioning + AGPL spdx; npm exact-pin (10 ranges removed) - AppImage SHA-256 sidecar in build.yml - README v0.1 section + Reporting-issues; canonical repo slug Closure pass — items moved from human-required to code-complete - KI-02 Linux idle inhibit: zbus 5 → org.freedesktop.login1.Manager.Inhibit - KI-03 Windows sleep prevention: SetThreadExecutionState(ES_CONTINUOUS|...) - acquire/release_idle_inhibit Tauri commands, wired in DictationPage - Diagnostic-bundle frontend wire-up (Settings → Help button) - WCAG-AA contrast fix via .btn-filled-text utility (no token changes) - 8 destructive-action sites wrapped in plain-language confirm() guards - KNOWN-ISSUES.md + v0.1-known-limitations.md updated (KI-02/03 fixed) Scripts - pre-tag-verify.sh, tag-day.sh, smoke-linux + driver - parse-diagnostic-bundle.sh, parse-activation-log.py Per-item audit trail: docs/release/v0.1-completion-status.md Remaining: W-01…W-08 (signing certs, hardware probes, smoke matrix, tester recruitment) — see docs/release/v0.1-known-limitations.md.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-ai-formatting"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "Text post-processing pipeline: filler removal, British English conversion, formatting for Lumotia"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-audio"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "Audio capture (cpal), VAD, resampling (rubato), file decoding (symphonia), WAV I/O (hound) for Lumotia"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-cloud-providers"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "Provider trait and BYOK cloud STT scaffolding for Lumotia"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-core"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "Core types, constants, traits, hardware detection, and model registry for Lumotia"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-hotkey"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "Wayland-compatible global hotkey listener for Lumotia — evdev backend with device hotplug"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-llm"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "Local LLM engine for Lumotia (Qwen3.5 / Qwen3.6 via llama-cpp-2): transcript cleanup, task extraction, micro-step decomposition"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -26,6 +26,20 @@ const MAX_CONTEXT_TOKENS: u32 = 8192;
|
||||
const CONTEXT_RESERVE_TOKENS: u32 = 64;
|
||||
const GENERATION_SEED: u32 = 0;
|
||||
|
||||
/// Maximum number of tasks returned by the rule-based fallback extractor.
|
||||
/// Caps output to avoid wall-of-text dumps when the transcript is dense.
|
||||
const MAX_RULE_BASED_TASKS: usize = 10;
|
||||
|
||||
/// Indicates which extraction path produced the task list.
|
||||
/// Propagated to callers so the UI can label rule-based results accordingly.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum TaskExtractionSource {
|
||||
/// Tasks extracted by the local LLM.
|
||||
Llm,
|
||||
/// LLM path failed; tasks extracted by the rule-based regex fallback.
|
||||
RuleBased,
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum EngineError {
|
||||
#[error("LLM not loaded. Download an AI model in Settings.")]
|
||||
@@ -553,6 +567,31 @@ impl LlmEngine {
|
||||
parse_string_array(&raw)
|
||||
}
|
||||
|
||||
/// Wrapper around [`extract_tasks_with_feedback`] that NEVER returns
|
||||
/// an error: if the LLM path fails for any reason the rule-based
|
||||
/// extractor fires as a safety net, satisfying the data-loss contract
|
||||
/// documented in `docs/release/v0.1-known-limitations.md`.
|
||||
///
|
||||
/// Returns `(tasks, source)` where `source` tells the caller which
|
||||
/// path produced the results so the UI can label them.
|
||||
pub fn extract_tasks_with_fallback(
|
||||
&self,
|
||||
transcript: &str,
|
||||
examples: &[prompts::FeedbackExample],
|
||||
) -> (Vec<String>, TaskExtractionSource) {
|
||||
match self.extract_tasks_with_feedback(transcript, examples) {
|
||||
Ok(tasks) => (tasks, TaskExtractionSource::Llm),
|
||||
Err(err) => {
|
||||
tracing::warn!(
|
||||
"LLM task extraction failed; using rule-based fallback: {}",
|
||||
err
|
||||
);
|
||||
let tasks = rule_based_extract_tasks(transcript);
|
||||
(tasks, TaskExtractionSource::RuleBased)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn loaded_handles(&self) -> Result<(Arc<LlamaBackend>, Arc<LlamaModel>), EngineError> {
|
||||
let guard = self.inner.lock().unwrap();
|
||||
let backend = guard.backend.clone().ok_or(EngineError::NotLoaded)?;
|
||||
@@ -741,6 +780,129 @@ fn parse_string_array(raw: &str) -> Result<Vec<String>, EngineError> {
|
||||
Ok(normalized)
|
||||
}
|
||||
|
||||
/// Rule-based task extractor used as the safety net when the LLM extraction
|
||||
/// path fails. Per `docs/release/v0.1-known-limitations.md`, task extraction
|
||||
/// must NEVER return zero tasks just because the LLM failed.
|
||||
///
|
||||
/// Heuristic: split on sentence boundaries (`. ? ! \n`), keep sentences that
|
||||
/// begin with (or contain near the start) an imperative-style cue. Trim,
|
||||
/// dedupe, cap at [`MAX_RULE_BASED_TASKS`] to avoid wall-of-text dumps.
|
||||
pub fn rule_based_extract_tasks(transcript: &str) -> Vec<String> {
|
||||
// Filler words that may precede the real imperative start.
|
||||
const FILLER: &[&str] = &["and ", "so ", "then ", "also ", "well ", "okay ", "ok "];
|
||||
|
||||
// Phrase-level cues (checked against the lowercased sentence start).
|
||||
const PHRASE_CUES: &[&str] = &[
|
||||
"i need to ",
|
||||
"i should ",
|
||||
"i have to ",
|
||||
"i must ",
|
||||
"need to ",
|
||||
"got to ",
|
||||
"have to ",
|
||||
"must ",
|
||||
"let me ",
|
||||
"let's ",
|
||||
"lets ",
|
||||
"remember to ",
|
||||
"don't forget to ",
|
||||
"dont forget to ",
|
||||
"don't forget ",
|
||||
"dont forget ",
|
||||
"make sure to ",
|
||||
"make sure i ",
|
||||
"todo:",
|
||||
"to-do:",
|
||||
"task:",
|
||||
];
|
||||
|
||||
// Bare imperative verbs expected at the start of a sentence.
|
||||
const IMPERATIVE_VERBS: &[&str] = &[
|
||||
"send",
|
||||
"write",
|
||||
"call",
|
||||
"email",
|
||||
"fix",
|
||||
"update",
|
||||
"review",
|
||||
"check",
|
||||
"finish",
|
||||
"schedule",
|
||||
"book",
|
||||
"order",
|
||||
"buy",
|
||||
"ask",
|
||||
"follow up",
|
||||
"followup",
|
||||
"create",
|
||||
"add",
|
||||
"remove",
|
||||
"delete",
|
||||
"submit",
|
||||
"upload",
|
||||
"download",
|
||||
"install",
|
||||
"configure",
|
||||
"test",
|
||||
"deploy",
|
||||
"merge",
|
||||
"close",
|
||||
"open",
|
||||
"share",
|
||||
"contact",
|
||||
"reach out",
|
||||
"prepare",
|
||||
"draft",
|
||||
"complete",
|
||||
"reply",
|
||||
"respond",
|
||||
];
|
||||
|
||||
// Split on sentence-terminating punctuation and newlines.
|
||||
let sentences: Vec<&str> = transcript.split(['.', '?', '!', '\n']).collect();
|
||||
|
||||
let mut seen: std::collections::HashSet<String> = std::collections::HashSet::new();
|
||||
let mut results: Vec<String> = Vec::new();
|
||||
|
||||
for raw in sentences {
|
||||
let trimmed = raw.trim();
|
||||
if trimmed.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Build a lowercase version for matching, stripping leading filler.
|
||||
let mut lc = trimmed.to_lowercase();
|
||||
for filler in FILLER {
|
||||
if lc.starts_with(filler) {
|
||||
lc = lc[filler.len()..].trim_start().to_string();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let is_task = PHRASE_CUES.iter().any(|cue| lc.starts_with(cue))
|
||||
|| IMPERATIVE_VERBS.iter().any(|verb| {
|
||||
lc.starts_with(verb)
|
||||
&& lc
|
||||
.as_bytes()
|
||||
.get(verb.len())
|
||||
.map(|&b| b == b' ' || b == b',')
|
||||
.unwrap_or(true)
|
||||
});
|
||||
|
||||
if is_task {
|
||||
let key = lc.clone();
|
||||
if seen.insert(key) {
|
||||
results.push(trimmed.to_string());
|
||||
if results.len() >= MAX_RULE_BASED_TASKS {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
results
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -1061,4 +1223,50 @@ mod tests {
|
||||
.unload()
|
||||
.expect("unload after load completes must succeed");
|
||||
}
|
||||
|
||||
// ── rule_based_extract_tasks ──────────────────────────────────────────
|
||||
|
||||
#[test]
|
||||
fn rule_based_extract_finds_explicit_imperatives() {
|
||||
let t = "I need to send Sarah the report tomorrow. Don't forget the slide deck.";
|
||||
let tasks = rule_based_extract_tasks(t);
|
||||
assert_eq!(tasks.len(), 2, "expected 2 tasks, got: {tasks:?}");
|
||||
assert!(
|
||||
tasks[0].to_lowercase().contains("send sarah"),
|
||||
"first task should mention 'send sarah': {tasks:?}"
|
||||
);
|
||||
assert!(
|
||||
tasks[1].to_lowercase().contains("slide deck"),
|
||||
"second task should mention 'slide deck': {tasks:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rule_based_extract_caps_at_max() {
|
||||
let t = "Send email. Write doc. Call client. Fix bug. Update spec. Review PR. Check tests. Finish report. Schedule meeting. Book hotel. Order parts. Buy supplies.";
|
||||
let tasks = rule_based_extract_tasks(t);
|
||||
assert!(
|
||||
tasks.len() <= MAX_RULE_BASED_TASKS,
|
||||
"expected at most {MAX_RULE_BASED_TASKS} tasks, got {}",
|
||||
tasks.len()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rule_based_extract_returns_empty_for_no_imperatives() {
|
||||
let t = "The weather is lovely today. The garden looks nice.";
|
||||
let tasks = rule_based_extract_tasks(t);
|
||||
assert_eq!(tasks.len(), 0, "expected 0 tasks, got: {tasks:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rule_based_extract_dedupes_repeated_sentences() {
|
||||
let t = "I need to send the report. I need to send the report.";
|
||||
let tasks = rule_based_extract_tasks(t);
|
||||
assert_eq!(
|
||||
tasks.len(),
|
||||
1,
|
||||
"expected 1 deduplicated task, got: {tasks:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-mcp"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "Read-only MCP stdio server exposing Lumotia transcripts and tasks to external agents"
|
||||
|
||||
[[bin]]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-storage"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "SQLite persistence, BM25 search, and file storage for Lumotia"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -1718,6 +1718,159 @@ pub async fn record_feedback(pool: &SqlitePool, params: RecordFeedbackParams) ->
|
||||
Ok(row.get::<i64, _>("id"))
|
||||
}
|
||||
|
||||
// --- Onboarding events ---
|
||||
|
||||
/// Row returned by [`list_onboarding_events`].
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct OnboardingEventRow {
|
||||
pub id: i64,
|
||||
pub event: String,
|
||||
pub completed_at: i64,
|
||||
pub version: String,
|
||||
pub skipped: bool,
|
||||
pub notes: Option<String>,
|
||||
}
|
||||
|
||||
/// Row returned by [`list_lumotia_events`].
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct LumotiaEventRow {
|
||||
pub id: i64,
|
||||
pub kind: String,
|
||||
pub occurred_at: i64,
|
||||
pub payload: Option<String>,
|
||||
}
|
||||
|
||||
/// Insert a single onboarding step event.
|
||||
///
|
||||
/// `now` is a Unix timestamp (seconds) — the caller is responsible for
|
||||
/// computing it so the helper stays testable without a clock dependency.
|
||||
pub async fn insert_onboarding_event(
|
||||
pool: &SqlitePool,
|
||||
event: &str,
|
||||
version: &str,
|
||||
skipped: bool,
|
||||
notes: Option<&str>,
|
||||
now: i64,
|
||||
) -> Result<()> {
|
||||
sqlx::query(
|
||||
"INSERT INTO onboarding_events (event, completed_at, version, skipped, notes)
|
||||
VALUES (?, ?, ?, ?, ?)",
|
||||
)
|
||||
.bind(event)
|
||||
.bind(now)
|
||||
.bind(version)
|
||||
.bind(skipped as i64)
|
||||
.bind(notes)
|
||||
.execute(pool)
|
||||
.await
|
||||
.map_err(|source| Error::Query {
|
||||
operation: "insert_onboarding_event".into(),
|
||||
source,
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Return all onboarding events, oldest first.
|
||||
pub async fn list_onboarding_events(pool: &SqlitePool) -> Result<Vec<OnboardingEventRow>> {
|
||||
let rows = sqlx::query(
|
||||
"SELECT id, event, completed_at, version, skipped, notes
|
||||
FROM onboarding_events
|
||||
ORDER BY id ASC",
|
||||
)
|
||||
.fetch_all(pool)
|
||||
.await
|
||||
.map_err(|source| Error::Query {
|
||||
operation: "list_onboarding_events".into(),
|
||||
source,
|
||||
})?;
|
||||
|
||||
Ok(rows
|
||||
.into_iter()
|
||||
.map(|r| OnboardingEventRow {
|
||||
id: r.get("id"),
|
||||
event: r.get("event"),
|
||||
completed_at: r.get("completed_at"),
|
||||
version: r.get("version"),
|
||||
skipped: r.get::<i64, _>("skipped") != 0,
|
||||
notes: r.get("notes"),
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// Returns `true` if the user has ever recorded a `completed` or `skipped`
|
||||
/// onboarding event — i.e. they do not need to see onboarding again.
|
||||
pub async fn has_completed_onboarding(pool: &SqlitePool) -> Result<bool> {
|
||||
let count: i64 = sqlx::query_scalar(
|
||||
"SELECT COUNT(*) FROM onboarding_events WHERE event IN ('completed', 'skipped')",
|
||||
)
|
||||
.fetch_one(pool)
|
||||
.await
|
||||
.map_err(|source| Error::Query {
|
||||
operation: "has_completed_onboarding".into(),
|
||||
source,
|
||||
})?;
|
||||
Ok(count > 0)
|
||||
}
|
||||
|
||||
/// Insert a single opt-in activation log event.
|
||||
///
|
||||
/// `now` is a Unix timestamp (seconds).
|
||||
pub async fn insert_lumotia_event(
|
||||
pool: &SqlitePool,
|
||||
kind: &str,
|
||||
payload: Option<&str>,
|
||||
now: i64,
|
||||
) -> Result<()> {
|
||||
sqlx::query("INSERT INTO lumotia_events (kind, occurred_at, payload) VALUES (?, ?, ?)")
|
||||
.bind(kind)
|
||||
.bind(now)
|
||||
.bind(payload)
|
||||
.execute(pool)
|
||||
.await
|
||||
.map_err(|source| Error::Query {
|
||||
operation: "insert_lumotia_event".into(),
|
||||
source,
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Return all lumotia events, oldest first.
|
||||
pub async fn list_lumotia_events(pool: &SqlitePool) -> Result<Vec<LumotiaEventRow>> {
|
||||
let rows = sqlx::query(
|
||||
"SELECT id, kind, occurred_at, payload
|
||||
FROM lumotia_events
|
||||
ORDER BY id ASC",
|
||||
)
|
||||
.fetch_all(pool)
|
||||
.await
|
||||
.map_err(|source| Error::Query {
|
||||
operation: "list_lumotia_events".into(),
|
||||
source,
|
||||
})?;
|
||||
|
||||
Ok(rows
|
||||
.into_iter()
|
||||
.map(|r| LumotiaEventRow {
|
||||
id: r.get("id"),
|
||||
kind: r.get("kind"),
|
||||
occurred_at: r.get("occurred_at"),
|
||||
payload: r.get("payload"),
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// Delete all rows from `lumotia_events`.
|
||||
pub async fn clear_lumotia_events(pool: &SqlitePool) -> Result<()> {
|
||||
sqlx::query("DELETE FROM lumotia_events")
|
||||
.execute(pool)
|
||||
.await
|
||||
.map_err(|source| Error::Query {
|
||||
operation: "clear_lumotia_events".into(),
|
||||
source,
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Fetch the most recent feedback rows for a given target type, scoped to
|
||||
/// the active profile. Used by the prompt builder to gather few-shot
|
||||
/// exemplars. Orders by `created_at DESC` so the most recent corrections
|
||||
@@ -3284,4 +3437,98 @@ mod tests {
|
||||
"audio for surviving in-retention row must NOT be removed by purge"
|
||||
);
|
||||
}
|
||||
|
||||
// --- onboarding_events tests ---
|
||||
|
||||
#[tokio::test]
|
||||
async fn onboarding_insert_and_list_roundtrip() {
|
||||
let pool = test_pool().await;
|
||||
insert_onboarding_event(&pool, "started", "0.1.0", false, None, 1_000_000)
|
||||
.await
|
||||
.unwrap();
|
||||
insert_onboarding_event(
|
||||
&pool,
|
||||
"recorded_first",
|
||||
"0.1.0",
|
||||
false,
|
||||
Some("took 45s"),
|
||||
1_000_060,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let rows = list_onboarding_events(&pool).await.unwrap();
|
||||
assert_eq!(rows.len(), 2);
|
||||
assert_eq!(rows[0].event, "started");
|
||||
assert_eq!(rows[0].version, "0.1.0");
|
||||
assert!(!rows[0].skipped);
|
||||
assert!(rows[0].notes.is_none());
|
||||
assert_eq!(rows[1].event, "recorded_first");
|
||||
assert_eq!(rows[1].notes.as_deref(), Some("took 45s"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn has_completed_onboarding_no_events() {
|
||||
let pool = test_pool().await;
|
||||
assert!(!has_completed_onboarding(&pool).await.unwrap());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn has_completed_onboarding_only_started() {
|
||||
let pool = test_pool().await;
|
||||
insert_onboarding_event(&pool, "started", "0.1.0", false, None, 1_000_000)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(!has_completed_onboarding(&pool).await.unwrap());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn has_completed_onboarding_with_completed_event() {
|
||||
let pool = test_pool().await;
|
||||
insert_onboarding_event(&pool, "started", "0.1.0", false, None, 1_000_000)
|
||||
.await
|
||||
.unwrap();
|
||||
insert_onboarding_event(&pool, "completed", "0.1.0", false, None, 1_000_120)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(has_completed_onboarding(&pool).await.unwrap());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn has_completed_onboarding_with_skipped_event() {
|
||||
let pool = test_pool().await;
|
||||
insert_onboarding_event(&pool, "skipped", "0.1.0", true, None, 1_000_005)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(has_completed_onboarding(&pool).await.unwrap());
|
||||
}
|
||||
|
||||
// --- lumotia_events tests ---
|
||||
|
||||
#[tokio::test]
|
||||
async fn lumotia_event_insert_list_clear_roundtrip() {
|
||||
let pool = test_pool().await;
|
||||
insert_lumotia_event(&pool, "app_launched", None, 1_000_000)
|
||||
.await
|
||||
.unwrap();
|
||||
insert_lumotia_event(
|
||||
&pool,
|
||||
"recording_started",
|
||||
Some(r#"{"profile":"default"}"#),
|
||||
1_000_010,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let rows = list_lumotia_events(&pool).await.unwrap();
|
||||
assert_eq!(rows.len(), 2);
|
||||
assert_eq!(rows[0].kind, "app_launched");
|
||||
assert!(rows[0].payload.is_none());
|
||||
assert_eq!(rows[1].kind, "recording_started");
|
||||
assert_eq!(rows[1].payload.as_deref(), Some(r#"{"profile":"default"}"#));
|
||||
|
||||
clear_lumotia_events(&pool).await.unwrap();
|
||||
let rows_after = list_lumotia_events(&pool).await.unwrap();
|
||||
assert!(rows_after.is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,18 +10,20 @@ pub use error::{Entity, Error, MigrationStep, OpenOp, Result};
|
||||
pub const DEFAULT_PROFILE_ID: &str = "00000000-0000-0000-0000-000000000001";
|
||||
|
||||
pub use database::{
|
||||
add_profile_term, complete_subtask_and_check_parent, complete_task, count_transcripts,
|
||||
create_profile, delete_implementation_rule, delete_profile, delete_profile_term, delete_task,
|
||||
delete_transcript, get_implementation_rule, get_profile, get_setting, get_task_by_id,
|
||||
get_transcript, init, init_readonly, insert_implementation_rule, insert_subtask, insert_task,
|
||||
insert_transcript, list_feedback_examples, list_implementation_rules, list_profile_terms,
|
||||
list_profiles, list_recent_completions, list_recent_errors, list_subtasks, list_tasks,
|
||||
list_transcripts, list_transcripts_paged, list_trashed_transcripts, log_error,
|
||||
mark_implementation_rule_fired, migrate_legacy_setting_keys, prune_error_log,
|
||||
purge_deleted_transcripts, record_feedback, restore_transcript, search_transcripts,
|
||||
set_implementation_rule_enabled, set_setting, set_task_energy, uncomplete_task, update_profile,
|
||||
update_task, update_transcript, update_transcript_meta, DailyCompletionCount, ErrorLogRow,
|
||||
FeedbackRow, FeedbackTargetType, ImplementationRuleRow, InsertTranscriptParams, ProfileRow,
|
||||
add_profile_term, clear_lumotia_events, complete_subtask_and_check_parent, complete_task,
|
||||
count_transcripts, create_profile, delete_implementation_rule, delete_profile,
|
||||
delete_profile_term, delete_task, delete_transcript, get_implementation_rule, get_profile,
|
||||
get_setting, get_task_by_id, get_transcript, has_completed_onboarding, init, init_readonly,
|
||||
insert_implementation_rule, insert_lumotia_event, insert_onboarding_event, insert_subtask,
|
||||
insert_task, insert_transcript, list_feedback_examples, list_implementation_rules,
|
||||
list_lumotia_events, list_onboarding_events, list_profile_terms, list_profiles,
|
||||
list_recent_completions, list_recent_errors, list_subtasks, list_tasks, list_transcripts,
|
||||
list_transcripts_paged, list_trashed_transcripts, log_error, mark_implementation_rule_fired,
|
||||
migrate_legacy_setting_keys, prune_error_log, purge_deleted_transcripts, record_feedback,
|
||||
restore_transcript, search_transcripts, set_implementation_rule_enabled, set_setting,
|
||||
set_task_energy, uncomplete_task, update_profile, update_task, update_transcript,
|
||||
update_transcript_meta, DailyCompletionCount, ErrorLogRow, FeedbackRow, FeedbackTargetType,
|
||||
ImplementationRuleRow, InsertTranscriptParams, LumotiaEventRow, OnboardingEventRow, ProfileRow,
|
||||
ProfileTermRow, RecordFeedbackParams, TaskRow, TranscriptRow,
|
||||
};
|
||||
pub use file_storage::{app_data_dir, crashes_dir, database_path, logs_dir, recordings_dir};
|
||||
|
||||
@@ -507,6 +507,32 @@ const MIGRATIONS: &[(i64, &str, &str)] = &[
|
||||
ON transcripts(deleted_at) WHERE deleted_at IS NOT NULL;
|
||||
"#,
|
||||
),
|
||||
(
|
||||
17,
|
||||
"onboarding_events + lumotia_events tables",
|
||||
r#"
|
||||
-- onboarding_events: gates first-run, supplies time-to-first-capture metric
|
||||
CREATE TABLE IF NOT EXISTS onboarding_events (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
event TEXT NOT NULL,
|
||||
completed_at INTEGER NOT NULL,
|
||||
version TEXT NOT NULL,
|
||||
skipped INTEGER NOT NULL DEFAULT 0,
|
||||
notes TEXT
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_onboarding_events_event ON onboarding_events(event);
|
||||
|
||||
-- lumotia_events: opt-in local activation log
|
||||
CREATE TABLE IF NOT EXISTS lumotia_events (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
kind TEXT NOT NULL,
|
||||
occurred_at INTEGER NOT NULL,
|
||||
payload TEXT
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_lumotia_events_kind ON lumotia_events(kind);
|
||||
CREATE INDEX IF NOT EXISTS idx_lumotia_events_occurred ON lumotia_events(occurred_at);
|
||||
"#,
|
||||
),
|
||||
];
|
||||
|
||||
/// Split SQL into individual statements, respecting BEGIN...END trigger blocks.
|
||||
@@ -681,7 +707,7 @@ mod tests {
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(count, 16);
|
||||
assert_eq!(count, 17);
|
||||
|
||||
sqlx::query("INSERT INTO settings (key, value) VALUES ('test', 'value')")
|
||||
.execute(&pool)
|
||||
@@ -700,7 +726,7 @@ mod tests {
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(count, 16);
|
||||
assert_eq!(count, 17);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -1239,6 +1265,77 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn migration_v17_creates_onboarding_and_lumotia_events_tables() {
|
||||
// v0.1 onboarding-event tracking and opt-in local activation log.
|
||||
// Verify both tables exist with the expected columns after running
|
||||
// all migrations. Uses PRAGMA table_info to inspect column presence.
|
||||
let pool = fk_test_pool().await;
|
||||
run_migrations(&pool).await.expect("migrate");
|
||||
|
||||
// --- onboarding_events ---
|
||||
let info = sqlx::query("PRAGMA table_info(onboarding_events)")
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.expect("pragma onboarding_events");
|
||||
assert!(
|
||||
!info.is_empty(),
|
||||
"onboarding_events table must exist after v17"
|
||||
);
|
||||
let names: Vec<String> = info.iter().map(|r| r.get::<String, _>("name")).collect();
|
||||
for col in ["id", "event", "completed_at", "version", "skipped", "notes"] {
|
||||
assert!(
|
||||
names.contains(&col.to_string()),
|
||||
"onboarding_events must have column {col}; got {names:?}"
|
||||
);
|
||||
}
|
||||
|
||||
// Index on onboarding_events(event) must exist.
|
||||
let idx_names: Vec<String> = sqlx::query_scalar(
|
||||
"SELECT name FROM sqlite_master \
|
||||
WHERE type = 'index' AND tbl_name = 'onboarding_events'",
|
||||
)
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.expect("read onboarding_events indexes");
|
||||
assert!(
|
||||
idx_names.iter().any(|n| n == "idx_onboarding_events_event"),
|
||||
"expected idx_onboarding_events_event, got {idx_names:?}",
|
||||
);
|
||||
|
||||
// --- lumotia_events ---
|
||||
let info2 = sqlx::query("PRAGMA table_info(lumotia_events)")
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.expect("pragma lumotia_events");
|
||||
assert!(
|
||||
!info2.is_empty(),
|
||||
"lumotia_events table must exist after v17"
|
||||
);
|
||||
let names2: Vec<String> = info2.iter().map(|r| r.get::<String, _>("name")).collect();
|
||||
for col in ["id", "kind", "occurred_at", "payload"] {
|
||||
assert!(
|
||||
names2.contains(&col.to_string()),
|
||||
"lumotia_events must have column {col}; got {names2:?}"
|
||||
);
|
||||
}
|
||||
|
||||
// Both indexes on lumotia_events must exist.
|
||||
let idx_names2: Vec<String> = sqlx::query_scalar(
|
||||
"SELECT name FROM sqlite_master \
|
||||
WHERE type = 'index' AND tbl_name = 'lumotia_events'",
|
||||
)
|
||||
.fetch_all(&pool)
|
||||
.await
|
||||
.expect("read lumotia_events indexes");
|
||||
for idx in ["idx_lumotia_events_kind", "idx_lumotia_events_occurred"] {
|
||||
assert!(
|
||||
idx_names2.iter().any(|n| n == idx),
|
||||
"expected index {idx}, got {idx_names2:?}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn migration_v16_adds_deleted_at_column_and_index() {
|
||||
// Rev-2 / Rev-3 atomiser fix (2026-05-12). Verify the soft-delete
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
[package]
|
||||
name = "lumotia-transcription"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
license.workspace = true
|
||||
description = "Speech-to-text engine wrappers, model management, and inference concurrency for Lumotia"
|
||||
build = "build.rs"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user