Chloe Fons activity https://gitlab.com/c_fons 2026-03-17T17:52:20Z tag:gitlab.com,2026-03-17:5214139107 Chloe Fons commented on merge request !226882 at GitLab.org / GitLab 2026-03-17T17:52:20Z c_fons Chloe Fons

@victorprete Could you please review this Geo MR if you've got time? You can pass it to @dbalexandre for final maintainer review once it looks good to you, as he's got some context on this 🙏

tag:gitlab.com,2026-03-17:5214113474 Chloe Fons pushed to project branch cf-consolidate-geo-git-update-hooks-to-event at GitLab.org / GitLab 2026-03-17T17:44:36Z c_fons Chloe Fons

Chloe Fons (1321191e) at 17 Mar 17:44

Simplify code and specs

tag:gitlab.com,2026-03-17:5213976041 Chloe Fons pushed to project branch cf-consolidate-geo-git-update-hooks-to-event at GitLab.org / GitLab 2026-03-17T17:07:46Z c_fons Chloe Fons

Chloe Fons (bd55925d) at 17 Mar 17:07

Remove useless safe navigation

... and 739 more commits

tag:gitlab.com,2026-03-17:5213827801 Chloe Fons pushed to project branch cf-consolidate-geo-git-update-hooks-to-event at GitLab.org / GitLab 2026-03-17T16:32:51Z c_fons Chloe Fons

Chloe Fons (dca9448a) at 17 Mar 16:32

Remove useless safe navigation

... and 1 more commit

tag:gitlab.com,2026-03-17:5213554064 Chloe Fons commented on merge request !221798 at GitLab.org / GitLab 2026-03-17T15:33:10Z c_fons Chloe Fons

@obaiye I could do the project creation on master and switch to your branch once it's failed. Could that work?

tag:gitlab.com,2026-03-17:5213208200 Chloe Fons pushed to project branch 590458-geo-fix-potential-duplicates-in-project_repository_states-and-add-constraint at GitLab.org / GitLab 2026-03-17T14:26:43Z c_fons Chloe Fons

Chloe Fons (539d4fa8) at 17 Mar 14:26

Add database constraint

tag:gitlab.com,2026-03-17:5213140404 Chloe Fons commented on merge request !227126 at GitLab.org / GitLab 2026-03-17T14:13:00Z c_fons Chloe Fons

@victorprete if you could please re-approve so this can get mwps that'd be brilliant 🙏 thank you!

tag:gitlab.com,2026-03-17:5213087607 Chloe Fons pushed to project branch cf-refactor-project-repository-registry-shared-example at GitLab.org / GitLab 2026-03-17T14:03:24Z c_fons Chloe Fons

Chloe Fons (86e16865) at 17 Mar 14:03

Revert "Lazy load projects in pipeline tests"

tag:gitlab.com,2026-03-17:5213083258 Chloe Fons commented on merge request !227126 at GitLab.org / GitLab 2026-03-17T14:02:33Z c_fons Chloe Fons

what you just explained is actually what I thought was right! I should have trusted myself more and pushed back 🙏

Can you have a final look please @daniele-gitlab?

tag:gitlab.com,2026-03-17:5213069399 Chloe Fons pushed to project branch 590458-geo-fix-potential-duplicates-in-project_repository_states-and-add-constraint at GitLab.org / GitLab 2026-03-17T13:59:58Z c_fons Chloe Fons

Chloe Fons (e26765a1) at 17 Mar 13:59

Remove un-necessary ordering

tag:gitlab.com,2026-03-17:5212894013 Chloe Fons pushed to project branch 590458-geo-fix-potential-duplicates-in-project_repository_states-and-add-constraint at GitLab.org / GitLab 2026-03-17T13:25:36Z c_fons Chloe Fons

Chloe Fons (513bc607) at 17 Mar 13:25

Address Duo comments

tag:gitlab.com,2026-03-17:5212640361 Chloe Fons commented on merge request !221798 at GitLab.org / GitLab 2026-03-17T12:34:15Z c_fons Chloe Fons

@obaiye I'm using the URL you've used in your screenshots: Screenshot_2026-03-17_at_12.33.22

tag:gitlab.com,2026-03-17:5212539714 Chloe Fons pushed to project branch cf-refactor-project-repository-registry-shared-example at GitLab.org / GitLab 2026-03-17T12:11:38Z c_fons Chloe Fons

Chloe Fons (75701ca6) at 17 Mar 12:11

Lazy load projects in pipeline tests

... and 867 more commits

tag:gitlab.com,2026-03-17:5212522534 Chloe Fons commented on issue #591222 at GitLab.org / GitLab 2026-03-17T12:07:35Z c_fons Chloe Fons

