Skip to content

account: include pending-deletion workspaces in getPendingWorkspace 'all' operation - #11004

Open
IamCoder18 wants to merge 1 commit into
hcengineering:developfrom
IamCoder18:fix/account-get-pending-workspace-all-deletion
Open

account: include pending-deletion workspaces in getPendingWorkspace 'all' operation#11004
IamCoder18 wants to merge 1 commit into
hcengineering:developfrom
IamCoder18:fix/account-get-pending-workspace-all-deletion

Conversation

@IamCoder18

Copy link
Copy Markdown

Context

The getPendingWorkspace query supports an 'all' operation that selects workspaces pending any worker action. It only matched workspaces pending creation or upgrade, so workspaces waiting on deletion were never picked up by the worker and just sat there. The 'all+backup' branch already includes the deletion clause, so this is a missing entry rather than a new behavior.

Implementation

In server/account/src/collections/mongo.ts, the 'all' case now spreads deletingQuery into the existing or-clauses. In server/account/src/collections/postgres/postgres.ts, the 'all' SQL now ORs in the existing deletingSql, matching the pattern used for pending creation and upgrade. The stale TODO comment about returning pending deletion workspaces was removed.

Tests

Updated the 'all' SQL snapshot in postgres.test.ts to include the new clause and added a focused test in mongo.test.ts that asserts the 'all' operation's or-array contains a status.mode $in ['pending-deletion', 'deleting'] clause.

…all' operation

    The default workspace-pod operation mode is 'all', which previously
    matched only pending-creation / creating and pending-upgrade workspaces.
    Soft-deleted workspaces (mode='pending-deletion') never matched, so they
    were never picked up by the worker and never reaped. Selfhosts that do
    not set WS_OPERATION=all+backup (the recommended mode that does include
    deletion) silently accumulate orphan rows.

    Extend the 'all' branch to also match pending-deletion / deleting in
    both PostgresAccountDB and MongoAccountDB so the operation name does
    what it says. The 'all+backup' branch is unchanged (already correct).
    Drop the stale TODO that called out this gap.

    Tests assert the pending-deletion clause is present in both backends.

Signed-off-by: Aarav Sharma <iamcoder18@gmail.com>
@IamCoder18
IamCoder18 force-pushed the fix/account-get-pending-workspace-all-deletion branch from 0ce95e7 to 1be40db Compare August 5, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant