feat(cli): cdk validate command (behind --unstable flag)#1527
Open
kaizencc wants to merge 8 commits into
Open
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned Files
|
72951bb to
152e026
Compare
06c9381 to
4c04289
Compare
3 tasks
rix0rrr
reviewed
May 22, 2026
rix0rrr
approved these changes
May 22, 2026
Contributor
rix0rrr
left a comment
There was a problem hiding this comment.
Conditionally ok. Let's speak to a human like a human.
Wire up the `cdk validate` command in the CLI package, gated behind the `--unstable=validate` flag. Adds: - CLI command routing, config, and user input parsing - Validate output formatting with severity-sorted violations - Integration test fixtures and tests - Multi-plugin validation fixture for formatter testing
hostMessageFromValidation was incorrectly always emitting at info level (CDK_TOOLKIT_I9600). Now uses CDK_TOOLKIT_E9600 (error level) when conclusion is 'failure', preserving the IO contract for consumers that rely on message level to detect problems.
Covers severity sorting, construct path formatting, stack trace parsing (both paren and bare formats), acknowledge line omission for fatal, and constructFqn display.
…rors Update to @aws-cdk/core:failSynthOnValidationErrors=false to match the aws-cdk PR (aws/aws-cdk#37909) which introduces this key. The old @aws-cdk/core:validationReportOnly was a placeholder.
- Use fs.readJson instead of Manifest.loadValidationReport (aws-cdk-lib doesn't write a version field yet, so schema validation throws) - Emit validate results at info level so the CLI IoHost doesn't wrap the entire output in red — the formatter handles per-severity coloring - Update fixture app to use cdk.Validations.of(app).addPlugins() - Use @aws-cdk/core:failSynthOnValidationErrors context key (2.257.0)
… update integ tests - Look for validation-report.json only (new format from aws-cdk-lib) - Strip [ack: ...] tags from descriptions, use dashes in acknowledge IDs - Underline file locations, add colon after severity, capitalize custom - Use relative paths for stack trace locations - Separate integ test apps: validate-app (failing) and validate-passing-app - Remove acknowledge integ test (depends on unreleased APIs) - Enable @aws-cdk/core:annotationsInValidationReport for Construct Annotations
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.
Wires up
cdk validateas a CLI command behind the--unstable=validatefeature flag. The command synthesizes the app, reads the validation report JSON from the cloud assembly, and renders results with per-severity coloring, construct paths, source locations, and acknowledge instructions.Changes
validatecommand behind--unstable=validate, sets@aws-cdk/core:failSynthOnValidationErrorscontext to suppress synthesis-time reportingvalidate()method that delegates to toolkit-libvalidation-report.jsonviaManifest.loadValidationReport, emits result at info level so IoHost doesn't override per-severity colorsvalidate-app(SecurityPlugin + Construct Annotations) andvalidate-passing-app(AlwaysPassesPlugin) fixtures with tests for violations and clean passTest plan
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license