Skip to content

refactor: concentrate settings persistence and application - #51

Merged
ElbertePlinio merged 1 commit into
mainfrom
refactor/settings-module
Jul 19, 2026
Merged

ElbertePlinio merged 1 commit into
mainfrom
refactor/settings-module

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Summary

  • add a deep Tauri settings module that serializes validated mutations and enforces persist → runtime effects → config publication
  • route full saves, the float command, capsule dismissal, and tray float toggles through the same transaction
  • make config replacement atomic and gate every Sentry envelope so persistence failure or local-only mode cannot leak into runtime/reporting state
  • reconcile external config events into dirty Settings forms by refreshing clean fields, preserving dirty fields, advancing the discard baseline, and showing an explicit notice
  • preserve unsaved theme previews and save responses across asynchronous event races without changing the Settings layout

Failure policy

Persistence failure returns before telemetry, minidump, float-window, or config-event effects. Atomic replacement also preserves the previous config bytes if the final rename fails.

Decisions

  • full-form saves validate theme plus positive typing/cleanup timeout values; float-only mutations validate only the boolean change so unrelated hand-edited config cannot brick tray/capsule toggles
  • external changes use a leaf-level three-way merge: untouched fields refresh, dirty fields remain local, and Discard targets the latest persisted external baseline
  • config event emission remains best-effort after persistence/runtime application because publication cannot be rolled back safely
  • no feature flag: this is a self-contained behavior-preserving CAND-4 refactor

Validation

  • cargo test --workspace --locked --all-targets — 90 passed
  • bun run test — 30 passed
  • bun run check — 0 errors, 0 warnings
  • bun run build — passed
  • focused Rust formatting and git diff --check — passed
  • serious full-stack local review completed; final fix verification clean

Refs #47 (CAND-4 only)

@ElbertePlinio
ElbertePlinio merged commit 86c941b into main Jul 19, 2026
1 check passed
@ElbertePlinio
ElbertePlinio deleted the refactor/settings-module branch July 19, 2026 20:43
ElbertePlinio added a commit that referenced this pull request Jul 19, 2026
…module (#53)

Concentrate the recording pipeline's deterministic decisions into a new
src-tauri/src/lifecycle.rs so they can be characterized without an
AppHandle, following #51's settings-module convention.

- toggle_action(): pure Idle/Recording/busy -> Start/Stop/Ignore decision,
  used by the command, tray, and single-instance adapters via toggle().
- session_is_current(): single predicate replacing the three duplicated
  stale-session checks in is_session_current/set_state_for_session/
  finish_session, gating every pipeline checkpoint.
- failure_outcome()/no_speech_outcome()/delivery_outcome(): terminal
  projections for recorder/transcription failure, empty transcript, and
  post-delivery cleanup/paste/history results (supersedes the old
  final_delivery_status()).

recorder/STT/cleanup/delivery/history stay effect implementations in
engine.rs; incremental scheduling and visible Stage values are untouched.

Adds characterization tests for duplicate start/toggle, stop before init
finishes, cancellation at every pipeline checkpoint, stale completion
after cancel/new session, cleanup failure with raw delivery, and history
failure.

Ref #47 (CAND-5).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant