This document locks in the intended behavior for Workspaces drawer actions.
- Keep action semantics explicit and predictable.
- Keep button visibility state-driven and mutually exclusive.
- Preserve workspace restore behavior by persisting state in IndexedDB.
Localscope: Workspaces whoseworkspaceScopeislocal.Repositoryscope: Workspaces whoseworkspaceScopeisrepositoryand whoserepomatches the selected repository filter.workspaceKey: Derived identity key from repository + head branch. Used for matching/preference logic, not for UI policy by itself.
InitializeandNew workspacemust never be visible at the same time.Localscope never showsInitialize.Initializefor non-Local empty scope updates the active workspace in place (no fork).New workspacealways forks from current editor/runtime state into a new record id.- Fork creation must generate a fresh head branch suffix so
workspaceKeyand visible labels are distinct. - Any workspace created via
New workspacemust persist withprContextState = "inactive". - For
New workspace,workspaceScopeis target-dependent:localwhen repository filter is__local__repositorywhen repository filter is a non-localowner/repo
State is derived from:
- Selected repository filter (
__local__vs non-localowner/repo) - Presence of stored workspaces in the selected scope
States:
local-empty- Show:
New workspace - Hide:
Initialize, workspace select,Open,Remove
- Show:
local-with-workspaces- Show:
New workspace, workspace select,Open,Remove - Hide:
Initialize
- Show:
repository-empty- Show:
Initialize - Hide:
New workspace, workspace select,Open,Remove
- Show:
repository-with-workspaces- Show:
New workspace, workspace select,Open,Remove - Hide:
Initialize
- Show:
- Action: fork current workspace into a new record.
- Persisted updates:
workspaceScope = "local"prContextState = "inactive"repo = ""- fresh
id - fresh local
head(suffix-appended) workspaceKey = local::<fresh-head>
- Action: update active workspace in place to selected repository scope.
- Persisted updates on current record:
workspaceScope = "repository"repo = <selected owner/repo>workspaceKey = <selected owner/repo>::<current head>
- Must preserve current record id.
- Action: fork current workspace into a new repository-scoped record.
- Persisted updates:
workspaceScope = "repository"prContextState = "inactive"repo = <selected owner/repo>- fresh
id - fresh repository
head(suffix-appended from current head) workspaceKey = <selected owner/repo>::<head>
- Canonical workflow state lives in IndexedDB (
prWorkspacesrecords). localStoragemust not own repository/workspace workflow state.
At minimum, tests should verify:
- Local
New workspacecreates a new record and distinct local label/key. - Non-local empty scope shows only
Initializeand updates active record in place. - Non-local scope with records shows only
New workspaceand forks new record. InitializeandNew workspacenever coexist.