Skip to content

docs: WS-003 missing side effects — delete_workspace also unpublishes files, fonts, and reassigns member workspaces #383

Description

@evan-zhang11

Documentation Gap

Entry: WS-003 (工作空间删除)
Current documentation: "DELETE /api/workspaces/:id 软删除工作空间(设置 deleted_at,重命名释放原名),仅 owner 可操作,个人工作空间不可删除"

Missing behaviors: The actual delete_workspace() handler performs several critical side effects that are not documented:

Undocumented Side Effects

  1. Unpublishes all files: Deletes published_files entries and sets files.is_public = FALSE for all files in the workspace
  2. Unpublishes all fonts: Sets fonts.is_public = FALSE, slug = NULL, published_at = NULL for all fonts in the workspace
  3. Reassigns current workspace for affected members: Calls reassign_current_workspace_for_workspace() to update users.current_workspace_id for all members whose current workspace was the deleted one
  4. Nullifies workspace slug: Sets slug = NULL (in addition to renaming)
  5. Idempotent on already-deleted: Returns 204 without error if the workspace is already soft-deleted (does NOT return 404)

Missing: Maps cleanup

Note: Maps (maps table with is_public, slug, published_at columns) are NOT cleaned up during workspace deletion. This is tracked separately in #341.

Impact

  • Medium-High: Users cannot predict what happens to their data when a workspace is deleted
  • Published files/fonts become inaccessible immediately, but this isn't documented
  • Members whose current workspace is deleted are silently moved to another workspace — this is a significant UX behavior
  • The 404 documented status code implies already-deleted workspaces return 404, but they actually return 204

Suggested Fix

Update WS-003 documentation to include:

Context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions