Work items - stop relying on base_type
A follow-up from sync call (video, notes - though we didn't follow notes)
Currently some work item related logic relies on work item type's base_type
. But we should rather rely on work item default types as base_type was not intended for this usage and can be eventually removed - default types are types which have nil namespace attribute.
List of places which should be updated:
-
widget's mapping for each work item type is now defined based on base_type - https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/work_items/type.rb#L23 - instead widgets should be associated with default types (perhaps by type ID?) and defined in DB -
validations about parent/child for hierarchy widgets check issue's type - https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/work_items/parent_link.rb#L39 - here we now rely on hardcoded base_type knowledge. Ideally we should rather define mapping of allowed parent/child types in DB for default types (this will be needed anyway for configurable hiearchies - &7876)
TODO: add other places to fix
Reasoning
The intent is for work item types to be highly configurable, both by GitLab for implementing various work item schemes for customers (an opinionated GitLab workflow, or SAFE 5, etc), and eventually for customers to customize their own workflows.
In this case, a work item scheme would be defined as a set of types with certain characteristics (some widgets enabled, others not), such as an Epic, Story, Bug, and Task, etc.
As we're building a new work item architecture, we want to build the ability to define these various types in a very flexible manner. Having GitLab utilize this system first (without introducing customer customization) allows us to better build out the initial system.