Tenant isolation lives in the database, not the application.
Every multi-tenant table has a workspace_id column. Postgres Row-Level Security policies enforce isolation as a hard backstop — a forgotten WHERE clause in application code cannot leak data across workspaces. The application sets the current workspace per request; RLS policies reference it. We chose this after watching Microsoft Teams ship a cross-tenant bypass that came down to trusting the application layer.
SET LOCAL app.current_workspace = ?;
CREATE POLICY tenant_isolation ON messages
USING (workspace_id = current_setting('app.current_workspace')::uuid);