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_repotask type - Use
force_index_repotasks in the "pending tasks" test scenarios, since the deduplication filter (without_pending_tasks_of_type) is now scoped toforce_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
- Issue: #596529 (closed)
Screenshots or screen recordings
N/A — backend-only change
How to set up and validate locally
- Make sure your Rails GDK is up
- Delete all the zoekt_tasks from the Rails console just for the ease of verification.
Search::Zoekt::Task.delete_all- Bump schemaVersion. For eg:
2602 - Run
make build-unified - Run
gdk restart gitlab-zoekt-indexer-development-1 gitlab-zoekt-indexer-development-2. - Check in the Rails console, you should see new zoekt_tasks with
force_index_repotask_type.
Search::Zoekt::Task.force_index_repoMR 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.