pub async fn initialize_user_state_doc( state: &AppState, user_id: &str, user_state: &UserState, ) -> Result<DocumentId, AppError>
Creates a fresh user state document and persists its ID.