You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No code anywhere computes or stores review turnaround time (webhook received → comment/verdict posted). activeReviewTracking (src/db/schema.ts:807-823) has a startedAt field, but it's only used to dedupe concurrent review passes on the same head SHA (src/db/repositories.ts:5091-5156) — it is never diffed against a completion timestamp. The only latency field that exists at all, productUsageEvents.latencyMs (src/db/schema.ts:1298), measures UI/API surface latency, not review processing time.
This is distinct from two adjacent, already-tracked things:
feat(selfhost): GPU + AI-provider observability (exporter, Prometheus, Grafana dashboard) #4367 (open) adds a gittensory_ai_provider_request_duration_seconds histogram for individual AI-provider call latency (embed/vision requests) — internal Prometheus/Grafana ops metric, not this issue's public end-to-end number. Reuse its histogram data as an input where useful; don't duplicate the exporter/Grafana work.
Start the clock when a review pass begins (the existing activeReviewTracking claim, or the webhook-received timestamp already available in the processing pipeline) and stop it when github_app.pr_public_surface_published fires (the existing audit event already recorded per completed review, src/queue/processors.ts — same site that already writes reviewEffortMinutes, see processors.ts:9031).
Persist the duration per review (a new column/field alongside the existing publish audit metadata, or a small new rollup table — follow the reviewEffortMinutes-in-audit-metadata precedent for the raw per-review number).
Extend GET /v1/public/stats (src/review/public-stats.ts:179-346, src/api/routes.ts:949-957) with the new rollup — reuse the existing totals/weekly/byProject response shape rather than inventing a new one. Regenerate OpenAPI (npm run ui:openapi).
Surface the trend on the homepage Proof-of-Power area (apps/gittensory-ui/src/components/site/proof-of-power-stats.tsx) or a /stats detail page — a p50/p95-over-time chart, not just a single current number.
Handle the "not enough history yet" state explicitly (a repo/project with too few completed reviews shows a clear unavailable state, not a misleading number from a tiny sample) — mirrors the pattern feat(signals): add queue pressure and review velocity trend windows #110 already established for its own trend windows.
Deliverables
Duration captured per completed review (start → pr_public_surface_published), persisted
Daily p50/p95 rollup per project, cron-refreshed
GET /v1/public/stats extended with the new trend data; OpenAPI regenerated
Homepage//stats page shows a review-speed trend, with an honest empty/insufficient-history state
No sensitive data in the public payload (aggregates only — matches the existing public-stats safety bar)
Tests: duration computation, rollup aggregation (including the empty-history branch), public endpoint shape
Expected outcome
A real, historical, publicly-visible "how fast does gittensory turn around a review" number — the first genuine measurement of this that has ever existed in this codebase.
Part of #4445.
Context
No code anywhere computes or stores review turnaround time (webhook received → comment/verdict posted).
activeReviewTracking(src/db/schema.ts:807-823) has astartedAtfield, but it's only used to dedupe concurrent review passes on the same head SHA (src/db/repositories.ts:5091-5156) — it is never diffed against a completion timestamp. The only latency field that exists at all,productUsageEvents.latencyMs(src/db/schema.ts:1298), measures UI/API surface latency, not review processing time.This is distinct from two adjacent, already-tracked things:
gittensory_ai_provider_request_duration_secondshistogram for individual AI-provider call latency (embed/vision requests) — internal Prometheus/Grafana ops metric, not this issue's public end-to-end number. Reuse its histogram data as an input where useful; don't duplicate the exporter/Grafana work.reviewVelocityPerDay(src/services/queue-trends.ts:100) — PR resolution throughput (merged+closed / day), not per-review turnaround time. Different metric.Requirements
activeReviewTrackingclaim, or the webhook-received timestamp already available in the processing pipeline) and stop it whengithub_app.pr_public_surface_publishedfires (the existing audit event already recorded per completed review,src/queue/processors.ts— same site that already writesreviewEffortMinutes, seeprocessors.ts:9031).reviewEffortMinutes-in-audit-metadata precedent for the raw per-review number).*/30cron already used forpr_handling_statsper feat(stats): public proof-of-power — lifetime PRs-handled + accuracy counter on homepage hero #1059).GET /v1/public/stats(src/review/public-stats.ts:179-346,src/api/routes.ts:949-957) with the new rollup — reuse the existingtotals/weekly/byProjectresponse shape rather than inventing a new one. Regenerate OpenAPI (npm run ui:openapi).apps/gittensory-ui/src/components/site/proof-of-power-stats.tsx) or a/statsdetail page — a p50/p95-over-time chart, not just a single current number.Deliverables
pr_public_surface_published), persistedGET /v1/public/statsextended with the new trend data; OpenAPI regenerated/statspage shows a review-speed trend, with an honest empty/insufficient-history stateExpected outcome
A real, historical, publicly-visible "how fast does gittensory turn around a review" number — the first genuine measurement of this that has ever existed in this codebase.
References
src/db/schema.ts:807-823(activeReviewTracking, existingstartedAt— reuse, don't duplicate)src/db/repositories.ts:5091-5156(existing concurrency-dedup use ofstartedAt)src/queue/processors.ts:9031(existingreviewEffortMinutesaudit-metadata precedent)src/review/public-stats.ts:179-346,src/api/routes.ts:949-957(existing public stats endpoint to extend)apps/gittensory-ui/src/components/site/proof-of-power-stats.tsx(existing homepage widget)src/services/queue-trends.ts:18,100(reviewVelocityPerDay— related but distinct metric, cite for context)Effort
M