@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
Chloe Fons (1321191e) at 17 Mar 17:44
Simplify code and specs
@obaiye I could do the project creation on master and switch to your branch once it's failed. Could that work?
Chloe Fons (539d4fa8) at 17 Mar 14:26
Add database constraint
@victorprete if you could please re-approve so this can get mwps that'd be brilliant
Chloe Fons (86e16865) at 17 Mar 14:03
Revert "Lazy load projects in pipeline tests"
Can you have a final look please @daniele-gitlab?
Chloe Fons (e26765a1) at 17 Mar 13:59
Remove un-necessary ordering
Chloe Fons (513bc607) at 17 Mar 13:25
Address Duo comments
@obaiye I'm using the URL you've used in your screenshots:

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)
Hi @obaiye thanks! I've been trying the verification steps but I can't create a fake project
There's not much to review on the backend besides tests and they LGTM
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).
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:
Geo::VerificationStateBackfillService, called every minute from the VerificationCronWorker.TBD
bundle exec rails db:migrate:down:main VERSION=20260317141445
bundle exec rails db:migrate:down:main VERSION=20260316153056
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)
bundle exec rails db:migrate VERSION=20260316153056
bundle exec rails db:migrate VERSION=20260317141445
# No duplicates remain
Geo::ProjectRepositoryState.where(project_repository_id: repo.id) # only returns 1 record
# 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)
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Chloe Fons (bcfa42ae) at 17 Mar 11:06
Use schema_migrate_up! in tests
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?
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