Skip to content

fix: health score total with sum, instead of mean - #4532

Merged
joanagmaia merged 3 commits into
mainfrom
chore/health-score-total
Aug 28, 2026
Merged

fix: health score total with sum, instead of mean#4532
joanagmaia merged 3 commits into
mainfrom
chore/health-score-total

Conversation

@joanagmaia

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI balanced review requested due to automatic review settings August 28, 2026 16:39
@cursor

cursor Bot commented Aug 28, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes published project health metrics and labels derived from healthScoreV2; scope is analytics/Tinybird copy jobs, but downstream dashboards may show different scores for many projects.

Overview
Project-level healthScoreV2 no longer uses the median of per-repo composite scores. It is now the sum of the three project rollups (maintainerHealthScoreV2, securitySupplyChainScoreV2, developmentActivityScoreV2), each still a median over enabled, non-excluded repos, with IN-1248 null-guarding (NULL when fewer than two categories have data).

The rollup SQL in project_insights_copy_health_v2_project switches to quantileExactOrNull for those medians so empty sets stay NULL instead of becoming 0, which would break the “< 2 categories → NULL” rule and skew sums.

Docs in project_insights_copy_ds, project_insights.pipe, and project_repo_insights.pipe are updated so project healthScoreV2 is described as that guarded sum, not an independent median that might not match the category fields.

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

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

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

Updates project Health Score v2 aggregation to sum category medians instead of taking the median repository score.

Changes:

  • Sums three per-category medians.
  • Returns NULL when fewer than two categories exist.
  • Documents the new aggregation, though related documentation remains outdated.
  • PR title is missing the required JIRA key.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread services/libs/tinybird/pipes/project_insights_copy.pipe
…edians rollup

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings August 28, 2026 16:59

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 4 out of 4 changed files in this pull request and generated no new comments.

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Copilot AI review requested due to automatic review settings August 28, 2026 17:03

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 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (2)

Previously missed (1) — in code that hasn't changed since the last review.

services/libs/tinybird/datasources/project_insights_copy_ds.datasource:35

  • This universal project-level contract omits the existing korg exception: project_insights_copy_project_results still forces healthScoreV2 to NULL for that slug while leaving its category scores populated (lines 199-203). Either remove that override if the new rollup resolves its mismatch, or document the exception here so consumers are not promised that every project total equals the category sum.
    - `healthScoreV2` column is the Akrites-methodology composite health score (0-100). For project records (`type='project'`): sum of the three per-category medians (maintainerHealthScoreV2 + securitySupplyChainScoreV2 + developmentActivityScoreV2), null-guarded per IN-1248 (null when fewer than 2 categories are present). For repo records (`type='repo'`): per-repo score passed through from `health_score_v2_repo_copy_ds`. Distinct from the legacy `healthScore` column (community/contributor-based).

services/libs/tinybird/pipes/project_insights_copy.pipe:117

  • The new null guard only uses quantileExactOrNull for the total. The three category fields below still use quantileExact, so an all-NULL category is emitted as 0 rather than NULL, contradicting the newly documented contract at line 121 and both endpoint descriptions. Please switch those three category aggregates to quantileExactOrNull as well so the breakdown preserves missingness while the total continues to coalesce missing categories.
    the guard and coalesce can see NULL explicitly — `quantileExact` returns 0 on an empty set, which

@joanagmaia
joanagmaia merged commit ceb4c7d into main Aug 28, 2026
16 checks passed
@joanagmaia
joanagmaia deleted the chore/health-score-total branch August 28, 2026 17:26
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