Integrate system-defined work item types into the types provider
What does this MR do and why?
This MR completes the integration of system-defined work item types into the WorkItems::TypesFramework::Provider, enabling a seamless transition from database-backed types to code-based type definitions controlled by the work_item_system_defined_type feature flag.
The changes ensure that all models and services work consistently with both system-defined and database-backed types, with the provider acting as a unified interface that switches between implementations based on feature flag state.
Changes
Provider Integration
- Uncommented and activated feature flag checks in provider methods
- Updated
type_classmethod to returnWorkItems::TypesFramework::SystemDefined::Typewhen feature flag is enabled
HasType Concern
- Included in:
Issue,WorkItems::UserPreference,WorkItems::TypeCustomField,WorkItems::TypeCustomLifecycle,WorkItems::Statuses::Custom::Mapping
EE Feature Support (Custom Fields & Lifecycles)
- Implemented
work_item_typesgetter/setter for custom fields and lifecycles - Manages associations with system-defined types through the provider
- Added
autosave: trueto associations for seamless persistence - Updated lifecycle attachment service to use provider methods and direct ID manipulation for efficiency
GraphQL & Services
- Updated
WorkItems::TypesResolverto skip widget definition preloads when using system-defined types (performance optimization) - Updated CSV export services to properly preload namespace for system-defined type resolution
Test Coverage
- Updated factories to use
build(:work_item_system_defined_type)for system-defined types - Added comprehensive test coverage for new getter/setter methods (50+ new test cases)
- Added tests for both feature flag enabled and disabled scenarios
- Updated lifecycle factory traits to use provider methods
- Added tests for hierarchy validation with system-defined types
Backward Compatibility
All changes are protected by the work_item_system_defined_type feature flag. When disabled, the system falls back to database-backed types with no behavioral changes.
Related Issues
How to set up and validate locally
-
Check out the branch:
git checkout sx/integrate-system-defined-type-into-types-provider -
Enable the feature flag: In your local Rails console or via the UI, enable
work_item_system_defined_typefor the group you are planning to test - Run tests: Execute the test suite to verify the changes work correctly
-
Manual testing: In general things need to work as before, there should not be ay change. Here are some things you can try manually.
- Create/edit work items and verify they function correctly with the new system-defined types.
- Create/edit custom fields and verify that the work item types are assigned correctly
- Filter by work item type works correctly, also changing the sorting preferences for the WorkItems::UserPreference model.
- Bulk update for work items, works as expected.
- Creating a custom lifecycle for a type and also the mapping works as expected
- Quick actions for updating type, works
Edited by Stefanos Xanthopoulos