Return system-defined and custom work item types via provider
What does this MR do and why?
Update WorkItems::TypesFramework::Provider#all_ordered_by_name to allow returning not only system-defined, but also custom (including converted) work item types via GraphQL APIs.
In EE, when the work_item_configurable_types feature flag is disabled, the queries always return system-defined work item types, even if the custom ones exist.
In CE, only system-defined work item types are returned regardless of the feature flag state.
Secure Store Approach
As per @msaleiko suggestion, the implementation uses Gitlab::SafeRequestStore to cache combined work item types (system-defined + custom) per namespace, improving performance by avoiding repeated database queries within the same request.
Affected Queries
This change affects the following GraphQL queries that retrieve work item types:
organization.workItemTypesnamespace.workItemTypesgroup.workItemTypesproject.workItemTypes
Notes
-
Since custom work item types can only be created at the organization or root group level, when querying custom work item types for any given namespace (root group, subgroup, or project), we should always query work item types from the root group level. This ensures that all work item types available to namespaces below the root group are properly included in the results.
-
In WS6, we'll introduce the ability to enable/disable work item types at subgroup and project levels. The query will then also need to check the
enabledattribute to determine which types are actually available in the specific namespace context.
Follow-up Work
- Note that filtering work item types by name currently only works with system-defined types. Support for filtering work item types by custom work item type name will be added in a follow-up: #592357 (closed).
References
Screenshots or screen recordings
How to set up and validate locally
Click to expand
- Enable the feature flag
work_item_configurable_types. - Create a new group and navigate to the 'Work Items Settings' page, for example
http://127.0.0.1:3000/groups/summer/-/settings/work_items. - Verify that under the 'Work Item Types' section, only system-defined work items are displayed.
- Create a new custom work item type using the
workItemTypeCreatemutation.
mutation {
workItemTypeCreate(input: {
fullPath: "summer"
name: "Bug"
iconName: "bug"
}) {
workItemType {
id
name
iconName
}
errors
}
}
- On the 'Work Item Types' list, confirm that the newly created custom work item type is displayed. You can also run the following query:
query GetWorkItemTypes {
namespace(fullPath: "summer") {
id
name
fullPath
workItemTypes {
nodes {
id
name
iconName
}
}
}
}
- Disable the FF and verify that only system-defined work items are visible.
- Additionally, test the changes via the UI. Navigate to the organization, root group, subgroup, and project work item settings pages to view the list of work item types.
- Organization:
http://127.0.0.1:3000/admin/application_settings/work_item/#js-work-item-types-settings - Root group:
http://127.0.0.1:3000/groups/summer/-/settings/work_items - Subgroup:
http://127.0.0.1:3000/groups/summer/subgroup/-/settings/work_items/#js-enabled-work-item-types-settings - Project:
http://127.0.0.1:3000/summer/project/-/settings/work_items
Please note that the names and icons of custom work item types are not currently displayed correctly in the UI. This is being addressed separately, as mentioned here.
Note: To create a custom work item type at the organization level, do not pass the fullPath argument in the workItemTypeCreate mutation.
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.








