Repository navigation
Conversation
Follow-up to aws-cloudformation#4704. The UpdatePolicy Fn::Select rejection carried a hardcoded schema_path (allOf/0/then/properties/UpdatePolicy/type) that does not match the schema: that node is a $ref with no `type` key, and allOf[0] is the AutoScaling branch only, so it misrepresents the other resource types. Drop the fabricated schema_path and validator_value so both lifecycle-policy rules emit the same minimal error shape, and add a comment explaining why Fn::Select is special-cased at these slots. aws-cloudformation#4645
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4711 +/- ##
=======================================
Coverage 94.67% 94.67%
=======================================
Files 435 435
Lines 15586 15586
Branches 3021 3021
=======================================
Hits 14756 14756
Misses 453 453
Partials 377 377
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:
|
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.
Description
Follow-up cleanup to #4704 (reject
Fn::Selectlifecycle policies without a transform).The
UpdatePolicyrejection inupdatepolicy/Configuration.pywas emitting a hardcodedschema_path:That path does not correspond to
update_policy.json:allOf[0].then.properties.UpdatePolicyis a$refnode with notypekey, so the trailingtypesegment points at nothing.allOf[0]is specifically theAWS::AutoScaling::AutoScalingGroupbranch, so the path misrepresents the other four resource types (Lambda::Alias, Elasticsearch/OpenSearch Domain, ElastiCache::ReplicationGroup, AppStream::Fleet).The sibling
CreationPolicy.py(E3055) emits the same class of error without anyschema_path, so this drops the fabricatedschema_pathandvalidator_valueto make both lifecycle-policy rules emit the same minimal error shape. The justifiedpath=["UpdatePolicy"]/instance=...are kept, sinceE3016validates the wholeResources/*object and the error belongs on theUpdatePolicychild.Also adds a short comment to both rules explaining why
Fn::Selectis special-cased at these slots (it declares anall_typesoutput, so the generic output-type check from #4641 treats it as object-compatible).No behavior change:
E3055/E3016still fire on a bareFn::SelectwithoutAWS::LanguageExtensionsand stay silent with it.Tests
pytest test/unit/rules/resources/test_creationpolicy.py test/unit/rules/resources/updatepolicy/test_configuration.py test/unit/rules/functions/test_select.py— 34 passedruff check+ruff format --checkon the changed files — cleanE3055+E3016fire without the transform and are suppressed withTransform: AWS::LanguageExtensions