Geo: Fix generate-blob-replicator script for upload partition mode
What does this MR do and why?
Geo: Fix generate-blob-replicator script for upload partition mode
Fix two bugs affecting --upload-partition mode:
- Replicator include indentation was misaligned for the UploadReplicatorBehavior concern (12 spaces instead of 4), producing invalid Ruby.
- Factory parent model name derivation was incorrect for models where the factory name differs from the derived name (e.g. Projects::Topic has factory :topic, not :project_topic). Added --parent-factory CLI option to allow overriding.
Relates to: #598863 (closed)
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
-
Check out this branch and run the script in dry-run mode to verify it parses correctly:
ruby scripts/geo/generate-blob-replicator \ --replicable-name=project_topic_upload \ --model-class='Projects::Topic' \ --table-name=project_topic_uploads \ --sharding-key=organization_id \ --milestone=19.0 \ --upload-partition \ --parent-factory=topic \ --dry-run -
Run without
--dry-runand verify the indentation fix — the generated replicator should have 4-space indentation:grep -A1 'BlobReplicatorStrategy' ee/app/replicators/geo/project_topic_upload_replicator.rbExpected:
include ::Geo::BlobReplicatorStrategy include ::Geo::Concerns::UploadReplicatorBehavior -
Verify the
--parent-factoryoption works — the generated factory and spec should use:topic, not:project_topic:grep 'create(:' ee/spec/factories/geo/project_topic_upload.rb grep 'create(:topic' ee/spec/models/geo/project_topic_upload_spec.rb -
Verify rubocop passes on the generated replicator (the indentation fix resolves the previous failure):
bundle exec rubocop ee/app/replicators/geo/project_topic_upload_replicator.rb
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 #598863 (closed)