generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 7
feat: tagging backward compatibility #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ammokhov
wants to merge
2
commits into
main
Choose a base branch
from
feature/tagging-backward-compatibility
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+503
−0
Conversation
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
Implement stateful guard rules to prevent breaking changes to tagging metadata in CloudFormation resource schemas. Changes: - Add cfn_object_constructs for tracking top-level objects with nested properties - Implement flat diff structure for tagging properties (removed/changed) - Add 3 guard rules: TAG100 (properties removed), TAG101 (taggable changed to false), TAG102 (properties changed) - Update unit and integration tests to validate new diff structure - Clean up temporary test files and unused JSON test data All tests passing: 22 unit tests, 6 integration tests
agarikana
reviewed
Oct 30, 2025
|
|
||
| def _is_tagging_property(path_list): | ||
| """This method checks if path is a tagging nested property""" | ||
| return len(path_list) == 2 and path_list[0] == "tagging" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we put 2 inside a var like TAGGING_NEST_DEPTH or something and use that var everywhere?
agarikana
reviewed
Oct 30, 2025
|
|
||
| def _get_path(path_list): | ||
| """This method converts array into schema path notation""" | ||
| return "/".join([""] + path_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is [""] required or is it AI generated 😄
agarikana
approved these changes
Oct 30, 2025
zhaomicx
approved these changes
Oct 30, 2025
kddejong
approved these changes
Oct 30, 2025
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.
Issue #, if available:
Description of changes:
Add Tagging Backward Compatibility Guard Rules
Summary
This PR implements stateful guard rules to prevent breaking changes to tagging metadata in CloudFormation resource provider schemas. The implementation ensures that once a resource is marked as taggable, that capability cannot be removed or degraded in future schema versions.
Changes
Core Implementation
cfn_object_constructs: New construct type for tracking top-level objects with nested properties (liketagging)removed:['tagging': {'removed': ['/tagging/taggable', '/tagging/tagProperty']}]changed:['tagging': {'changed': [{'property': '/tagging/taggable', 'old_value': true, 'new_value': false}]}]Guard Rules (3 rules)
ensure_tagging_properties_not_removed- Prevents removal of any tagging propertiesensure_taggable_not_changed- Prevents changing taggable from true to falseensure_taggable_not_changed- Prevents changing tagOnCreate from true to falseensure_taggable_not_changed- Prevents changing cloudFormationSystemTags from true to falseensure_taggable_not_changed- Prevents changing tagPropertyTesting
test_stateful.pyto validate new diff structuretest_integ_runner.pywith correct expectationsFiles Modified
src/rpdk/guard_rail/core/stateful.py- Added tagging diff generation logicsrc/rpdk/guard_rail/rule_library/stateful/schema-stateful-cfn-enforced-checks.guard- Added 3 guard rulestests/unit/core/test_stateful.py- Updated test expectations for flat diff structuretests/integ/runner/test_integ_runner.py- Updated integration test expectationsDesign Document
Overview
This design implements backward compatibility guard rules for tagging metadata in CloudFormation resource provider schemas. The rules validate changes between schema versions to ensure tagging capabilities are not removed or degraded.
Architecture
Component Location
The guard rules are placed in the existing stateful rule library:
Integration Points
prepare_ruleset()when mode is "stateful"schema_diff()instateful.py__exec_rules__()closure inrunner.pyData Models
Input Schema Difference Structure
{ "tagging": { "removed": ["/tagging/taggable", "/tagging/tagProperty"], "changed": [ { "property": "/tagging/taggable", "old_value": true, "new_value": false } ] } }Output Structure
{ "result": "NON_COMPLIANT", "check_id": "TAG100", "message": "tagging properties MUST NOT be removed from schema" }Edge Cases (Allowed)
Implementation Tasks
✅ Completed Tasks
1. Investigate and update stateful.py to track tagging metadata changes
cfn_object_constructsfor tracking objects with nested properties2. Add backward compatibility guard rules
3. Testing
4. Cleanup
Test Results
Unit Tests: 22/22 passing ✅
Integration Tests: 6/6 passing ✅
Testing Instructions
To test this PR locally:
Breaking Changes
None. This PR only adds new guard rules and does not modify existing behavior.
Related Issues
Implements backward compatibility checks for tagging metadata as per CloudFormation resource provider requirements.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.