Skip to content

fix(deploy): surface recent CloudFormation failure reasons - #2615

Open
proton0210 wants to merge 1 commit into
aws:mainfrom
proton0210:fix/2540-deploy-diagnostics
Open

proton0210 wants to merge 1 commit into
aws:mainfrom
proton0210:fix/2540-deploy-diagnostics

Conversation

@proton0210

Copy link
Copy Markdown

Description

Closes #2540 (deployment diagnostics described by the issue title).

A terminal toolkit error such as NoStack: CloudFormationStack object does not hold a stack can obscure the causal CloudFormation resource failure. Enrich final deployment failures with a best-effort, read-only DescribeStackEvents lookup, independently of verbose/progress output.

  • Query explicit selected stack names, or synthesized stack names when the TUI uses default selection, in the deployment region/profile.
  • Filter out events older than this deployment and cancellation fallout; include resource IDs, status, and service failure reasons, without dumping resource properties.
  • Bound lookup to five event pages, ten deduplicated reasons, and a ten-second request abort deadline; truncate individual reasons and strip terminal formatting.
  • Preserve the original Error instance/type/cause, changeset retries, and caller cleanup. Denied/deleted-stack/empty event lookups cannot mask the original failure; provide a manual inspection command.
  • No additional event lookups on a successful deployment or a changeset retry that succeeds.

The unrelated JSON-flag validation and online-eval deletion concerns mentioned in the issue body are not changed by this PR. Nested stacks are not recursively queried; wildcard-only selectors without concrete stack names are not expanded. Event lookup is best-effort and may not find a cause when events are not yet visible, inaccessible, outside the time/page window, or the stack has been deleted.

Type of Change

  • Bug fix
  • Documentation update (in this PR; no separate documentation PR)

Testing

  • Before the fix: both new final-error regressions failed (lost causal reason and absent manual guidance).
  • Focused diagnostics suite: 13 passed, covering NoStack with a causal resource failure, access denial, successful deployments, TUI default stacks, unchanged retry behavior, pagination/history filtering, cancellation, deduplication/output bounds, profile/region selection, partial lookup failure, and plain-text rendering.
  • Final full npm test: 6,365 passed across 443 files. Selected offline CLI integration tests (integ-tests/help.test.ts and integ-tests/config.test.ts): 30 passed.
  • Build, typecheck, and lint pass; repository lint has 35 existing warnings and no errors. Normal commit hooks check changed-file lint, formatting, secrets, and typecheck.
  • Three audit passes: failing reproduction/error propagation; diagnostic safety, targeting, cleanup and retry compatibility; final suite/build/lint/diff and scope review.

All CloudFormation interactions were mocked. No AWS deployment or live failure was created, and no paid invocation was performed. The full integration suite was not run.

Checklist

  • Read CONTRIBUTING and linked the existing issue
  • Added regression tests and updated the relevant documentation
  • No dependency changes or new warnings
  • Independent of the promotion-safety PR

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] project deploy never surfaces CloudFormation CREATE_FAILED reasons

1 participant