Gate commit traversal_ids behind AddTraversalIdsToCommits migration

What does this MR do and why?

Pass --commit-traversal-ids-enabled to gitlab-elasticsearch-indexer only after the AddTraversalIdsToCommits mapping migration has finished.

Until that migration completes, the commits index does not have a traversal_ids field in its mapping. Because GitLab Advanced Search uses strict mapping, Elasticsearch/OpenSearch rejects any commit document that includes an unmapped field, causing all commit indexing to fail with a strict_dynamic_mapping_exception.

The Go indexer already conditionally writes traversal_ids onto commit documents when the flag value is non-empty. This MR adds the gate on the Ruby side so the flag is only passed once the mapping is ready.

References

  • Issue: #599628 (closed)
  • Mapping migration: ee/elastic/migrate/20260216152309_add_traversal_ids_to_commits.rb
  • Backfill migration: ee/elastic/migrate/20260216153009_backfill_traversal_ids_on_commits.rb

Screenshots or screen recordings

N/A — backend only change.

How to set up and validate locally

  1. Ensure AddTraversalIdsToCommits migration has not finished.
  2. Push to a repository with Advanced Search enabled.
  3. Confirm no strict_dynamic_mapping_exception errors in the indexer logs.
  4. Mark the migration as finished and re-index — confirm traversal_ids is now written to commit documents.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Merge request reports

Loading