Skip to content

feat: add sonatype fields (CM-1308) - #4298

Merged
ulemons merged 1 commit into
mainfrom
feat/add-sonatype-fields
Jul 3, 2026
Merged

feat: add sonatype fields (CM-1308)#4298
ulemons merged 1 commit into
mainfrom
feat/add-sonatype-fields

Conversation

@ulemons

@ulemons ulemons commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the schema foundation for the Sonatype popularity signal on Maven packages.

Sonatype could not deliver raw monthly Maven download counts, so instead they provide a popularity score derived from their SCA telemetry — normalized 0–100 per ecosystem, tiered P0–P3. Today the Maven ranking pipeline has no popularity signal at all (only dependent_count and transitive_dependent_count feed criticality), so industry-critical packages that are under-represented as dependency targets in our graph get missed.

This PR is step 1 of 3: it only introduces the columns that will hold the Sonatype data. The ingestion script and the ranking-function change land in follow-up PRs:

  • This PR — schema: add sonatype_* columns to packages.
  • Follow-up — one-shot CSV ingestion script (--file, insert-if-missing, idempotent).
  • Follow-up — feed sonatype_popularity_score into rank_packages() as a 4th signal.

Changes

  • New Flyway migration V1783123200__sonatype_popularity.sql adding five columns to packages:
    • sonatype_popularity_score numeric — 0–100, normalized per ecosystem; the only column consumed by rank_packages().
    • sonatype_rank int — rank within the Sonatype list; display/audit only, not consumed by ranking.
    • sonatype_tier textP0 | P1 | P2 | P3.
    • sonatype_snapshot_at timestamptz — timestamp of the Sonatype snapshot the row came from.
    • sonatype_updated_at timestamptz — timestamp of our last upsert of the sonatype_* fields.
  • Columns are nullable with no DEFAULT — intentional. Existing rows (all non-Maven, plus Maven rows not in Sonatype's list) stay NULL, meaning "no Sonatype signal". This is what lets the follow-up ranking change drop the signal for other ecosystems automatically (ecosystem_signal_total = 0 → excluded), with zero impact on npm/pypi.
  • Dedicated columns, not JSONB — score/rank/tier are queried independently.
  • No index on first pass — dataset is small (first delivery is P0 only, ~500 rows). Add later if a real query pattern demands it.
  • Instant, non-blocking migration (ADD COLUMN ... NULL with no default → no table rewrite).

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Performance improvement
  • Chore / dependency update
  • Documentation

JIRA ticket

CM-1308


Note

Low Risk
Schema-only, nullable column additions with no behavior or ranking changes in this PR.

Overview
Adds Flyway migration V1783123200__sonatype_popularity.sql that extends packages with five nullable Sonatype fields: sonatype_popularity_score, sonatype_rank, sonatype_tier, sonatype_snapshot_at, and sonatype_updated_at.

The migration is additive only (ADD COLUMN IF NOT EXISTS, no defaults, no indexes). Existing rows stay NULL until follow-up ingestion and rank_packages() wiring land in later PRs.

Reviewed by Cursor Bugbot for commit ec661c7. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@ulemons ulemons self-assigned this Jul 3, 2026
@ulemons ulemons added the Feature Created by Linear-GitHub Sync label Jul 3, 2026
Copilot AI review requested due to automatic review settings July 3, 2026 08:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is step 1 of 3 for the Sonatype popularity signal on Maven packages. It adds only the schema foundation — five nullable sonatype_* columns on the packages table — leaving CSV ingestion and the rank_packages() wiring to follow-up PRs. The columns default to NULL ("no Sonatype signal"), which keeps existing npm/pypi/other rows unaffected.

Changes:

  • Adds Flyway migration V1783123200__sonatype_popularity.sql.
  • Introduces sonatype_popularity_score, sonatype_rank, sonatype_tier, sonatype_snapshot_at, and sonatype_updated_at as nullable columns (no defaults, no index).
  • Documents intent inline (only sonatype_popularity_score will feed ranking; rank/tier are display/audit).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ulemons
ulemons merged commit 5ab88b0 into main Jul 3, 2026
21 checks passed
@ulemons
ulemons deleted the feat/add-sonatype-fields branch July 3, 2026 08:37
skwowet pushed a commit that referenced this pull request Jul 3, 2026
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants