Stay updated — Join the build list for tutorials and AI insights. No spam.

Impact Analysis

Assess the impact of changes before refactoring — find dependents, trace ripple effects, and plan safe modifications.

Impact Analysis

Assess the impact of changes before you make them — find all dependents, trace ripple effects, and plan safe refactoring.

🎯 The Core Question

“If I change X, what breaks?”

Graphify answers this by finding all nodes that depend on X, directly or transitively.


🔍 Finding Direct Dependents

What Depends on This File?

1graphify query "what depends on scripts/dictionary/yt-to-content-v2.py?"
2graphify query "what depends on tasks/content.yaml?"
3graphify query "what depends on data/course/meta/providers-ags-storytelling.yaml?"

What Calls This Function?

1graphify query "what calls mergeParams?"
2graphify query "what calls the vocabulary extraction function?"

What Imports This Module?

1graphify query "what imports scripts/dictionary/extract_vocab.py?"

🌊 Tracing Transitive Dependents (Ripple Effects)

Full Dependency Chain

1# Find ALL transitive dependents (not just direct)
2graphify query "show the full dependency tree for scripts/dictionary/yt-to-content-v2.py"

Path to Each Dependent

1# For each dependent, trace the path
2graphify path scripts/dictionary/yt-to-content-v2.py tasks/content.yaml
3graphify path scripts/dictionary/yt-to-content-v2.py content/courses/ags/storytelling/j-wiebe/youtube-content/articulate-your-thoughts/index.md
4graphify path scripts/dictionary/yt-to-content-v2.py .github/skills/youtube-content/SKILL.md

📋 Pre-Refactoring Checklist

Before Changing a File

 1# 1. Signal activity
 2mkdir -p graphify-out && touch graphify-out/.graphify-activity
 3
 4# 2. Find direct dependents
 5graphify query "what depends on path/to/file.py?"
 6
 7# 3. Find function-level dependents
 8graphify query "what calls functionName in path/to/file.py?"
 9
10# 4. Trace to each dependent
11graphify path path/to/file.py dependent1
12graphify path path/to/file.py dependent2
13
14# 5. Assess risk
15# - How many dependents?
16# - How critical are they?
17# - Are tests covering them?

Before Changing a Function Signature

1# 1. Find all callers
2graphify query "what calls functionName?"
3
4# 2. For each caller, trace the call chain
5graphify path path/to/file.py caller1
6graphify path path/to/file.py caller2
7
8# 3. Check if callers are in tests
9graphify query "which callers of functionName are in test files?"

Before Deleting a File

1# 1. Comprehensive dependent check
2graphify query "what depends on path/to/file.py?"
3
4# 2. Check if it's an entry point
5graphify query "is path/to/file.py an entry point or imported by tasks?"
6
7# 3. Verify no dynamic imports
8grep -r "import.*path/to/file" . --include="*.py" --include="*.js" --include="*.ts"

🎯 Real-World Examples

Example 1: Changing the YouTube Content Script

Scenario: Modify scripts/dictionary/yt-to-content-v2.py to add a new CLI flag.

 1# 1. What depends on it?
 2graphify query "what depends on scripts/dictionary/yt-to-content-v2.py?"
 3
 4# Expected: tasks/content.yaml (yt:content task), any wrapper scripts
 5
 6# 2. Trace to task
 7graphify path scripts/dictionary/yt-to-content-v2.py tasks/content.yaml
 8
 9# 3. Check if flag parsing needs update
10graphify explain scripts/dictionary/yt-to-content-v2.py | grep -A 10 "argparse"
11
12# 4. Risk: LOW - only task invokes it, flag addition is backward compatible

Example 2: Refactoring Vocabulary Extraction

Scenario: Change the output format of scripts/dictionary/extract_vocab.py.

1# 1. What consumes the output?
2graphify query "what reads data/dictionary/*/vocabulary.yaml?"
3
4# 2. Trace from script to consumers
5graphify path scripts/dictionary/extract_vocab.py data/dictionary/capitalism/vocabulary.yaml
6graphify path data/dictionary/capitalism/vocabulary.yaml content/docs/dictionary/capitalism/index.md
7
8# 3. Risk: MEDIUM - Hugo pages consume YAML, need to update both

Example 3: Modifying Task Configuration

Scenario: Change variable names in tasks/content.yaml.

1# 1. What reads these variables?
2graphify query "what reads tasks/content.yaml?"
3
4# 2. Trace to scripts
5graphify path tasks/content.yaml scripts/dictionary/yt-to-content-v2.py
6graphify path tasks/content.yaml scripts/dictionary/yt-shorts-prompts.py
7
8# 3. Risk: HIGH - multiple scripts depend on task variables

📊 Impact Assessment Matrix

FactorLow RiskMedium RiskHigh Risk
Dependent count0-12-56+
Dependent criticalityInternal scriptsContent generatorsBuild/tasks, public APIs
Change typeAdditive (new flag)Behavioral (logic change)Breaking (signature, format)
Test coverageHighPartialNone
Rollback easeTrivialManualComplex

🛡️ Mitigation Strategies

For High-Risk Changes

  1. Create a branch — Isolate the change
  2. Add tests first — Cover dependents before changing
  3. Use feature flags — Gradual rollout
  4. Run full validation — task validate after change
  5. Rebuild graph — graphify update . to verify new structure

For Breaking Changes

 1# 1. Document current behavior
 2graphify query "describe the current behavior of X" > before.md
 3
 4# 2. Make change
 5
 6# 3. Rebuild and verify
 7graphify update . --code-only
 8graphify query "describe the new behavior of X" > after.md
 9
10# 4. Compare
11diff before.md after.md

🔄 CI/CD Integration

 1# .github/workflows/impact-analysis.yml
 2name: Impact Analysis
 3on:
 4  pull_request:
 5    paths:
 6      - 'scripts/**'
 7      - 'tasks/**'
 8      - 'data/course/meta/**'
 9
10jobs:
11  impact:
12    runs-on: ubuntu-latest
13    steps:
14      - uses: actions/checkout@v4
15      - name: Install Graphify
16        run: uv tool install graphifyy && graphify install
17      - name: Build graph
18        run: graphify . --code-only
19      - name: Check dependents
20        run: |
21          for file in ${{ github.event.pull_request.changed_files }}; do
22            echo "Checking dependents of $file"
23            graphify query "what depends on $file?"
24          done

Next Steps