ecosyste-ms / ecosyste-ms/packages

packages.language only written by nuget; SQL filter by language misses everything else

Open
#1,817 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
111
Forks
25
Avg merge
3h 47m
Merged PRs (30d)
14

Description

The `language` column on `packages` is only ever assigned by `Ecosystem::Nuget` (from the nuspec `` element, which is a locale like `en-US`, not a programming language). `Package#language` (`app/models/package.rb:182`) falls back to `repo_metadata['language']` when the column is nil, so `pkg.language` returns `"Scala"` in Ruby, but SQL `WHERE language = 'Scala'` matches zero rows for every non-nuget registry.

On maven (620k packages, 462k with `repo_metadata`):

```
Package.where(registry_id: 22, language: 'Scala').count # => 0
Package.where(registry_id: 22).where("repo_metadata->>'language' = 'Scala'").count # => 79314
```

Options: write `repo_metadata['language']` into the column during `update_repo_metadata` and index it, or drop the column and add an expression index on `(registry_id, (repo_metadata->>'language'))`. The nuget locale value should probably move to `metadata` in either case.

Contributor guide

Open the contributing guide

Research direction

Start with app/models/package.rb:182, update_repo_metadata, and the Ecosystem::Nuget assignment described in the issue. Compare the Ruby language fallback with the SQL filtering behavior and determine how the existing column and repo_metadata are intended to interact. Done means language filters return non-NuGet matches while preserving correct NuGet locale handling and suitable query performance.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, sql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.