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
active_context_code_index_project
FF
With no projects enabled for -
Follow the state management testing guide up to "Run
saas_initial_indexing
task". Ensure that theAi::ActiveContext::Code::EnabledNamespace
record's state ispending
. -
With the
Ai::ActiveContext::Code::EnabledNamespace
record created in Step 1, run theProcessPendingEnabledNamespaceEventWorker
synchronously:Ai::ActiveContext::Code::ProcessPendingEnabledNamespaceEventWorker.new.handle_event("")
-
Verify that no
Ai::ActiveContext::Code::Repository
records for the namespace were created:::Ai::ActiveContext::Code::Repository.where(enabled_namespace_id: <id of namespace from step 1>) => []
active_context_code_index_project
FF for certain projects
With the -
Follow the state management testing guide up to "Run
saas_initial_indexing
task". Ensure that theAi::ActiveContext::Code::EnabledNamespace
record'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::EnabledNamespace
record created in Step 1, run theProcessPendingEnabledNamespaceEventWorker
synchronously:Ai::ActiveContext::Code::ProcessPendingEnabledNamespaceEventWorker.new.handle_event("")
-
Verify that there is
Ai::ActiveContext::Code::Repository
record 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)