Impact Analysis Before Committing
Understand the full scope of your changes before committing code
Use impact detection to understand what your changes affect before committing them.
Scenario
Before committing code, you want to:
- See what symbols changed
- Understand which processes are affected
- Identify unexpected impacts
- Plan testing strategy
Tools & Resources
- Impact Detection - Analyze changes
- Process Trace - Understand affected processes
- Cypher Query - Investigate details
Impact Analysis Workflow
Step 1: Check Unstaged Changes
Before staging:
{
"repository": "my-app",
"change_scope": "unstaged"
}Review:
- Which files changed
- Which symbols modified
- Direct impacts
Step 2: Analyze Affected Processes
For each affected process:
GET map://my-app/process/{process-id}Understand:
- What the process does
- How your changes affect it
- Which tests to run
Step 3: Check for Unexpected Impacts
Look for potentially_affected symbols:
{
"affected_symbols": [
{
"symbol_name": "unexpectedFunction",
"change_type": "potentially_affected"
}
]
}These call or are called by your changes.
Step 4: Review Cross-Community Impacts
If process_type is cross_community:
GET map://my-appCheck cross-flows to understand wider impact.
Step 5: Verify with Queries
For critical changes, verify dependencies:
MATCH (caller:CODE_SYMBOL)-[:CALLS]->(changed:CODE_SYMBOL {name: "yourChangedFunction"})
RETURN caller.name, caller.file_pathStep 6: Stage and Re-Check
After staging:
{
"repository": "my-app",
"change_scope": "staged"
}Verify everything looks correct.
Example Walkthrough
Scenario: Changing API Response Format
You modified getUserData to return additional fields.
Step 1: Initial Impact Check
{
"repository": "api-server",
"change_scope": "unstaged"
}Response shows:
getUserDatamodifiedUserControllerprocess affectedformatUserResponsepotentially affected
Step 2: Investigate Affected Process
GET map://api-server/process/UserControllerProcess shows:
- Calls
getUserData - Calls
formatUserResponse - Returns to API endpoints
Step 3: Find All Callers
MATCH (caller:CODE_SYMBOL)-[:CALLS]->(f:CODE_SYMBOL {name: "getUserData"})
RETURN caller.name, caller.file_pathResults:
handleGetUserinroutes/users.tsgetUserProfileincontrollers/profile.tsexportUserDatainservices/export.ts
Step 4: Check Each Caller
For each caller, verify it handles new fields:
- Read the code
- Check if new fields break anything
- Update if necessary
Step 5: Plan Testing
Based on affected processes:
- Test
UserControllerflow - Test all 3 callers
- Integration test for API endpoints
Step 6: Final Verification
{
"repository": "api-server",
"change_scope": "staged",
"include_content": true
}Review symbol content to confirm changes.
Impact Analysis Patterns
Pattern 1: Pre-Commit Checklist
async function preCommitCheck(repo: string) {
// 1. Check unstaged
const unstaged = await detectImpact({
repository: repo,
change_scope: "unstaged"
});
console.log(`Modified: ${unstaged.changed_files.length} files`);
console.log(`Affected: ${unstaged.total_processes} processes`);
// 2. Review cross-community impacts
const crossCommunity = unstaged.affected_processes
.filter(p => p.process_type === "cross_community");
if (crossCommunity.length > 0) {
console.warn("Cross-community impacts detected!");
for (const proc of crossCommunity) {
console.log(`- ${proc.process_label}`);
}
}
// 3. Check for high-impact symbols
const highImpact = unstaged.affected_processes
.flatMap(p => p.affected_symbols)
.filter(s => s.centrality > 0.8);
if (highImpact.length > 0) {
console.warn("High-impact symbols affected!");
}
return {
safeToCommit: crossCommunity.length === 0 && highImpact.length === 0,
warnings: {
crossCommunity: crossCommunity.length,
highImpact: highImpact.length
}
};
}Pattern 2: Find Breaking Changes
async function findBreakingChanges(repo: string) {
const impact = await detectImpact({
repository: repo,
change_scope: "staged",
include_content: true
});
// Check for public API changes
const publicAPIs = impact.affected_processes
.flatMap(p => p.affected_symbols)
.filter(s =>
s.file_path.includes('/api/') ||
s.file_path.includes('/public/')
);
if (publicAPIs.length > 0) {
console.warn("Public API changes detected:");
for (const api of publicAPIs) {
console.log(`- ${api.symbol_name} in ${api.file_path}`);
}
}
return publicAPIs;
}Pattern 3: Generate Test Plan
async function generateTestPlan(repo: string) {
const impact = await detectImpact({
repository: repo,
change_scope: "all"
});
const testPlan = {
unit_tests: [],
integration_tests: [],
e2e_tests: []
};
// Unit tests for modified symbols
for (const file of impact.changed_files) {
testPlan.unit_tests.push(...file.affected_symbols);
}
// Integration tests for affected processes
for (const proc of impact.affected_processes) {
testPlan.integration_tests.push(proc.process_label);
}
// E2E tests for cross-community impacts
const crossCommunity = impact.affected_processes
.filter(p => p.process_type === "cross_community");
testPlan.e2e_tests = crossCommunity.map(p => p.process_label);
return testPlan;
}Tips
Before Staging
- Check unstaged - Review before committing to staging
- Look for surprises - Unexpected impacts need investigation
- Understand processes - Know what flows you're affecting
- Query dependencies - Verify critical relationships
After Staging
- Re-check staged - Verify final impact
- Include content - Review symbol signatures if unsure
- Compare with base - Check against target branch
- Plan tests - Know what to test before pushing
For Large Changes
- Use pagination - Don't overwhelm yourself
- Focus on high-impact - Prioritize critical symbols
- Check cross-community - These have wider impact
- Iterate - Review in chunks
Common Scenarios
API Changes
{
"change_scope": "staged",
"include_content": true
}Look for potentially_affected symbols in other services.
Database Schema Changes
Check all data access code:
MATCH (s:CODE_SYMBOL)
WHERE s.name CONTAINS "query"
OR s.name CONTAINS "database"
OR s.name CONTAINS "repository"
RETURN s.name, s.file_pathAuthentication Changes
Verify all auth-dependent code:
{
"change_scope": "all",
"max_processes": 100
}Check for cross-community auth flows.
Related
- Impact Detection Tool - Detect changes
- Process Trace - Understand processes
- Cypher Query - Verify dependencies
- Refactoring - Safe refactoring