Skip to content

Enable state tracking on mutating Array operations#13996

Merged
tpowell-progress merged 1 commit intochef:mainfrom
Annih:array_state_tracking
Oct 31, 2023
Merged

Enable state tracking on mutating Array operations#13996
tpowell-progress merged 1 commit intochef:mainfrom
Annih:array_state_tracking

Conversation

@Annih
Copy link
Copy Markdown
Contributor

@Annih Annih commented Oct 6, 2023

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'] << 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.

Related Issue

#13995

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

@Annih Annih requested review from a team as code owners October 6, 2023 23:27
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.
Copy link
Copy Markdown
Contributor

@tpowell-progress tpowell-progress left a comment

Choose a reason for hiding this comment

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

Add tests, but also questions about approach by @dafyddcrosby

@johnmccrae johnmccrae added the Status: Waiting on Contributor A pull request that has unresolved requested actions from the author. label Oct 17, 2023
@tpowell-progress tpowell-progress added Priority: High Fix as soon as possible Focus: Community PR Review and removed Status: Waiting on Contributor A pull request that has unresolved requested actions from the author. labels Oct 30, 2023
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>
@Annih Annih force-pushed the array_state_tracking branch from 6ca4ca6 to aa2d9f8 Compare October 31, 2023 09:28
@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: High Fix as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants