Skip to content

Commit a41c378

Browse files
Copilottikazyq
andcommitted
fix(desktop): add logging for config migration and backup operations
Address code review feedback: - Log when JSON parsing fails and migration is attempted - Log migration progress messages - Log backup success/failure status Co-authored-by: tikazyq <3393101+tikazyq@users.noreply.github.com>
1 parent f2bc7b0 commit a41c378

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

packages/desktop/src-tauri/src/config.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,19 @@ impl DesktopConfig {
108108
return config;
109109
}
110110
Err(error) => {
111-
eprintln!("Failed to parse desktop config: {error}");
111+
eprintln!("Failed to parse desktop config as JSON: {error}");
112+
eprintln!("Will attempt migration from legacy YAML format");
112113
}
113114
},
114115
Err(_) => {}
115116
}
116117

117118
// Migration: Try legacy YAML
118119
if let Some(legacy_config) = load_legacy_yaml() {
120+
eprintln!("Migrating desktop config from YAML to JSON format");
119121
legacy_config.persist(); // Save as JSON
120122
backup_legacy_yaml();
123+
eprintln!("Migration complete: desktop.yaml → desktop.json");
121124
return legacy_config;
122125
}
123126

@@ -161,7 +164,10 @@ fn backup_legacy_yaml() {
161164
if let Some(dir) = config_dir() {
162165
let legacy = dir.join(LEGACY_CONFIG_FILE);
163166
let backup = dir.join("desktop.yaml.bak");
164-
let _ = fs::rename(legacy, backup);
167+
match fs::rename(&legacy, &backup) {
168+
Ok(_) => eprintln!("Legacy config backed up: desktop.yaml.bak"),
169+
Err(error) => eprintln!("Failed to backup legacy config: {error}"),
170+
}
165171
}
166172
}
167173

specs/162-desktop-config-json-migration/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
status: planned
2+
status: complete
33
created: '2025-12-10'
44
tags:
55
- desktop
@@ -12,12 +12,17 @@ created_at: '2025-12-10T08:49:08.237Z'
1212
depends_on:
1313
- 147-json-config-format
1414
- 148-leanspec-desktop-app
15-
updated_at: '2025-12-10T08:49:08.287Z'
15+
updated_at: '2025-12-18T09:56:48.390Z'
16+
completed_at: '2025-12-18T09:56:48.390Z'
17+
completed: '2025-12-18'
18+
transitions:
19+
- status: complete
20+
at: '2025-12-18T09:56:48.390Z'
1621
---
1722

1823
# Migrate Desktop Config from YAML to JSON
1924

20-
> **Status**: 🗓️ Planned · **Priority**: High · **Created**: 2025-12-10 · **Tags**: desktop, config, migration, breaking-change, consistency
25+
> **Status**: ✅ Complete · **Priority**: High · **Created**: 2025-12-10 · **Tags**: desktop, config, migration, breaking-change, consistency
2126
2227
## Overview
2328

0 commit comments

Comments
 (0)