TenantAtlas/specs/121-workspace-switch-fix/contracts/routes.md
ahmido 891f177311 fix: route workspace switch to chooser (#147)
## 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
2026-03-08 00:58:51 +00:00

54 lines
1.7 KiB
Markdown

# Route Contract: Workspace Switch Semantic Fix
**Feature**: 121-workspace-switch-fix | **Date**: 2026-03-07
## Intent-level contract
### Switch workspace
- **Surface**: admin and tenant-panel context bar
- **Label**: `Switch workspace`
- **Canonical target**: `ChooseWorkspace::getUrl(panel: 'admin').'?choose=1'`
- **Meaning**: enter the explicit workspace chooser flow
- **User-menu duplication**: not allowed
### Manage workspaces
- **Surface**: existing administrative navigation / chooser management affordance
- **Canonical target**: workspace management resource index
- **Meaning**: create, view, and edit workspace records
## Before / After
### Before
```text
Context bar "Switch workspace"
-> /admin/workspaces
-> lands on workspace management CRUD index
```
### After
```text
Context bar "Switch workspace"
-> /admin/choose-workspace?choose=1
-> lands on chooser flow
```
## Invariants
1. Workspace chooser remains the canonical manual-switch surface.
2. `?choose=1` remains the explicit forced-chooser signal for intentional switching.
3. The top-right user menu must not expose a duplicate workspace-switch shortcut.
4. Workspace management remains separately reachable and semantically distinct.
5. Choosing a workspace continues to use existing `WorkspaceIntendedUrl` / `WorkspaceRedirectResolver` behavior.
6. No new routes, middleware rules, or authorization rules are introduced.
## Verification expectations
- Response rendering for a real admin page containing the context bar must show the chooser target.
- Filament user-menu evaluation must not register a `switch-workspace` item.
- Existing chooser behavior tests remain green.
- Workspace management navigation remains reachable through its existing destination.