Bug/"flaky" test fix: Avoid stale runner list after turning off group runners
What does this MR do and why?
Context
Turning off the group runners toggle in Settings > CI/CD > Runners sometimes leaves the Group tab still listing the group runners the project can no longer use. Only a page reload corrects it.
GroupRunnersToggle emits change from two places: after the toggle mutation, and from its Apollo query result on page load. RunnersTabs cannot tell them apart, so it treats reading the current value as a user change and refetches the runner list on load. That refetch is redundant, and it overlaps the refetch that follows the mutation: both request the same query, so the pre-toggle response can be the one that lands, and Apollo dedupes identical in-flight queries. Nothing refetches afterwards, so the stale list stays.
This is also the likely cause of spec/features/projects/runners/maintainer_manages_group_runners_spec.rb:67 failing intermittently (https://gitlab.com/gitlab-org/quality/test-failure-issues/-/work_items/43856). So this test isn't flaky; there is a real race condition bug in the application code. The load-time refetch fires in the same tick that enables the toggle, which is when the spec clicks it, so the two requests overlap on every run. The failing job artifacts show exactly the resulting state: the mutation succeeded, the toggle reads off, and the tab still renders the runner with its count badge at 1.
Those failures began when this page's runners app moved onto the Vue 3 island in !248259 (merged), which shifted the timing. The race itself is not specific to Vue 3 — it is present on both builds.
This MR
Splits the load-time notification into a fetched event that updates the value without refreshing, leaving change to mean only that the user changed the setting. The group runners list is now requested once per page load instead of twice, so the post-toggle refetch has nothing to race.
Changelog: fixed
References
- Flaky spec this likely fixes: https://gitlab.com/gitlab-org/quality/test-failure-issues/-/work_items/43856+ (not actually "flaky" if the race condition bug is the culprit.)
- Vue 3 island rollout that surfaced it: Extend Vue 3 runner rollout to group and projec... (!248259 - merged)
Screenshots or screen recordings
No visual change. The fix removes a redundant request; the stale render it could cause is not reproducible on demand.
How to set up and validate locally
- Create a group runner for a group that owns a project.
- As a project maintainer, visit the project's Settings > CI/CD > Runners and open the Group tab. The runner is listed.
- Turn off Turn on group runners for this project.
- The tab shows the "Group runners are turned off" empty state, and the runner list does not come back.
In the browser network tab, the group runners query now fires once on page load instead of twice.
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.