Skip to content

fix(core): skip default validation when context is unresolved - #39560

Open
OKAN-SOFTWARE wants to merge 1 commit into
aws:mainfrom
OKAN-SOFTWARE:fix/38989-context-validation
Open

OKAN-SOFTWARE wants to merge 1 commit into
aws:mainfrom
OKAN-SOFTWARE:fix/38989-context-validation

Conversation

@OKAN-SOFTWARE

@OKAN-SOFTWARE OKAN-SOFTWARE commented Oct 29, 2026 •

Copy link
Copy Markdown

Issue # (if applicable)

Closes #38989.

Reason for this change

The built-in CloudFormation validation plugin reports false-positive violations during synthesis when context lookups have not yet resolved. CDK generates temporary placeholder values such as vpc-12345, p-12345, and dummy-value-for-..., which fail CloudFormation's resource identifier format checks.

These warnings can appear during unit tests and initial synthesis, even though the placeholder values are not intended for deployment.

Description of changes

  • Detect unresolved context across synthesized cloud assemblies.
  • Skip automatic registration of the built-in CloudFormation validation plugin when context is missing.
  • Preserve explicitly registered validation plugins.
  • Retain normal built-in validation when context is fully resolved.
  • Add regression coverage verifying that missing context suppresses automatic validation while a custom plugin continues running.

This addresses the false positives centrally without modifying the existing lookup placeholders.

Describe any new or updated permissions being added

None.

Description of how you validated changes

  • Reproduced the original CloudFormation validation warnings using the issue's VPC and AMI lookup scenario.
  • Added a regression test for unresolved context and custom plugin execution.
  • Passed all 43 tests in cloudformation-validate-plugin.test.ts.
  • Successfully built aws-cdk-lib and its dependencies: 10 build projects passed.
  • Verified formatting and lint checks.

Checklist

  • My code adheres to the CONTRIBUTING GUIDE and DESIGN GUIDELINES.

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

@OKAN-SOFTWARE
OKAN-SOFTWARE requested a review from a team as a code owner October 29, 2026 21:14
@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels Oct 29, 2026

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

✅ A exemption request has been requested. Please wait for a maintainer's review.

@OKAN-SOFTWARE

Copy link
Copy Markdown
Author

Exemption Request

This fix addresses synthesis-time validation behavior when context lookups are unresolved. It does not modify generated CloudFormation resources or deployment behavior.

The change is covered by a focused regression test in cloudformation-validate-plugin.test.ts, verifying that the automatically registered validator is skipped for unresolved context while explicitly registered validation plugins continue to execute.

Validation completed successfully:

  • 43/43 targeted tests passed.
  • Full aws-cdk-lib build and dependencies passed (10 projects).
  • Lint and formatting checks passed.

Since integration-test snapshots would not directly exercise this synthesis-time validation behavior, I would appreciate an exemption from the integration-test snapshot requirement for this change.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Oct 29, 2026
@mergify

mergify Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

This branch was previously deployed

1 inactive deployment
automation — 8b3ef20b Deployed Oct 29, 2026 by aws-cdk-automation via validate-pr #375550
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p1 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: context-miss dummy values (vpc-12345, p-12345, dummy-value-for-...) fail the built-in CloudFormation validation

2 participants