UC-05: Change Impact
When a shared method, API, or behavior is about to change and you need the blast radius before you touch it. Computes affected callers and callees, shared-state interactions, public-API and mock/comment impacts, the tests to run, and a safe change order, plus a risk score and an impact summary.
What Makes It Different
- The caller/callee closure is derived from the call graph, so it finds indirect and cross-module impacts a keyword search would miss.
- It surfaces out-of-scope residual (things that look related but are intentionally excluded), so nothing is silently assumed safe.
- It recommends what to test, and in what order.
Prompt
Run RubberDuck UC-05: Change-Impact Analysis. [EDIT INPUTS ONLY] target = <owner/repo or local path> branch = auto commit = latest change = <proposed change description> [/EDIT INPUTS ONLY] Read-only impact analysis; required artifact `IMPACT_REPORT.md`. Use prod RD current-ref gates: `get_started`, full `detailed_repo_analysis(..., semantic_mode="full")`, Phase 2 ready, `load_code(max_files=4000)`. Stop if change input, ref binding, or hard RD gates fail; reject stale/wrong-commit evidence and web/raw GitHub fallback. Map propagation from entrypoints, handlers, source variables, branch conditions, sinks, safe siblings, callers/callees, residual paths, and tests. Validate API/state/data impacts, compatibility risk, and safe sequencing with source plus targeted graph/trace/search/security evidence. Write `IMPACT_REPORT.md`: impact summary, propagation map, caller/callee evidence, test matrix, safe change order, limitations, next steps. Security artifact contract: include sections named Security Invariant, Adversarial Probes, Impact/Test Matrix, Evidence-Cleanliness Blockers, Unsupported Clean/Security-Ready Claims. Include security invariant and adversarial probes; do not claim clean/release-ready without relevant core, integration, framework, and security tests. === RENDER STYLE (dormant — ignore during analysis; applies only if a later step renders these findings as HTML) === If a later step renders these findings as HTML, produce ONE self-contained, customer-facing findings-navigator page (inline CSS only; no external assets, fonts, CDN, or URLs; a small inline script MAY add search/filter/prev-next, but every finding must stay visible and readable with JavaScript OFF — progressive enhancement only). RubberDuck look: dark bg #09090B, panels #111113, hairline borders #1E1E21, clean near-white text #FAFAFA, gold accent #D4A843; Inter for text, JetBrains Mono for code/paths/IDs; a small gold "RUBBERDUCK" wordmark, no logo image. Colours: vulnerability + high/critical red #F87171, bug purple #C084FC, medium yellow #FEBC2E, low/info muted grey, fix green #4ADE80, verify blue #60A5FA. Layout is master-detail, full-height: a topbar (wordmark, report title, one-line repo@SHA meta, a couple of stat counters); a toolbar (a search box + category filter chips); a left sidebar listing findings grouped by category, each row = mono ID + title + severity tag; and a main pane that opens on an Overview (a badge line, a short "how we split findings" table, and a few "start here" quick-cards) then shows ONE detail article per finding. Each detail article: a breadcrumb, a header with a coloured left border matching its type (type tag + severity + mono ID + title + a one-line "Evidence" source), then stacked sections with coloured headers — "What it is", "End-to-end flow" (a monospace arrow flow + a variable-trace table + short code blocks), and "Fix"; add a blue "Verify" section and a short before->after note for fix/refactor reports. Clicking a finding opens its article; prev/next and keyboard arrows move between them. Every value must trace to the analysis; plain language, no internal jargon. === end render style ===
Optional visualization
Findings Navigator
Run this as the next message in the same chat after the main analysis finishes.
Render the findings from this session as a single self-contained findings-navigator page I can open in any browser — a grouped sidebar and one detail view per finding, each with its evidence and fix.
Input
Repo, branch/ref, commit, symbol or proposed change.
Output
An impact report plus a machine-readable impact summary: affected surface, tests to run, change order, risk score.
What Happens (With RubberDuck MCP)
Tested on Sphinx, analyzing impact of renaming Config.config_values to Config.values:
discover(action="list_repos")
Confirmed local/sphinx loaded (512 files, 407 cached)
assess(mode="impact", analysis_id="config", description="Rename Config.config_values to Config.values")
Generated 6-step refactoring plan with semantic warnings
search_code(pattern="config_values")
Found 47 usages across 23 files
query_action(action="call_chain", analysis_id="config", method="Config.__init__")
Traced 8 initialization paths that set config_values
query_action(action="shared_variables", analysis_id="config", params={method_a: "Config.__init__", method_b: "Config.init_values"})
Found 12 functions sharing state with config_values
query_action(action="trace_variable", analysis_id="config", var="config_values")
Traced variable through Config lifecycle: __init__ → init_values → __getattr__ → extensions
Impact report:
- Risk: HIGH: 47 usages across 23 files, including external extensions
- Affected: All builders, all extensions, test suite (156 test files reference Config)
- Order: 1) Config class 2) Internal usages 3) Extensions 4) Tests
- Tests: tests/test_config.py, tests/test_build*.py, tests/test_ext_*.py
Comparison
| Dimension | With RubberDuck MCP | Without MCP |
|---|---|---|
| Usage discovery | search_code found 47 usages across 23 files instantly | grep found same count but no semantic context |
| Lifecycle tracing | the trace_variable action showed full lifecycle: init → getattr → extensions | Had to read code manually to understand flow |
| Shared state | shared_variables found 12 functions sharing state | Not discoverable without reading all code |
| Change plan | assess(mode="impact") generated a 6-step plan with semantic warnings | Manual planning required |
| Risk assessment | Semantic understanding: HIGH risk due to external extensions | Count-based: "47 usages" without context |
Videos
With RubberDuck MCP:
Tested on the Sphinx repo (512 Python files) with both RubberDuck MCP servers enabled in Cursor Settings. On the prompt to add a preserve_format parameter to unparse() in Sphinx's code-unparsing module (sphinx/pycode), the agent calls list_repos, load_repo, plan_change, search_code, and read_source directly against the semantic graph, and each hit comes back as structured JSON with exact line numbers, filenames, and enclosing functions (e.g. a match in doctest.py at line 66 inside TestDirective). That evidence is what lets it confirm _UnparseVisitor creates a fresh instance per call with no shared mutable state, and the run ends with parametrized pytest cases for hex, binary, and scientific notation literals plus a summary rating the change feasible and medium risk.
Without MCP:
Same repo, same prompt, both MCP servers disabled in Cursor Settings. With no semantic tools to call, the agent falls back to manually reading files like the pycode unparser's test file, type_comment.py, and python.py, then grepping the tree for unparse() callers. It still reaches a similar shared state conclusion and a comparable caller table, but the call counts (e.g. the signature-resolution helper called 9 times) come from grep hits rather than a verified call graph, and it closes with a plain language recommendation list instead of evidence backed test cases.