Use force_index_repo task type for Zoekt schema_version bump reindexing

What does this MR do and why?

When Zoekt indexing is triggered by a schema_version bump (via RepoToReindexEventWorker), it should use the force_index_repo task type instead of the default index_repo. This ensures that when the schema version changes, repositories are fully force-reindexed on the Zoekt node, which is the correct behavior for schema version upgrades.

Previously, create_bulk_tasks was called without a task_type argument, defaulting to :index_repo. Originally, when we wrote this worker, we intended to do a reindex, but we missed passing task_type. The worker's name also suggests it is a reindex worker.

The tests are also updated to:

  • Assert that created tasks use the force_index_repo task type
  • Use force_index_repo tasks in the "pending tasks" test scenarios, since the deduplication filter (without_pending_tasks_of_type) is now scoped to force_index_repo

The tests also got some cleanup, using more consistent factory patterns (like :ready instead of state: :ready) and clearer assertions to verify the specific task types being created. This makes the code more maintainable and the intent clearer for future developers.

References

Screenshots or screen recordings

N/A — backend-only change

How to set up and validate locally

  1. Make sure your Rails GDK is up
  2. Delete all the zoekt_tasks from the Rails console just for the ease of verification.
Search::Zoekt::Task.delete_all
  1. Bump schemaVersion. For eg: 2602
  2. Run make build-unified
  3. Run gdk restart gitlab-zoekt-indexer-development-1 gitlab-zoekt-indexer-development-2.
  4. Check in the Rails console, you should see new zoekt_tasks with force_index_repo task_type.
Search::Zoekt::Task.force_index_repo

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.

Edited by Ravi Kumar

Merge request reports

Loading