Skip to content

Commit 5c5517c

Browse files
Naman Khatormaplenk
authored andcommitted
Wire blast radius public surface
Add the impact-analysis store API declaration, expose get_impact_analysis in CLI help text, and cover the tool with the existing integration fixture.
1 parent 4b82d5e commit 5c5517c

3 files changed

Lines changed: 51 additions & 2 deletions

File tree

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void print_help(void) {
150150
printf(" Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode\n");
151151
printf("\nTools: index_repository, search_graph, query_graph, trace_call_path,\n");
152152
printf(" get_code_snippet, get_graph_schema, get_architecture,\n");
153-
printf(" get_architecture_summary, search_code,\n");
153+
printf(" get_architecture_summary, get_impact_analysis, search_code,\n");
154154
printf(" get_key_symbols,\n");
155155
printf(" list_projects, delete_project, index_status, detect_changes,\n");
156156
printf(" manage_adr, ingest_traces\n");

src/store/store.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,40 @@ cbm_impact_summary_t cbm_build_impact_summary(const cbm_node_hop_t *hops, int ho
429429
int cbm_deduplicate_hops(const cbm_node_hop_t *hops, int hop_count, cbm_node_hop_t **out,
430430
int *out_count);
431431

432+
typedef struct {
433+
const char *name;
434+
const char *file;
435+
const char *type;
436+
double pagerank;
437+
int hop; /* internal traversal depth used for ordering/grouping */
438+
} cbm_impact_item_t;
439+
440+
typedef struct {
441+
const char *name;
442+
const char *file;
443+
} cbm_affected_test_t;
444+
445+
typedef struct {
446+
const char *symbol;
447+
const char *qualified_name;
448+
const char *file;
449+
double pagerank;
450+
cbm_impact_item_t *direct;
451+
int direct_count;
452+
cbm_impact_item_t *indirect;
453+
int indirect_count;
454+
cbm_impact_item_t *transitive;
455+
int transitive_count;
456+
cbm_affected_test_t *affected_tests;
457+
int affected_test_count;
458+
const char *risk_score;
459+
const char *summary;
460+
} cbm_impact_analysis_t;
461+
462+
int cbm_store_get_impact_analysis(cbm_store_t *s, const char *project, const char *symbol,
463+
int depth, cbm_impact_analysis_t *out);
464+
void cbm_store_impact_analysis_free(cbm_impact_analysis_t *out);
465+
432466
/* ── Schema ─────────────────────────────────────────────────────── */
433467

434468
int cbm_store_get_schema(cbm_store_t *s, const char *project, cbm_schema_info_t *out);

tests/test_integration.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,20 @@ TEST(integ_mcp_get_key_symbols) {
393393
PASS();
394394
}
395395

396+
TEST(integ_mcp_get_impact_analysis) {
397+
char args[256];
398+
snprintf(args, sizeof(args), "{\"project\":\"%s\",\"symbol\":\"Add\",\"depth\":3}", g_project);
399+
400+
char *resp = call_tool("get_impact_analysis", args);
401+
ASSERT_NOT_NULL(resp);
402+
ASSERT_NOT_NULL(strstr(resp, "\"symbol\":\"Add\""));
403+
ASSERT_NOT_NULL(strstr(resp, "\"impact\""));
404+
ASSERT_NOT_NULL(strstr(resp, "\"risk_score\""));
405+
ASSERT_TRUE(strstr(resp, "Multiply") || strstr(resp, "Compute"));
406+
free(resp);
407+
PASS();
408+
}
409+
396410
TEST(integ_mcp_trace_call_path) {
397411
/* Trace outbound calls from Compute → should reach Add and Multiply */
398412
char args[256];
@@ -575,7 +589,7 @@ SUITE(integration) {
575589
if (integration_setup() != 0) {
576590
printf(" %-50s", "integration_setup");
577591
printf("SKIP (setup failed)\n");
578-
tf_skip_count += 25; /* skip all integration tests */
592+
tf_skip_count += 26; /* skip all integration tests */
579593
integration_teardown();
580594
return;
581595
}
@@ -597,6 +611,7 @@ SUITE(integration) {
597611
RUN_TEST(integ_mcp_get_architecture);
598612
RUN_TEST(integ_mcp_get_architecture_summary);
599613
RUN_TEST(integ_mcp_get_key_symbols);
614+
RUN_TEST(integ_mcp_get_impact_analysis);
600615
RUN_TEST(integ_mcp_trace_call_path);
601616
RUN_TEST(integ_mcp_index_status);
602617

0 commit comments

Comments
 (0)