Skip to content

Add mass env delete - #245

Merged
chrisghill merged 1 commit into
mainfrom
mass-env-delete
Jul 21, 2026
Merged

Add mass env delete#245
chrisghill merged 1 commit into
mainfrom
mass-env-delete

Conversation

@chrisghill

@chrisghill chrisghill commented Jul 21, 2026

Copy link
Copy Markdown
Member

Implements a delete subcommand for environments (aliased as mass env delete),
rounding out the environment CRUD lifecycle alongside create, get, list,
and update.

What's new

  • mass environment delete <environment> — permanently deletes an environment
    via the SDK's Environments.Delete.
  • --force, -f flag to skip the confirmation prompt (for automation/CI).
  • Type-to-confirm safety prompt: by default the user must type the environment
    ID to confirm, mirroring the existing mass project delete pattern. The
    environment is fetched first so the prompt shows the real ID and fails cleanly
    if it doesn't exist.

Behavior notes

  • Deleting an environment does not tear down its running infrastructure. The
    help doc calls this out and points users to mass environment decommission
    first if they want the underlying resources removed.

@chrisghill
chrisghill requested a review from coryodaniel as a code owner July 21, 2026 19:42
@chrisghill chrisghill changed the title Add mass env delete Add mass env delete Jul 21, 2026
@chrisghill

Copy link
Copy Markdown
Member Author

@claude review

@claude

claude Bot commented Jul 21, 2026

Copy link
Copy Markdown

Claude finished @chrisghill's task in 2m 28s —— View job


Code Review: mass env delete

  • Gather context (PR diff, related files)
  • Review cmd/environment.go delete command implementation
  • Review generated/help docs
  • Compare against existing mass project delete pattern for consistency
  • Post review feedback

Reviewed the diff (git diff origin/main...HEAD) covering cmd/environment.go, the generated docs, and the new helpdoc.

Summary

The implementation is clean and follows the existing mass project delete convention (cmd/project.go:339) closely: fetch-then-confirm-then-delete, with a type-to-confirm prompt and a --force bypass. No correctness issues found.

Observations (non-blocking)

  1. Confirmation-prompt duplication (cmd/environment.go:463-473) — This exact type-to-confirm block (bufio reader, trim, compare) is now duplicated nearly verbatim across 5 files: project.go, instance.go, repository.go, resource_type.go, and now environment.go. Since this PR adds a 5th copy, it might be worth a follow-up to extract a shared confirmDeletion(prompt, expected string) (bool, error) helper — not a blocker for this PR since it matches established repo convention, but the duplication is growing. Fix this →

  2. Get call always runs, even with --force (cmd/environment.go:456-459) — In automation contexts using --force, this still does a network round-trip to fetch the environment before deleting, purely to populate the confirmation message. This is intentional per the PR description (fail cleanly if the environment doesn't exist) and mirrors project delete's behavior exactly, so it's consistent — just noting the extra API call for CI-heavy use of --force.

  3. No test coverage — There's no test file for environment.go (or project.go) in the repo currently, so this isn't a regression introduced by this PR, just flagging that the new runEnvironmentDelete path (confirm/cancel/force branches) is untested, consistent with the rest of the file.

  4. Nice touch: the generated help doc correctly states the prompt requires typing the environment ID (docs/helpdocs/environment/delete.md:33) — this is actually more accurate than docs/helpdocs/project/delete.md, whose doc text says the prompt requires typing "yes" even though the code requires the project ID. Not something to fix here, just worth being aware of for a future doc pass on project delete.

Verification notes

I was not able to run go build/go vet/go test in this sandboxed environment (network/toolchain access was blocked), so this review is based on static reading of the diff and cross-referencing the SDK usage patterns already established in cmd/project.go. The import additions (bufio) are correct and os/strings were already imported in this file.

Verdict

Looks good — matches established patterns, docs are consistent and correct, behavior notes about non-destructive infra are clearly called out. Nothing blocking.

@chrisghill
chrisghill merged commit ad8e8f8 into main Jul 21, 2026
7 checks passed
@chrisghill
chrisghill deleted the mass-env-delete branch July 21, 2026 19:59
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.

3 participants