Draft: Claim records Kamil
What does this MR do and why?
Change how the changes are captured and sent to TS.
References
This is targeting !200701 and part of it.
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
From very limited testing.
Create new
User.create!(email: "test#{Random.rand}@example.com", password: 'aaa1111aa', name: 'aaa', username: "acvcx222#{Random.rand}") { |u| u.assign_personal_namespace(Organizations::Organization.default_organization); u.emails.build(email: "another#{Random.
rand}@example.com") }
p'*/
...
"claim_save_changes 801880: User 76"
" attribute 'username' changed from '' to 'acvcx2220.27214185750843556'"
"create_record 801840 {:subject=>{:type=>4, :id=>1}, :source=>{:type=>1, :rails_primary_key_id=>76}, :bucket=>{:type=>0, :value=>\"acvcx2220.27214185750843556\"}}"
"send_begin_update req <Gitlab::Cells::TopologyService::Claims::V1::BeginUpdateRequest: create_records: [<Gitlab::Cells::TopologyService::Claims::V1::Metadata: bucket: <Gitlab::Cells::TopologyService::Claims::V1::Bucket: type: :ROUTES, value: \"acvcx2220.27214185750843556\">, subject: <Gitlab::Cells::TopologyService::Claims::V1::Subject: type: :GROUP, id: 95>, source: <Gitlab::Cells::TopologyService::Claims::V1::Source: type: :RAILS_TABLE_ROUTES, rails_primary_key_id: 95>>, <Gitlab::Cells::TopologyService::Claims::V1::Metadata: bucket: <Gitlab::Cells::TopologyService::Claims::V1::Bucket: type: :UNSPECIFIED, value: \"another0.04009797882569199@example.com\">, subject: <Gitlab::Cells::TopologyService::Claims::V1::Subject: type: :USER, id: 76>, source: <Gitlab::Cells::TopologyService::Claims::V1::Source: type: :RAILS_TABLE_EMAILS, rails_primary_key_id: 81>>, <Gitlab::Cells::TopologyService::Claims::V1::Metadata: bucket: <Gitlab::Cells::TopologyService::Claims::V1::Bucket: type: :UNSPECIFIED, value: \"acvcx2220.27214185750843556\">, subject: <Gitlab::Cells::TopologyService::Claims::V1::Subject: type: :USER, id: 1>, source: <Gitlab::Cells::TopologyService::Claims::V1::Source: type: :RAILS_TABLE_USERS, rails_primary_key_id: 76>>], destroy_records: [], cell_id: 1>"
"send_begin_update res <Gitlab::Types::UUID: value: \"950ee9e7-8134-47bc-b712-af5717d016b8\">"
Cells::OutstandingLease Create (0.2ms) INSERT INTO "cells_outstanding_leases" ("uuid", "created_at", "updated_at") VALUES ('950ee9e7-8134-47bc-b712-af5717d016b8', '2025-10-07 08:07:01.188853', '2025-10-07 08:07:01.188853') RETURNING "uuid" /*application:console,db_config_database:gitlabhq_development,db_config_name:main,console_hostname:gitlab-rails-spring,line:/app/models/cells/outstanding_lease.rb:55:in `send_begin_update'*/
TRANSACTION (0.4ms) COMMIT
/home/git/gitlab/lib/gitlab/global_id/deprecations.rb:12: warning: already initialized constant Gitlab::GlobalId::Deprecations::DEPRECATIONS
/home/git/gitlab/lib/gitlab/global_id/deprecations.rb:12: warning: previous definition of DEPRECATIONS was here
Update existing
I did run the User.last.update!(username: "testuser5")
from Rails console. It did what it was supposed to do.
Destroy existing
User.last.destroy!
"send_begin_update req <Gitlab::Cells::TopologyService::Claims::V1::BeginUpdateRequest: create_records: [], destroy_records: [<Gitlab::Cells::TopologyService::Claims::V1::Metadata: bucket: <Gitlab::Cells::TopologyService::Claims::V1::Bucket: type: :UNSPECIFIED, value: \"acvcx2220.27214185750843556\">, subject: <Gitlab::Cells::TopologyService::Claims::V1::Subject: type: :USER, id: 1>, source: <Gitlab::Cells::TopologyService::Claims::V1::Source: type: :RAILS_TABLE_USERS, rails_primary_key_id: 76>>, <Gitlab::Cells::TopologyService::Claims::V1::Metadata: bucket: <Gitlab::Cells::TopologyService::Claims::V1::Bucket: type: :ROUTES, value: \"acvcx2220.27214185750843556\">, subject: <Gitlab::Cells::TopologyService::Claims::V1::Subject: type: :GROUP, id: 95>, source: <Gitlab::Cells::TopologyService::Claims::V1::Source: type: :RAILS_TABLE_ROUTES, rails_primary_key_id: 95>>], cell_id: 1>"
"send_begin_update res <Gitlab::Types::UUID: value: \"5d68edeb-7ed2-4e9d-8a1a-ba30132e29c0\">"
Cells::OutstandingLease Create (0.3ms) INSERT INTO "cells_outstanding_leases" ("uuid", "created_at", "updated_at") VALUES ('5d68edeb-7ed2-4e9d-8a1a-ba30132e29c0', '2025-10-07 08:09:55.013896', '2025-10-07 08:09:55.013896') RETURNING "uuid" /*application:console,db_config_database:gitlabhq_development,db_config_name:main,console_hostname:gitlab-rails-spring,line:/app/models/cells/outstanding_lease.rb:55:in `send_begin_update'*/
(As expected emails are not processed as destroy via ActiveRecord)
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 Lin Jen-Shin