Resolve programming languages through stable identifiers

What does this MR do and why?

Contributes to #614125 (closed)

Problem

repository_languages references programming_languages by its non-portable id column. Rows can reference a missing or different language, while language_id may still be NULL on self-managed instances before 19.6.

Solution

  • Add an optional stable language association and resolve it before the legacy id-based association.
  • Delegate language attributes through the resolver and preload both associations.
  • Use the resolved language when calculating language detection updates.
  • Keep legacy row targeting and language-name scopes on legacy ids during the transition.

References

How to set up and validate locally

  1. Run the updated specs: bundle exec rspec spec/models/repository_language_spec.rb spec/lib/gitlab/language_detection_spec.rb
  2. Run RuboCop on the five changed files.

34 examples pass and RuboCop is clean.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Vasilii Iakliushin

Merge request reports

Loading
Loading