Skip to content

feat(cycle-time): per-repo open-to-merge distribution on the org dashboard#60

Merged
trentas merged 1 commit into
mainfrom
feat/cycle-time-by-repo
May 25, 2026
Merged

feat(cycle-time): per-repo open-to-merge distribution on the org dashboard#60
trentas merged 1 commit into
mainfrom
feat/cycle-time-by-repo

Conversation

@renatoguimaraescb
Copy link
Copy Markdown
Contributor

Summary

  • Adds a new Cycle Time section to the org dashboard so engineering can see how long it takes to go from PR open to merge, broken down per repository — mirrors the reference layout (4 KPI cards + 2 horizontal charts).
  • Engine now emits the full cycle-time distribution alongside the existing median: pr_mean_time_to_merge_hours, pr_p90_time_to_merge_hours, pr_pct_merged_within_24h, and a five-bucket pr_cycle_time_buckets (same_day / 1d / 2–3d / 4–7d / 7+d).
  • Org-level numbers: bucket counts are summed exactly across repos (so the distribution chart and "% within 24h" KPI are exact); org median/mean are weighted by per-repo merged count. Worst-case P90 reports the slowest repo's P90.
  • i18n strings added for en-US and pt-BR. New --color-bucket-* tokens in the design system.

What's in the PR

Engine (Python)

  • iris/analysis/pr_lifecycle.pyPRLifecycleResult gains mean, p90, pct_within_24h, and CycleTimeBuckets. Nearest-rank percentile uses ceil so the rank stays monotonic.
  • iris/metrics/aggregator.py — passes the new fields into ReportMetrics.
  • iris/models/metrics.pyReportMetrics schema extended (optional fields preserve backward compatibility).
  • iris/reports/writer.py — Markdown report shows the new metrics when present.
  • iris/i18n.py — en/pt strings for the new metric labels.
  • tests/test_pr_lifecycle.py — 5 new tests cover buckets, % within 24h boundary, mean/P90, and the merged-only filter.

Platform (TypeScript / Next.js)

  • platform/src/types/metrics.ts — TS types mirror the engine fields.
  • platform/src/types/org-summary.ts — new CycleTimeData shape.
  • platform/lib/queries/org-summary.ts — new computeCycleTime() aggregator.
  • platform/src/app/[tenant]/dashboard/sections/CycleTime.tsx — the new section: 4 KPI cards, "% merged within 1 day per repo" sorted ranking chart, and a stacked bucket distribution chart per repo. Insight banner appears once there are ≥ 50 merged PRs.
  • platform/src/app/[tenant]/dashboard/page.tsx — wires the section in (below PRHealth).
  • platform/src/styles/globals.css — new --color-bucket-* ordinal palette for the stacked bars.
  • platform/lib/translations.tsdashboard.cycleTime.* strings in en-US and pt-BR.

Docs

  • docs/METRICS.md — new fields documented in §15.
  • CHANGELOG.md — entry under Unreleased.

Test plan

  • pytest tests/ — 135 passed (5 new in test_pr_lifecycle.py)
  • npm run test (vitest) — 186 passed
  • tsc --noEmit — clean
  • npm run lint — 0 errors (preexisting warnings only)
  • npm run build — production build succeeds
  • Verify in a tenant with multiple repos that the section renders correctly and the org-level KPIs match the engine emissions
  • Confirm the section is hidden gracefully when no repo has merged PRs in the window

🤖 Generated with Claude Code

…board

Adds a new "Cycle Time" section to the org dashboard so engineering
can see how long it takes to go from PR open to merge, broken down
per repository. The engine now emits mean, P90, % merged within 24h
and a five-bucket distribution alongside the existing median, and the
platform aggregates these into 4 KPI cards, a sorted "% merged within
1 day per repo" bar chart, and a stacked distribution chart per repo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clickbus-iris Ready Ready Preview, Comment May 25, 2026 7:17pm

Request Review

@trentas trentas merged commit 0484f98 into main May 25, 2026
5 checks passed
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