Skip to content

fix(core): synth output is not valid YAML when using policy validation#37597

Open
kaizencc wants to merge 2 commits intomainfrom
conroy/stderr
Open

fix(core): synth output is not valid YAML when using policy validation#37597
kaizencc wants to merge 2 commits intomainfrom
conroy/stderr

Conversation

@kaizencc
Copy link
Copy Markdown
Contributor

@kaizencc kaizencc commented Apr 14, 2026

Closes #25331

Reason for this change

According to synth docs, CDK is supposed to support cdk synth > template.yml

When using policy validation, some outputs are being written to stdout. This makes the stdout not valid YAML (in situations where we specify a single stack and thus write the YAML template to stdout).

Description of changes

Instead of writing to stdout, we write to stderr. This is a pattern established elsewhere in CDK where we reserve stdout for the YAML template. No new tests; only the output channel is being changed and is reflected in updated tests.

Checklist


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

@kaizencc kaizencc requested a review from a team as a code owner April 14, 2026 17:43
@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Apr 14, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team April 14, 2026 17:43
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 14, 2026
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@kaizencc kaizencc added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Apr 14, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 14, 2026 20:02

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Tests were asserting on consoleLogMock for messages that now go to
console.error. Updated all test assertions to read from
consoleErrorMock with adjusted call indices since 'Performing Policy
Validations' is now also on stderr (index 0), shifting the report
to index 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/medium Medium work item – several days of effort p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(synthesis): CDK synth output is not valid CFN

2 participants