Internal: Refactor core classifications system to be based on harm identifiers instead#164
Open
turt2live wants to merge 14 commits into
Open
Internal: Refactor core classifications system to be based on harm identifiers instead#164turt2live wants to merge 14 commits into
turt2live wants to merge 14 commits into
Conversation
The intention behind harm identifiers is to return the one(s) which are most applicable to the situation rather than all possible identifiers. This commit does this by returning the most specific identifiers it can rather than always appending SpamGeneral (for example). Where a policyserv-specific identifier is used, a non-custom identifier is also included for backwards compatibility. This commit also fixes a bug in the metrics where we were previously capturing index numbers rather than the actual classifications (oops).
A large portion of this code is to maintain backwards compatibility with older databases. Because policyserv might have a slow rollout in multi-process environments, we can't simply do a migration and expect it to work. We also don't want to migrate millions of rows if we don't have to. This does mean we establish a ton of tech debt, however it's all in the name of backwards compatibility. We might never drop this tech debt to avoid an invasive database migration.
The intention behind harm identifiers is to return the one(s) which are most applicable to the situation rather than all possible identifiers. This commit does this by returning the most specific identifiers it can rather than always appending SpamGeneral (for example). Where a policyserv-specific identifier is used, a non-custom identifier is also included for backwards compatibility.
We were trying to persist a `nil` result, which doesn't work that well. This should probably be fixed external to this PR, but given the code has been migrated to harm identifiers it seems best to wedge it in here.
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.
Reviewable commit-by-commit (strongly recommended).
The old confidence vectors system has finally been removed completely. A while ago we removed the ability for filters to return "spam: 0.8"-style classifications, so it effectively became a zero or one. As part of switching to harm IDs, we're removing the variability from the remaining structures.
The commit messages contain more information, especially around harm identifier use. In short: per MSC4456 we should be returning the most specific harm identifiers we can rather than all of them, so we do that. We also include a MSC4456-standard identifier whenever we return a custom one for backwards compatibility.
Fixes #167
TODO:
Pull Request Checklist
mainbranch.