-
Notifications
You must be signed in to change notification settings - Fork 536
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
Generate and write stash including soft blocked versions #22826
Conversation
5d67b09
to
dc97c8a
Compare
d5652d0
to
3d8e95b
Compare
@willdurand and @diox 2 remaining questions from my side.
|
7d932aa
to
f73aa2b
Compare
f73aa2b
to
f4b5386
Compare
ff970f1
to
d515b9d
Compare
59de2e8
to
5f52ca5
Compare
5f52ca5
to
96fc256
Compare
9ec0295
to
a985af0
Compare
@willdurand rebased |
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 have questions.
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.
This looks good overall but given the number of suggestions, I'm going to request changes to get a chance to re-read the entire diff once updated. Given that most of the tests are in the single test_diff_all_possible_changes
test method, I made numerous suggestions to get it better documented for our future selves (not that it wasn't well documented initially).
Another thing that I am wondering is that we do a lot of comparisons between a MLBF (so a base bloom filter) and changes. Do we have test coverage to generate a stash after a previous stash was created?
328fd09
to
157353b
Compare
@willdurand I'm not sure I get it but
Each time we run the cron job we check the current state of the database from the previous It's actually totally irrelevant if we created a stash the last time or not. It only matters what was the state of the DB during the last run. In the case where we don't have any filter to compare to, we cannot create a stash because we need to create a filter. |
157353b
to
b0179cc
Compare
You got it right, I think. Do we have test coverage that reads a previous |
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.
r+wc, thank you!
), | ||
} | ||
|
||
assert second_mlbf.generate_and_write_stash(previous_mlbf=first_mlbf) == { |
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.
If we ever change the default of the switch, this would fail. Maybe we should put this assertion in a with override_switch('mlbf-soft-blocks-enabled', active=False):
block? Or we ensure the switch is disabled in a setUp
method in this test file.
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 think we will remove the switch before flipping the default, and even if we did, I'd just update the tests then.
65031a1
to
70fc8a3
Compare
Update src/olympia/blocklist/mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Simplify the test comment Add waffle switch controlling stash link explicitly to soft blocking Better comment Update src/olympia/blocklist/tests/test_mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Update src/olympia/blocklist/tests/test_mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Update src/olympia/blocklist/tests/test_mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Update src/olympia/blocklist/tests/test_mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Update src/olympia/blocklist/tests/test_mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Update src/olympia/blocklist/tests/test_mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Update src/olympia/blocklist/tests/test_mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Update src/olympia/blocklist/tests/test_mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Apply suggestions from code review Co-authored-by: William Durand <will+git@drnd.me> Update src/olympia/blocklist/mlbf.py Co-authored-by: William Durand <will+git@drnd.me> Apply suggestions from code review Co-authored-by: William Durand <will+git@drnd.me>
70fc8a3
to
2944f54
Compare
9cc6c6b
to
ad8267d
Compare
@willdurand added the integration test for invalid cache, we already had for previously existing cache. |
} | ||
|
||
if waffle.switch_is_active('mlbf-soft-blocks-enabled'): |
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.
Scheiße forgot to update the switch name.
Fixes: mozilla/addons#15050
Description
This PR updates the
generate_and _write_stash
method onMLBF
class to consider the range of use cases covered in the linked jira issue document.We have to add support for specifying a block_type when requesting a change count. This will be useful for creating type level filters as we need to know for each type if we have any changes and enough changes for a new filter.
We have to modify which guids are included in the now 3 different properties on the stash. This has to cover the set of use cases where blocks are added as hard or soft as well as moving from soft to hard and vice versa.
Context
When updating our bloom filter we are now going to create a unified stash which will allow us to enable support for adding/removing items from the soon to be soft block filter, but, to do so in a way that is backwards compatible with legacy fx clients that have no concept of soft blocking. This raises some edge cases that increased the complexity of this patch. Read the doc for more info
Testing
Look at the automated tests but essentially we should consider the following scenarios and you can independently verify them if you don't trust the tests.
Here is a detailed break down of the scenarios
Checklist
#ISSUENUM
at the top of your PR to an existing open issue in the mozilla/addons repository.