Code Review
Review PRs for quality, safety, and impact
Review PRs for quality, safety, and impact using impact detection and graph analysis.
Quick Start
"Review this PR comparing my branch to main"
"What's the blast radius of changes on this branch?"
"Which communities are affected by this PR?"
When to Use
Use this workflow when:
- Reviewing pull requests
- Assessing merge risk
- Checking for unintended side effects
- Verifying test coverage
Code Review Workflow
Run Impact Detection
Compare the PR branch against the base:
"Check the impact comparing this branch to main"
Uses: noodlbox_detect_impact tool with:
change_scope: "compare"base_ref: "main"(or target branch)
This returns:
changed_symbols: What was directly modifiedpotentially_affected: Code that depends on changesaffected_documents: Docs that may need updating
Check Cross-Community Impact
Look for changes that affect multiple modules:
"Which communities are affected by these changes?"
Review the communities_impacted in the impact detection results.
Red flags:
- Changes affecting 3+ communities
- High-cohesion communities being modified
- Changes to shared utilities or core modules
Identify High-Centrality Changes
Check if important symbols are being modified:
"Are any central functions being changed?"
Look for:
- Functions with many callers
- Core utilities
- Public APIs
MATCH (caller)-[:CALLS]->(target:Symbol)
WHERE target.name IN ["changedFunction1", "changedFunction2"]
RETURN target.name, count(caller) as caller_count
ORDER BY caller_count DESCVerify Test Coverage
Check that impacted processes have test coverage:
"Do the affected processes have tests?"
Review the affected_processes and verify each has corresponding tests.
Review Affected Documentation
Check affected_documents from impact detection:
"What docs need updating based on these changes?"
Uses: noodlbox_search_documents tool
Flag any documentation that references changed code.
Document Coordination Needs
If multiple communities are affected:
- Note which teams need to be informed
- Identify integration points that need verification
- Document any breaking changes
Code Review Checklist
- Run impact detection (
change_scope: "compare",base_ref: target_branch) - Check cross-community impact
- Verify test coverage for impacted areas
- Review affected_documents for outdated docs
- Flag high-centrality changes (many callers)
- Document coordination needs if multiple teams affected
Risk Matrix for PR Review
| Impact | Callers | Risk | Action |
|---|---|---|---|
| Single community | < 10 | Low | Standard review |
| Single community | 10-50 | Medium | Verify tests pass |
| Multiple communities | Any | High | Request additional reviewers |
| Core/shared code | > 50 | Critical | Require senior review |
Example: Review a Feature PR
PR: Add email notification preferences
Run Impact Detection
"Check the impact comparing feature/email-prefs to main"
Results:
- 8 changed symbols
- 23 potentially affected
- 2 communities impacted (Notifications, UserSettings)
Assess Risk
- Two communities affected (medium risk)
- Changes to NotificationService (check caller count)
MATCH (caller)-[:CALLS]->(target:Symbol {name: "NotificationService"})
RETURN count(caller) as caller_countResult: 15 callers (medium risk)
Verify Coverage
Check that notification and settings tests exist and pass.
Review Decision
- Risk: Medium
- Requires: Standard review + verify tests
- No additional reviewers needed
Example: Review a Refactoring PR
PR: Split DataService into domain-specific services
Identify High-Risk Changes
MATCH (caller)-[:CALLS]->(target:Symbol)
WHERE target.file_path CONTAINS "DataService"
RETURN target.name, count(caller) as caller_count
ORDER BY caller_count DESC
LIMIT 10Flag the top callers for extra scrutiny.
Check for Breaking Changes
Look for:
- Changed method signatures
- Removed exports
- New required parameters
Review Decision
- Risk: High (5 communities, 120+ affected)
- Requires: Senior review
- Action: Break into smaller PRs if possible
Useful Queries for Code Review
Find All Callers of Changed Functions
MATCH (caller)-[:CALLS]->(target:Symbol)
WHERE target.name IN $changedFunctions
RETURN target.name, collect(caller.name) as callersCheck for Orphaned Code
MATCH (sym:Symbol)
WHERE sym.file_path CONTAINS $removedFile
AND NOT (sym)<-[:CALLS]-()
AND sym.kind = "function"
RETURN sym.name as potentially_dead_codeVerify Test File Exists
MATCH (test:Symbol)
WHERE test.file_path CONTAINS "test" OR test.file_path CONTAINS "spec"
AND test.name CONTAINS $changedFunctionName
RETURN test.file_pathTools Reference
| Purpose | Tool |
|---|---|
| Compare branches | noodlbox_detect_impact with change_scope: "compare" |
| Find affected docs | noodlbox_search_documents |
| Understand context | noodlbox_query_with_context |
| Query relationships | noodlbox_raw_cypher_query |