EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
D2: workspace files of earlier versions migrate to craft-ui workspaces
aiongg3014f03a816f
diff --git a/crates/ui-egui/src/workspace_state.rs b/crates/ui-egui/src/workspace_state.rsindex 01018bc6f..fe522075a 100644--- a/crates/ui-egui/src/workspace_state.rs+++ b/crates/ui-egui/src/workspace_state.rs@@ -8,7 +8,11 @@ use serde::{Deserialize, Serialize};use crate::dock::{PanelKind, Workspace};use crate::state::UiState;+mod legacy;+const FILE: &str = "workspaces.json";+/// An earlier version's file, kept when it is first rewritten in the current format.+const BACKUP: &str = "workspaces.old.json";const MAX_BYTES: usize = 1024 * 1024;const MAX_WORKSPACES: usize = 64;/// Leave room for new viewers without approaching the u32 allocator limit.@@ -94,23 +98,27 @@ pub(crate) struct WorkspaceStore {saved: Snapshot,last_attempt: f64,writable: bool,+ /// The text of an earlier version's file that loaded: the first save copies it to+ /// [`BACKUP`] and writes the file in the current format.+ migrated_from: Option<String>,pub(crate) error: Option<String>,}impl WorkspaceStore {pub(crate) fn load(config: Option<&dyn ConfigStore>, ui: &mut UiState) -> Self {+ let mut original = None;let loaded = config.map_or(Ok(None), |c| c.read_bounded(FILE, MAX_BYTES)).map_err(|e| e.to_string()).and_then(|text| {text.map(|text| {let value: serde_json::Value = serde_json::from_str(&text).map_err(|e| e.to_string())?;- // D2: migrate the version 1 snapshot (EffectCraft's own dock tree, craft-libs- // 5c874d51) and the unversioned `{workspaces, floating}` record here. Until then- // they load as an error: this session keeps the default layout and leaves the- // file untouched.- let version = value.get("version").and_then(serde_json::Value::as_u64);- if version.is_none_or(|v| v < u64::from(VERSION)) {- return Err("this workspace file is from an earlier EffectCraft version".to_string());- }- let snapshot = serde_json::from_value::<Snapshot>(value).map_err(|e| e.to_string())?;+ let snapshot = if legacy::is_legacy(&value) {+ let snapshot = legacy::migrate(value, ui)?;+ original = Some(text);+ snapshot+ } else if value.get("version").is_none() {+ return Err("not a workspace file".to_string());+ } else {+ serde_json::from_value::<Snapshot>(value).map_err(|e| e.to_string())?+ };snapshot.validate()?;Ok(snapshot)})@@ -127,10 +135,11 @@ impl WorkspaceStore {if let Some(error) = &error {log::warn!("{error}");ui.status = error.clone();+ original = None;}// An unreadable or newer file is never replaced by this session, even after a later// layout edit. Ordinary failed writes remain dirty and retryable.- Self { saved: Snapshot::capture(ui), last_attempt: f64::NEG_INFINITY, writable: error.is_none(), error }+ Self { saved: Snapshot::capture(ui), last_attempt: f64::NEG_INFINITY, writable: error.is_none(), migrated_from: original, error }}pub(crate) fn due(&mut self, now: f64) -> bool {@@ -145,7 +154,8 @@ impl WorkspaceStore {if !self.writable {return false;}- self.saved.workspace != ui.workspace+ self.migrated_from.is_some()+ || self.saved.workspace != ui.workspace|| self.saved.dock != ui.dock|| self.saved.focused != ui.focused|| self.saved.maximized != ui.maximized@@ -163,7 +173,11 @@ impl WorkspaceStore {if text.len() > MAX_BYTES {return Err("workspace file exceeds 1 MiB".into());}+ if let Some(original) = &self.migrated_from {+ config.write(BACKUP, original).map_err(|e| format!("keep the earlier workspace file: {e}"))?;+ }config.write(FILE, &text).map_err(|e| format!("save workspaces: {e}"))?;+ self.migrated_from = None;self.saved = snapshot;self.error = None;Ok(true)@@ -200,14 +214,35 @@ mod tests {}#[test]- fn corrupt_future_or_earlier_workspace_keeps_defaults_and_original_file() {+ fn corrupt_future_or_unknown_workspace_keeps_defaults_and_original_file() {let valid = Snapshot::capture(&UiState::default());- // An earlier version's file (EffectCraft's own dock tree) waits for its migration.- let earlier = r#"{"version":1,"workspace":"Default","dock":{"Tabs":{"panels":["Composition"],"active":0}},"floating":[],"focused":"Composition","maximized":null,"saved_workspaces":{},"saved_floating":{}}"#;- let legacy = r#"{"workspaces":{"Mine":{"Tabs":{"panels":["Composition"],"active":0}}}}"#;- for text in- ["{".into(), serde_json::to_string(&Snapshot { version: VERSION + 1, ..valid }).unwrap(), " ".repeat(MAX_BYTES + 1), earlier.into(), legacy.into()]- {+ // Damaged files of the earlier version: a panel in two places, a bad split, an unknown+ // panel, a tree deeper than craft-ui allows, a missing field.+ let earlier = |dock: &str| {+ format!(+ r#"{{"version":1,"workspace":"Default","dock":{dock},"floating":[],"focused":"Composition","maximized":null,"saved_workspaces":{{}},"saved_floating":{{}}}}"#+ )+ };+ let mut deep = r#"{"Tabs":{"panels":["Composition"],"active":0}}"#.to_string();+ for _ in 0..=craft_ui::docking::MAX_DEPTH {+ deep = format!(r#"{{"Split":{{"vertical":true,"size":{{"Ratio":0.5}},"a":{deep},"b":{{"Tabs":{{"panels":[],"active":0}}}}}}}}"#);+ }+ let twice =+ r#"{"Split":{"vertical":true,"size":{"Ratio":0.5},"a":{"Tabs":{"panels":["Project"],"active":0}},"b":{"Tabs":{"panels":["Project"],"active":0}}}}"#;+ let bad_split = r#"{"Split":{"vertical":true,"size":{"Ratio":7.0},"a":{"Tabs":{"panels":["Project"],"active":0}},"b":{"Tabs":{"panels":["Timeline"],"active":0}}}}"#;+ for text in [+ "{".into(),+ "{}".into(),+ "[1, 2]".into(),+ serde_json::to_string(&Snapshot { version: VERSION + 1, ..valid }).unwrap(),+ " ".repeat(MAX_BYTES + 1),+ earlier(twice),+ earlier(bad_split),+ earlier(r#"{"Tabs":{"panels":["NoSuchPanel"],"active":0}}"#),+ earlier(&deep),+ r#"{"version":1,"workspace":"Default"}"#.into(),+ r#"{"workspaces":{"Mine":{"Tabs":{"panels":["Composition"],"active":3}}}}"#.into(),+ ] {let config = MemoryConfig::default();config.write(FILE, &text).unwrap();let mut ui = UiState::default();@@ -220,7 +255,91 @@ mod tests {assert!(!store.save(Some(&config), &ui).unwrap());assert!(store.save_now(Some(&config), &ui).unwrap_err().contains("couldn't be loaded"));assert_eq!(config.read(FILE).as_deref(), Some(text.as_str()));+ assert_eq!(config.read(BACKUP), None);+ }+ }++ /// A file written by EffectCraft 0.10 (craft-libs 5c874d51): the Default workspace with+ /// Preview floating, Render Queue floating in its own native window, Align closed,+ /// Effects & Presets moved into the Project group and Audio split beside the Timeline,+ /// saved as "My Layout"; then Layer closed.+ const V1: &str = include_str!("../tests/fixtures/workspaces-v1.json");++ #[test]+ fn version_one_file_loads_with_every_panel_in_place() {+ let config = MemoryConfig::default();+ config.write(FILE, V1).unwrap();+ let mut ui = UiState::default();+ let store = WorkspaceStore::load(Some(&config), &mut ui);+ assert_eq!(store.error, None);+ assert_eq!(ui.workspace, "My Layout");+ assert_eq!(ui.focused, PanelKind::Composition);+ use PanelKind::*;+ let root = crate::dock::hsplit(+ SplitSize::FixedSecond(300.0),+ crate::dock::vsplit(+ SplitSize::Ratio(0.56),+ crate::dock::hsplit(SplitSize::FixedFirst(300.0), crate::dock::tabs(&[Project, EffectControls, EffectsPresets], 2), tabs(&[Composition])),+ crate::dock::hsplit(SplitSize::Ratio(0.5), tabs(&[Timeline]), tabs(&[Audio])),+ ),+ crate::dock::stack(&[(Properties, true, None)]),+ );+ assert_eq!(ui.dock.layout.root, Some(root));+ let floating: Vec<_> = ui.dock.layout.floating.iter().map(|w| (w.panels().copied().collect::<Vec<_>>(), w.rect, w.native)).collect();+ assert_eq!(+ floating,+ [+ (vec![Preview], [900.0, 120.0, 300.0, 260.0], None),+ (vec![RenderQueue], [200.0, 500.0, 520.0, 240.0], Some(crate::dock_ui::sanitized_window_rect([200.0, 500.0, 520.0, 240.0]))),+ ]+ );+ // Closed panels stay closed.+ for panel in [Align, Layer] {+ assert!(!ui.dock.is_open(panel), "{panel:?}");}+ // The named workspace still has Layer, closed only after it was saved.+ let saved = ui.saved_workspaces.get("My Layout").unwrap();+ assert!(saved.is_docked(Layer) && saved.is_floating(Preview) && !saved.is_open(Align));+ assert_eq!(saved.layout.floating.iter().filter_map(|w| w.native).count(), 0);+ }++ #[test]+ fn version_one_file_is_rewritten_once_in_the_current_format_and_kept_as_a_backup() {+ let config = MemoryConfig::default();+ config.write(FILE, V1).unwrap();+ let mut ui = UiState::default();+ let mut store = WorkspaceStore::load(Some(&config), &mut ui);+ let migrated = Snapshot::capture(&ui);+ assert!(store.has_changes(&ui), "the migrated layout is written without waiting for an edit");+ assert!(store.save(Some(&config), &ui).unwrap());+ assert_eq!(config.read(BACKUP).as_deref(), Some(V1));+ let text = config.read(FILE).unwrap();+ assert_eq!(serde_json::from_str::<serde_json::Value>(&text).unwrap()["version"], VERSION);+ assert!(!store.has_changes(&ui));+ let mut restored = UiState::default();+ let reloaded = WorkspaceStore::load(Some(&config), &mut restored);+ assert_eq!(reloaded.error, None);+ assert!(!reloaded.has_changes(&restored));+ assert_eq!(Snapshot::capture(&restored), migrated);+ }++ #[test]+ fn stacked_frames_with_tabs_and_an_empty_root_migrate() {+ let text = r#"{"version":1,"workspace":"Mine","dock":{"Tabs":{"panels":[],"active":0}},+ "floating":[{"panels":["Project"],"active":0,"rect":[10.0,10.0,300.0,200.0]}],+ "focused":"Project","maximized":null,+ "saved_workspaces":{"Mine":{"Stack":{"entries":[{"panel":"Info","open":true},{"panels":["Audio","Preview"],"active":1,"open":true,"height":80.0}]}}},+ "saved_floating":{"Gone":[{"panels":["Align"],"active":0,"rect":[0.0,0.0,100.0,100.0]}]}}"#;+ let config = MemoryConfig::default();+ config.write(FILE, text).unwrap();+ let mut ui = UiState::default();+ let store = WorkspaceStore::load(Some(&config), &mut ui);+ assert_eq!(store.error, None);+ assert_eq!(ui.dock.layout.root, None);+ assert!(ui.dock.is_floating(PanelKind::Project));+ let stack = crate::dock::stack(&[(PanelKind::Info, true, None), (PanelKind::Audio, false, None), (PanelKind::Preview, true, Some(80.0))]);+ assert_eq!(ui.saved_workspaces.get("Mine").and_then(|w| w.layout.root.clone()), Some(stack));+ assert_eq!(ui.saved_workspaces.len(), 1, "floating groups of no named workspace are dropped");}#[test]diff --git a/crates/ui-egui/src/workspace_state/legacy.rs b/crates/ui-egui/src/workspace_state/legacy.rsnew file mode 100644index 000000000..ed969575a--- /dev/null+++ b/crates/ui-egui/src/workspace_state/legacy.rs@@ -0,0 +1,179 @@+//! Workspace files of earlier versions: EffectCraft's own dock tree (craft-libs 5c874d51 and+//! before), read into private copies of its types and turned into craft-ui workspaces.+//!+//! - Version 1 (`{version: 1, workspace, dock, floating, …, panel_windows}`) keeps the current+//! arrangement, the named workspaces, focus and the maximized panel.+//! - The unversioned record (`{workspaces, floating}`) holds only named workspaces; the+//! current arrangement stays the default.+//! - A stacked frame with several tabs becomes one stacked panel per tab; the shown tab keeps+//! the frame's open state and height, the others are collapsed.+//! - A floating group in its own native window (`panel_windows`) keeps that place as the+//! window's native rect.+//! - Closed panels had no recorded place: they stay closed and reopen at their default place.++use std::collections::BTreeMap;++use craft_ui::docking::{Floating, Node, StackEntry};+use craft_ui::layout::{SplitAxis, SplitSize};+use serde::Deserialize;++use super::{Snapshot, VERSION};+use crate::dock::{Layout, PanelKind, Workspace};+use crate::state::UiState;++#[derive(Deserialize)]+enum OldSplitSize {+ Ratio(f32),+ FixedA(f32),+ FixedB(f32),+}++/// A stacked frame; files from before stacked frames held tabs name one `panel`.+#[derive(Deserialize)]+struct OldStackEntry {+ #[serde(default)]+ panel: Option<PanelKind>,+ #[serde(default)]+ panels: Vec<PanelKind>,+ #[serde(default)]+ active: usize,+ open: bool,+ #[serde(default)]+ height: Option<f32>,+}++#[derive(Deserialize)]+enum OldNode {+ Split { vertical: bool, size: OldSplitSize, a: Box<OldNode>, b: Box<OldNode> },+ Tabs { panels: Vec<PanelKind>, active: usize },+ Stack { entries: Vec<OldStackEntry> },+}++#[derive(Deserialize)]+struct OldFloating {+ panels: Vec<PanelKind>,+ active: usize,+ rect: [f32; 4],+}++/// The floating group holding `panel` shows in its own native window at `rect`.+#[derive(Deserialize)]+struct OldPanelWindow {+ panel: PanelKind,+ rect: [f32; 4],+}++#[derive(Deserialize)]+struct OldSnapshot {+ workspace: String,+ dock: OldNode,+ floating: Vec<OldFloating>,+ focused: PanelKind,+ maximized: Option<PanelKind>,+ saved_workspaces: BTreeMap<String, OldNode>,+ saved_floating: BTreeMap<String, Vec<OldFloating>>,+ #[serde(default)]+ panel_windows: Vec<OldPanelWindow>,+}++#[derive(Deserialize)]+struct OldRecord {+ #[serde(default)]+ workspaces: BTreeMap<String, OldNode>,+ #[serde(default)]+ floating: BTreeMap<String, Vec<OldFloating>>,+}++/// Whether `value` is a file of an earlier version that [`migrate`] reads.+pub(super) fn is_legacy(value: &serde_json::Value) -> bool {+ match value.get("version") {+ Some(version) => version.as_u64() == Some(1),+ None => value.as_object().is_some_and(|fields| fields.contains_key("workspaces") || fields.contains_key("floating")),+ }+}++/// The snapshot an earlier version's file describes. `ui` supplies what an unversioned record+/// leaves out (the current arrangement). The caller validates the result.+pub(super) fn migrate(value: serde_json::Value, ui: &UiState) -> Result<Snapshot, String> {+ if value.get("version").is_none() {+ let record: OldRecord = serde_json::from_value(value).map_err(|e| e.to_string())?;+ let mut snapshot = Snapshot::capture(ui);+ snapshot.saved_workspaces = named(record.workspaces, record.floating)?;+ return Ok(snapshot);+ }+ let old: OldSnapshot = serde_json::from_value(value).map_err(|e| e.to_string())?;+ Ok(Snapshot {+ version: VERSION,+ workspace: old.workspace,+ dock: workspace(old.dock, old.floating, &old.panel_windows)?,+ focused: old.focused,+ maximized: old.maximized,+ saved_workspaces: named(old.saved_workspaces, old.saved_floating)?,+ })+}++/// Named workspaces with their floating groups; floating groups of no named workspace are+/// dropped, as the earlier version never showed them.+fn named(roots: BTreeMap<String, OldNode>, mut floating: BTreeMap<String, Vec<OldFloating>>) -> Result<BTreeMap<String, Workspace>, String> {+ roots+ .into_iter()+ .map(|(name, root)| {+ let groups = floating.remove(&name).unwrap_or_default();+ workspace(root, groups, &[]).map(|workspace| (name, workspace))+ })+ .collect()+}++fn workspace(root: OldNode, floating: Vec<OldFloating>, windows: &[OldPanelWindow]) -> Result<Workspace, String> {+ // Closing the last docked panel left an empty tab group as the root.+ let root = match root {+ OldNode::Tabs { panels, .. } if panels.is_empty() => None,+ root => Some(node(root, 0)?),+ };+ let floating = floating+ .into_iter()+ .map(|group| {+ let native = windows.iter().find(|window| group.panels.contains(&window.panel)).map(|window| window.rect);+ let mut window = Floating::single(group.panels, group.active, group.rect);+ window.native = native.map(crate::dock_ui::sanitized_window_rect);+ window+ })+ .collect();+ Ok(Workspace::new(Layout { root, floating }))+}++fn node(old: OldNode, depth: usize) -> Result<Node<PanelKind>, String> {+ if depth > craft_ui::docking::MAX_DEPTH {+ return Err("workspace dock tree exceeds supported limits".into());+ }+ Ok(match old {+ OldNode::Tabs { panels, active } => Node::Tabs { panels, active },+ OldNode::Split { vertical, size, a, b } => Node::Split {+ axis: if vertical { SplitAxis::Vertical } else { SplitAxis::Horizontal },+ size: match size {+ OldSplitSize::Ratio(value) => SplitSize::Ratio(value),+ OldSplitSize::FixedA(value) => SplitSize::FixedFirst(value),+ OldSplitSize::FixedB(value) => SplitSize::FixedSecond(value),+ },+ first: Box::new(node(*a, depth.saturating_add(1))?),+ second: Box::new(node(*b, depth.saturating_add(1))?),+ },+ OldNode::Stack { entries } => {+ let mut out = Vec::new();+ for entry in entries {+ let mut panels = entry.panels;+ if let Some(panel) = entry.panel+ && !panels.contains(&panel)+ {+ panels.insert(0, panel);+ }+ let shown = panels.get(entry.active).or(panels.first()).copied();+ for panel in panels {+ let front = Some(panel) == shown;+ out.push(StackEntry { panel, open: front && entry.open, height: entry.height.filter(|_| front) });+ }+ }+ Node::Stack { entries: out }+ }+ })+}diff --git a/crates/ui-egui/tests/fixtures/workspaces-v1.json b/crates/ui-egui/tests/fixtures/workspaces-v1.jsonnew file mode 100644index 000000000..164bf37f0--- /dev/null+++ b/crates/ui-egui/tests/fixtures/workspaces-v1.json@@ -0,0 +1,234 @@+{+ "version": 1,+ "workspace": "My Layout",+ "dock": {+ "Split": {+ "vertical": false,+ "size": {+ "FixedB": 300.0+ },+ "a": {+ "Split": {+ "vertical": true,+ "size": {+ "Ratio": 0.56+ },+ "a": {+ "Split": {+ "vertical": false,+ "size": {+ "FixedA": 300.0+ },+ "a": {+ "Tabs": {+ "panels": [+ "Project",+ "EffectControls",+ "EffectsPresets"+ ],+ "active": 2+ }+ },+ "b": {+ "Tabs": {+ "panels": [+ "Composition"+ ],+ "active": 0+ }+ }+ }+ },+ "b": {+ "Split": {+ "vertical": false,+ "size": {+ "Ratio": 0.5+ },+ "a": {+ "Tabs": {+ "panels": [+ "Timeline"+ ],+ "active": 0+ }+ },+ "b": {+ "Tabs": {+ "panels": [+ "Audio"+ ],+ "active": 0+ }+ }+ }+ }+ }+ },+ "b": {+ "Stack": {+ "entries": [+ {+ "panels": [+ "Properties"+ ],+ "active": 0,+ "open": true,+ "height": null+ }+ ]+ }+ }+ }+ },+ "floating": [+ {+ "panels": [+ "Preview"+ ],+ "active": 0,+ "rect": [+ 900.0,+ 120.0,+ 300.0,+ 260.0+ ]+ },+ {+ "panels": [+ "RenderQueue"+ ],+ "active": 0,+ "rect": [+ 200.0,+ 500.0,+ 520.0,+ 240.0+ ]+ }+ ],+ "focused": "Composition",+ "maximized": null,+ "saved_workspaces": {+ "My Layout": {+ "Split": {+ "vertical": false,+ "size": {+ "FixedB": 300.0+ },+ "a": {+ "Split": {+ "vertical": true,+ "size": {+ "Ratio": 0.56+ },+ "a": {+ "Split": {+ "vertical": false,+ "size": {+ "FixedA": 300.0+ },+ "a": {+ "Tabs": {+ "panels": [+ "Project",+ "EffectControls",+ "EffectsPresets"+ ],+ "active": 2+ }+ },+ "b": {+ "Tabs": {+ "panels": [+ "Composition",+ "Layer"+ ],+ "active": 0+ }+ }+ }+ },+ "b": {+ "Split": {+ "vertical": false,+ "size": {+ "Ratio": 0.5+ },+ "a": {+ "Tabs": {+ "panels": [+ "Timeline"+ ],+ "active": 0+ }+ },+ "b": {+ "Tabs": {+ "panels": [+ "Audio"+ ],+ "active": 0+ }+ }+ }+ }+ }+ },+ "b": {+ "Stack": {+ "entries": [+ {+ "panels": [+ "Properties"+ ],+ "active": 0,+ "open": true,+ "height": null+ }+ ]+ }+ }+ }+ }+ },+ "saved_floating": {+ "My Layout": [+ {+ "panels": [+ "Preview"+ ],+ "active": 0,+ "rect": [+ 900.0,+ 120.0,+ 300.0,+ 260.0+ ]+ },+ {+ "panels": [+ "RenderQueue"+ ],+ "active": 0,+ "rect": [+ 200.0,+ 500.0,+ 520.0,+ 240.0+ ]+ }+ ]+ },+ "panel_windows": [+ {+ "panel": "RenderQueue",+ "rect": [+ 200.0,+ 500.0,+ 520.0,+ 240.0+ ]+ }+ ]+}\ No newline at end of filediff --git a/crates/ui-egui/tests/it/ui_workspace_focus.rs b/crates/ui-egui/tests/it/ui_workspace_focus.rsindex 8874c987d..39462c699 100644--- a/crates/ui-egui/tests/it/ui_workspace_focus.rs+++ b/crates/ui-egui/tests/it/ui_workspace_focus.rs@@ -97,18 +97,20 @@ fn unreadable_native_workspace_is_preserved_after_later_layout_changes() {}#[test]-#[ignore = "D2: the migration of workspace files written with craft-libs 5c874d51"]fn legacy_named_workspaces_migrate_once_and_survive_actual_app_restart() {let store = Arc::new(MemoryConfig::default());+ // An unversioned record from an earlier EffectCraft: its Minimal layout saved as "Legacy".+ let legacy = r#"{"floating":{},"workspaces":{"Legacy":{"Split":{"a":{"Tabs":{"active":0,"panels":["Composition"]}},"b":{"Tabs":{"active":0,"panels":["Timeline"]}},"size":{"Ratio":0.6000000238418579},"vertical":true}}}}"#;+ store.write("workspaces.json", legacy).unwrap();let saved = effectcraft_ui_egui::dock::Workspace::new(effectcraft_ui_egui::dock::workspace("Minimal"));- store.write("workspaces.json", &json!({"workspaces":{"Legacy":saved},"floating":{}}).to_string()).unwrap();let mut app = EffectcraftApp::new(Session { config: Some(store.clone()), ..Default::default() });assert_eq!(app.ui.saved_workspaces.get("Legacy"), Some(&saved));app.set_workspace("Legacy");let ctx = egui::Context::default();effectcraft_ui_egui::menus::invoke(&mut app, &ctx, "window.saveWorkspaceAs", json!({"name":"Migrated"})).unwrap();let text = store.read("workspaces.json").unwrap();- assert_eq!(serde_json::from_str::<serde_json::Value>(&text).unwrap()["version"], 1);+ assert_eq!(serde_json::from_str::<serde_json::Value>(&text).unwrap()["version"], 2);+ assert_eq!(store.read("workspaces.old.json").as_deref(), Some(legacy));let restarted = EffectcraftApp::new(Session { config: Some(store), ..Default::default() });assert_eq!(restarted.ui.saved_workspaces.get("Legacy"), Some(&saved));assert_eq!(restarted.ui.saved_workspaces.get("Migrated"), Some(&saved));