agent: lumotia-rebrand — data dir migration shim + paths.rs rename
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

Phase 5 of the rebrand cascade per locked decision D1 (migrate in place).

crates/core/src/paths.rs:
- Hardcoded subdir strings renamed: magnotia/Magnotia -> lumotia/Lumotia
  across all four OS branches (Linux XDG + dot-legacy, macOS Application
  Support, Windows LOCALAPPDATA, fallback dot-dir).
- Database filename: magnotia.db -> lumotia.db.
- Test path fixtures renamed: /tmp/magnotia-test -> /tmp/lumotia-test.
- New MigrationStatus enum (Migrated / TargetAlreadyExists / NoLegacyFound).
- New migrate_legacy_data_dir() that probes the platform-correct legacy
  magnotia path, renames it to the lumotia equivalent via fs::rename, and
  also renames magnotia.db -> lumotia.db inside if found. Idempotent: safe
  to call on every boot. Refuses to overwrite an existing lumotia dir to
  protect user data.
- Four new unit tests covering all branches via the test-friendly
  migrate_legacy_data_dir_inner that takes an explicit legacy path.

crates/storage/src/database.rs:
- New migrate_legacy_setting_keys(pool) that renames any settings rows
  with key matching magnotia_* to lumotia_*. Single SQL UPDATE with
  NOT EXISTS guard so it leaves rows alone if a lumotia_ row already
  exists. Re-exported from lib.rs.

src-tauri/src/lib.rs:
- Calls migrate_legacy_data_dir(&app_data_dir()) at the start of setup()
  BEFORE database_path() resolves the now-renamed dir. Logs migration
  outcome to lumotia_startup tracing target.
- Calls migrate_legacy_setting_keys(&db) immediately after init_db
  returns. Logs only when rows are actually renamed.

src-tauri/src/{lib,commands/{diagnostics,rituals,transcripts}}.rs +
crates/storage/src/database.rs:
- All in-code references to magnotia_preferences, magnotia_history (in
  comments), and magnotia_morning_triage_last_shown renamed to lumotia_*.

cargo build --workspace passes. cargo test --workspace: 334 pass, 0 fail
(up from 330; +4 paths::tests).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-13 09:21:45 +01:00
parent e2a5feb718
commit 86f83b7a45
7 changed files with 335 additions and 26 deletions

View File

@@ -335,7 +335,7 @@ async fn generate_diagnostic_report_inner(
if opts.include_settings {
out.push_str("## Settings (sanitised)\n\n");
match lumotia_storage::get_setting(&state.db, "magnotia_preferences").await {
match lumotia_storage::get_setting(&state.db, "lumotia_preferences").await {
Ok(Some(json)) => {
out.push_str("```json\n");
out.push_str(&sanitise_preferences_json(&json));

View File

@@ -8,13 +8,13 @@
//!
//! Stored under the existing SQLite settings table via
//! `lumotia_storage::{get_setting, set_setting}` — same bag as
//! `magnotia_preferences`.
//! `lumotia_preferences`.
use lumotia_storage::{get_setting, set_setting};
use crate::AppState;
const LAST_TRIAGE_KEY: &str = "magnotia_morning_triage_last_shown";
const LAST_TRIAGE_KEY: &str = "lumotia_morning_triage_last_shown";
/// Returns the YYYY-MM-DD date string stored on the last successful
/// morning triage dismissal, or `None` if the user has never been

View File

@@ -28,7 +28,7 @@ use crate::AppState;
///
/// Task 2.5 — `starred`, `manualTags`, `template`, `language`, `segmentsJson`
/// were added to back the viewer metadata that previously lived only in the
/// removed `magnotia_history` localStorage cache.
/// removed `lumotia_history` localStorage cache.
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TranscriptDto {