TenantAtlas/specs/121-workspace-switch-fix/data-model.md
2026-03-08 01:43:37 +01:00

2.5 KiB

Data Model: Workspace Switch Semantic Fix

Feature: 121-workspace-switch-fix | Date: 2026-03-07

Overview

This feature does not add or modify database tables. It corrects the navigation contract between three existing workspace-related concepts:

  1. the topbar Switch workspace entry,
  2. the canonical workspace chooser,
  3. the separate workspace management destination.

Existing Entities / Concepts

Workspace switch entry (UI affordance)

Attribute Value
Surface Admin context bar / topbar partial
Current problem Routes to workspace management instead of chooser
New contract Routes to the chooser using the existing forced-switch convention
Mutation None

Workspace chooser

Attribute Value
Backing page App\Filament\Pages\ChooseWorkspace
Route slug /admin/choose-workspace
Purpose Explicit manual workspace selection
Existing behavior After selection, consumes intended URL or resolves redirect via WorkspaceRedirectResolver

Workspace management destination

Attribute Value
Backing resource App\Filament\Resources\Workspaces\WorkspaceResource
Purpose Workspace CRUD / administrative management
Access model Existing capability-aware workspace management rules
Change in this feature None

Relevant Existing State

Session-backed workspace context

Key Type Notes
current_workspace_id int Active workspace context used across the admin plane
intended workspace URL string/null Existing post-selection return path managed by WorkspaceIntendedUrl

Existing redirect semantics

Switch intent
  -> ChooseWorkspace (`?choose=1` forces chooser)
  -> User selects workspace
  -> WorkspaceIntendedUrl::consume() if present
  -> else WorkspaceRedirectResolver::resolve()

Validation / Rules

Rule Result
Intentional workspace switching must target chooser Required
Intentional switching must not target workspace CRUD Required
Workspace management remains separately reachable Required
Existing membership/capability enforcement remains unchanged Required
Existing post-selection redirect behavior remains unchanged Required

State Transition

[User on admin page]
    |
    | click "Switch workspace"
    v
[Chooser page displayed]
    |
    | select workspace
    v
[Existing intended URL or resolved workspace landing]

No new persistence state is introduced.