Skip to content

feat(repo): add Median Time to Review stat to Repository Stats tile#1292

Merged
e35ventura merged 1 commit into
entrius:testfrom
Khaostica:feat/repo-stats-median-time-to-review
May 28, 2026
Merged

feat(repo): add Median Time to Review stat to Repository Stats tile#1292
e35ventura merged 1 commit into
entrius:testfrom
Khaostica:feat/repo-stats-median-time-to-review

Conversation

@Khaostica
Copy link
Copy Markdown
Contributor

@Khaostica Khaostica commented May 28, 2026

Summary

Adds a Median Time to Review row to the Repository Stats tile in the Repo Check sidebar, giving contributors a quick read on how responsive a repo's maintainers are to outside contributions before they invest effort there.

The metric is computed entirely from existing public API data:

  • Primary signal — time to first maintainer review: for the most recent non-maintainer PRs in the repo (capped at 30), it finds the first comment from a maintainer (matched by maintainer login or OWNER/MEMBER/COLLABORATOR author association) and measures the time from PR open to that comment, then takes the median. Comments are fetched in parallel via a new bounded usePullRequestCommentsBatch hook whose cache keys match the existing single-PR comments hook, so results are shared and reused.
  • Fallback — time to merge: where review-comment data isn't available, it falls back to the median time from PR open to merge over merged non-maintainer PRs (derived from the already-loaded /prs data, no extra requests). This keeps the stat meaningful across repos rather than showing a blank.
  • Renders when there is genuinely nothing to measure (no maintainer comments and no merged outside PRs).

Maintainer-authored PRs are excluded from both computations so the number reflects turnaround on external contributions.

Related Issues

None

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Screenshots

Before:
TTR - Before

After:
TTR - After

Checklist

  • New components are modularized/separated where sensible
  • Uses predefined theme (e.g. no hardcoded colors)
  • Responsive/mobile checked
  • Tested against the test API
  • `npm run format` and `npm run lint:fix` have been run
  • `npm run build` passes
  • Screenshots included for any UI/visual changes

Adds a "Median Time to Review" row to the Repository Stats tile that
measures how quickly maintainers engage with outside contributions.

It prefers the true signal — the median time from PR open to the first
maintainer comment over recent non-maintainer PRs (bounded fan-out via a
new parallel comments hook) — and falls back to median time-to-merge for
repos where review-comment data isn't available, so the stat stays useful
across repos.
@xiao-xiao-mao xiao-xiao-mao Bot added the enhancement New feature or request label May 28, 2026
@Khaostica Khaostica marked this pull request as ready for review May 28, 2026 18:05
@ventura-oss
Copy link
Copy Markdown
Contributor

Merged — thanks! We'd love to expand the per-repo stats in this direction; more features and metrics like this are very welcome.

Copy link
Copy Markdown
Contributor

@ventura-oss ventura-oss left a comment

Choose a reason for hiding this comment

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

Approving to merge — clean, focused addition that reuses existing hooks and theme tokens.

@e35ventura e35ventura merged commit 926c9ee into entrius:test May 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants