mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-08 08:53:43 +08:00
feat(pipeline): emit USAGE edges for decorator applications (#208)
Decorators previously only created DECORATES edges. References like @login_required were invisible to find-references queries that walk CALLS/USAGE relationships. Both sequential (resolve_decorator) and parallel (resolve_def_decorators) paths now emit a USAGE edge alongside DECORATES. Empty {} properties avoid clobbering richer metadata from pass_calls when a function both has @decorator and calls decorator() directly. Using USAGE instead of CALLS keeps pass_tests' CALLS-scan from inferring false TESTS edges (decorated test function → decorator).
This commit is contained in:
@@ -1615,6 +1615,9 @@ static void resolve_def_decorators(resolve_ctx_t *rc, resolve_worker_state_t *ws
|
||||
char dp[CBM_SZ_256];
|
||||
snprintf(dp, sizeof(dp), "{\"decorator\":\"%s\"}", def->decorators[dc]);
|
||||
cbm_gbuf_insert_edge(ws->local_edge_buf, node->id, dn->id, "DECORATES", dp);
|
||||
/* Ensure a reference-style edge exists so the decorator appears in queries
|
||||
* without being misclassified as a real call by downstream passes. */
|
||||
cbm_gbuf_insert_edge(ws->local_edge_buf, node->id, dn->id, "USAGE", "{}");
|
||||
ws->semantic_resolved++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,6 +321,9 @@ static void resolve_decorator(cbm_pipeline_ctx_t *ctx, const cbm_gbuf_node_t *no
|
||||
char props[CBM_SZ_256];
|
||||
snprintf(props, sizeof(props), "{\"decorator\":\"%s\"}", decorator);
|
||||
cbm_gbuf_insert_edge(ctx->gbuf, node->id, dec->id, "DECORATES", props);
|
||||
/* Ensure a reference edge exists so the decorator appears in usage queries
|
||||
* without being misclassified as a real call by downstream passes. */
|
||||
cbm_gbuf_insert_edge(ctx->gbuf, node->id, dec->id, "USAGE", "{}");
|
||||
(*count)++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user