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
- Unpublishes all files: Deletes
published_files entries and sets files.is_public = FALSE for all files in the workspace
- Unpublishes all fonts: Sets
fonts.is_public = FALSE, slug = NULL, published_at = NULL for all fonts in the workspace
- 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
- Nullifies workspace slug: Sets
slug = NULL (in addition to renaming)
- 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
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
published_filesentries and setsfiles.is_public = FALSEfor all files in the workspacefonts.is_public = FALSE,slug = NULL,published_at = NULLfor all fonts in the workspacereassign_current_workspace_for_workspace()to updateusers.current_workspace_idfor all members whose current workspace was the deleted oneslug = NULL(in addition to renaming)204without error if the workspace is already soft-deleted (does NOT return404)Missing: Maps cleanup
Note: Maps (
mapstable withis_public,slug,published_atcolumns) are NOT cleaned up during workspace deletion. This is tracked separately in #341.Impact
404documented status code implies already-deleted workspaces return 404, but they actually return 204Suggested Fix
Update WS-003 documentation to include:
Context