## Summary - route the context-bar `Switch workspace` link to the canonical chooser flow instead of workspace management - add focused regression coverage for topbar switching, management separation, and chooser redirect semantics - add Spec 121 artifacts (`spec`, `plan`, `research`, `data-model`, `contracts`, `quickstart`, `tasks`, checklist) ## Validation - `vendor/bin/sail artisan test --compact tests/Feature/Monitoring/HeaderContextBarTest.php tests/Feature/Workspaces/WorkspaceSwitchUserMenuTest.php tests/Feature/Workspaces/ChooseWorkspacePageTest.php tests/Feature/Workspaces/WorkspaceNavigationHubTest.php tests/Feature/Workspaces/EnsureWorkspaceSelectedMiddlewareTest.php tests/Feature/Workspaces/ChooseWorkspaceRedirectsToChooseTenantTest.php` - `vendor/bin/sail bin pint --dirty --format agent` ## Notes - base branch: `dev` - branch: `121-workspace-switch-fix` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #147
86 lines
2.5 KiB
Markdown
86 lines
2.5 KiB
Markdown
# 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
|
|
|
|
```text
|
|
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
|
|
|
|
```text
|
|
[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.
|