fix: return v2 health score total in public project insights api - #2117
Merged
Conversation
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the public project insights API to expose the v2 health score while preserving compatibility.
Changes:
- Returns
healthScoreV2ashealthScore. - Falls back to the legacy score when v2 is unavailable.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
joanagmaia
approved these changes
Aug 26, 2026
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
…-1212 Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
frontend/server/api/project/[slug]/insights.get.ts:45
healthScoreV2is nullable, so this intentionally permitshealthScore: null, but the public OpenAPI contract still markshealthScoreas a required, non-nullnumber. Update that schema (and any public response type) to allow null; otherwise generated clients and response validators will reject valid responses for projects without a v2 score.
healthScore: project.healthScoreV2,
Comment on lines
+257
to
+269
| "healthLabel": { | ||
| "type": "string", | ||
| "nullable": true, | ||
| "enum": [ | ||
| "excellent", | ||
| "healthy", | ||
| "fair", | ||
| "concerning", | ||
| "critical", | ||
| null | ||
| ], | ||
| "description": "Qualitative band for healthScore. Null if not yet computed for this project." | ||
| }, |
Comment on lines
+257
to
+268
| "healthLabel": { | ||
| "type": "string", | ||
| "nullable": true, | ||
| "enum": [ | ||
| "excellent", | ||
| "healthy", | ||
| "fair", | ||
| "concerning", | ||
| "critical", | ||
| null | ||
| ], | ||
| "description": "Qualitative band for healthScore. Null if not yet computed for this project." |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
frontend/docs/openapi.json:259
- This document declares OpenAPI 3.1, where
nullableis no longer the way to extend a type with null. Withtype: "string", thenullenum member still fails type validation, so the schema contradicts the description. Express nullability with astring | nullunion instead.
"type": "string",
"nullable": true,
|
|
||
| return { | ||
| ...project, | ||
| healthScore: project.healthScoreV2, |
| return { | ||
| ...project, | ||
| healthScore: project.healthScoreV2, | ||
| healthLabel: project.healthLabel, |
joanagmaia
added a commit
to joanagmaia/cncf.io
that referenced
this pull request
Aug 26, 2026
LFX Insights has released a new 5-tier Health Score system that replaces the previous Excellent/Healthy/Stable/Unsteady/Critical bands with recalibrated thresholds and renamed labels. New bands: 85–100 Excellent 70–84 Healthy 50–69 Fair 30–49 Concerning 0–29 Critical Changes: - Extract threshold logic from project-single.php into a new LF_Utils::get_health_band() helper to eliminate the duplicated if/elseif ladders (icon + label were separate blocks). - Update thresholds from > comparisons to >= to match the inclusive band boundaries. - Rename stable.svg → fair.svg and unsteady.svg → concerning.svg so icon filenames match the labels they represent. Coordinated with Insights public API release: linuxfoundation/insights#2117 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
cjyabraham
pushed a commit
to cncf/cncf.io
that referenced
this pull request
Aug 27, 2026
LFX Insights has released a new 5-tier Health Score system that replaces the previous Excellent/Healthy/Stable/Unsteady/Critical bands with recalibrated thresholds and renamed labels. New bands: 85–100 Excellent 70–84 Healthy 50–69 Fair 30–49 Concerning 0–29 Critical Changes: - Extract threshold logic from project-single.php into a new LF_Utils::get_health_band() helper to eliminate the duplicated if/elseif ladders (icon + label were separate blocks). - Update thresholds from > comparisons to >= to match the inclusive band boundaries. - Rename stable.svg → fair.svg and unsteady.svg → concerning.svg so icon filenames match the labels they represent. Coordinated with Insights public API release: linuxfoundation/insights#2117 Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/project/{slug}/insights(the public, unauthenticated API documented infrontend/docs/openapi.jsonthat CNCF and other LF web properties consume) still returned the legacy v1healthScorefield verbatim from theproject_insightsTinybird pipe, even though that same pipe already computeshealthScoreV2.health-score-v2.get.ts) was already updated to serve v2, so Insights' own UI shows v2 scores while the public API — and everything that reads it, including cncf.io/projects/* — still shows v1. This is the gap Joana flagged in IN-1212 comment 118228 (Argo showing v1 on cncf.io vs v2 on insights.linuxfoundation.org).healthScoreV2as thehealthScorefield value (falling back to the legacy v1 value if v2 hasn't been computed yet for a given project), while every other field in the response is untouched — matching AC Setup pinia #3 on IN-1212 ("system returns v2 total score in public API responses; all other metrics remain unchanged from previous responses").Test plan
pnpm tsc-check— passespnpm lint:fix— no new warnings/errors introduced/api/project/argo/insightsin staging returns the v2 total scoreJIRA: IN-1212