🐾 fix(api): workspace DELETE must not report success it didn't perform #11
Reference in New Issue
Block a user
Delete Branch "fix/workspace-delete-orphan-libraries"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
DELETE /library/api/workspaces/{id}/returned 204 having deleted nothing when the Library'sowner_usernamedidn't match the caller. The caller (Daedalus) takes 204 as confirmation, drops its own workspace row, and moves on — while the Library survives, holding its globally-unique name forever. Nothing anywhere records why. The name simply can never be reused, and the next workspace that wants it hits an unexplainedname_conflict.This bites hardest for libraries created via
POST /library/api/libraries/, which sets neitherowner_usernamenorworkspace_id(views.py:116-131) — such a library holds a name globally but can never be deleted through the workspaces endpoint.What
owner_conflict, reusing the code the create path already emits for the same condition (so Daedalus's existing_sync_error_messagemapping already understands it).Verification
WorkspaceDeleteOwnershipTests: absent → 204, owned → deleted (cascade called once), unowned → 409 withdelete_library_cascadenot called, unowned GET → still 404.librarysuite run before and after: identical 8 failures + 1 error, all pre-existing intest_search_api/test_tasksand unrelated to this change (artifacts of the sqlite settings override used locally — this host has no Postgres create permission and Neo4j atariel.incusis unreachable).neomodel.sync_.match.NodeSet.get—Library.nodesreturns a freshNodeSetper access, so patching the instance silently does nothing.Companion
Daedalus side is in
r/daedalusPR #27, which records a failed delete as a durable orphan and retries it from the reconciler. Either fix alone narrows the window; together they close it.🤖 Generated with Claude Code