Fix JobAnalytics deduplicated finder query and gate behind feature flag
What does this MR do and why?
- Fixes
Ci::JobAnalytics::QueryBuilderto callfinal_queryonFinishedBuildsDeduplicatedFinderinstead ofquery_builder, which was producing queries without the required inner subquery structure. Also makesfinal_querya public method so it can be called from outside the finder. - To safely roll this fix out, the use of the deduplicated finder is now gated behind a
gitlab_com_deriskfeature flag (:use_job_analytics_deduplicated_finder) scoped toproject, allowing incremental per-project rollout during the ClickHouse backfill migration.
Changes
- Call
final_queryonFinishedBuildsDeduplicatedFinderto construct the correct query withFROMinner subquery - Move
final_queryfromprivatetopublicinFinishedBuildsDeduplicatedFinder - Add
:use_job_analytics_deduplicated_finderfeature flag (gitlab_com_derisk, project-scoped) - Add spec coverage for the feature flag gating and deduplicated finder SQL generation
References
- Backfill issue: #585179
- MR which caused this issue: !221683 (merged)
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.