Skip to content

docs: add PR approval waiting-time analysis#10506

Draft
basvandijk wants to merge 2 commits into
masterfrom
ai/pr-approval-waiting-time-analysis-2026-06-18
Draft

docs: add PR approval waiting-time analysis#10506
basvandijk wants to merge 2 commits into
masterfrom
ai/pr-approval-waiting-time-analysis-2026-06-18

Conversation

@basvandijk

Copy link
Copy Markdown
Collaborator

What

Adds a reproducible analysis of how long PRs in dfinity/ic wait for code-review approval, to assess whether review is a productivity bottleneck as AI makes writing code cheaper.

Everything lives under pr-approval-analysis/ — see REPORT.md for the full findings and README.md to reproduce.

Headline findings (last 12 months, 3,953 human PRs after filtering)

  • For the median PR, approval is fast: ~1.5 h to first approval, ~4.5 h to full approval. Review is not a severe bottleneck at the center of the distribution.
  • The cost is in the tail (overall full-approval p90 ≈ 5 days, p95 ≈ 8 days) and in cross-team PRs.
  • Cross-team vs same-team: full-approval median 8.3 h vs 3.4 h, p90 6.1 d vs 4.5 d. Cross-team PRs get a first look fastest (38 min) but collecting all required approvals is the drag.
  • Weekends inflate the tail; the last 6 months are slightly faster than the full year (not worsening).

Method notes

  • Data via the GitHub GraphQL API (reviews + review-request timeline events).
  • Filters out draft PRs and abandoned (stale >30d) open PRs; bots reported separately and excluded from timing.
  • Same-team vs cross-team is based on CODEOWNERS review requests, canonicalized to stable umbrella teams to account for the 61 CODEOWNERS reorganizations during the window (e.g. consensus/execution/team-dsmcore-protocol).

Notes

  • Draft, intended for sharing/discussion with colleagues.
  • Adds a new top-level dir, so it pulls in @dfinity/ic-owners-owners as a code owner.
  • See Limitations & caveats in the report (approval elapsed time is an upper bound on "lost" time, not pure idle time).

Adds a reproducible analysis of how long PRs in dfinity/ic wait for code-review approval, to assess review as a productivity bottleneck.

- Fetches all PRs from the last 12 months (reviews + review-request timeline) via the GitHub GraphQL API.
- Filters out drafts and abandoned (stale) open PRs; reports bots separately.
- Classifies PRs as same-team vs cross-team using CODEOWNERS review requests, canonicalized to stable umbrella teams to account for CODEOWNERS reorganizations over the window.
- Reports time-to-first-approval and time-to-full-approval (wall-clock and weekday-only) for 12- and 6-month windows.

See pr-approval-analysis/REPORT.md for findings and pr-approval-analysis/README.md to reproduce.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new pr-approval-analysis/ directory containing a reproducible (scripts + checked-in outputs) analysis of PR approval waiting times in dfinity/ic, split into same-team vs cross-team approval dynamics.

Changes:

  • Adds Python scripts to fetch PR/review-request data from GitHub, snapshot CODEOWNERS umbrella-team membership, derive a stable team mapping across CODEOWNERS reorganizations, and compute summary statistics.
  • Checks in the generated report (REPORT.md) plus the derived team mapping (team_mapping.json) and supporting reproduction docs (README.md, .gitignore).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pr-approval-analysis/README.md Reproduction instructions and artifact inventory for the analysis.
pr-approval-analysis/REPORT.md Generated findings (12-month and 6-month windows) and methodology/limitations.
pr-approval-analysis/analyze.py Core analysis and report rendering from fetched PR/review data.
pr-approval-analysis/fetch_prs.py GraphQL-based PR data fetcher (reviews + timeline review-request events), resumable.
pr-approval-analysis/fetch_teams.py Fetches current membership of CODEOWNERS umbrella teams via gh api.
pr-approval-analysis/build_team_mapping.py Derives fine-team → umbrella-team mapping from historical vs current CODEOWNERS resolution.
pr-approval-analysis/team_mapping.json Checked-in derived mapping used to canonicalize teams across time.
pr-approval-analysis/.gitignore Ignores fetched datasets and intermediate artifacts produced by scripts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +655 to +658
report = render(results, home, prs)
with open("report.md", "w") as f:
f.write(report)
print("\nwrote report.md")
Comment on lines +9 to +11

Writes report.md and prints a summary.
"""
Comment on lines +59 to +63
reviewDecision
reviews(first: 50) {
totalCount
nodes { state submittedAt author { login __typename } }
}
Comment on lines +159 to +160
"research": "core-protocol",
"p2p-systems-research-team": "core-protocol",
Comment on lines +163 to +165
"canister-os": "node",
"platform-operations": "dre",
"governance": "governance-team",
Comment on lines +167 to +170
"cross-chain-team": "defi",
"languages": "sdk",
"motoko": "sdk",
"utopia": "sdk",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants