noodlbox

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 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-app

Check 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_path

Step 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:

  • getUserData modified
  • UserController process affected
  • formatUserResponse potentially affected

Step 2: Investigate Affected Process

GET map://api-server/process/UserController

Process 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_path

Results:

  • handleGetUser in routes/users.ts
  • getUserProfile in controllers/profile.ts
  • exportUserData in services/export.ts

Step 4: Check Each Caller

For each caller, verify it handles new fields:

  1. Read the code
  2. Check if new fields break anything
  3. Update if necessary

Step 5: Plan Testing

Based on affected processes:

  • Test UserController flow
  • 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

  1. Check unstaged - Review before committing to staging
  2. Look for surprises - Unexpected impacts need investigation
  3. Understand processes - Know what flows you're affecting
  4. Query dependencies - Verify critical relationships

After Staging

  1. Re-check staged - Verify final impact
  2. Include content - Review symbol signatures if unsure
  3. Compare with base - Check against target branch
  4. Plan tests - Know what to test before pushing

For Large Changes

  1. Use pagination - Don't overwhelm yourself
  2. Focus on high-impact - Prioritize critical symbols
  3. Check cross-community - These have wider impact
  4. 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_path

Authentication Changes

Verify all auth-dependent code:

{
  "change_scope": "all",
  "max_processes": 100
}

Check for cross-community auth flows.

On this page