Skip to content

cleanup command - #98

Closed
jirkasemmler wants to merge 1 commit into
mainfrom
jirka/cleanup-commands
Closed

cleanup command#98
jirkasemmler wants to merge 1 commit into
mainfrom
jirka/cleanup-commands

Conversation

@jirkasemmler

Copy link
Copy Markdown
Contributor

Changes:


Additional notes

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

improve commands
@jirkasemmler
jirkasemmler force-pushed the jirka/cleanup-commands branch from 248e277 to 9e9ce4a Compare June 30, 2026 14:24
jirkasemmler added a commit that referenced this pull request Jul 30, 2026
…ting

Consolidates the outstanding workspace tooling into this branch, replacing
PRs #92, #98 and #100. Adds three commands and documents them; no existing
command is modified.

manage:check-project-workspaces-state (read-only)
  Triage step for a known list of workspaces: reports whether each is still
  live and whether its configuration is live, trashed or gone, and suggests
  the follow-up command. Configuration state is resolved per branch, because
  branches hold independent copies under the same id and merging them
  misclassifies a config that is live in one branch and trashed in another.
  Also reports each configuration's most recent job from the Queue API, which
  is usually what decides whether it is still in use, and runs a sanity query
  for any job in the project first so that blank lastJob columns are not
  misread as "never used".

manage:delete-project-workspaces-by-id
  List-driven deletion with layered guards: password-login only unless
  --any-login-type, optional expected-schema verification, and configuration
  deletion only behind --with-configuration and only when that configuration
  owns exactly the listed workspace. Deletes the workspace without touching
  the configuration by default. A purge refused with
  storage.components.cannotDeleteConfiguration is counted as failed rather
  than deleted, since in that case the configuration is still in the trash and
  its workspace and backend user still exist.

manage:list-external-buckets (read-only)
  Stack-wide CSV audit of external buckets with created date, isReadOnly and
  whether KBC.description metadata is set. Drops its temporary token even when
  listing fails, and continues past projects it cannot reach.

README gains entries for all three, and the "Which command should I use?"
table now points at the by-id command as the preferred list-driven option over
manage:mass-delete-project-workspaces, which needs an interactively pasted
token per project and always purges the configuration.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jirkasemmler

Copy link
Copy Markdown
Contributor Author

Closing as part of consolidating the workspace tooling into #106.

The keep-rule mode is deliberately not carried over. --keep-creator / --keep-created-from means "delete every workspace in these organizations that was not created by X", with no component filter required, and under --force it also deleted the parent configuration whenever one existed, with no separate opt-in. On a transformation component the configuration is the user's code, so that combination is the INC-01328 mechanism with an organization-wide blast radius. It was one-off tooling for the Carvago cleanup (DMD-1594), and that work is finished.

Two changes here were uncontroversial and are not in #106, because that PR deliberately does not modify existing commands. They are worth salvaging separately if still wanted:

  • DeleteStorageBackend — reporting success/failure per backend instead of printing really and letting a ClientException escape. Also carries the one-line fix for the failing Check codestyle build (a blank line at the end of a control structure in DeleteStorageBackend.php:60, auto-fixable with phpcbf).
  • DescribeOrganizationWorkspaces — the --legacy-only filter and the loginType column. Read-only and useful for triage. Note Consolidate workspace tooling: state check, delete-by-id, external buckets + docs #106 documents the describe command's real CSV header, which was missing activeUser.

⚠️ This branch still contains a customer's email address in a code comment, in DeleteOrganizationOrphanedWorkspaces.php:

// the email, e.g. "kbagent-cli [<redacted>@<customer-domain>]" for workspaces created on his behalf.

keboola/cli-utils is a public repository. This branch was squashed on 2026-06-30 for that reason, but the squash flattened the history and left the address in the code itself. It is the only occurrence — the other branches are clean.

Closing this PR does not unpublish it. GitHub keeps the head commit reachable at refs/pull/98/head indefinitely, so removing it properly needs the comment scrubbed and the branch force-pushed, and then GitHub Support asked to purge the stale ref. Worth doing regardless of what happens to the rest of this PR.

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