fn current_workspace_id(store: &Store) -> Option<String>Expand description
The workspace backing one of this client’s windows, if any.
Mirrors how window_close.rs picks the workspace to snapshot, so the
shutdown path and the clean-quit path capture the same thing. With
multiple windows this captures the first live one — the same
single-workspace limitation restore-on-relaunch already has, not a new
one introduced here.
Walks windowids rather than only checking the first: the repo’s own
restart/reprojection paths already tolerate a polluted windowids list
(a stale id whose Window row no longer exists, or whose Window row
exists but references a Workspace that’s gone), so that state can and
does occur in real persisted data. Bailing out on the first entry alone
— whether it’s missing outright or just points at a dead workspace —
would skip the flush entirely whenever that specific entry is stale, even
with a perfectly good workspace sitting at a later id (Codex P2 on
#3106’s first fix, then again on the fix itself: the first pass only
checked that the Window row existed, not that its workspaceid still
resolved to a live Workspace).