Skip to content

fix: stack header emoji respects allowedDestroyTypes#164

Open
igraves wants to merge 1 commit into
corymhall:mainfrom
igraves:fix-emoji-allowed-destroy-types
Open

fix: stack header emoji respects allowedDestroyTypes#164
igraves wants to merge 1 commit into
corymhall:mainfrom
igraves:fix-emoji-allowed-destroy-types

Conversation

@igraves

@igraves igraves commented Jun 12, 2026

Copy link
Copy Markdown

Problem

Removals whose resource type is listed in allowedDestroyTypes are correctly excluded from destructiveChanges — they don't fail the job and don't appear in the "Destructive Changes" warning banner. But the per-stack header emoji still keys on the raw removal count:

private getEmoji(changes: ChangeDetails): string {
  if (changes.destructiveChanges.length || changes.removedResources) {
    return ':x:';

So routine, by-design churn — e.g. the AWS::ApiGateway::Deployment roll CDK performs on every REST API change (new hash-suffixed logical ID + removal of the old one) — paints the stack header ❌ even though there's no warning banner and the job passes. Reviewers see a red X with nothing destructive reported, which reads as inconsistent.

Fix

Key :x: on the filtered destructiveChanges only. Removals of allowed types render :yellow_circle: like other routine updates. Any non-allowed removal still lands in destructiveChanges (the early-return in StackDiff.evaluateDiff only skips allowed types), so it keeps the ❌.

Tests

Two new cases in stage-processor.test.ts:

  • removal of a type in allowedDestroyTypesdestructiveChanges == 0, comment contains :yellow_circle: and not :x:
  • same removal with empty allowedDestroyTypesdestructiveChanges == 1, comment contains :x:

npx projen build run; dist/ included per repo convention.

🤖 Generated with Claude Code

Removals whose resource type is in allowedDestroyTypes are excluded from
destructiveChanges (no failure, no warning banner), but getEmoji() still
keyed ❌ on the raw removedResources count — so routine churn like the
AWS::ApiGateway::Deployment roll CDK performs on every REST API change
painted the stack header red with no corresponding warning. Key ❌ on
the filtered destructiveChanges only; allowed-type removals render
🟡 like other updates.
@igraves

igraves commented Jun 12, 2026

Copy link
Copy Markdown
Author

@corymhall Feel free to take this or not. It was an issue I bumped into when visually filtering destructive changes from updates and an artifact of how CDK considers certain updates in an immutable context.

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.

1 participant