Skip to content

feat: add blast radius analysis with risk scoring#148

Open
maplenk wants to merge 9 commits intoDeusData:mainfrom
maplenk:feat/blast-radius
Open

feat: add blast radius analysis with risk scoring#148
maplenk wants to merge 9 commits intoDeusData:mainfrom
maplenk:feat/blast-radius

Conversation

@maplenk
Copy link
Copy Markdown

@maplenk maplenk commented Mar 26, 2026

Summary

New get_impact_analysis tool that answers "what breaks if I change this function?" with risk-tiered results and test coverage detection.

Stacked PR: This builds on #147 (PageRank + Architecture). Please merge #147 first — this PR's unique changes are the 2 commits after PR 1's HEAD.

New tool: get_impact_analysis

Parameters: project, symbol, depth (default 3), include_tests (default true), max_tokens (default 2000)

Key features

  • Custom multi-edge-type BFS: follows CALLS (inbound) + HANDLES (outbound) for callables, HTTP_CALLS + ASYNC_CALLS for routes. Different from generic cbm_store_bfs().
  • Depth grouping: hop 1 = direct (will break), hop 2-3 = indirect (may break), hop 4+ = transitive (ripple risk)
  • Risk scoring (low/medium/high): based on direct caller count, entry-point presence in radius, PageRank percentile, and test coverage
  • Symbol disambiguation: when multiple nodes share a name, auto-picks by non-test file, then PageRank, then in-degree
  • Affected test detection: filters BFS results by test file path
  • Batch node fetching: single chunked SQL query (batches of 900) instead of per-node lookups

Tests

New tests in test_store_search.c (risk tiers, routes+tests, disambiguation) and test_mcp.c (basic, missing symbol, disambiguation, include_tests, route typing).


Part 2 of a 4-PR series. Depends on #147.


Built with OpenAI Codex and Claude Code.

@DeusData
Copy link
Copy Markdown
Owner

Thanks @maplenk — blast radius analysis would be very useful for impact assessment. Will review.

Naman Khator and others added 9 commits March 27, 2026 18:10
Account for optional signatures in the search_graph and trace_call_path size estimators, and improve compact trace chains to report omitted-node counts.

This also documents the normal-path output enrichment introduced with Task 4: search_graph results now include file_path, start_line, end_line, and signature, and trace_call_path hop items now include file_path, start_line, and signature.
- Guard cbm_mcp_text_result() against NULL text
- Fix memory leak in handle_get_key_symbols() REQUIRE_STORE path (focus not freed)
- Wire qn_pattern through handle_search_graph()
- Fix OOM infinite loop in markdown_builder_reserve()
- Return 0 instead of CBM_STORE_ERR from summary_count_nodes() on prepare fail

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prefer non-test symbol matches before pagerank for ambiguous short names. Batch-load visited node metadata and pagerank scores to remove per-node query loops during impact analysis. Hide test counts from the public summary when include_tests=false, and add max_tokens truncation support to get_impact_analysis with MCP coverage.
Add the impact-analysis store API declaration, expose get_impact_analysis in CLI help text, and cover the tool with the existing integration fixture.
- Chunk impact_fetch_nodes_with_scores() into batches of 900 to stay
  under SQLite's SQLITE_MAX_VARIABLE_NUMBER bind limit
- Replace REQUIRE_STORE in handle_get_impact_analysis() with explicit
  cleanup that frees symbol on early return
- Fix pre-existing test_integration assertion that used escaped JSON
  field matching (was already failing on origin/feat/blast-radius)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maplenk maplenk force-pushed the feat/blast-radius branch from 5c5517c to 31de109 Compare March 27, 2026 13:13
@DeusData
Copy link
Copy Markdown
Owner

@maplenk — I've updated the CONTRIBUTING.md with clearer guidelines. The key one: please open an issue first to discuss the feature before implementing it. This applies to all feature PRs.

I appreciate the effort, but submitting fully implemented features without prior discussion makes it much harder to align on whether the feature is needed, how it should work, and whether it fits the project's direction. It also increases the likelihood that the PR gets closed.

Could you open an issue describing the use case for blast radius analysis? I'd like to discuss the approach before any code is written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants