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
- Issue: #519895 (closed)
- Step 1 (add column): !231864 (merged)
- Step 2 (expose from Gitaly): !230678 (merged)
Screenshots or screen recordings
Not applicable — backend-only change.
How to set up and validate locally
- Run
bin/rails console - Pick a project with a repository:
project = Project.find_by_full_path('your/project') - Run detection:
Projects::DetectRepositoryLanguagesService.new(project).execute - Verify
language_idis 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.