Skip to content

fix: downloads count for ai report (IN-1182)#4228

Open
joanagmaia wants to merge 10 commits into
mainfrom
fix/IN-1182-downloads-count-ai-report
Open

fix: downloads count for ai report (IN-1182)#4228
joanagmaia wants to merge 10 commits into
mainfrom
fix/IN-1182-downloads-count-ai-report

Conversation

@joanagmaia

@joanagmaia joanagmaia commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Fixes incorrect download and Docker pull metrics on the Agentic AI projects list by rewriting the ai_package_metrics node in agentic_ai_projects_list_copy.pipe.

What changed:

  • ai_repos now excludes repositories with an empty insightsProjectId, so all downstream nodes (activity, contributor, PR, issue metrics) automatically skip those repos.
  • ai_package_metrics is restructured as a three-level pipeline:
    1. Inner deduplicationargMax(..., updatedAt) per (insightsProjectId, date, ecosystem, repo, name) to collapse duplicate/versioned rows in packageDownloads.
    2. Per-package rollup — groups by (insightsProjectId, ecosystem, repo, name) and applies argMax(..., date) / argMaxIf(..., date, ...) independently per package, so each package contributes its own latest cumulative value and its own 30-day delta regardless of when it was last updated.
    3. Project rollupsum across packages per insightsProjectId for downloads and Docker pulls; max for dependent repo/package counts.

The previous single-pass query either picked one package's value per project (original) or summed per calendar date and silently dropped packages whose last row predated the project's latest date (intermediate version).


Note

Medium Risk
Changes analytics SQL that feeds the daily agentic_ai_projects_list_ds refresh; metrics will shift for multi-package projects and repos without insightsProjectId, but scope is limited to the Agentic AI collection pipe.

Overview
Fixes incorrect download and Docker pull totals on the Agentic AI projects list by changing how agentic_ai_projects_list_copy.pipe builds package metrics and which repos feed the pipeline.

ai_repos now drops repositories with an empty insightsProjectId, so every downstream node (activity, contributors, PRs, issues, packages) no longer includes those repos.

ai_package_metrics is rewritten as a three-stage rollup instead of a single argMax over packageDownloads: dedupe rows per (insightsProjectId, date, ecosystem, repo, name) with argMax(..., updatedAt), compute each package’s latest cumulative counts and 30-day deltas, then sum downloads/Docker metrics per project (and max for dependent repo/package counts). That fixes under-counting when a project has multiple packages or when packages last updated on different dates.

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

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings June 17, 2026 11:07
Comment thread services/libs/tinybird/pipes/agentic_ai_projects_list_copy.pipe Outdated
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>

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 updates the Tinybird pipe that computes per-project package metrics for the Agentic AI report, aiming to correct how cumulative package download metrics are deduplicated and rolled up to the project level.

Changes:

  • Replaces argMax(..., date) reads from packageDownloads FINAL with a deduplication subquery using argMax(..., updatedAt) per (insightsProjectId, date, ecosystem, repo, name).
  • Switches the rollup logic for downloads and docker pulls to use max / maxIf when computing totals and 30-day deltas.
  • Tightens the AI project filter to exclude empty insightsProjectId values from ai_repos.

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

Comment thread services/libs/tinybird/pipes/agentic_ai_projects_list_copy.pipe Outdated
Comment thread services/libs/tinybird/pipes/agentic_ai_projects_list_copy.pipe Outdated
Comment thread services/libs/tinybird/pipes/agentic_ai_projects_list_copy.pipe Outdated
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings June 17, 2026 11:20

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread services/libs/tinybird/pipes/agentic_ai_projects_list_copy.pipe Outdated
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings June 17, 2026 11:27

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 80d2424. Configure here.

Comment thread services/libs/tinybird/pipes/agentic_ai_projects_list_copy.pipe

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings June 17, 2026 13:07

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread services/libs/tinybird/pipes/agentic_ai_projects_list_copy.pipe
@joanagmaia joanagmaia requested a review from gaspergrom June 17, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants