Skip to content
Snippets Groups Projects

Update parent link validate_max_children validation

Merged Eugenia Grieff requested to merge fix-parent-link-max-children-validation into master
All threads resolved!

What does this MR do and why?

Related to #451062 (closed)

When migrating epics to work items some parent epics could have more children than the limit set for parent links (100) but we need these links to remain valid after the backfilling. To achieve it, this MR modifies the validation validate_max_children in WorkItems::ParentLink model to be performed only when the parent changes so this will cover both create and update actions.

As these changes make the validation more lenient there is no risk involved for existing records.

Changelog: changed

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

:white_check_mark:

Screenshots or screen recordings

Screenshot_2024-05-07_at_13.09.51

How to set up and validate locally

  1. Enable feature flag Feature.enable(:namespace_level_work_items)
  2. Visit any group work items URL and create a work item epic Parent Epic. E.g. http://gdk.test:3000/groups/GROUP_PATH/-/work_items/new
  3. In the child items create and add 2 new child issues
  4. Go to your IDE and open the file app/models/work_items/parent_link.rb to modify the MAX_CHILDREN variable. Set a limit of 1.
  5. Back in the browser try to add a new issue to Parent Epic, this should display an error because the limit has been reached
  6. Verify that the existing 2 children are valid by changing their position in the list (when invalid the update action for reordering would fail)
Edited by Eugenia Grieff

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading