Impact
impact
Change impact analysis — who is affected when you modify a symbol.
Composes callers, graph, and search into a single
"what breaks if I change X?" answer.
Example
from axm_ast.core.impact import analyze_impact result = analyze_impact(Path("src/axm_ast"), "analyze_package") print(result["score"]) 'HIGH'
analyze_impact(path, symbol, *, project_root=None, exclude_tests=False)
Full impact analysis for a symbol.
Combines definition location, callers, re-exports, tests, and an impact score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to the package directory. |
required |
symbol
|
str
|
Name of the symbol to analyze. |
required |
project_root
|
Path | None
|
Project root (for test detection). |
None
|
exclude_tests
|
bool
|
If True, filter test callers and test type_refs from the output. The impact score is still computed on the full (unfiltered) caller set. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Complete impact analysis dict. |
Example
result = analyze_impact(Path("src/axm_ast"), "analyze_package") result["score"] 'HIGH'
Source code in packages/axm-ast/src/axm_ast/core/impact.py
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | |
analyze_impact_workspace(ws_path, symbol, *, exclude_tests=False)
Full impact analysis for a symbol across a workspace.
Searches all packages for definition, callers, re-exports, and test files. Module names include package prefix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ws_path
|
Path
|
Path to workspace root. |
required |
symbol
|
str
|
Name of the symbol to analyze. |
required |
exclude_tests
|
bool
|
If True, filter test callers from the output. Score is computed on the full caller set. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Complete impact analysis dict (workspace-scoped). |
Example
result = analyze_impact_workspace(Path("/ws"), "ToolResult") result["score"] 'HIGH'
Source code in packages/axm-ast/src/axm_ast/core/impact.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | |
find_definition(pkg, symbol)
Locate where a symbol is defined.
Supports dotted paths like ClassName.method to find
methods within class bodies. For deeply nested paths like
Outer.Inner.method, resolution is best-effort.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pkg
|
PackageInfo
|
Analyzed package info. |
required |
symbol
|
str
|
Name of the function/class to find. May be
dotted (e.g. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
Dict with module, line, kind — or None if not found. |
Source code in packages/axm-ast/src/axm_ast/core/impact.py
find_reexports(pkg, symbol)
Find modules that re-export a symbol via all or imports.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pkg
|
PackageInfo
|
Analyzed package info. |
required |
symbol
|
str
|
Name to search for in exports. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of module names that re-export the symbol. |
Source code in packages/axm-ast/src/axm_ast/core/impact.py
find_type_refs(pkg, type_name)
Find functions that reference a type in their signatures.
Scans all function parameters, return types, and module-level variable annotations for occurrences of type_name using word-boundary matching.
Handles compound types: list[X], dict[str, X],
X | None, Optional[X], nested generics, and
string annotations ("X").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pkg
|
PackageInfo
|
Analyzed package info. |
required |
type_name
|
str
|
Exact type name to search for (e.g. |
required |
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
List of dicts with |
list[dict[str, Any]]
|
and |
Source code in packages/axm-ast/src/axm_ast/core/impact.py
map_tests(symbol, project_root)
Find test files that reference a given symbol.
Scans tests/ directory for test_*.py files containing
the symbol name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
str
|
Name to search for in test files. |
required |
project_root
|
Path
|
Root of the project. |
required |
Returns:
| Type | Description |
|---|---|
list[Path]
|
List of test file paths that reference the symbol. |
Source code in packages/axm-ast/src/axm_ast/core/impact.py
score_impact(result)
Score impact as LOW, MEDIUM, or HIGH.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
dict[str, Any]
|
Dict with callers, reexports, affected_modules, and optionally git_coupled and type_refs. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Impact level string. |