Skip to content

refactor(core): Phase 3.5 — split settings into core (consumer) and app (UI) buckets #1406

@shm11C3

Description

@shm11C3

Parent

Part of #1402. Depends on Phase 3.

Goal

Split today's settings module so that core::settings (in the root-level core crate) only holds fields that change Core behavior. UI-only fields stay in src-tauri/src/app/. Storage backend (Tauri Store / SQLite) remains shared infrastructure accessed from both crates.

Workspace Context

core::settings lives at core/src/settings.rs (or a settings/ submodule) inside the workspace core crate — no tauri dependency. App-side settings stay under src-tauri/src/app/settings/.

Scope

Core-owned fields (move to core::settings in core/src/)

  • hardware_archive.enabled
  • hardware_archive.refresh_interval_days
  • hardware_archive.scheduled_data_deletion
  • hardware_archive.interval
  • (placeholder for future) sensor polling interval

App-owned fields (stay UI-side under src-tauri/src/app/settings/)

  • theme, language
  • display_targets, graph_size
  • line_graph_* (color, border, fill, show_legend, show_scale, show_tooltip, mix, type)
  • burn_in_shift*
  • background_img_opacity, selected_background_img
  • temperature_unit — presentation only; Core stores values in °C
  • text_selectable, decoration

db_startup_service split

  • DB compatibility check (infrastructure/database/preflight::check_db_compatibility) → core::persistence::preflight at core/src/persistence/preflight.rs.
  • Dialog and recovery flow (prompt_startup_error, reset_database_and_restart, StartupErrorAction) → app::startup at src-tauri/src/app/startup.rs.

Persistence Backend

Storage mechanism is unchanged: both buckets can read/write via the same Tauri Store / SQLite. They simply own different keys, and core::settings deserializes only its own subset.

Out of Scope

  • Persistence relocation (Phase 4).
  • Lifecycle changes (Phase 5).

Definition of Done

  • core::settings deserializes only Core-relevant fields and is unit-tested via cargo test -p <core-crate> without a Tauri runtime.
  • commands/settings.rs setters touching UI-only fields no longer round-trip through state structs that Core can see.
  • temperature_unit changes only affect formatting in App; raw temperature values in Core are always °C.
  • No user-visible regression in the Settings page.

Open Question (from parent)

  • Confirm temperature_unit direction (Core stores °C, App formats) during implementation review.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions