ActiveContext: migration for update_code_model_metadata
What does this MR do and why?
This adds the migration to set the current_indexing_embedding_model and search_embedding_model values.
Note: this change has been validated to work when integrating the new model design into the ActiveContext pipelines. See validation steps in ActiveContext: integrate new model design into ... (!222417 - merged)
Step-by-step changes summary
| MR | Status |
|---|---|
| Introduce the new hash/object-based models | |
Add indexing_embedding_fields to Collection class |
|
Add embeddings_with_model_redesign preprocessor |
|
| Add migration to update models metadata | This MR |
| Integrate model redesign into Code Embeddings pipeline | Ready for review |
References
Screenshots or screen recordings
N/A
How to set up and validate locally
Setup
-
Ensure the self-hosted AIGW url is not set:
Ai::Setting.instance.update(ai_gateway_url: nil) -
Setup your Code Embeddings Indexing pipeline
Validation - WITHOUT self-hosted AIGW url
Once you've followed the setup steps in Code Embeddings Indexing pipeline, all of the migrations (including the one in this MR) should be run already. Make sure that:
-
The
UpdateCodeModelMetadatais completed. You can do this by checking onpsql, verifying that it hasstatus=10.# select id, version, metadata, status from ai_active_context_migrations where version='20260213124605'; id | version | metadata | status ----+----------------+----------+-------- 15 | 20260213124605 | {} | 10 -
The collection record's
current_indexing_embedding_modelandsearch_embedding_modelare set to the correct values -- these should be the same values.next_indexing_embedding_modelmust benil:Ai::ActiveContext::Collections::Code.collection_record.current_indexing_embedding_model => {"field"=>"embeddings_v1", "model_ref"=>"text_embedding_005_vertex"} Ai::ActiveContext::Collections::Code.collection_record.search_embedding_model => {"field"=>"embeddings_v1", "model_ref"=>"text_embedding_005_vertex"} Ai::ActiveContext::Collections::Code.collection_record.next_indexing_embedding_model => nil
Validation - with self-hosted AIGW
We need to make sure that the migration is skipped in a self-hosted AIGW setup.
-
Set the self-hosted AIGW url:
Ai::Setting.instance.update(ai_gateway_url: 'http://gdk.test:5052') -
Delete the
UpdateCodeModelMetadatamigration record:# in psql console delete from ai_active_context_migrations where version='20260213124605'; -
Run the migration worker:
Ai::ActiveContext::MigrationWorker.new.perform -
Verify that the status for the migration is
skipped(100):# select id, version, metadata, status from ai_active_context_migrations where version='20260213124605'; id | version | metadata | status ----+----------------+----------+-------- 17 | 20260213124605 | {} | 100
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 #588847