integrate system defined type into types provider

The original MR with those changes it was merged last Friday !219133 (merged), but as it was merged in combination with another MR and it case some failing tests, and it was reverted. You can find more details about it in this comment

I reopened the previous MR, with fixing the failing test on this commit. Also fixing a bug that i found out that is happening in FOSS, that causes some test failures. The issue is that we were using the class method of the provider for the param_types, and the instance method to compare if the params are valid, and that returns different results.

And fixing this spec as key_result where used in a FOSS only spec

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_class method to return WorkItems::TypesFramework::SystemDefined::Type when 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_types getter/setter for custom fields and lifecycles
  • Manages associations with system-defined types through the provider
  • Added autosave: true to associations for seamless persistence
  • Updated lifecycle attachment service to use provider methods and direct ID manipulation for efficiency

GraphQL & Services

  • Updated WorkItems::TypesResolver to 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.

How to set up and validate locally

  1. Check out the branch: git checkout sx/integrate-system-defined-type-into-types-provider
  2. Enable the feature flag: In your local Rails console or via the UI, enable work_item_system_defined_type for the group you are planning to test
  3. Run tests: Execute the test suite to verify the changes work correctly
  4. Manual testing: In general things need to work as before, there should not be ay change. Here are some things you can try manually.
    1. Create/edit work items and verify they function correctly with the new system-defined types.
    2. Create/edit custom fields and verify that the work item types are assigned correctly
    3. Filter by work item type works correctly, also changing the sorting preferences for the WorkItems::UserPreference model.
    4. Bulk update for work items, works as expected.
    5. Creating a custom lifecycle for a type and also the mapping works as expected
    6. Quick actions for updating type, works
Edited by Stefanos Xanthopoulos

Merge request reports

Loading