[Fix] Change flipper_id actor from Namespace to Group
What does this MR do and why?
Fixes a bug where custom work item types were not returned by the Provider when the work_item_configurable_types feature flag was enabled for a group.
Root Cause
The feature_available? method was using Namespace.actor_from_id(root_id) to check the feature flag, which creates a flipper_id of Namespace:143.
However, feature flags are enabled on Group objects which have a flipper_id of Group:143. This mismatch caused Feature.enabled? to return false even when the flag was properly enabled for the group.
Fix
Changed Namespace.actor_from_id(root_id) to Group.actor_from_id(root_id) to ensure the flipper_id matches how the feature flag is enabled.
# Before (bug)
Namespace.actor_from_id(143).flipper_id # => "Namespace:143"
# After (fix)
Group.actor_from_id(143).flipper_id # => "Group:143"
References
Screenshots or screen recordings
| Create New Type | Before | After |
|---|---|---|
|
|
|
How to set up and validate locally
# In rails console
group = Group.first
# 1. Ensure feature flag is disabled globally
Feature.disable(:work_item_configurable_types)
# 2. Create a custom type for testing
custom_type = WorkItems::TypesFramework::Custom::Type.create!(
name: 'Test Bug Type',
icon_name: 'bug',
namespace: group
)
# 3. Verify custom types are NOT returned when FF is disabled
RequestStore.clear!
provider = WorkItems::TypesFramework::Provider.new(group)
types = provider.all_ordered_by_name.map(&:name)
# Should NOT include 'Test Bug Type'
types.include?('Test Bug Type')
# => false
# 4. Enable feature flag for the group only
Feature.enable(:work_item_configurable_types, group)
# 5. Verify custom types ARE returned when FF is enabled
RequestStore.clear!
provider = WorkItems::TypesFramework::Provider.new(group)
types = provider.all_ordered_by_name.map(&:name)
# Should include 'Test Bug Type'
types.include?('Test Bug Type')
# => true
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.


