Introduce Cells claims verification service

What does this MR do and why?

Implements the Cells::Claims::VerificationService to backfill Cells claims between Rails database and the Topology Service. The verification service iterates over all records for a given model in batches, compares them against what the Topology Service has, and commits the diff (creates for records missing in TS, destroys for orphaned TS records). This ensures claims remain in sync even when prior writes were missed.

This MR specifically implements the backfill portion as part of the whole Verification Loop.

Not included in this MR

  • Checks the diff when a record is found in both local and TS, eg reconciling different bucket value for the same source_id. This will be done in a follow up MR.

References

How to set up and validate locally

  1. With seeded GDK, check the users table has some data in it
  2. Run Cells::Claims::VerificationService.new(User).execute
  3. Check the claims table in gdk psql -d topology_service
  4. It should have 2 * number of users record in Rails (because User has 2 claimable attributes, thus 2x the amount in TS)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist (https://docs.gitlab.com/ee/development/code_review.html#acceptance-checklist)

Edited by Marco Gregorius

Merge request reports

Loading