Fix flaky spec: TrialAccountGitlabInstance.find_most_recent_seat_link returns wrong record
Problem
The test TrialAccountGitlabInstance.find_most_recent_seat_link when instance exists with multiple seat links returns the most recent seat link is failing.
Test Location: ./spec/models/trial_account_gitlab_instance_spec.rb:104
Job: rspec 2/4 (#13087138384)
Failure Details
The test expects the most recent seat link (id: 28, created_at: 2026-02-11) but the method returns an older one (id: 27, created_at: 2026-02-10).
Root Cause
The find_most_recent_seat_link method in TrialAccountGitlabInstance is likely not ordering results correctly by created_at in descending order.
Expected Fix
Verify the implementation in app/models/trial_account_gitlab_instance.rb and ensure the method uses:
def self.find_most_recent_seat_link
seat_links.order(created_at: :desc).first
end
Test Output
Expected: #<Utilization::TrialLicenseSeatLink id: 28, created_at: 2026-02-11...>
Actual: #<Utilization::TrialLicenseSeatLink id: 27, created_at: 2026-02-10...>