feat: destroy command — requirements and design spec#128
Conversation
940267d to
22490bd
Compare
|
|
||
| #### Acceptance Criteria | ||
|
|
||
| 1. THE Destroy_Command SHALL run a full validation cycle across ALL targeted stages before initiating any destructive action or prompting for confirmation. Resource discovery includes live AWS API calls to resolve S3 connection details, enumerate QuickSight resources by prefix, and check for active Airflow workflow runs. |
There was a problem hiding this comment.
Will the validations include missing permission errors?
There was a problem hiding this comment.
See, if we can add them. Otherwise, we can run destroy multiple times
There was a problem hiding this comment.
I think I am gonna wait for your dry-run CR to be out and see, if I can use your existing IAM validation logic to destroy resources.
| ) | ||
| continue | ||
|
|
||
| s3_helper.delete_objects(bucket, object_keys, region=effective_region) |
There was a problem hiding this comment.
Will this delete the bundle as well?
There was a problem hiding this comment.
This only deletes the deploy S3 target resources. I think bundle is stored somewhere else, so it is not deleted
There was a problem hiding this comment.
This is deleting everything that deploy command creates. I believe bundle is saved somewhere outside of this path, so it will stay
| @@ -0,0 +1,51 @@ | |||
| """ | |||
| Operator registry for the destroy command. | |||
There was a problem hiding this comment.
Keeping for now, can remove this later, if customers do not want it
| ) | ||
|
|
||
|
|
||
| def list_dashboards( |
There was a problem hiding this comment.
Why do we need to list the dashboards? can't we just directly fetch the ones mentioned in the manifest?
There was a problem hiding this comment.
In the manifest we are only listing the dashboard name. Any account can have any number of identical dashboard names and they can also be changed after creation. So, doing a prefix search is a little safer, though still not entirely deterministic
There was a problem hiding this comment.
not sure if i follow the reasoning. We should use the same logic to identify the resource as the deploy. If deploy looks up using name, destroy should do the same as well.
There was a problem hiding this comment.
Deploy command is actually using dashboard_id look up as well. Dashboard name is used as the name of the exported .qs file (which QuickSight generates itself I think).
4dc08b1 to
9a314ff
Compare
- Requirements: 12 requirements covering CLI interface, validation phase, destruction ordering, Airflow workflow deletion, QuickSight prefix-based cleanup, S3 object deletion, conditional DataZone project deletion, operator registry for workflow-created resources (Glue jobs), idempotency, output formatting, and scope boundaries - Design: two-phase architecture (validate-all-then-destroy), operator registry pattern, data models, correctness properties, error handling tables, unit test strategy, integration test extension plan, and design decision rationale for operator registry vs reverse DAG approach
- Add Bootstrap_Connection deletion (datazone.create_connection bootstrap actions) - Add catalog resource deletion (glossaries, terms, form types, asset types, assets, data products) - Refactor S3 deletion to use existing s3_helper instead of inline boto3 calls - Add resource_type field to OPERATOR_REGISTRY entries (remove hardcoding) - Derive registry resource types dynamically in _destroy_stage Step b - Fix Rich markup mismatch in WARNING message (red→yellow) - Update requirements (Req 13-15), design, and tasks for connections and catalog - 86 unit tests passing
- Add destroy command section to docs/cli-commands.md (options, examples, TEXT/JSON output, two-phase behavior, use cases, notes) - Update command count from 8 to 9 in cli-commands.md - Add destroy to command overview table and pipeline commands list - Expand Clean Up Resources walkthrough to cover both destroy and delete - Add Rollback Workflow to Common Workflows section in cli-commands.md - Add destroy cleanup step to README.md Quick Start - Add Rollback Guide link to README.md documentation section - Add destroy cleanup step to all 6 translated READMEs (pt, fr, it, ja, zh, he) - Update examples/full-pipeline-lifecycle.sh Step 8 to use destroy - Update examples/cleanup-demo-resources.sh to use destroy with explanation - Add new docs/rollback-guide.md covering manual rollback strategies, destroy+redeploy clean slate approach, decision tree, catalog/project preservation, GitHub Actions automated rollback workflows, and bundle-based rollback setup
… --targets - Remove delete command entirely (code, tests, docs, CLI registration) - Replace delete with destroy in integration test cleanup steps - Make --targets required for destroy (no implicit all-stages) - Add WARNING banner: destroy deletes all matching resources including user-created ones, not only CI/CD-created resources - Add irreversibility warning in CLI docs - Remove explicit workflow run stopping from destruction phase; MWAA Serverless auto-terminates runs on workflow deletion - Fetch workflow definitions from MWAA API (get_workflow) instead of scanning S3 for YAML files - Add deploy/destroy drift detection: DEPLOY_RESOURCE_TYPES registry in resource_types.py with unit test asserting parity with DESTROY_SUPPORTED_RESOURCE_TYPES - Rename --stages to --targets across all commands (including create) and all documentation for consistency - Fix --targets typo in AWS EventBridge put-targets doc examples - Consolidate cli-commands.md into single 1-10 command list, remove duplicate sections, fix numbering, remove stray content - Split destroy.py (1656 lines) into four modules: destroy.py (282), destroy_models.py (68), destroy_validator.py (568), destroy_executor.py (382) - Update specs (requirements, design, tasks) to reflect all changes
Content from main was lost during cli-commands.md consolidation. Restores: pre-deployment validation step, --dry-run/--skip-validation options, dry run mode documentation, catalog asset access details.
- Remove unused imports from destroy.py (F401) - Apply black formatting to all destroy helper modules - Update drift test to import directly from destroy_models - Restore dry-run example reports in cli-commands.md
…, cleanup - Strip numbered prefixes from all command help strings in cli.py - Remove chat command (agent.chat_agent module does not exist) - Remove last delete command reference from cleanup-demo-resources.sh - Apply black formatting to airflow_serverless.py
- Move resolve_resource_prefix to quicksight.py (shared by deploy+destroy) - Add resolve_resource_ids_from_overrides to quicksight.py for exact ID resolution from manifest overrideParameters (Dashboards/DataSets/DataSources) - Add find_resources_by_prefix to quicksight.py for paginated prefix scan - Update deploy to use shared helpers instead of inline boto3 calls (fixes missing pagination in deploy's post-import resource discovery) - Update destroy validator: try exact IDs from overrides first, fall back to prefix scan for uncovered types - Add unit tests for all three new quicksight helper functions - Remove duplicate resolve_resource_prefix tests from test_destroy.py - Remove dead chat command, cleanup-demo-resources.sh delete reference - Apply black formatting to all changed files
Update cli-commands.md with main's dry-run best-effort language: pre-deployment validation, --dry-run option, dry run mode section, and pre-deployment validation section all now include caveats about best-effort nature and conditions that may cause deployment failure despite clean validation.
2d698dc to
14da19c
Compare
Overview
This PR adds the requirements and design spec for the new
destroycommand. No implementation code yet — for team review before implementation begins.What's included
.kiro/specs/destroy-command/requirements.md— 12 requirements covering the full feature scope.kiro/specs/destroy-command/design.md— technical design with architecture, data models, correctness properties, and testing strategyFeature summary
The
destroycommand is the inverse ofdeploy. It reads a manifest file and deletes all resources created bydeploy, in a safe dependency order:targetDirectoryprefixesproject.create: true)Key design decisions
Resource_Prefixrather than reconstructing IDs--asyncmode: dependency ordering requires synchronous execution--forceTesting plan
test_dashboard_glue_quick_workflow.pywith destroy + verify steps after the existing deploy + test stepsReview focus
Please review requirements and design for correctness, completeness, and any edge cases missed before implementation begins.