Skip to content

feat: add health_score_report_kpis pipe (IN-1285) - #4578

Open
gaspergrom wants to merge 1 commit into
mainfrom
feat/IN-1285-health-score-kpis-pipe
Open

feat: add health_score_report_kpis pipe (IN-1285)#4578
gaspergrom wants to merge 1 commit into
mainfrom
feat/IN-1285-health-score-kpis-pipe

Conversation

@gaspergrom

Copy link
Copy Markdown
Contributor

Summary

Adds the health_score_report_kpis Tinybird pipe, following the agentic_ai_momentum_glance style, 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

  • Validated pipe output against live Tinybird data (crowd-tinybird-manager)
  • Deployed to staging, then production
  • Confirmed insights-app-token can read tinybird.datasources_ops_log on both environments

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI balanced review requested due to automatic review settings September 8, 2026 18:18
@cursor

cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Read-only analytics pipe over existing datasources; no application or auth logic changes.

Overview
Adds a new Tinybird pipe health_score_report_kpis that powers top-line Health Score v2 coverage metrics for the Insights Health Score report (IN-1285 / IN-1276).

The endpoint returns a single row with tracked vs scored counts for repos and projects from project_insights_copy_ds, plus projects_partial (projects with healthScoreV2 but coveredCategoryCount < 3), and an updated_at freshness timestamp from the latest successful copy into that datasource via tinybird.datasources_ops_log. It is exposed with insights-app-token read access and tagged for Insights/Health widgets.

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

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

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_kpis endpoint pipe that computes tracked/scored repo and project counts from project_insights_copy_ds.
  • Adds an updated_at KPI based on the latest copy event timestamp from tinybird.datasources_ops_log.
  • Combines the counts and freshness timestamp via CROSS JOIN to 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.

Comment on lines +10 to +11
- `updated_at` — freshness timestamp: max `timestamp` from `tinybird.datasources_ops_log` for the
last successful (`event_type = 'copy'`) copy into `project_insights_copy_ds`.

@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 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'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2c485de. Configure here.

@gaspergrom
gaspergrom requested a review from epipav September 9, 2026 02:57
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