Persist Gitaly language_id when creating programming languages

What does this MR do and why?

Contributes to #519895 (closed)

Problem

The programming_languages table has a language_id column and Gitaly exposes a stable language_id, but DetectRepositoryLanguagesService#create_language never persists it. New rows are created with language_id NULL.

Solution

Pass the Gitaly-provided language_id from LanguageDetection#language_gitaly_id through to create_language and include it in the first_or_create attributes. Use .compact so a nil value from Gitaly is safely omitted. Also populate language_id by default in the :programming_language factory and add feature_category metadata to ProgrammingLanguageSpec.

References

Screenshots or screen recordings

Not applicable — backend-only change.

How to set up and validate locally

  1. Run bin/rails console
  2. Pick a project with a repository: project = Project.find_by_full_path('your/project')
  3. Run detection: Projects::DetectRepositoryLanguagesService.new(project).execute
  4. Verify language_id is populated on new records: ProgrammingLanguage.where.not(language_id: nil).any?

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.

Merge request reports

Loading
Loading