FeatureFlag: fix changing from default value and value of default#14133
Merged
Conversation
See test results for failed build of commit 77b915a162 |
feerrenrut
reviewed
Sep 14, 2022
See test results for failed build of commit b2f3ec5b6c |
seanbudd
commented
Sep 26, 2022
See test results for failed build of commit a91446c26a |
feerrenrut
reviewed
Oct 3, 2022
feerrenrut
left a comment
Contributor
There was a problem hiding this comment.
I think this looks good, However, could you add unit tests?
In particular, given PR #14183, it would be good to confirm this behavior for other data types.
6ef7a57 to
154a90a
Compare
seanbudd
commented
Jan 9, 2023
Comment on lines
+1253
to
1260
| if self._isSection(val) or self._isSection(curVal): | ||
| # If value is a section, continue to update | ||
| pass | ||
| elif str(val) == str(curVal): | ||
| # Check str comparison as this is what is written to the config. | ||
| # If the value is unchanged, do not update | ||
| # or mark the profile as dirty. | ||
| return |
Member
Author
There was a problem hiding this comment.
Note: this section is the only intended change of behaviour
michaelDCurran
approved these changes
Jan 9, 2023
6 tasks
seanbudd
added a commit
that referenced
this pull request
Jul 3, 2023
Fixes #14760 Fixup of #14133 Summary of the issue: When saving a config spec, validation would be skipped if the string value of the data is unchanged. This caused various issues including config values not being correctly converted to numbers from strings when validating. This caused config profiles to fail to load or save correctly. Description of user facing changes Fix up of various bugs related to user config Description of development approach Perform special handling that was introduced in #14133 for feature flags only
9 tasks
seanbudd
pushed a commit
that referenced
this pull request
Sep 17, 2024
) Fixes #17157 Fixup of #14133 Partially reverts #15074 Summary of the issue: When saving configuration profiles, unchanged values are yet saved to a profile. Description of user facing changes Configuration profiles should become less polluted after this change. Description of development approach Restored the behavior of #14133, mostly reverting #15074. There was namely a False assumption in #15074. @seanbudd wrote: This caused various issues including config values not being correctly converted to numbers from strings when validating. In fact, the validation was not the problem here. Instead, when __getitem__ was called with checkValidity set to False, the unvalidated value was yet saved in the cache. Therefore subsequent calls of __getitem__ would always return the unvalidated cached value that would always be of the string type.
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.
Link to issue number:
None
Summary of the issue:
Feature flags use a default option that results in a default value.
For example, for a boolean feature flag could have three options:
Default (Enabled), Enabled, Disabled.When comparing feature flags
__eq__is overridden such thatDefault (Enabled) == Enabled.NVDA checks if a value has changed before marking a profile as dirty so that it is written to disk when saving the configuration.
Due to
__eq__being overridden, NVDA does not write changes to disk if you change from the default value to the value of default.STR:
Default (Enabled)toEnabledDefault (Enabled)Description of user facing changes
NVDA correctly updates feature flags when changing from the default value to the value of default.
Description of development approach
When checking if a config setting has changed, compare non-sections as strings, as this is how they are written to the config profile.
Testing strategy:
Manually test STR
Unit testing has been added for
AggregatedSectionKnown issues with pull request:
AggregatedSectionshould be moved in a separate PR to the new module.Change log entries:
Bug fixes:
Code Review Checklist: