[default branch protection] Update `ProtectDefaultBranchService` to use new settings column
Background Context
Currently, the options for default branch protection at the instance and group level lag behind, and are not as fin grained, as the options available from the Protected Branches feature
The branch defaults lag behind because the current implementation uses an integer column to store the default settings, which becomes difficult if not impossible to expand as new options and finer detail controls are added to the protected branches feature
at a high-ish level the existing feature is implemented as:
- there are integer columns on the database tables (application level and group level)
- these integers are mapped to a subset of protected branch settings
- these mappings defined in access.rb
- mappings are used here via
BranchProtection
helper
- when creating a default branch, those settings are passed into the protected branch service
Proposal
A more detailed proposal can be seen in the epic [here](&10391
At a high level the proposal is to:
- use a
jsonb
column rather than an integer - update the settings API to accept a payload the matches the protected branches API
- Pass those settings into the
ProtecteBrancheService
here
This issue
If we are starting work on this issue, we should have all the pieces in place to update the code path to use the new column and have this feature rolled out behind a feature flag
by this point we should:
- have a new
jsonb
column for storing settings in the database #408150 (closed) - be writing to that column indirectly via the original API #408309 (closed)
- Have to API updated to write to this column directly #408151 (closed)
- and have backfilled that column #408153 (closed)
Assuming all of that is done, we should be able to start passing those settings into the protected branches create service here
We'll want to have a feature flag to fall back to the original logic just in case