Skip to content

Impact

impact

ImpactTool — change impact analysis.

ImpactTool

Bases: AXMTool

Analyze blast radius of changing a symbol.

Registered as ast_impact via axm.tools entry point. Workspace-aware: if path is a uv workspace root, analyzes impact across all member packages.

Source code in packages/axm-ast/src/axm_ast/tools/impact.py
Python
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
class ImpactTool(AXMTool):
    """Analyze blast radius of changing a symbol.

    Registered as ``ast_impact`` via axm.tools entry point.
    Workspace-aware: if path is a uv workspace root, analyzes
    impact across all member packages.
    """

    @property
    def name(self) -> str:
        """Return tool name for registry lookup."""
        return "ast_impact"

    @safe_execute
    def execute(  # noqa: PLR0913 - opt-in module-importers toggle joins the existing option surface
        self,
        *,
        path: str = ".",
        symbol: str | None = None,
        symbols: list[str] | None = None,
        exclude_tests: bool = False,
        detail: str | None = None,
        include_module_importers: bool = False,
        precise_callers: bool = False,
        **kwargs: object,
    ) -> ToolResult:
        """Analyze change impact for a symbol.

        Args:
            path: Path to package or workspace directory.
            symbol: Symbol name to analyze (required if symbols is not provided).
                An ambiguous bare name expands to one report per module-qualified
                candidate; use one of those qualified names to replay a targeted
                query.
            symbols: Optional list of symbol names for batch inspection.
            exclude_tests: If True, exclude test files from impact analysis.
            detail: Output detail level. Use ``"compact"`` for a markdown
                table summary instead of the full JSON dict.
            include_module_importers: OPT-IN (default ``False``). When ``True``,
                forward the core reverse-import toggle so the result data carries
                a ``module_level_importers`` field listing modules that only
                ``import pkg.m`` the edited symbol's *module* (or a re-export
                shim of it) without referencing the symbol itself -- dependents a
                symbol-level traversal misses. Off (the default) the ToolResult
                data and text are byte-for-byte the legacy output (AC2).
                Best-effort: inert in workspace mode (the core
                ``analyze_impact_workspace`` does not yet accept the toggle -- a
                documented residual, single-package analysis is unaffected) and
                silently empty when the import graph is unavailable.
            precise_callers: OPT-IN (default ``False``). When ``True``,
                discard callers proven to import a distinct homonymous symbol.
                Ambiguous, unresolvable, or unreadable imports remain included
                (fail-open).
            **kwargs: Extra options. ``test_filter`` (``"none"``,
                ``"all"``, ``"related"``) controls test caller filtering.

        Returns:
            ToolResult with impact analysis.

        Note:
            Seeding (Volet B): the analysis seeds from *symbol* verbatim -- the
            tool never derives or proxies the seed. If a caller (the
            BUILD-briefing) hands in a derived/proxy symbol, that mis-seed lives
            on the caller side; it is a documented residual, not fixable here
            without forcing an axm-ast change.
        """
        if not symbol and not symbols:
            return ToolResult(success=False, error="symbol parameter is required")

        project_path = Path(path).resolve()
        if not project_path.is_dir():
            return ToolResult(success=False, error=f"Not a directory: {project_path}")

        raw_filter = kwargs.get("test_filter")
        test_filter: str | None = raw_filter if isinstance(raw_filter, str) else None
        tf: _TestFilterKwargs = (
            {"test_filter": test_filter} if test_filter is not None else {}
        )

        try:
            if symbols is not None:
                return self._execute_batch(
                    project_path,
                    symbols,
                    exclude_tests,
                    detail,
                    include_module_importers=include_module_importers,
                    precise_callers=precise_callers,
                    **tf,
                )

            if symbol is None:
                return ToolResult(success=False, error="symbol parameter is required")
            return self._execute_symbol(
                project_path,
                symbol,
                exclude_tests,
                detail,
                include_module_importers=include_module_importers,
                precise_callers=precise_callers,
                **tf,
            )
        except Exception as exc:  # noqa: BLE001
            return ToolResult(success=False, error=str(exc))

    def _execute_symbol(  # noqa: PLR0913 - mirrors the public option surface
        self,
        project_path: Path,
        symbol: str,
        exclude_tests: bool,
        detail: str | None,
        *,
        test_filter: str | None = None,
        include_module_importers: bool = False,
        precise_callers: bool = False,
    ) -> ToolResult:
        candidates = self._qualified_candidates(project_path, symbol)
        target_symbols = sorted(candidates) if len(candidates) > 1 else None
        if target_symbols is not None:
            return self._execute_batch(
                project_path,
                target_symbols,
                exclude_tests,
                detail,
                test_filter=test_filter,
                include_module_importers=include_module_importers,
                precise_callers=precise_callers,
                definition_files=candidates,
            )
        return self._execute_single(
            project_path,
            symbol,
            exclude_tests,
            detail,
            test_filter=test_filter,
            include_module_importers=include_module_importers,
            precise_callers=precise_callers,
        )

    @staticmethod
    def _qualified_candidates(project_path: Path, symbol: str) -> dict[str, str]:
        if "." in symbol:
            return {}
        try:
            pkg = get_package(project_path)
            candidates: dict[str, str] = {}
            for _, candidate in search_symbols(pkg, name=symbol):
                if candidate.name != symbol:
                    continue
                module = find_module_for_symbol(pkg, candidate)
                if module is None:
                    continue
                module_name = module.name or module_dotted_name(module.path, pkg.root)
                candidates[f"{module_name}.{symbol}"] = str(module.path)
            return candidates
        except Exception:  # noqa: BLE001 - ambiguity probing is best-effort
            return {}

    def _execute_batch(  # noqa: PLR0913 - opt-in toggles join the existing option surface
        self,
        project_path: Path,
        symbols: list[str],
        exclude_tests: bool,
        detail: str | None,
        *,
        test_filter: str | None = None,
        include_module_importers: bool = False,
        precise_callers: bool = False,
        definition_files: Mapping[str, str] | None = None,
    ) -> ToolResult:
        """Run batch impact analysis for multiple symbols.

        In compact mode, returns formatted markdown via ``ToolResult.text``
        with an empty ``data`` dict. In full mode, returns per-symbol dicts
        under ``data["symbols"]``.
        """
        if not isinstance(symbols, list):
            return ToolResult(success=False, error="symbols parameter must be a list")
        if not symbols:
            return ToolResult(success=False, error="symbols list must not be empty")
        results: list[ImpactResult] = []
        for sym in symbols:
            tf: _TestFilterKwargs = (
                {"test_filter": test_filter} if test_filter is not None else {}
            )
            if precise_callers:
                results.append(
                    self._analyze_single(
                        project_path,
                        sym,
                        exclude_tests=exclude_tests,
                        include_module_importers=include_module_importers,
                        precise_callers=True,
                        **tf,
                    )
                )
            else:
                results.append(
                    self._analyze_single(
                        project_path,
                        sym,
                        exclude_tests=exclude_tests,
                        include_module_importers=include_module_importers,
                        **tf,
                    )
                )
        if definition_files is not None:
            for result in results:
                candidate_file = definition_files.get(result.get("symbol", ""))
                definition = result.get("definition")
                if candidate_file is not None and definition is not None:
                    definition_data = cast("dict[str, object]", definition)
                    definition_data["file"] = candidate_file
        if detail == "compact":
            return ToolResult(
                success=True,
                data={},
                text=format_impact_compact(cast("list[Mapping[str, object]]", results)),
            )
        text = self._render_batch_text(results)
        return ToolResult(
            success=True,
            data={"symbols": cast("list[dict[str, object]]", results)},
            text=text,
        )

    @staticmethod
    def _render_batch_text(results: list[ImpactResult]) -> str | None:
        """Render batch text from results, returning *None* on failure."""
        try:
            if any("score" in r or "callers" in r for r in results):
                return render_impact_batch_text(results)
        except (KeyError, TypeError):
            pass
        return None

    def _execute_single(  # noqa: PLR0913 - opt-in toggles join the existing option surface
        self,
        project_path: Path,
        symbol: str,
        exclude_tests: bool,
        detail: str | None,
        *,
        test_filter: str | None = None,
        include_module_importers: bool = False,
        precise_callers: bool = False,
    ) -> ToolResult:
        """Run single-symbol impact analysis with optional compact output.

        In compact mode, returns formatted markdown via ``ToolResult.text``
        with an empty ``data`` dict. Otherwise delegates to
        ``_analyze_single_result``.
        """
        tf: _TestFilterKwargs = (
            {"test_filter": test_filter} if test_filter is not None else {}
        )
        if detail == "compact":
            if precise_callers:
                result = self._analyze_single(
                    project_path,
                    symbol,
                    exclude_tests=exclude_tests,
                    include_module_importers=include_module_importers,
                    precise_callers=True,
                    **tf,
                )
            else:
                result = self._analyze_single(
                    project_path,
                    symbol,
                    exclude_tests=exclude_tests,
                    include_module_importers=include_module_importers,
                    **tf,
                )
            return ToolResult(
                success=True,
                data={},
                text=format_impact_compact(result),
            )
        return self._analyze_single_result(
            project_path,
            symbol,
            exclude_tests=exclude_tests,
            include_module_importers=include_module_importers,
            precise_callers=precise_callers,
            **tf,
        )

    def _analyze_single(  # noqa: PLR0913 - opt-in toggles join the option surface
        self,
        project_path: Path,
        symbol: str,
        *,
        exclude_tests: bool = False,
        test_filter: str | None = None,
        include_module_importers: bool = False,
        precise_callers: bool = False,
    ) -> ImpactResult:
        """Run impact analysis for a single symbol.

        The analysis seeds from *symbol* exactly as received (Volet B): the
        real edit-target, never a derived proxy. ``include_module_importers``
        is forwarded to the single-package core path only -- the workspace path
        (``analyze_impact_workspace``) does not yet accept the toggle, so the
        opt-in is a best-effort no-op there (documented residual).

        Returns:
            Impact dict with ``score`` key on success,
            or ``{"symbol": name, "error": msg}`` on failure.
        """
        try:
            try:
                from axm_ast.core.impact import analyze_impact_workspace

                # Residual: the workspace core does not accept the reverse-import
                # toggle yet, so it is intentionally not forwarded here.
                if precise_callers:
                    try:
                        workspace_analyzer = cast(
                            "_PreciseWorkspaceAnalyzer", analyze_impact_workspace
                        )
                        impact = workspace_analyzer(
                            project_path,
                            symbol,
                            exclude_tests=exclude_tests,
                            test_filter=test_filter,
                            precise_callers=True,
                        )
                    except TypeError as exc:
                        if "unexpected keyword argument 'precise_callers'" not in str(
                            exc
                        ):
                            raise
                        impact = analyze_impact_workspace(
                            project_path,
                            symbol,
                            exclude_tests=exclude_tests,
                            test_filter=test_filter,
                        )
                else:
                    impact = analyze_impact_workspace(
                        project_path,
                        symbol,
                        exclude_tests=exclude_tests,
                        test_filter=test_filter,
                    )
            except ValueError:
                from axm_ast.core.impact import analyze_impact

                if precise_callers:
                    impact = analyze_impact(
                        project_path,
                        symbol,
                        exclude_tests=exclude_tests,
                        test_filter=test_filter,
                        include_module_importers=include_module_importers,
                        precise_callers=True,
                    )
                else:
                    impact = analyze_impact(
                        project_path,
                        symbol,
                        exclude_tests=exclude_tests,
                        test_filter=test_filter,
                        include_module_importers=include_module_importers,
                    )

            if impact.get("definition") is None:
                return cast(
                    "ImpactResult",
                    {"symbol": symbol, "error": f"Symbol '{symbol}' not found"},
                )
            return impact
        except Exception as exc:  # noqa: BLE001 — final boundary
            return cast(
                "ImpactResult",
                log_and_fallback(logger, exc, {"symbol": symbol, "error": str(exc)}),
            )

    def _analyze_single_result(  # noqa: PLR0913 - opt-in toggles join the option surface
        self,
        project_path: Path,
        symbol: str,
        *,
        exclude_tests: bool = False,
        test_filter: str | None = None,
        include_module_importers: bool = False,
        precise_callers: bool = False,
    ) -> ToolResult:
        """Run single-symbol impact analysis and return a ToolResult."""
        tf: _TestFilterKwargs = (
            {"test_filter": test_filter} if test_filter is not None else {}
        )
        # Omit the toggle entirely when off so the default delegation stays
        # byte-for-byte identical to the legacy call (AC2); forward it verbatim
        # only when opted-in.
        if include_module_importers and precise_callers:
            result = self._analyze_single(
                project_path,
                symbol,
                exclude_tests=exclude_tests,
                include_module_importers=True,
                precise_callers=True,
                **tf,
            )
        elif include_module_importers:
            result = self._analyze_single(
                project_path,
                symbol,
                exclude_tests=exclude_tests,
                include_module_importers=True,
                **tf,
            )
        elif precise_callers:
            result = self._analyze_single(
                project_path,
                symbol,
                exclude_tests=exclude_tests,
                precise_callers=True,
                **tf,
            )
        else:
            result = self._analyze_single(
                project_path,
                symbol,
                exclude_tests=exclude_tests,
                **tf,
            )
        if "error" in result:
            err = result.get("error", "")
            return ToolResult(
                success=False,
                error=err if isinstance(err, str) else str(err),
            )
        try:
            text: str | None = render_impact_text(result)
        except (KeyError, TypeError):
            text = None
        return ToolResult(
            success=True,
            data=cast("dict[str, object]", result),
            text=text,
        )
