Repository navigation
refactor(cloud): delete the unread _DELETE_DONE constant - #14498
Conversation
|
Intent: Make |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 62ce026 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (2 items) — 2 justifiedIntent: FIX — make
Verified: grep for [FIRST-PRINCIPLES-REVIEWED] 62ce026 |
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
CI reds on
No rerun requested: all three are deterministic on main, so a rerun would fail identically. This PR is otherwise converged — GPT, Opus, Design, First Principles and UX all PASS with no findings. |
ec2.py bound _DELETE_DONE = "DELETE_COMPLETE" at module scope, but no code, test, doc or script in the tree reads it, and it has never had a reader since it was added. The delete path waits on `aws cloudformation wait stack-delete-complete` and never compares a status string against it. The destroy() docstring claimed the wait "raises on DELETE_FAILED". It does not: wait_for_delete returns False whenever the wait does not confirm the delete, and destroy() reports that as destroyed=False. The docstring now says so. Behaviour is unchanged.
b057d39 to
62ce026
Compare
|
Rebased onto |
|
|
Problem / Motivation
Goal: Make
src/kiro_crew/cloud/ec2.pysay only true things about stack deletion: drop a constant nothing reads, and correct a docstring that promises an exception the code never raises._DELETE_DONE = "DELETE_COMPLETE"sits among the terminal CloudFormation state sets incloud/ec2.py. No code, test, doc or script reads it, and it has never had a reader since it was added. Next to it, thedestroy()docstring says the wait "raises onDELETE_FAILED". It does not: a failed delete comes back asdestroyed: False.Why it matters
A reader of the stack-state block assumes every name there feeds a decision; an unread one sends them hunting for delete logic that does not exist. The docstring is worse: a caller who trusts it wraps
destroy()in atryand never checksdestroyed, so a stack stuck inDELETE_FAILEDkeeps billing while the caller reports success.Not a goal
destroy()keeps returning a failed delete rather than raising it.cloudcleanup: the deepif/elifchains inlaunch_job.pyandwizard.pysit insidetry/finallyand do not flatten cleanly, so they stay.What changed (motivation → approach → change)
One unread constant goes away and one docstring now matches the code; behaviour is unchanged.
The module-simplification detector reports zero mechanical sites tree-wide, so this is a judgment-class pass: an AST scan for top-level private names whose identifier appears exactly once across
src/,test/,docs/,scripts/andwebsite/. In thecloudmodule that finds only_DELETE_DONE, and its line is deleted.The
destroy()docstring now says what the code does.wait_for_deletereturnsrc == 0from the CLI waiter, anddestroy()passes that through asdestroyed. SoFalsemeans the wait did not confirmDELETE_COMPLETE, and that outcome is returned, never raised. Every otherDELETE_FAILEDmention incloud/,cli_cloud.pyanddashboard/handlers_cloud.pyalready describes it this way.Backwards compatibility
Compatible: the name is private and has no reader anywhere in the tree, so nothing that works today can observe its absence.
Tests
No test change. Nothing tests or patches the constant. The existing
cloudtests (test_cloud_ec2.py,test_cloud_cli.py,test_launch_engine_ref.py,test_aws_profile_charset.py; 321 tests) pass unchanged.Manual verification
N/A — a deleted unread constant and a docstring edit have no runtime path to exercise. Static gates (flake8, isort, mypy, brand, harness-parity, docs-lint, per-file coverage, vendor manifest) pass. Backend-only diff, so CI's
changesjob narrows toonly_backend=trueand the frontend suites do not run.Pre-PR review: five read-only lenses (AUTOSDE blocking rules, behaviour preservation, import semantics, security keystone and boot path, comment accuracy), then independent refuters for each finding. Two findings survived: the
destroy()docstring's false "raises onDELETE_FAILED" (fixed here) and an inaccurate history claim in the commit message (reworded). A verifier then flagged the first rewrite of the docstring as over-claiming ("the waiter giving up" cannot happen before the 1800 s timeout); it was tightened to the current wording. Nothing was dropped as a false positive.Screenshots / video
Why no screenshot: backend-only constant deletion and docstring edit; nothing renders differently.
Related Issues
no linked issue: a readability cleanup from the module-simplification sweep, not a tracked defect.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)