Fix missing papertrail versions in GitlabSubscriptions::Duo::BulkAssignService when using upsert_all

Summary

The GitlabSubscriptions::Duo::BulkAssignService uses upsert_all to create addon assignments, but this bypasses ActiveRecord callbacks which are required by papertrail to create version records. This results in orphaned addon assignments without corresponding subscription_user_add_on_assignment_versions records, causing data inconsistencies in ClickHouse historical data.

Problem

As discovered in #498633 (comment 2644308842), we currently have ~9000 orphan addon assignment records without papertrail versions because:

  1. GitlabSubscriptions::Duo::BulkAssignService uses upsert_all which bypasses ActiveRecord callbacks
  2. Papertrail requires ActiveRecord callbacks to create version records
  3. This leads to missing historical data in ClickHouse for addon assignments

Root Cause

# In GitlabSubscriptions::Duo::BulkAssignService
SubscriptionUserAddOnAssignment.upsert_all(assignments_data, unique_by: [:user_id, :add_on_id])

The upsert_all method doesn't trigger ActiveRecord callbacks, so papertrail doesn't create the corresponding version records.

Proposal

Update GitlabSubscriptions::Duo::BulkAssignService to manually create papertrail version records when using upsert_all. This follows the pattern established in previous fixes:

Implementation Details

  1. After the upsert_all operation, manually create papertrail version records for the inserted/updated assignments
  2. Ensure proper event type is set ('create' for new records, 'update' for existing ones)
  3. Preserve correct timestamps and metadata
  4. Consider using PaperTrail::Version.create! or similar approach

Acceptance Criteria

  • GitlabSubscriptions::Duo::BulkAssignService creates papertrail versions manually after upsert_all
  • New addon assignments created via bulk assign service have corresponding version records
  • Historical data is properly synced to ClickHouse
  • No new orphaned addon assignments are created
  • Tests verify that version records are created correctly

Related Issues

Additional Context

This is a critical fix needed to ensure data consistency for the historical addon assignment finder functionality. Without proper papertrail versions, the ClickHouse historical data will be incomplete, affecting AI Impact analytics and metrics.