Fix AwardEmoji namespace during work item moves

What does this MR do and why?

Moving a Work Item between projects copies its AwardEmoji rows from the source attributes. The copy updates awardable_id and awardable_type, but previously did not replace namespace_id, so copied rows retained the source namespace. The rows are then inserted with insert_all using that copied sharding key.

This change fixes a functional data-integrity issue in Work Item move data synchronization. It sets each copied row's namespace_id to target_work_item.namespace_id, keeping the sharding key and namespace lifecycle aligned with the target Work Item.

The regression test uses different source and target projects, preserves the existing copied-content assertion, and verifies that every copied AwardEmoji row uses the target namespace.

Validated against canonical master at e92cdba2c4c83fb0c7898741bf3c035ca3a621e3.

AI-assisted tooling was used during investigation and preparation. The contributor reviewed and validated the code, regression coverage, test results, and MR content before submission.

References

Closes #628128 (closed)

Screenshots or screen recordings

Before After
N/A N/A

How to set up and validate locally

Run the focused regression with both validation seeds:

RAILS_ENV=test mise exec -- bundle exec rspec spec/services/work_items/data_sync/widgets/award_emoji_spec.rb:29 --seed 17 --format documentation RAILS_ENV=test mise exec -- bundle exec rspec spec/services/work_items/data_sync/widgets/award_emoji_spec.rb:29 --seed 29 --format documentation

Run the complete affected spec and targeted RuboCop:

RAILS_ENV=test mise exec -- bundle exec rspec spec/services/work_items/data_sync/widgets/award_emoji_spec.rb --seed 17 --format documentation mise exec -- bundle exec rubocop app/services/work_items/data_sync/widgets/award_emoji.rb spec/services/work_items/data_sync/widgets/award_emoji_spec.rb

Before the fix, the focused regression failed twice for the predicted namespace mismatch (target/source: 8/6 and 12/10, exit status 1). After the fix, both focused runs passed with 1 example, the complete spec passed with 6 examples, and RuboCop reported no offenses.

A temporary uncommitted integration spec through WorkItems::DataSync::MoveService also passed with 1 example.

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 Whale Tech

Merge request reports

Loading
Loading