fix(toolkit-lib): cdk validate drops the plugin's customSeverity label - #1894
Merged
aws-cdk-automation merged 1 commit intoAug 25, 2026
Merged
Conversation
flattenViolations() called normalizeSeverity(violation.severity) without
forwarding violation.customSeverity, even though normalizeSeverity accepts
it specifically to label a 'custom'-severity violation with the plugin's
own severity string. As a result, any validation plugin reporting
{ severity: 'custom', customSeverity: 'BLOCKER' } (or any other label) had
that label silently discarded — cdk validate always printed INFO instead,
understating the plugin's intended severity.
Fixes aws#1893
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1894 +/- ##
=======================================
Coverage 91.38% 91.38%
=======================================
Files 80 80
Lines 12264 12264
Branches 1747 1747
=======================================
Hits 11207 11207
Misses 1021 1021
Partials 36 36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mrgrain
approved these changes
Aug 25, 2026
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.
Reason for this change
flattenViolations()invalidate-formatting.tscallsnormalizeSeverity(violation.severity)without forwardingviolation.customSeverity.normalizeSeverityalready accepts acustomSeverityparameter and uses it specifically for the'custom'severity case (return customSeverity ?? 'INFO'), but since the call site never passes it, that argument is alwaysundefined— so everyseverity: 'custom'violation is mislabeledINFOincdk validateoutput, silently discarding whatever severity the validation plugin actually intended (e.g.BLOCKER).Description of changes
Pass
violation.customSeveritythrough at the one call site:normalizeSeverity(violation.severity, violation.customSeverity).Description of how you validated changes
Added a regression test asserting that a violation with
severity: 'custom', customSeverity: 'BLOCKER'rendersBLOCKER(notINFO) in the formatted output. Verified the test fails against the unmodified code and passes with the fix. Ran the fullvalidate-formattingtest suite (13 tests) — all pass.Checklist
Fixes #1893
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license