Skip to content

refactor(core): Phase 3 — relocate collector and history state into core::collector #1405

@shm11C3

Description

@shm11C3

Parent

Part of #1402. Depends on Phase 2.

Goal

Move the sensor collector and per-sensor history state into the root-level core crate (core/src/collector/), behind a Core-owned API. Strip the AppHandle dependency from collector setup.

Workspace Context

core/ is the Tauri-independent workspace crate at the repo root. Anything moved "into Core" in this phase lands under core/src/... and stops compiling against tauri.

Scope

  • Relocate src-tauri/src/workers/system_monitor.rscore/src/collector/ (split into submodules as needed).
  • Move models::hardware::HardwareMonitorState (the Arc<Mutex<...>> bag for CPU / memory / GPU / process histories) into core/src/collector/history.rs (or similar) behind a Core read API such as core::collector::history::cpu(...).
  • Replace direct mutex access in src-tauri/src/commands/hardware.rs with calls into the Core read API.
  • Move src-tauri/src/platform/ and the sensor-side of src-tauri/src/infrastructure/providers/ (NVAPI, WMI, procfs, drm_sys, …) into the core crate (core/src/platform/, core/src/infrastructure/providers/) so Core's dependencies remain legal under the no-tauri rule.
  • Drop AppHandle from SystemMonitorController::setup.

Out of Scope

  • Persistence relocation (Phase 4).
  • Settings split (Phase 3.5).
  • Lifecycle changes (Phase 5).

Migration Strategy

  • 3a — Introduce the Core read API alongside existing direct Arc<Mutex> access. Both paths work.
  • 3b — Migrate all command callers to the Core API.
  • 3c — Remove the old direct-mutex path and models::hardware::HardwareMonitorState.

Definition of Done

  • commands/hardware.rs no longer references Arc<Mutex<History*>> directly.
  • SystemMonitorController does not take AppHandle.
  • core/src/collector/ has unit tests that run via cargo test -p <core-crate> without a Tauri runtime.
  • No user-visible regression on the dashboard or 1-minute usage graphs.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions