Validate parent and child depth and cyclic references
What does this MR do and why?
Adds hierarchy-sepcific restrictions:
- checks for cyclic references
- checks for maxium_depth
Related to #378801 (closed)
DB queries:
Note: we don't support creating multi-level hierarchy yet, queries below are for a random issue task in gitlab/gitlab-org project but there are no ancestors/descendants for it.
To get ancestors/descendants, this MR adds an object hierarchy (lib/gitlab/work_items/work_item_hierarchy.rb, heavily inspired by lib/gitlab/ci/pipeline_object_hierarchy.rb).
- work_item.ancestors: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/13634/commands/47880
- work_item.same_type_descendants_depth: https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/13634/commands/47881
- work_item.same_type_descendants_depth : https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/13634/commands/47882
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Jan Provaznik