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:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user