Introduce feature flags for claimable models
What does this MR do and why?
This MR introduces feature flags for claimable models in the GitLab Cells infrastructure. It adds granular control over the claims system by allowing individual model types to be enabled/disabled independently through feature flags.
Key changes:
- Adds
feature_flagparameter tocells_claims_attributemethod - Creates 7 new beta feature flags for different model types:
-
cells_claims_email- Controls email claiming -
cells_claims_group- Controls namespace/group claiming -
cells_claims_key- Controls SSH/GPG key claiming -
cells_claims_organization- Controls organization claiming -
cells_claims_project- Controls project claiming -
cells_claims_route- Controls route/redirect route claiming -
cells_claims_user- Controls user claiming
-
- Implements feature flag checking logic in the
Claimableconcern - Adds early returns in transaction record methods when no records need processing
- Updates all claimable models to use appropriate feature flags
- Adds comprehensive test coverage for feature flag behavior
This enables safer rollout of the cells claims system by allowing gradual enablement per model type.
References
- gitlab-com/gl-infra/tenant-scale/cells-infrastructure/team#602 (closed)
- gitlab-com/gl-infra/tenant-scale/cells-infrastructure/team#555 (comment 2917573494)
Screenshots or screen recordings
N/A
How to set up and validate locally
-
Enable specific feature flags in Rails console:
# Enable claims for users only Feature.enable(:cells_claims_user) # Enable claims for emails only Feature.enable(:cells_claims_email) # Enable claims for organizations Feature.enable(:cells_claims_organization) # Check all available flags Feature.all.select { |f| f.name.start_with?('cells_claims_') } -
Test that claims are only created for enabled model types:
# With `cells_claims_user` enabled user = User.create!(username: 'test', email: 'test@example.com') # Should create claims for user attributes in the `topology_service` DB # With `cells_claims_email` enabled user.emails.create(email: 'fatos@gitlab.com') # Should create claims for email attributes in the `topology_service` DB # With `cells_claims_organization` disabled org = Organization.create!(path: 'test-org') # Should NOT create claims for organization attributes in the `topology_service` DB
note: you can connect to the topology_service DB via GDK using gdk psql -d topology_service command!
-
Verify feature flag behavior in tests:
bundle exec rspec spec/cells/claims/ -t feature_flag
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.