Skip to content

Add workspace state check and per-workspace delete commands#100

Open
jirkasemmler wants to merge 1 commit into
mainfrom
jirka/workspace-state-check-and-delete-by-id
Open

Add workspace state check and per-workspace delete commands#100
jirkasemmler wants to merge 1 commit into
mainfrom
jirka/workspace-state-check-and-delete-by-id

Conversation

@jirkasemmler

Copy link
Copy Markdown
Contributor

Changes:

  • New command manage:check-project-workspaces-state — read-only classifier. Input: headerless CSV projectId,workspaceSchema[,componentId,configurationId]. For each row it checks the live API across all dev branches and reports the state (live / config_in_trash / config_live_workspace_gone / purged_or_orphan / access_denied) with a suggested cleanup action, workspaceId, branch and loginType. Makes no changes.
  • New command manage:delete-project-workspaces-by-id — deletes single workspaces by id, keeping the parent configuration and its other workspaces (unlike manage:mass-delete-project-workspaces, which deletes the whole configuration and only works via editor sessions, i.e. sandboxes only). With --with-configuration it deletes the whole configuration (trash + purge; handles configurations that are live, already in trash, or fully purged).
  • Safety rails: dry-run by default (-f to write); refuses workspaces whose loginType is not a password login unless --any-login-type (protects key-pair siblings of migrated sandboxes); optional expectedSchema CSV column must match the live schema; --with-configuration refuses configurations owning more than the one listed workspace.
  • Both commands take a manage token and mint short-lived (30 min) per-project storage tokens (canManageBuckets, plus canPurgeTrash for configuration deletes), dropping them after each project — no interactive token pasting.

Built for the SLSP LEGACY_SERVICE cleanup (DMD-1565), where they executed 215 deletions with zero failures; the tooling is stack-agnostic and reusable for any password-login workspace cleanup.

phpstan level 9 and phpcs clean.


Additional notes

⚠️ Don't forget to release new version after merge

🤖 Generated with Claude Code

manage:check-project-workspaces-state — read-only classifier: for a CSV of
projectId,schema[,componentId,configId] it checks the live API (all dev
branches) and reports whether each workspace is live, its configuration is
in trash, or fully purged, with a suggested cleanup action per row.

manage:delete-project-workspaces-by-id — deletes single workspaces by id
(keeps the parent configuration and its other workspaces), or with
--with-configuration the whole configuration (trash + purge). Dry-run by
default; refuses non-password-login (key-pair) workspaces unless
--any-login-type; optional expectedSchema column cross-check; with
--with-configuration refuses configurations owning more than the one
listed workspace.

Both mint short-lived per-project storage tokens from a manage token, so
no interactive token pasting. Built for LEGACY_SERVICE workspace-user
cleanups (DMD-1565).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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