chore: remove workspaces endpoint + account-type plumbing (chat#1979)

Merged
SW
3mo ago
+101-503

Implements item 3 (api: endpoint + plumbing out) of recoupable/chat#1979 — workspaces are removed as an account type; organizations supersede them.

Merge gate: merge only AFTER the docs removal PR merges (de-document, then remove — per the issue's resequenced order: audit → chat-UI → docs → api → chat-flags → database). The breaking removal of the documented POST /api/workspaces endpoint is deliberate per the issue decision (its only caller is chat's CreateWorkspaceModal, removed in the chat-UI PR; external exposure was docs-advertised only).

Removals

  • app/api/workspaces/route.ts — POST /api/workspaces now 404s
  • lib/workspaces/ — createWorkspacePostHandler, createWorkspaceInDb, validateCreateWorkspaceBody
  • lib/supabase/account_workspace_ids/ — getAccountWorkspaceIds, insertAccountWorkspaceId, selectAccountWorkspaceId + test
  • lib/artists/getArtists.ts — workspace merge dropped from both roster paths (orgId === null and default); artist rows are field-identical otherwise
  • lib/auth/checkAccountAccess.ts — access path 3 (workspace) removed; "workspace" dropped from AccountEntityType
  • lib/composio/checkConnectorAuthority.ts — authority path 4 (workspace) removed
  • lib/artists/getFormattedArtist.ts — isWorkspace field removed from FormattedArtist
  • Duplicate "(workspace)" connector-validation tests deleted (strict duplicates of their "(artist)"/"(unopinionated)" siblings); ARTIST/WORKSPACE prompt sentinels renamed to ARTIST; workspace-account-type mentions cleaned from comments and AGENTS.md terminology

checkAccountAccess test evidence (red → green)

checkAccountAccess authorizes the connectors override suite (live prod traffic), so the change is pinned by new unit tests in lib/auth/__tests__/checkAccountAccess.test.ts:

  • RED (against main's code): "denies a workspace pair" failed — selectAccountWorkspaceId mocked to return a join row, current code granted { hasAccess: true, entityType: "workspace" }; the self/artist/organization pins passed. (1 failed | 4 passed)
  • GREEN (after removal): all 5 pass — self, artist, and organization branches unchanged; a workspace pair now denies. Same red→green done for checkConnectorAuthority (its workspace-grant test flipped to a denial pin: 1 failed | 7 passed → all pass).

isWorkspace response-field decision

Removed outright (no hardcoded false). Evidence from chat origin/main: types/Artist.tsx declares isWorkspace?: boolean (optional), and every consumer tolerates undefined — !artist.isWorkspace filters in ConfirmRosterStep, VerifySocialsStep, hooks/useRunValuation.ts, hooks/useSetupValuation.ts, and ?.isWorkspace === true checks in ArtistSetting/{Settings,Inputs}.tsx. With workspace rows gone from rosters, an absent field is behaviorally identical to false on every row.

Verification

  • Full suite: pnpm exec vitest run — 834 files, 4636 tests, all green
  • pnpm exec tsc --noEmit — error set is a strict subset of a clean main-checkout run (no new errors)
  • eslint + prettier clean on all changed files
  • Repo grep: zero code references to the deleted modules; remaining "workspace" strings in lib//app/ are the out-of-scope sandbox working-directory naming (enumerated in the issue), Attio-tenant constants, a Slack-URL test fixture, and the two test pins documenting that account_workspace_ids no longer grants access

Net LOC: −402 (22 files changed, 101 insertions, 503 deletions)

🤖 Generated with Claude Code

https://claude.ai/code/session_01ExgW1WRbZXendHdFw1fwBT


Summary by cubic

Removes workspaces as an account type; organizations supersede them. POST /api/workspaces now 404s, and workspace-based access/authority is denied.

  • getArtists returns only artists (no workspace merge); the isWorkspace field is removed.
  • checkAccountAccess no longer returns "workspace"; workspace pairs now deny. checkConnectorAuthority no longer grants via account_workspace_ids.
  • Deletes app/api/workspaces/route.ts, lib/workspaces/*, and lib/supabase/account_workspace_ids/*. Prompt sentinels change from "ARTIST/WORKSPACE" to "ARTIST".

Rollout / Migration

  • Merge only after the docs PR that removes POST /api/workspaces; remove any remaining callers and workspace-account-type checks.
  • No DB drops; lingering account_workspace_ids rows no longer grant access.

Summary by CodeRabbit

  • Breaking Changes

    • Removed workspace creation through the API.
    • Removed workspace-based account access and connector authorization.
    • Workspace accounts are no longer included in artist listings or account resolution.
  • Updates

    • Artist profiles and assistant context now use artist- and organization-focused terminology.
    • Removed workspace-related account linking and validation functionality.