Skip to content

fix(toolkit-lib): cdk validate drops the plugin's customSeverity label - #1894

Merged
aws-cdk-automation merged 1 commit into
aws:mainfrom
Adityaj0:fix/validate-custom-severity-dropped
Aug 25, 2026
Merged

fix(toolkit-lib): cdk validate drops the plugin's customSeverity label#1894
aws-cdk-automation merged 1 commit into
aws:mainfrom
Adityaj0:fix/validate-custom-severity-dropped

Conversation

@Adityaj0

Copy link
Copy Markdown
Contributor

Reason for this change

flattenViolations() in validate-formatting.ts calls normalizeSeverity(violation.severity) without forwarding violation.customSeverity. normalizeSeverity already accepts a customSeverity parameter and uses it specifically for the 'custom' severity case (return customSeverity ?? 'INFO'), but since the call site never passes it, that argument is always undefined — so every severity: 'custom' violation is mislabeled INFO in cdk validate output, silently discarding whatever severity the validation plugin actually intended (e.g. BLOCKER).

Description of changes

Pass violation.customSeverity through 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' renders BLOCKER (not INFO) in the formatted output. Verified the test fails against the unmodified code and passes with the fix. Ran the full validate-formatting test suite (13 tests) — all pass.

Checklist

  • Unit tests added/updated
  • Integration tests added/updated — not applicable, pure formatting logic
  • No manual edits to generated files

Fixes #1893

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

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
@Adityaj0
Adityaj0 deployed to automation August 25, 2026 08:31 — with GitHub Actions Active
@Adityaj0
Adityaj0 deployed to automation August 25, 2026 08:31 — with GitHub Actions Active
@aws-cdk-automation
aws-cdk-automation requested a review from a team August 25, 2026 08:32
@github-actions github-actions Bot added the p2 label Aug 25, 2026
@Adityaj0
Adityaj0 deployed to integ-approval August 25, 2026 08:32 — with GitHub Actions Active
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.38%. Comparing base (ca8a14a) to head (0e53c24).

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           
Flag Coverage Δ
suite.unit 91.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aws-cdk-automation
aws-cdk-automation added this pull request to the merge queue Aug 25, 2026
Merged via the queue into aws:main with commit 7a7a4ba Aug 25, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cdk validate drops the plugin-supplied customSeverity, mislabeling every 'custom' severity violation as INFO

4 participants