feat: introduce v4 policy with type - #2939
Open
minottic wants to merge 5 commits into
Open
Conversation
minottic
force-pushed
the
policy_flat
branch
from
September 7, 2026 12:58
ee877b0 to
c5dfcc6
Compare
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.
Description
This is a reimplementation of #2925 with a better data model at a cost of more code to keep v3.
The idea is that the v3 policy object that encoded job type harcoding (archiveEmailNotification ... ) is now exposed via v4 as a generic policy object with a "type", an extra free form obj "policyParams" and common "emailNotification" and "emailTo". This will later allow to narrow what every job could do. The DB mirrors the v4 shape, thus some dynamic reshaping is required by v3 which, on CRUDs, merges the last 2 policies in the DB of type archive and retrieve for a given ownerGroup. Even though the v3 code is a bit convoluted, an easier data model will pay out as soon as we shift to v4 and since policies are not yet very used in the current code base, this might be the time.
The v3 version of policies had no uniqueness constraint though policies where considered unique per ownergroup, given the default policy mapping. The migration here introduces a new index making (ownerGroup, type) unique unless they are marked with a superseededBy key that is introduced to avoid removing duplicates generate in v3 implementation
Tests included
Documentation
official documentation info
Summary by Sourcery
Introduce generic v4 policy resources while preserving the existing v3 policy API through a compatibility layer and migrated split storage.
New Features:
Bug Fixes:
Enhancements:
Tests: