Skip to content
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

Refactor MLBF in preparation for soft blocking #22718

Closed
wants to merge 1 commit into from

Conversation

KevinMind
Copy link
Contributor

@KevinMind KevinMind commented Sep 30, 2024

Relates to: mozilla/addons#15014

Description

  • Introduce by_block_type queryset on BlockVerssion model to query blocked versions by block type consistently.
  • Add BlockType enum to model block type consistently.
  • Add MLBF_File to model the additional mlbf files "stash" "notblocked"
  • Derive paths in MLBF from storage (with improved path helper) based on MLBF_File input
  • Add dump/load/path helpers for handling json data and deriving paths
  • Ever so slightly improve the type hints for the MLBF methods.

Context

This PR should introduce zero changes to the public API of MLBF or the functionality but sets the stage for adding additional block types for deriving filters/stashes per type.

The current implementation is really designed for a binary blocked/unlblocked but we will now need 2 binary states and we can reduce some boilerplate and introduce the concepts for doing that in a PR that doesn't actually require changing the API, reducing the size of the PR introducing soft blocking.

Testing

CI passes.

Checklist

  • Add #ISSUENUM at the top of your PR to an existing open issue in the mozilla/addons repository.
  • Successfully verified the change locally.
  • The change is covered by automated tests, or otherwise indicated why doing so is unnecessary/impossible.
  • Add before and after screenshots (Only for changes that impact the UI).
  • Add or update relevant docs reflecting the changes made.

@KevinMind KevinMind changed the base branch from soft-block-bloomfilter to master September 30, 2024 11:35
@KevinMind KevinMind force-pushed the soft-block-configurable branch 21 times, most recently from 5022e11 to e154d6f Compare October 7, 2024 09:49
@KevinMind KevinMind force-pushed the soft-block-configurable branch 8 times, most recently from 81175ac to 8eaf9b2 Compare October 8, 2024 12:21
@KevinMind KevinMind force-pushed the soft-block-configurable branch 2 times, most recently from 8ef3173 to bb1e457 Compare October 8, 2024 15:03
Update tests

Better test with from_db/storage

Better mocks in the tests

lint

Missing tests

rename
@KevinMind KevinMind force-pushed the soft-block-configurable branch from bb1e457 to 59bc6b4 Compare October 8, 2024 15:04
@KevinMind KevinMind mentioned this pull request Oct 8, 2024
5 tasks
@KevinMind KevinMind closed this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant