Write cutover for work_item_positions (rebalancing path)

What does this MR do and why?

First slice of the write cutover for work item relative positioning.

  • Adds the feature flag write_relative_positions_to_work_item_positions (gitlab_com_derisk, default off) and the Issue.write_relative_positions_to_work_item_positions? gate.
  • Redirects the rebalancing service's position UPDATE (Issues::RelativePositionRebalancingService) to work_item_positions when the flag is on.
  • The flag-off path is byte-identical to today, so this change is dormant until the flag is enabled.

This is part of the write cutover (#612911) under epic &23222, which makes work_item_positions the source of truth for position writes instead of issues.relative_position. The read side already moved in !248883 (merged). Later slices (core move path, move_nulls, update_relative_siblings, dropping the sync trigger) will follow as separate MRs — do not enable the flag until those land, or issues and work_item_positions will diverge.

No changelog entry (behind a default-off flag). Added a spec for the flag-on path (rebalance writes to work_item_positions, leaves issues.relative_position untouched); existing specs already cover the flag-off path.

Query Plan

References

Part of #612911, epic &23222, rollout #627322. Follows read-side MR !248883 (merged).

How to set up and validate locally

  1. Enable both flags in the rails console:
    Feature.enable(:read_relative_positions_from_work_item_positions)
    Feature.enable(:write_relative_positions_to_work_item_positions)
  2. Trigger a rebalance, e.g.:
    Issues::RelativePositionRebalancingService.new(namespace).execute
    on a namespace with issues.
  3. Confirm work_item_positions.relative_position is updated (spread out) and issues.relative_position is unchanged.

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.

Edited by Vedant Jain

Merge request reports

Loading
Loading