Skip to content

feat(repo-stats): count self-reviews and bot reviews separately - #9

Merged
g-husam merged 2 commits into
mainfrom
repo-stats-self-reviews
Oct 29, 2026
Merged

g-husam merged 2 commits into
mainfrom
repo-stats-self-reviews

Conversation

@g-husam

@g-husam g-husam commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

What

Reviews from the PR author's own account and from bot accounts used to be dropped entirely. This counts them and labels every merged PR with the strongest review it got:

Status Meaning Color
Reviewed (by others) a review from a person other than the author blue
Reviewed (self) only from the author's own account green
Reviewed (bot) only from bot accounts purple
Unreviewed nothing before merge red

How self-reviews are identified

Neither GitHub nor GitLab says whether a review was written by a person or an agent, only which account posted it. So:

  • self: the reviewer login equals the PR author login. This covers reviewing your own PR and agents that post with your credentials (for example gh or an MCP server using your token).
  • bot: a bot account that is not the author (a GitHub App, or a login ending in [bot] or -bot), for example gemini-code-assist or Copilot.
  • others: everyone else.

Grouping into cycles

Self and bot cycles use the same per-version rule as the existing review_cycles. On GitHub each review names the head commit it was made against; on GitLab "added N commits" notes mark pushes. So a batched review, a run of single inline comments, replies, and several reviews of one version all count as one cycle.

Changes

  • repo_stats.py: reviewer_kind, review_status; new review_status, self_review_cycles and bot_review_cycles fields on records and in the CSV.
  • Dashboard (Review cycles section): the cycles histogram splits 0-cycle PRs into self / bot / unreviewed; "Review status by month" stacks all four statuses; new "Review cycles by reviewer" chart; stats rows for self and bot cycles; status breakdown in the "Merged without review" KPI; methodology text.
  • Unchanged on purpose: review_cycles, reviewers, pickup and review time, and the unreviewed risk factor still use reviews by others only. The risk detail now says "(self-review only)" or "(bot review only)".
  • README updated.

Testing

  • python3 -m unittest discover -s tests: 246 tests, OK (the browser test was skipped locally because Playwright isn't installed; CI runs it).
  • New tests: GitHub status precedence, self and bot cycles grouped by version, GitLab author notes, self-approvals and bot notes split by pushes, the risk detail, and an end-to-end check. The UI dataset now includes self-only and bot-only PRs.

Reviews from the PR author's own account (including agents acting with the
author's credentials) and from bot accounts used to be dropped. They are now
classified and counted:

- review_status per merged PR: others > self > bot > none, colored
  separately on the dashboard (Reviewed (by others) / (self) / (bot) /
  Unreviewed).
- self_review_cycles and bot_review_cycles, using the same per-version rule
  as review_cycles, so a batched review, a run of single comments, replies
  and several reviews of one version count as one cycle.
- New "Review cycles by reviewer" chart, a status breakdown in the KPI, the
  stats table and the monthly chart, plus CSV columns.

review_cycles, reviewers, pickup and review time and the unreviewed risk
factor still use reviews by others only; the risk detail now says when a PR
had only a self or bot review.
Lines of code keep the whole history so totals stay correct, which made the
header and the 'All time' range start at the first commit even with --since.
Record the window in meta and clamp the dashboard's range to it.
@g-husam
g-husam marked this pull request as ready for review October 29, 2026 21:25
@g-husam
g-husam merged commit ae81129 into main Oct 29, 2026
2 checks passed
@g-husam
g-husam deleted the repo-stats-self-reviews branch October 29, 2026 21:25
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.

1 participant