Read and write operations for group_push_rules table
What does this MR do and why?
Implements read and write operations for the new group_push_rules table as part of migrating away from the existing push_rules table for groups.
This is a foundational change for the group push rules migration. When the feature flag is enabled, groups will use the dedicated group_push_rules table instead of sharing the push_rules table with projects.
Key Changes
New Model & Finder
- Adds
GroupPushRulemodel with proper associations to groups - Creates
GroupPushRuleFinderto abstract push rule retrieval logic
Feature Flag Integration
- Introduces the
read_and_write_group_push_rulesfeature flag (disabled by default) - When enabled, uses new
group_push_rulestable; when disabled, falls back to existingpush_rulestable
Controller Updates
- Updates group repository settings and push rules controllers to use the new finder
- Maintains backward compatibility through feature flag checks
Service Layer Changes
- Modifies
PushRules::CreateOrUpdateServiceto handle both old and new models - Updates predefined rule creation service for groups
API Compatibility
- Updates Group Push Rule API to work with both table structures
- Maintains the same API regardless of which table is used
Helper Method Updates
- Adds safety checks for
global?method calls (new model doesn't have this method) - Updates organization detection logic for push rule inheritance
References
Database
New query in ee/app/finders/group_push_rule_finder.rb
With read_and_write_group_push_rules enabled
SELECT "group_push_rules".*
FROM "group_push_rules"
WHERE "group_push_rules"."group_id" = <group_id>
LIMIT 1
With read_and_write_group_push_rules disabled
It does not introduce new queries.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #498936 (closed) and #500481 (closed)
Edited by Javiera Tapia