Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
revert(extract): drop template-URL constant resolution now done by the URL fold
Martin Vogela76600db0967
diff --git a/internal/cbm/extract_calls.c b/internal/cbm/extract_calls.cindex 1ec05de2a..f14efb766 100644--- a/internal/cbm/extract_calls.c+++ b/internal/cbm/extract_calls.c@@ -2192,9 +2192,9 @@ static void extract_call_args(CBMExtractCtx *ctx, TSNode args, CBMCall *call) {if (is_string_like(ak) && ca->expr) {ca->value = strip_quotes(ctx->arena, ca->expr);} else if (strcmp(ak, "template_string") == 0) {- /* Resolve known constants; dynamic substitutions keep the route placeholder. */- ca->value = cbm_template_string_text(ctx->arena, arg_node, ctx->source,- &ctx->string_constants);+ /* Flattened {} form so downstream url-arg detection joins the+ * canonical server route shape (issue #1006/#1009). */+ ca->value = cbm_template_string_text(ctx->arena, arg_node, ctx->source);} else if (strcmp(ak, "identifier") == 0 && ca->expr) {ca->value = lookup_string_constant(ctx, ca->expr);} else if (strcmp(ak, "object") == 0) {@@ -2259,8 +2259,7 @@ static bool is_queue_topic_field(const char *key) {static const char *extract_string_value(CBMExtractCtx *ctx, TSNode val_node) {const char *vk = ts_node_type(val_node);if (strcmp(vk, "template_string") == 0) {- return cbm_template_string_text(ctx->arena, val_node, ctx->source,- &ctx->string_constants);+ return cbm_template_string_text(ctx->arena, val_node, ctx->source);}if (is_string_like(vk)) {char *text = cbm_node_text(ctx->arena, val_node, ctx->source);@@ -2435,10 +2434,10 @@ static TSNode swift_unwrap_url_constructor(CBMExtractCtx *ctx, TSNode arg) {}static const char *extract_positional_url(CBMExtractCtx *ctx, TSNode arg, const char *ak) {- /* Resolve constants while keeping dynamic route parts in canonical form. */+ /* JS/TS template literals: `/things/${id}` normalizes to "/things/{}" so the+ * client URL joins the server route's canonical placeholder (issue #1006). */if (strcmp(ak, "template_string") == 0) {- const char *flat = cbm_template_string_text(ctx->arena, arg, ctx->source,- &ctx->string_constants);+ const char *flat = cbm_template_string_text(ctx->arena, arg, ctx->source);if (flat) {return strip_and_validate_string_arg(ctx->arena, (char *)flat);}diff --git a/internal/cbm/extract_unified.c b/internal/cbm/extract_unified.cindex cce2100b7..086f501a0 100644--- a/internal/cbm/extract_unified.c+++ b/internal/cbm/extract_unified.c@@ -1212,7 +1212,7 @@ static void handle_string_constants(CBMExtractCtx *ctx, TSNode node, const WalkSconst char *value_kind = ts_node_type(value_node);const char *flat_value = NULL;if (strcmp(value_kind, "template_string") == 0) {- flat_value = cbm_template_string_text(ctx->arena, value_node, ctx->source, NULL);+ flat_value = cbm_template_string_text(ctx->arena, value_node, ctx->source);if (!flat_value) {return;}@@ -1263,7 +1263,7 @@ static void handle_string_refs(CBMExtractCtx *ctx, TSNode node, const WalkState* template strings become string_refs with the canonical placeholder shape* shared with server route paths (issue #1006). */if (strcmp(kind, "template_string") == 0) {- const char *flat = cbm_template_string_text(ctx->arena, node, ctx->source, NULL);+ const char *flat = cbm_template_string_text(ctx->arena, node, ctx->source);if (!flat) {return;}diff --git a/internal/cbm/helpers.c b/internal/cbm/helpers.cindex 86c54c4e9..4c4d340f0 100644--- a/internal/cbm/helpers.c+++ b/internal/cbm/helpers.c@@ -1803,10 +1803,13 @@ int cbm_classify_string(const char *str, int len) {return NOT_FOUND;}-/* Flatten a JS/TS template string, resolving known string constants and- * replacing other substitutions with the route placeholder. */-const char *cbm_template_string_text(CBMArena *a, TSNode node, const char *source,- const CBMStringConstantMap *string_constants) {+/* Flatten a JS/TS `template_string` node into plain text (issue #1006).+ * String fragments are kept verbatim; each ${...} substitution becomes the+ * "{}" placeholder so client URLs built from template literals share the+ * canonical parameter shape of server-side route paths+ * (`/things/${id}/x` -> "/things/{}/x"). Returns NULL when the node yields+ * no text or exceeds the route-sized buffer. */+const char *cbm_template_string_text(CBMArena *a, TSNode node, const char *source) {enum { TPL_BUF = 512 };char buf[TPL_BUF];size_t pos = 0;@@ -1826,29 +1829,6 @@ const char *cbm_template_string_text(CBMArena *a, TSNode node, const char *sourcmemcpy(buf + pos, frag, fl);pos += fl;} else if (strcmp(k, "template_substitution") == 0) {- const char *resolved = NULL;- TSNode expr = ts_node_named_child(c, 0);- if (string_constants && !ts_node_is_null(expr) &&- strcmp(ts_node_type(expr), "identifier") == 0) {- char *name = cbm_node_text(a, expr, source);- for (int j = 0; name && j < string_constants->count; j++) {- if (!string_constants->is_url_builder[j] && string_constants->names[j] &&- string_constants->values[j] &&- strcmp(string_constants->names[j], name) == 0) {- resolved = string_constants->values[j];- break;- }- }- }- if (resolved) {- size_t rl = strlen(resolved);- if (pos + rl >= TPL_BUF) {- return NULL;- }- memcpy(buf + pos, resolved, rl);- pos += rl;- continue;- }if (pos + PAIR_LEN >= TPL_BUF) {return NULL;}diff --git a/internal/cbm/helpers.h b/internal/cbm/helpers.hindex 16c132d10..00e3d30dc 100644--- a/internal/cbm/helpers.h+++ b/internal/cbm/helpers.h@@ -253,9 +253,10 @@ char *cbm_fqn_compute_source_lang(CBMArena *a, const char *project, const char *// Folder QN: project.dir_partschar *cbm_fqn_folder(CBMArena *a, const char *project, const char *rel_dir);-/* Flatten JS/TS template strings for URL extraction. Known string constants- * resolve; other substitutions become "{}". NULL when empty/oversized. */-const char *cbm_template_string_text(CBMArena *a, TSNode node, const char *source,- const CBMStringConstantMap *string_constants);+/* Flatten a JS/TS `template_string` node into plain text: string fragments are+ * kept verbatim and each ${...} substitution becomes the "{}" placeholder, so+ * client-side URLs built from template literals share the canonical parameter+ * shape that server-side route paths already use. NULL when empty/oversized. */+const char *cbm_template_string_text(CBMArena *a, TSNode node, const char *source);#endif // CBM_HELPERS_H