Fix custom-template pull mirrors after transient repository misses
What does this MR do and why?
Projects created from custom project templates retain their template import type after creation. When success has been recorded while mirroring is enabled, a transient false repository-existence result can still hit the initial-template guard before the existing persisted-success protection, skipping that update.
This MR limits the guard to projects without that recorded success. Initial template creation keeps its export path, while established mirrors use the existing update worker.
References
Screenshots or screen recordings
There is no UI change.
| Before | After |
|---|---|
| N/A | N/A |
How to set up and validate locally
- Run
bin/rspec ee/spec/models/ee/project_spec.rb:3591. - Run
bin/rspec ee/spec/models/ee/project_spec.rb -e '#add_import_job'. - Run
bin/rspec spec/models/project_import_state_spec.rb ee/spec/models/project_import_state_spec.rb. - Run
bin/rspec ee/spec/workers/project_import_schedule_worker_spec.rb ee/spec/workers/update_all_mirrors_worker_spec.rb ee/spec/workers/repository_update_mirror_worker_spec.rb ee/spec/workers/repository_import_worker_spec.rb. - Run
bin/rspec ee/spec/services/projects/gitlab_projects_import_service_spec.rb ee/spec/services/projects/create_from_template_service_spec.rb. - Run
bundle exec rubocop --parallel --force-exclusion ee/app/models/ee/project.rb ee/spec/models/ee/project_spec.rb.
The direct regression fails before this change and passes afterward. The project, import-state, worker, and template service suites passed locally (10, 150, 61, and 58 examples respectively); changed-file RuboCop found no offenses. Initial template creation and mirrors without recorded success retain their existing routing.
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.
The change is limited to one EE model and its regression spec; the existing mirror-worker error path remains visible.
AI assistance
AI tooling was used to assist with investigation and drafting. The contributor independently reviewed the implementation, reproduced the bug locally, verified the regression test and fix, and takes responsibility for the submitted changes.