name property

Return tool name for registry lookup.

execute(*, path='.', symbol=None, symbols=None, exclude_tests=False, detail=None, include_module_importers=False, precise_callers=False, **kwargs)

Analyze change impact for a symbol.

Parameters:

Name Type Description Default
path str

Path to package or workspace directory.

'.'
symbol str | None

Symbol name to analyze (required if symbols is not provided). An ambiguous bare name expands to one report per module-qualified candidate; use one of those qualified names to replay a targeted query.

None
symbols list[str] | None

Optional list of symbol names for batch inspection.

None
exclude_tests bool

If True, exclude test files from impact analysis.

False
detail str | None

Output detail level. Use "compact" for a markdown table summary instead of the full JSON dict.

None
include_module_importers bool

OPT-IN (default False). When True, forward the core reverse-import toggle so the result data carries a module_level_importers field listing modules that only import pkg.m the edited symbol's module (or a re-export shim of it) without referencing the symbol itself -- dependents a symbol-level traversal misses. Off (the default) the ToolResult data and text are byte-for-byte the legacy output (AC2). Best-effort: inert in workspace mode (the core analyze_impact_workspace does not yet accept the toggle -- a documented residual, single-package analysis is unaffected) and silently empty when the import graph is unavailable.

False
precise_callers bool

OPT-IN (default False). When True, discard callers proven to import a distinct homonymous symbol. Ambiguous, unresolvable, or unreadable imports remain included (fail-open).

False
**kwargs object

Extra options. test_filter ("none", "all", "related") controls test caller filtering.

{}

Returns:

Type Description
ToolResult

ToolResult with impact analysis.

Note

Seeding (Volet B): the analysis seeds from symbol verbatim -- the tool never derives or proxies the seed. If a caller (the BUILD-briefing) hands in a derived/proxy symbol, that mis-seed lives on the caller side; it is a documented residual, not fixable here without forcing an axm-ast change.

Source code in packages/axm-ast/src/axm_ast/tools/impact.py
Python
@safe_execute
def execute(  # noqa: PLR0913 - opt-in module-importers toggle joins the existing option surface
    self,
    *,
    path: str = ".",
    symbol: str | None = None,
    symbols: list[str] | None = None,
    exclude_tests: bool = False,
    detail: str | None = None,
    include_module_importers: bool = False,
    precise_callers: bool = False,
    **kwargs: object,
) -> ToolResult:
    """Analyze change impact for a symbol.

    Args:
        path: Path to package or workspace directory.
        symbol: Symbol name to analyze (required if symbols is not provided).
            An ambiguous bare name expands to one report per module-qualified
            candidate; use one of those qualified names to replay a targeted
            query.
        symbols: Optional list of symbol names for batch inspection.
        exclude_tests: If True, exclude test files from impact analysis.
        detail: Output detail level. Use ``"compact"`` for a markdown
            table summary instead of the full JSON dict.
        include_module_importers: OPT-IN (default ``False``). When ``True``,
            forward the core reverse-import toggle so the result data carries
            a ``module_level_importers`` field listing modules that only
            ``import pkg.m`` the edited symbol's *module* (or a re-export
            shim of it) without referencing the symbol itself -- dependents a
            symbol-level traversal misses. Off (the default) the ToolResult
            data and text are byte-for-byte the legacy output (AC2).
            Best-effort: inert in workspace mode (the core
            ``analyze_impact_workspace`` does not yet accept the toggle -- a
            documented residual, single-package analysis is unaffected) and
            silently empty when the import graph is unavailable.
        precise_callers: OPT-IN (default ``False``). When ``True``,
            discard callers proven to import a distinct homonymous symbol.
            Ambiguous, unresolvable, or unreadable imports remain included
            (fail-open).
        **kwargs: Extra options. ``test_filter`` (``"none"``,
            ``"all"``, ``"related"``) controls test caller filtering.

    Returns:
        ToolResult with impact analysis.

    Note:
        Seeding (Volet B): the analysis seeds from *symbol* verbatim -- the
        tool never derives or proxies the seed. If a caller (the
        BUILD-briefing) hands in a derived/proxy symbol, that mis-seed lives
        on the caller side; it is a documented residual, not fixable here
        without forcing an axm-ast change.
    """
    if not symbol and not symbols:
        return ToolResult(success=False, error="symbol parameter is required")

    project_path = Path(path).resolve()
    if not project_path.is_dir():
        return ToolResult(success=False, error=f"Not a directory: {project_path}")

    raw_filter = kwargs.get("test_filter")
    test_filter: str | None = raw_filter if isinstance(raw_filter, str) else None
    tf: _TestFilterKwargs = (
        {"test_filter": test_filter} if test_filter is not None else {}
    )

    try:
        if symbols is not None:
            return self._execute_batch(
                project_path,
                symbols,
                exclude_tests,
                detail,
                include_module_importers=include_module_importers,
                precise_callers=precise_callers,
                **tf,
            )

        if symbol is None:
            return ToolResult(success=False, error="symbol parameter is required")
        return self._execute_symbol(
            project_path,
            symbol,
            exclude_tests,
            detail,
            include_module_importers=include_module_importers,
            precise_callers=precise_callers,
            **tf,
        )
    except Exception as exc:  # noqa: BLE001
        return ToolResult(success=False, error=str(exc))

format_impact_compact(impact)

Format impact analysis as a compact markdown table.

Accepts either a single impact dict or a list of per-symbol reports. When given a list, each symbol gets its own row with per-symbol callers.

Parameters:

Name Type Description Default
impact Mapping[str, object] | list[Mapping[str, object]]

Single impact dict or list of per-symbol impact dicts.

required

Returns:

Type Description
str

Markdown string with symbol table, caller details, and test footer.

Source code in packages/axm-ast/src/axm_ast/tools/impact.py
Python
def format_impact_compact(
    impact: Mapping[str, object] | list[Mapping[str, object]],
) -> str:
    """Format impact analysis as a compact markdown table.

    Accepts either a single impact dict or a list of per-symbol reports.
    When given a list, each symbol gets its own row with per-symbol callers.

    Args:
        impact: Single impact dict or list of per-symbol impact dicts.

    Returns:
        Markdown string with symbol table, caller details, and test footer.
    """
    if isinstance(impact, list):
        score = _max_score(impact)
        return format_impact_compact_multi(impact, score)

    # Single-report dict path
    score_raw = impact.get("score", "UNKNOWN")
    score = score_raw if isinstance(score_raw, str) else "UNKNOWN"
    return format_impact_compact_multi([impact], score)

format_impact_compact_multi(reports, score)

Format multiple impact reports as a compact table with per-symbol callers.

Each symbol gets its own row with its own Prod / Direct tests / Indirect tests columns. Each row displays the per-symbol score from the report.

Parameters:

Name Type Description Default
reports list[Mapping[str, object]]

Individual per-symbol impact dicts.

required
score str

Kept for backward compatibility (not used for row display).

required

Returns:

Type Description
str

Markdown table string.

Source code in packages/axm-ast/src/axm_ast/tools/impact.py
Python
def format_impact_compact_multi(
    reports: list[Mapping[str, object]],
    score: str,
) -> str:
    """Format multiple impact reports as a compact table with per-symbol callers.

    Each symbol gets its own row with its own Prod / Direct tests / Indirect
    tests columns.  Each row displays the per-symbol score from the report.

    Args:
        reports: Individual per-symbol impact dicts.
        score: Kept for backward compatibility (not used for row display).

    Returns:
        Markdown table string.
    """
    lines: list[str] = [
        "| Symbol | Location | Score | Prod | Direct tests | Indirect tests |",
        "|---|---|---|---|---|---|",
    ]
    for report in reports:
        row_score_raw = report.get("score", "LOW")
        row_score = row_score_raw if isinstance(row_score_raw, str) else "LOW"
        lines.append(_format_symbol_row(report, row_score))

    # Aggregate test_files across all reports
    seen: set[str] = set()
    all_test_files: list[str] = []
    for report in reports:
        report_tfs = report.get("test_files", [])
        if not isinstance(report_tfs, list):
            continue
        for tf in report_tfs:
            if isinstance(tf, str) and tf not in seen:
                seen.add(tf)
                all_test_files.append(tf)
    lines.append("")
    lines.append(f"Tests: {_format_test_files_compact(all_test_files)}")
    return "\n".join(lines)

render_impact_batch_text(reports)

Render multiple impact reports as human-readable text.

Source code in packages/axm-ast/src/axm_ast/tools/impact_text.py
Python
def render_impact_batch_text(reports: list[ImpactResult]) -> str:
    """Render multiple impact reports as human-readable text."""
    if not reports:
        return ""

    try:
        score_order = {"LOW": 0, "MEDIUM": 1, "HIGH": 2}
        best = "LOW"
        for r in reports:
            s = r.get("score", "LOW")
            if score_order.get(s, 0) > score_order.get(best, 0):
                best = s
        header = f"ast_impact | {len(reports)} symbols | max={best}"
        sections: list[str] = [header]
        for r in reports:
            symbol = r.get("symbol", "?")
            score = r.get("score", "UNKNOWN")
            section_header = f"## {symbol} | {score}"
            body = _render_impact_single(r)
            body_lines = body.split("\n")[1:]
            sections.append(section_header + "\n" + "\n".join(body_lines))
        return "\n\n".join(sections)
    except (KeyError, TypeError, AttributeError):
        return ""

render_impact_text(report)

Render a single impact report as human-readable text.

Source code in packages/axm-ast/src/axm_ast/tools/impact_text.py
Python
def render_impact_text(report: ImpactResult) -> str:
    """Render a single impact report as human-readable text."""
    try:
        return _render_impact_single(report)
    except (KeyError, TypeError, AttributeError):
        symbol = report.get("symbol", "?") if isinstance(report, dict) else "?"
        return f"ast_impact | {symbol} | render error"