Summary
Update the AI Workspace organization switch flow so that a project reload uses the organization selected by the user.
Rationale
switchOrganization currently updates currentOrganization in the SPA and then reloads projects through GET /projects. The request continues to use the organization claim in the current session or token. A selected organization can therefore differ from the organization that scopes the project response.
Affected areas
portals/ai-workspace/src/contexts/AppShellContext.tsx
- The AI Workspace organization token-exchange or server-side organization-context flow
- Project retrieval through
GET /projects
Required changes
Before reloading projects after an organization selection, update the server-side organization context or exchange the token so its organization claim matches the selected organization. Ensure that project requests use that updated context. Keep the existing protection that ignores results from superseded organization selections.
Acceptance criteria
- Selecting organization B after organization A updates the request context to organization B before
GET /projects.
- The project response after the switch is scoped to organization B.
- A slower request from an earlier organization selection cannot overwrite the current project state.
- The switch flow has automated test coverage.
Backlinks
Summary
Update the AI Workspace organization switch flow so that a project reload uses the organization selected by the user.
Rationale
switchOrganizationcurrently updatescurrentOrganizationin the SPA and then reloads projects throughGET /projects. The request continues to use the organization claim in the current session or token. A selected organization can therefore differ from the organization that scopes the project response.Affected areas
portals/ai-workspace/src/contexts/AppShellContext.tsxGET /projectsRequired changes
Before reloading projects after an organization selection, update the server-side organization context or exchange the token so its organization claim matches the selected organization. Ensure that project requests use that updated context. Keep the existing protection that ignores results from superseded organization selections.
Acceptance criteria
GET /projects.Backlinks