Conversation
New `suggest-reviewers` command that ranks the best reviewers for changed files using a weighted combination of: - Code expertise (60%) — who knows this code best, from git history - Social proximity (30%) — who already collaborates with the PR author - Review load balance (10%) — prefer less-loaded reviewers Usage: social-graph suggest-reviewers src/social_graph/scoring.py social-graph suggest-reviewers --author pwerry src/graph/ src/models.py Auto-detects the PR author from git config. Requires a prior `build`.
There was a problem hiding this comment.
This PR has been reviewed by Unblocked Code Review
Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.
2 issues found.
About Unblocked
📖 Documentation — Learn more in our docs.
💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions about your code.
👍 Give feedback — React to comments with 👍 or 👎 to help us improve.
⚙️ Customize — Adjust settings in your preferences.
|
@unblocked I wonder if you would mind sharing your opinions about the entire codebase? |
|
Sure thing, Peter! Here are my impressions after exploring the codebase: Overall: A well-structured, focused project 👍
What I like
Things I'd consider improving
SummaryIt's a well-crafted project with good foundations — clean models, sensible algorithms, and pragmatic tooling choices. The main areas for investment would be keeping the CLI modular as commands grow, and tightening up the type contracts on the newer dictionary-based APIs. Nice work! 🎉 In reply to #11 (comment) |
- Extract login from email addresses returned by experts_for_path (strips domain and noreply prefix like '12345+user@...') - Guard against ZeroDivisionError when all expertise scores are 0.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Build an email_to_login mapping from social edges so expertise keys (email-prefix from git log) resolve to GitHub logins used by social edges. Also catch subprocess.TimeoutExpired in CLI author detection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Raw edge weights (already <= 1.0, halved for reverse edges) were systematically underweighting the proximity signal. Now normalized like expertise and load so the 60/30/10 split works as documented. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The identity-only mapping (login→login) didn't resolve email prefixes from git log to GitHub logins. Now accepts a known_users dict (built from PR data in the CLI) that maps display names and email prefixes to GitHub logins. Also resolves the auto-detected author email prefix through the same mapping. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| avg_expertise: dict[str, float] = {} | ||
| for login, total in expertise_scores.items(): | ||
| avg_expertise[login] = total / expertise_counts[login] |
There was a problem hiding this comment.
The average is computed only over the paths where a user appears (expertise_counts[login]), not over all changed_paths. This means a person who is a heavy committer on 1 of 10 changed files (but absent from the other 9) gets the same average expertise as if that single file were the only changed file — their score is never diluted by the files they don't know.
Example with changed_paths = ["a.py", "b.py", "c.py"]:
- Alice: score 10 on
a.py, absent fromb.pyandc.py→ avg = 10/1 = 10 - Bob: score 4 on each of all three files → avg = 12/3 = 4
Alice is ranked far above Bob despite Bob knowing all the changed code. The denominator should be len(changed_paths) to properly reflect breadth of expertise across the change set.
for login, total in expertise_scores.items():
avg_expertise[login] = total / len(changed_paths)
Summary
Closes #5. Adds a
suggest-reviewerscommand that recommends the best PR reviewers for a given set of changed files.The algorithm combines three signals:
Usage
Example output
Changes
src/social_graph/graph/reviewers.py— recommendation algorithmsrc/social_graph/cli.py—suggest-reviewersCLI commandtests/test_reviewers.py— 8 tests covering ranking, author exclusion, expertise/proximity weighting, edge casesTest plan
ruff checkcleansocial-graph suggest-reviewers --repo-path ~/Developer/unblocked src/