Repository navigation
fix(cli): confirm before destructive compound-verb deletes (#285) - #329
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
isDestructive() in the flag-conventions guard keyed on the exact cobra command name, but Name() is the first whitespace token of Use — so hyphenated compound verbs like `workspace-remove` and `remove-schedule` never matched the destructive set. Both commands did an irreversible delete (DynamoDB workspace registration; scheduled scaling action) with no --yes flag and no confirmation prompt. - Guard now inspects every hyphen-segment of the verb, so compound destructive verbs can't slip past it (and future ones can't regress). - `notify workspace-remove` and `autoscale remove-schedule` now prompt via confirmYes and accept -y/--yes to skip for scripts. Piped/EOF stdin reads as "no" → aborts rather than deleting silently. Also adds the 2026-07-11 audit report under docs/.
scttfrdmn
force-pushed
the
audit/285-destructive-gate-compound-verbs
branch
from
July 11, 2026 18:47
73b011c to
fe6a216
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #285.
Problem
isDestructive()incmd/flag_conventions_test.gokeyed on the exact cobra command name. ButName()returns only the first whitespace-delimited token ofUse, so hyphenated compound verbs arrive as a single token and never matched the destructive set (cancel/terminate/delete/remove/destroy).Result: two commands did an irreversible delete with no
--yesand no prompt:spawn notify workspace-remove→DeleteItemon the DynamoDB workspaces table (cmd/bot.go:599)spawn autoscale remove-schedule→ drops a scheduled scaling action viaUpdateGroup(cmd/autoscale.go)Fix
workspace-destroyremains satisfied via its existing--confirm/dry-run.confirmYes(...)before acting and register-y/--yesto skip the prompt for scripts. Piped/EOF stdin reads as "no" → aborts rather than deleting silently.Verification
TestFlagConventionsfails on the pre-fix code (flagging exactly these two commands), passes after.echo "" | spawn notify workspace-remove --platform slack --workspace-id TTEST→ prints prompt, exits 1, makes zero AWS calls.--helpshows-y, --yeson both.go vet ./cmdclean. (Pre-existing unrelated failure:TestCatalogValid/ feat(plugin): permissions declaration block (#388) #392 private catalog images — fails onmaintoo.)Part of the 2026-07-11 audit (tracker #328, Phase 0). Report added under
docs/spawn-audit-2026-07-11.md.No user-facing rename; adds
--yes(additive) and a prompt. CHANGELOG updated under Fixed.