Stabilise query counts in the issue move list spec

What does this MR do and why?

Fixes the flaky query limit in ee/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb. The query count of the nil epic example changed with test state, so it went over the limit of 114 in some runs.

This MR makes the count stable and bumps the limit from 114 to 118, which is the real count of the request.

Why the count changed and why 118 There were two moving parts:
  1. Epic at the move target (+2 queries). The epic factory sets the epic work item position to epic.id (commit 9a557a1e57db, !145538 (merged)). The trigger from !230107 (merged) copies it to work_item_positions, so the epic shares positions with the issues. When the epic id was 30, the move between 10 and 50 hit a taken position and ran 2 extra queries (115). The epic work item is now pinned at 1000.
  2. User activity write (+5 queries). Users::ActivityService writes last_activity_on only when it gets a 1-minute Redis lease. The lease stayed in Redis after an earlier example, so in a full file run the write was skipped. When the example ran alone, for example in the CI retry, the write ran and the count was 118. The spec now cleans shared state Redis, so the write runs every time.

The limit of 114 came from commit 66076d3046b8 (!263759 (merged)). It was measured in a run where the lease was already held, so it did not count the activity write and left no room. With Redis cleaned, the count is 118 in every order and when the example runs alone. The other example measures 190 every time, so its limit of 192 stays.

References

How to set up and validate locally

  1. On master, run the example alone. It fails with 118 against 114:

    bin/rspec ee/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb:86
  2. On this branch, run the same example alone and the whole file with a few seeds. All pass:

    bin/rspec ee/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb:90
    bin/rspec ee/spec/requests/api/graphql/mutations/boards/issues/issue_move_list_spec.rb --seed 1

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.

🤖 Generated with Claude Code

Edited by Rajan Mistry

Merge request reports

Loading
Loading