Read work item positions scoped by the positioning root column

What

Switches the flag-on relative-positioning reads to filter by work_item_positions.relative_positioning_namespace_id (the positioning root) instead of the descendant namespace_id fan-out, so the root-leading (relative_positioning_namespace_id, relative_position) index actually serves:

  • the board / manual-list load — order_by_relative_position, with Boards::Issues::ListService passing the board's positioning root (the project namespace for personal projects, the top-level group otherwise), and
  • the drag/drop neighbour + gap lookups — relative_positioning_query_base, next_object_by_relative_position.

Behind the existing read_relative_positions_from_work_item_positions flag (default off). No behaviour change when off.

Verified query plan

Query
Before — issues namespace_id IN (<descendants>) fan-out Link
After — work_item_positions root filter + index Link

Testing

  • Specs (both flag states): spec/models/issue_spec.rb, spec/lib/gitlab/relative_positioning/item_context_spec.rb, spec/services/boards/issues/list_service_spec.rb.
  • Manual: enable the flag for a top-level group, reorder on a board (top / middle / bottom), confirm order + drops are identical to flag-off.

Related to #594236

Edited by Vedant Jain

Merge request reports

Loading
Loading