fix: health score total with sum, instead of mean - #4532
Conversation
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
PR SummaryMedium Risk Overview The rollup SQL in Docs in Reviewed by Cursor Bugbot for commit 07f0a6b. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
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
NULLwhen 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.
…edians rollup Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
There was a problem hiding this comment.
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
korgexception:project_insights_copy_project_resultsstill forceshealthScoreV2toNULLfor 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
quantileExactOrNullfor the total. The three category fields below still usequantileExact, so an all-NULL category is emitted as0rather thanNULL, contradicting the newly documented contract at line 121 and both endpoint descriptions. Please switch those three category aggregates toquantileExactOrNullas 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
No description provided.