Skip to content

Allow elastic client adapter to be set

What does this MR do and why?

This MR re-instates a reverted MR. I added the fix in a separate fixup commit to ease review from the original MR

The fix included:

  • add null check operator when using options[:client_adapter]
  • adding .to_sym to value
  • adding some tests which fail before the fix

References

merge requests

issues

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. enable elasticsearch for gdk
  2. setup a new connection for the elastic adapter
    es_connection = Ai::ActiveContext::Connection.create!(name: 'es-test-adapter', adapter_class: "ActiveContext::Databases::Elasticsearch::Adapter", options: { use_advanced_search_config: true } )
  3. activate connection
    es_connection.activate!
  4. reload or restart rails console
    reload!
  5. run the migration worker
    Ai::ActiveContext::MigrationWorker.new.perform

logs before


{
  "severity": "INFO",
  "time": "2025-09-19T12:59:27.664Z",
  "class": "Ai::ActiveContext::MigrationWorker",
  "message": "Ai::ActiveContext::MigrationWorker: Created missing migration records for 20250423135734, 20250430114936, 20250508151423",
  "job_status": "running",
  "queue": "default",
  "jid": null
}
{
  "severity": "INFO",
  "time": "2025-09-19T12:59:27.667Z",
  "class": "Ai::ActiveContext::MigrationWorker",
  "message": "Ai::ActiveContext::MigrationWorker: Starting migration 20250423135734",
  "job_status": "running",
  "queue": "default",
  "jid": null
}
{
  "severity": "INFO",
  "time": "2025-09-19T12:59:27.672Z",
  "class": "Ai::ActiveContext::MigrationWorker",
  "message": "Ai::ActiveContext::MigrationWorker: Migration 20250423135734 failed: wrong constant name typhoeus. Retries left: 2",
  "job_status": "running",
  "queue": "default",
  "jid": null
}

logs after

{
  "severity": "INFO",
  "time": "2025-09-19T13:00:31.529Z",
  "class": "Ai::ActiveContext::MigrationWorker",
  "message": "Ai::ActiveContext::MigrationWorker: Starting migration 20250423135734",
  "job_status": "running",
  "queue": "default",
  "jid": null
}
{
  "severity": "INFO",
  "time": "2025-09-19T13:00:31.554Z",
  "class": "Ai::ActiveContext::MigrationWorker",
  "message": "Ai::ActiveContext::MigrationWorker: Marking migration 20250423135734 as completed",
  "job_status": "running",
  "queue": "default",
  "jid": null
}

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 #550805 (closed)

Edited by Terri Chu

Merge request reports

Loading