Skip to content

perf(ci): read the CI analytics from ci_runs and ci_jobs - #1719

Open
Makisuo wants to merge 1 commit into
ci-rollup/tablesfrom
ci-rollup/queries
Open

Makisuo wants to merge 1 commit into
ci-rollup/tablesfrom
ci-rollup/queries

perf(ci): read the CI analytics from ci_runs and ci_jobs

fa3ad2b
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 22, 2026 in 1m 35s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge
Every CI read moves onto ci_runs/ci_jobs with OrgId intact, columns verified against migration 0047, and the numeric attempt/pull request conversion is pinned by the ClickHouse e2e and the servi…
no findings · tests covered · risk medium

Moves every CI read (analytics page, PR sheet, ci_runs MCP tool) from raw traces to the ci_runs / ci_jobs projections, and lets attempt and pull request arrive as numbers. Parity holds and the missing-table case is handled; safe to merge once the 0047 tables are live.

  • ci-runs.ts builders read CiRuns/CiJobs columns instead of traces attributes
  • ciJobStatsQuery counts reruns as Attempt > 1 rather than run_attempt != '1'
  • CiRunRow.attempt becomes a Number; the MCP tool and service drop their string parsing
  • The ci_runs tool maps a missing table to McpUnavailableError with remediation

Before merge

  • Warehouse · Deploy the schema before the code that reads it · packages/domain/src/tinybird/datasources.ts
  • Manual · Deploy only after migration 0047 is applied: the CI page and the ci_runs tool now fail without ci_runs/ci_jobs
  • Manual · Self-hosted ClickHouse orgs must apply the schema or the CI tab shows the warehouse config error

Production impact

Telemetry this change adds and removes (16)
  • ➖ attribute cicd.pipeline.task.name (~33k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:389
  • ➖ attribute cicd.pipeline.task.run.result (~33k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:389
  • ➖ attribute maple.cicd.failure.reason (~97/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:389
  • ➖ attribute cicd.pipeline.task.run.url.full (~33k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:389
  • ➖ attribute maple.cicd.step.number (~29k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:389
  • ➖ attribute cicd.pipeline.name (~36k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:409
  • ➖ attribute maple.cicd.run_attempt (~36k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:414
  • ➖ attribute maple.cicd.queue_duration_ms (~6.7k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:414
  • ➖ attribute cicd.pipeline.result (~779/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:438
  • ➖ attribute cicd.pipeline.run.id (~54k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:491
  • ➖ attribute cicd.pipeline.run.url.full (~779/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:491
  • ➖ attribute vcs.ref.head.name (~49k/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:491
  • ➖ attribute vcs.ref.head.revision (~13.2M/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:491
  • ➖ attribute maple.cicd.trigger_event (~779/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:491
  • ➖ attribute maple.cicd.actor (~779/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:491
  • ➖ attribute vcs.change.id (~670/day today) · packages/query-engine/src/__sql_baseline__/catalog.sql:491
What was checked
  • ciScope, ciRunsQuery and ciFailedJobsQuery all still filter OrgId (queries/ci-runs.ts:57,98,165)
  • ci_jobs carries StatusCode and Attempt columns, so the Error filter and rerun count read real data (materializations.ts:1297,1300)
  • attempt/pullRequest are uint16/uint32, so ClickHouse's JSON output is numeric and matches the new Schema.Number

fa3ad2b · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.