-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Fix for configoptions, remove check for isset() #71089
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #71089 +/- ##
=======================================
Coverage 77.91% 77.91%
=======================================
Files 6528 6528
Lines 290912 290912
Branches 50340 50340
=======================================
Hits 226654 226654
+ Misses 58036 58035 -1
- Partials 6222 6223 +1
|
# isset() will pull from local cache, which gets updated with every get() call. | ||
# configoptions is only concerned with removing the option from the db. | ||
elif not options.set_on_db(opt.name): |
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.
We could also change isset()
so that it behaves correctly. Currently the docstring for isset
claims
Check if a key has been set to a value and not inheriting from its default.
Which doesn't match its current behavior. We could have isset compare the value from the store to the option default. If the store value and default are the same, the option is not 'set'.
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.
I originally wanted to do that but serveral other files and methods use issset()
, worried I could break their functionality
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.
The other issue is that if this is what we use to compare options, configoptions
would never actually remove options from the DB if the DB value is just the default value.
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.
I originally wanted to do that but serveral other files and methods use issset(), worried I could break their functionality
We could review those callsites and see if their behaviour would change.
The other issue is that if this is what we use to compare options, configoptions would never actually remove options from the DB if the DB value is just the default value.
If the value is set in the store and equal to the default, wouldn't we still be able to check the option's update channel?
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.
Spoke with @markstory and decided that fixing isset()
is the better course of action.
Co-authored-by: Mark Story <mark@mark-story.com>
|
||
rv = self.invoke( | ||
"-f", | ||
"tests/sentry/runner/commands/unsetsync.yaml", |
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.
You could put this yaml file with other test data in fixtures
. It could be helpful to have an options
directory for this and other test fixture files.
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.
Looks good to me. Options that were automated and have been removed from the options data will now be removed if the option's last update was through automator. other states that aren't default/disk values will result in drift 👍
We only need check the
last_updated_by
,if the option is already unset (removed from db), last_updated_by will be
None
. All other channels we can write as drift.