From bac1867e6c92f8284dd3d4e98d9d8b92d4c3fb78 Mon Sep 17 00:00:00 2001 From: map588 Date: Sat, 4 Apr 2026 20:54:40 -0400 Subject: [PATCH 1/3] feat(pipeline): emit CALLS edges for decorator applications Decorators previously only created DECORATES edges. References like @login_required were invisible to "find all references" queries which look for CALLS and USAGE edges. Now both sequential (resolve_decorator) and parallel (resolve_def_decorators) paths emit a CALLS edge alongside DECORATES. Uses "{}" properties to avoid clobbering richer metadata from pass_calls when a function both has @decorator and calls decorator() directly. --- src/pipeline/pass_parallel.c | 3 +++ src/pipeline/pass_semantic.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/pipeline/pass_parallel.c b/src/pipeline/pass_parallel.c index 68843df..2812559 100644 --- a/src/pipeline/pass_parallel.c +++ b/src/pipeline/pass_parallel.c @@ -1261,6 +1261,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 CALLS edge exists so decorator appears in reference queries. + * Use "{}" to avoid clobbering richer metadata from pass_calls. */ + cbm_gbuf_insert_edge(ws->local_edge_buf, node->id, dn->id, "CALLS", "{}"); ws->semantic_resolved++; } } diff --git a/src/pipeline/pass_semantic.c b/src/pipeline/pass_semantic.c index ef32780..30c6081 100644 --- a/src/pipeline/pass_semantic.c +++ b/src/pipeline/pass_semantic.c @@ -321,6 +321,10 @@ 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 CALLS edge exists so decorator appears in reference queries. + * Use "{}" to avoid clobbering richer metadata from pass_calls + * (dedup skips replacement when new props are "{}"). */ + cbm_gbuf_insert_edge(ctx->gbuf, node->id, dec->id, "CALLS", "{}"); (*count)++; } } From b07fdd3a7a3fe92177c1e5073b3e57df193a3e18 Mon Sep 17 00:00:00 2001 From: Matthew Prock <122550757+map588@users.noreply.github.com> Date: Sun, 5 Apr 2026 15:07:29 -0400 Subject: [PATCH 2/3] Update src/pipeline/pass_semantic.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/pipeline/pass_semantic.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pipeline/pass_semantic.c b/src/pipeline/pass_semantic.c index 30c6081..423375c 100644 --- a/src/pipeline/pass_semantic.c +++ b/src/pipeline/pass_semantic.c @@ -321,10 +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 CALLS edge exists so decorator appears in reference queries. - * Use "{}" to avoid clobbering richer metadata from pass_calls - * (dedup skips replacement when new props are "{}"). */ - cbm_gbuf_insert_edge(ctx->gbuf, node->id, dec->id, "CALLS", "{}"); + /* 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)++; } } From c48da5e206adec0025d6f61eceabeac5b2986f90 Mon Sep 17 00:00:00 2001 From: Matthew Prock <122550757+map588@users.noreply.github.com> Date: Sun, 5 Apr 2026 15:07:37 -0400 Subject: [PATCH 3/3] Update src/pipeline/pass_parallel.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/pipeline/pass_parallel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pipeline/pass_parallel.c b/src/pipeline/pass_parallel.c index 2812559..d2b1703 100644 --- a/src/pipeline/pass_parallel.c +++ b/src/pipeline/pass_parallel.c @@ -1261,9 +1261,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 CALLS edge exists so decorator appears in reference queries. - * Use "{}" to avoid clobbering richer metadata from pass_calls. */ - cbm_gbuf_insert_edge(ws->local_edge_buf, node->id, dn->id, "CALLS", "{}"); + /* 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++; } }