feat: add health_score_report_kpis pipe (IN-1285) - #4578
Conversation
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
PR SummaryLow Risk Overview The endpoint returns a single row with tracked vs scored counts for repos and projects from Reviewed by Cursor Bugbot for commit 2c485de. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Pull request overview
Adds a new Tinybird pipe that provides a single-row set of Health Score v2 “coverage” KPIs intended for the Insights health-score-coverage report scaffold.
Changes:
- Introduces
health_score_report_kpisendpoint pipe that computes tracked/scored repo and project counts fromproject_insights_copy_ds. - Adds an
updated_atKPI based on the latestcopyevent timestamp fromtinybird.datasources_ops_log. - Combines the counts and freshness timestamp via
CROSS JOINto guarantee a single-row result.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - `updated_at` — freshness timestamp: max `timestamp` from `tinybird.datasources_ops_log` for the | ||
| last successful (`event_type = 'copy'`) copy into `project_insights_copy_ds`. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 2c485de. Configure here.
| SQL > | ||
| SELECT max(timestamp) AS updated_at | ||
| FROM tinybird.datasources_ops_log | ||
| WHERE datasource_name = 'project_insights_copy_ds' AND event_type = 'copy' |
There was a problem hiding this comment.
Freshness timestamp includes failed copies
Medium Severity
updated_at takes max(timestamp) from tinybird.datasources_ops_log for any event_type = 'copy' row and never checks result. Failed copies still land in that log, so a failed nightly replace can advance freshness while project_insights_copy_ds keeps the last successful snapshot. The field is documented as the last successful copy.
Reviewed by Cursor Bugbot for commit 2c485de. Configure here.


Summary
Adds the
health_score_report_kpisTinybird pipe, following theagentic_ai_momentum_glancestyle, exposing repos_tracked/repos_scored/projects_tracked/projects_scored/projects_partial/updated_at for the new Insights health-score-coverage report scaffold (IN-1276 epic).Already validated against production data and deployed staging → production by crowd-tinybird-manager.
Test plan
insights-app-tokencan readtinybird.datasources_ops_logon both environments