Remove Stale Properties on Template Upgrade#4
Remove Stale Properties on Template Upgrade#4google-labs-jules[bot] wants to merge 2 commits intotemplate-upgrade-propertiesfrom
Conversation
When a resource's template is upgraded, properties that existed in the old template but are no longer present in the new one are now removed from the resource's `properties` dictionary. This is achieved by: - A new helper function, `_get_all_property_keys_from_template`, which extracts all property keys from a template, including those in `allOf` blocks. - The `patch_resource` function now compares the property keys of the old and new templates and removes any that are no longer present. - A new test case has been added to verify this new functionality.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
When a resource's template is upgraded, properties that existed in the old template but are no longer present in the new one are now removed from the resource's `properties` dictionary. This is achieved by: - A new helper function, `_get_all_property_keys_from_template`, which extracts all property keys from a template, including those in `allOf` blocks. - The `patch_resource` function now compares the property keys of the old and new templates and removes any that are no longer present. - New test cases have been added to verify this new functionality, including a test to ensure that properties are removed even if they are not part of the patch payload.
This change ensures that when a resource's template is upgraded, any properties that are no longer defined in the new template are removed from the resource. This prevents the accumulation of stale data and ensures that the resource's properties are always in sync with its template.
PR created automatically by Jules for task 9913618680028133578 started by @JC-wk