[Index state tracking: Deletion] Find enabled namespaces that need to be deleted

EnabledNamespace records are created for eligible namespaces. When a namespace is no longer eligible for this feature, we need to handle deleting the repositories associated with it.

After !211933 (merged), putting an EnabledNamespace in a state other than :ready or deleting the record will cause its associated repository records to go into pending_deletion, and then the delete is handled.

JTBD:

  • Add a worker in scheduling service that periodically checks for EnabledNamespaces that are no longer valid. Delete these records so that repo cleanup can happen.
  • Check for the conditions that create EnabledNamespaces in ee/app/workers/ai/active_context/code/saas_initial_indexing_event_worker.rb
    • the conditions will be different for SaaS and SM. Maybe create a saas event like for indexing.
Edited by 🤖 GitLab Bot 🤖