You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are top-level keys — the dot is part of the key name, not a nesting separator. `parse_settings_v2` reads them manually (serde can't express dot-notation field names as struct fields).
33
-
34
-
**`settings.json`** (legacy): nested JSON with camelCase keys, parsed via serde aliases.
32
+
These are top-level keys — the dot is part of the key name, not a nesting separator. `parse_settings` reads them manually (serde can't express dot-notation field names as struct fields).
35
33
36
34
## Key decisions
37
35
38
36
**Decision**: Rust reads the settings file directly instead of receiving values via IPC from the frontend.
39
37
**Why**: Several backend systems (MCP server, hidden files filter, indexing) need their config *before* any frontend window loads. Waiting for the frontend to boot and push settings would create a race condition or require delaying backend initialization. Reading the file directly means the backend is configured immediately at launch.
40
38
41
-
**Decision**: Manual JSON field extraction in `parse_settings_v2` instead of serde auto-derivation.
39
+
**Decision**: Manual JSON field extraction in `parse_settings` instead of serde auto-derivation.
42
40
**Why**: `tauri-plugin-store` writes flat JSON with literal dot-notation string keys like `"developer.mcpEnabled"`. Serde's `rename` attribute can handle this per-field, but the dot is part of the key name, not a nesting separator. The manual extraction makes this non-obvious format explicit and avoids confusion about nested vs. flat structure.
43
41
44
-
**Decision**: Try `settings-v2.json` first, then fall back to `settings.json`, then defaults.
45
-
**Why**: The app migrated from a nested JSON format (v1) to the flat dot-notation format (v2) written by `tauri-plugin-store`. Users upgrading from older versions still have the v1 file. The cascade ensures settings survive across app updates without requiring an explicit migration step.
46
-
47
42
## Key patterns
48
43
49
44
-**One-way read only.** This module never writes. All writes go through the frontend's settings store.
50
45
- Module is named `legacy` because ideally the frontend would push relevant values via IPC at startup rather than requiring Rust to parse the store file directly.
51
46
-`full_disk_access_choice` is marked `#[allow(dead_code)]` — it is persisted by the frontend but the backend takes no action on it.
52
-
- Falls back gracefully at every step: missing file → try next format → use `Default`.
47
+
- Falls back gracefully: missing file → use `Default`.
0 commit comments