Longer term I can imagine it would be a nice-to-have in the UI for all data types

And indeed, it's planned in #570726, but that needs serious refinement and might not be possible due to timeouts on very large tables (job_artifacts, I'm looking at you)

tag:gitlab.com,2026-03-17:5212500075 Chloe Fons commented on merge request !221798 at GitLab.org / GitLab 2026-03-17T12:02:35Z c_fons Chloe Fons

Hi @obaiye thanks! I've been trying the verification steps but I can't create a fake project 🤔 when using a fake git URL I'm faced with "Host cannot be resolved or invalid". How can I create an invalid import?

There's not much to review on the backend besides tests and they LGTM 👍

tag:gitlab.com,2026-03-17:5212309380 Chloe Fons opened merge request !227637: Draft: Geo: add migrations to delete `project_repository_states` duplicate records and prevent further duplicates at... 2026-03-17T11:17:26Z c_fons Chloe Fons

What does this MR do and why?

This MR implements Step 2 of the deduplication plan tracked in #590458.

The project_repository_states table can contain duplicate rows for the same project_repository_id due to a missing uniqueness constraint. This MR adds a post-deployment migration (DeduplicateProjectRepositoryStates) that cleans up any such existing duplicates and a unique index to ensure no new duplicates will be created.

The deletion can be done in a post-deployment migration because the table is seldom used yet, so will be small. On GitLab.com, it's empty (because Geo is not enabled).

References

Database considerations

Destructive action

The migration 20260316153056_deduplicate_project_repository_states_spec.rb does remove duplicate records in the project_repository_states table. If something goes wrong and too many/all records are deleted, this will not cause disruption to users:

  1. This table is not yet used. It will be used when Project Replication V2 is added and enabled (not before 19.0 at the very earliest). There might already be records in there through the default Geo SSF behaviour, but those records would not be used for actual Geo replication.
  2. Geo has mechanisms to periodically populate missing records in this table through the Geo::VerificationStateBackfillService, called every minute from the VerificationCronWorker.

Query plans

TBD

How to set up and validate locally

  1. Check out the branch
  2. Roll back to before the migrations (if you've already run them)
bundle exec rails db:migrate:down:main VERSION=20260317141445
bundle exec rails db:migrate:down:main VERSION=20260316153056
  1. Open the Rails console and create duplicate records:
project = Project.first
repo = project.project_repository
state = repo.project_repository_state # if it doesn't exist, it's OK, we'll create some
state_data = { project_repository_id: repo.id, project_id: project.id }

# Now create and duplicate this existing state
Geo::ProjectRepositoryState.insert_all([state_data, state_data]) # insert 2 additional records

# Verify there's more than one record for the repo:
Geo::ProjectRepositoryState.where(project_repository_id: repo.id)
  1. Now run the migrations:
bundle exec rails db:migrate VERSION=20260316153056
bundle exec rails db:migrate VERSION=20260317141445
  1. Verify in the console:
# No duplicates remain
Geo::ProjectRepositoryState.where(project_repository_id: repo.id) # only returns 1 record
  1. Inserting a duplicate record does not work anymore:
# This'll return @rows=[] meaning no row was inserted
Geo::ProjectRepositoryState.insert(project_repository_id: repo.id, project_id: repo.project_id, verification_state: 0)

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.

tag:gitlab.com,2026-03-17:5212262403 Chloe Fons pushed to project branch 590458-geo-fix-potential-duplicates-in-project_repository_states-and-add-constraint at GitLab.org / GitLab 2026-03-17T11:06:43Z c_fons Chloe Fons

Chloe Fons (bcfa42ae) at 17 Mar 11:06

Use schema_migrate_up! in tests

tag:gitlab.com,2026-03-17:5212122752 Chloe Fons pushed to project branch 590458-geo-fix-potential-duplicates-in-project_repository_states-and-add-constraint at GitLab.org / GitLab 2026-03-17T10:37:31Z c_fons Chloe Fons

Chloe Fons (d5c116d8) at 17 Mar 10:37

Simplify duplicates list

... and 1 more commit

tag:gitlab.com,2026-03-17:5211977571 Chloe Fons commented on merge request !227126 at GitLab.org / GitLab 2026-03-17T10:07:12Z c_fons Chloe Fons

Thank you for the review @daniele-gitlab! I've addressed your comment. Could you please have a last look and setting MWPS if it looks good? 🙏

tag:gitlab.com,2026-03-17:5211977540 Chloe Fons commented on merge request !227126 at GitLab.org / GitLab 2026-03-17T10:07:11Z c_fons Chloe Fons

Right, good point. I'm always quite confused with exactly when it's best to use let vs. let_it_be. Thanks for the guidance @daniele-gitlab