feat(review): capture review turnaround duration onto the publish audit event (#4446) - #4635
Conversation
…it event (#4446) No code anywhere computed or stored review turnaround time (webhook received -> comment posted). Reuses activeReviewTracking's existing startedAt (already recorded for review-evasion protection) rather than a second clock, and persists the elapsed ms onto the SAME github_app.pr_public_surface_published audit event reviewEffortMinutes already uses -- the raw per-review number a later daily rollup job can aggregate into p50/p95 trends. First slice of #4446's deliverables (capture only); the daily rollup, public API extension, and homepage trend chart follow as separate PRs once this data exists to aggregate.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4635 +/- ##
=======================================
Coverage 94.11% 94.11%
=======================================
Files 432 432
Lines 38370 38379 +9
Branches 13989 13994 +5
=======================================
+ Hits 36113 36122 +9
Misses 1600 1600
Partials 657 657
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-10 08:54:54 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 4 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
reviewDurationMs) onto the existinggithub_app.pr_public_surface_publishedaudit event, reusing thestartedAttimestampactiveReviewTrackingalready records for review-evasion protection.getActiveReviewStartedAt(env, repoFullName, pullNumber, headSha)(src/db/repositories.ts) reads that row, matched to the exactheadShabeing published so a race with a newer pass degrades to "no duration" rather than a wrong number.reviewDurationMsSince(startedAt, nowMs)(src/queue/processors.ts) clamps the computed duration to a sane non-negative finite value — a clock-skew/future timestamp or unparseable string degrades toundefinedrather than ever reaching the public payload with a negative orNaNvalue.reviewEffortMinutesalready set at the same call site: a raw per-PR number conditionally spread into the same audit event'smetadata, to be aggregated by a rollup job later.GET /v1/public/statsextension, and homepage trend chart are deliberately deferred to follow-up PRs — this slice only lands the capture, so there's real data to aggregate once those land.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally — 100% line/branch coverage on the diff (including the future-timestamp/clock-skew and unparseable-string branches, and the.catch()fail-safe path)npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderate— 0 vulnerabilitiesSafety
reviewDurationMsfield lands in a private audit-event payload, not a public response).UI Evidencesection. — N/A, backend-only change, no visible UI.Notes
maybePublishPrPublicSurfaceis deliberately AFTERstartActiveReviewTrackingand the AI-review section both run in the same pass (confirmed viafinishPublicSurfacePublication's actual call site, not its earlier definition line).