fn apply_tab_moved(
wstore: &WaveStore,
tab_id: &str,
src_workspace_id: &str,
dst_workspace_id: &str,
dst_index: u32,
new_src_active_tab_id: Option<&str>,
new_dst_active_tab_id: Option<&str>,
) -> Result<(), Box<dyn Error>>Expand description
Phase E.5.5 — apply a TabMoved event to SQLite.
Idempotent: detects already-moved state (tab in dst, not in src)
and returns Ok(()) without re-mutating.
What this writes:
- Removes
tab_idfromsrc_workspace.tabids(andpinnedtabidsfor legacy rows — bootstrap merges them into reducer state, so any leftover here is a stray legacy entry that should be drained). - Updates
src_workspace.activetabidtonew_src_active_tab_id(which may be empty when the source emptied). - Inserts
tab_idatdst_indexindst_workspace.tabids, clamping to the dst list length. - Updates the
Tabrow’s parent ref so loaders find it under the new workspace.