Toggle ActiveContext::Code project indexing behind a feature flag
What does this MR do and why?
Currently, the ActiveContext Code processes allows per-namespace rollout by specifying NAMESPACE_IDS in the SaasInitialIndexingEventWorker.
We need to support rollout specific to the gitlab-org/gitlab project so that we can do initial indexing on staging/production. This would make it easier to monitor the initial rollout.
References
- Issue: [Code chat] constrain rollout for gitlab-org/gi... (#555558 - closed)
- FF rollout issue: [FF] `active_context_code_index_project` -- rol... (#556108)
- Discussion thread
Screenshots or screen recordings
N/A
How to set up and validate locally
With no projects enabled for active_context_code_index_project FF
-
Follow the state management testing guide up to "Run
saas_initial_indexingtask". Ensure that theAi::ActiveContext::Code::EnabledNamespacerecord's state ispending. -
With the
Ai::ActiveContext::Code::EnabledNamespacerecord created in Step 1, run theProcessPendingEnabledNamespaceEventWorkersynchronously:Ai::ActiveContext::Code::ProcessPendingEnabledNamespaceEventWorker.new.handle_event("") -
Verify that no
Ai::ActiveContext::Code::Repositoryrecords for the namespace were created:::Ai::ActiveContext::Code::Repository.where(enabled_namespace_id: <id of namespace from step 1>) => []
With the active_context_code_index_project FF for certain projects
-
Follow the state management testing guide up to "Run
saas_initial_indexingtask". Ensure that theAi::ActiveContext::Code::EnabledNamespacerecord's state ispending. -
Pick a project under the code_embeddings-enabled namespace and enable the FF for it:
Feature.enable(:active_context_code_index_project, <the project>) -
With the
Ai::ActiveContext::Code::EnabledNamespacerecord created in Step 1, run theProcessPendingEnabledNamespaceEventWorkersynchronously:Ai::ActiveContext::Code::ProcessPendingEnabledNamespaceEventWorker.new.handle_event("") -
Verify that there is
Ai::ActiveContext::Code::Repositoryrecord for the project you selected:::Ai::ActiveContext::Code::Repository.where(enabled_namespace_id: <id of namespace from step 1>) => [#<Ai::ActiveContext::Code::Repository:0x000000031c817800...<details>]
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.
Related to #555558 (closed)