Enable state tracking on mutating Array operations#13996
Merged
tpowell-progress merged 1 commit intochef:mainfrom Oct 31, 2023
Merged
Enable state tracking on mutating Array operations#13996tpowell-progress merged 1 commit intochef:mainfrom
tpowell-progress merged 1 commit intochef:mainfrom
Conversation
Annih
added a commit
to Annih/chef-updatable-attributes
that referenced
this pull request
Oct 6, 2023
There is a bug in Chef, preventing detection of mutating array ops. See chef/chef#13995 However, the fix is not yet merged, and even when it will be it may not be available for people not able to bump Chef. This commit patch Chef internales to backport the fix provided in: chef/chef#13996 This should fix #7.
Annih
added a commit
to Annih/chef-updatable-attributes
that referenced
this pull request
Oct 8, 2023
There is a bug in Chef, preventing detection of mutating array ops. See chef/chef#13995 However, the fix is not yet merged, and even when it will be it may not be available for people not able to bump Chef. This commit patches Chef internales to backport the fix provided in: chef/chef#13996 This should fix #7.
tpowell-progress
requested changes
Oct 10, 2023
Contributor
tpowell-progress
left a comment
There was a problem hiding this comment.
Add tests, but also questions about approach by @dafyddcrosby
The State tracking feature is nice, especially as it allows to get an event when an attribute is updated. However, mutating operations on Arrays were not properly tracked, at least for the "attribute_changed" event. For instance, `default['array'] << 1` was not triggering an event. The new code, ensure that all identified mutating methods are properly implementing the State Tracking feature. To do it, it leverages existing DISALLOWED_MUTATOR_METHODS constant. Signed-off-by: Baptiste Courtois <b.courtois@criteo.com>
6ca4ca6 to
aa2d9f8
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
tpowell-progress
approved these changes
Oct 31, 2023
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
The State tracking feature is nice, especially as it allows to get an event when an attribute is updated.
However, mutating operations on Arrays were not properly tracked, at least for the "attribute_changed" event.
For instance,
default['array'] << 1was not triggering an event.The new code, ensure that all identified mutating methods are properly implementing the State Tracking feature.
To do it, it leverages existing DISALLOWED_MUTATOR_METHODS constant.
Related Issue
#13995
Types of changes
Checklist:
Gemfile.lockhas changed, I have used--conservativeto do it and included the full output in the Description above.