Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions desktop/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod events;
mod huddle;
mod managed_agents;
mod media_proxy;
mod migration;
mod models;
pub mod nostr_convert;
mod prevent_sleep;
Expand Down Expand Up @@ -352,11 +351,6 @@ pub fn run() {
let app_handle = app.handle().clone();
let shutdown_started = Arc::clone(&restore_shutdown_started);

// Migrate data from the legacy `com.wesb.sprout` directory before
// resolving identity, so the persisted key is available at the new
// path on first launch after the identifier change.
migration::migrate_legacy_data_dir(&app_handle);

// Resolve persisted identity key (env var → file → generate+save).
// This is fatal — the app should not start with an ephemeral identity
// that will be lost on restart, as that silently breaks channel
Expand Down
10 changes: 9 additions & 1 deletion desktop/src-tauri/src/managed_agents/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ pub fn save_managed_agents(app: &AppHandle, records: &[ManagedAgentRecord]) -> R
let path = managed_agents_store_path(app)?;
let payload = serde_json::to_vec_pretty(&sorted)
.map_err(|error| format!("failed to serialize agent store: {error}"))?;
fs::write(&path, payload).map_err(|error| format!("failed to write agent store: {error}"))

// Atomic write: write to a temp file then rename. This prevents partial
// writes from corrupting the store if the process crashes mid-write.
// rename() is atomic on the same filesystem on both macOS and Linux.
let tmp_path = path.with_extension("json.tmp");
fs::write(&tmp_path, &payload)
.map_err(|error| format!("failed to write temp agent store: {error}"))?;
fs::rename(&tmp_path, &path)
.map_err(|error| format!("failed to rename temp agent store: {error}"))
}

/// Maximum log file size before rotation (10 MB).
Expand Down
286 changes: 0 additions & 286 deletions desktop/src-tauri/src/migration.rs

This file was deleted.

Loading