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 theIssue.write_relative_positions_to_work_item_positions?gate. - Redirects the rebalancing service's position
UPDATE(Issues::RelativePositionRebalancingService) towork_item_positionswhen 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.
References
Part of #612911, epic &23222, rollout #627322. Follows read-side MR !248883 (merged).
How to set up and validate locally
- 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) - Trigger a rebalance, e.g.:
on a namespace with issues.
Issues::RelativePositionRebalancingService.new(namespace).execute - Confirm
work_item_positions.relative_positionis updated (spread out) andissues.relative_positionis 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.