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
perf(lsp): smart-prune cross-LSP + add Python Tier 2 wiring
Martin Vogel8ce222883426
diff --git a/src/pipeline/pass_lsp_cross.h b/src/pipeline/pass_lsp_cross.hindex 578ddaf8b..06433fc07 100644--- a/src/pipeline/pass_lsp_cross.h+++ b/src/pipeline/pass_lsp_cross.h@@ -30,6 +30,7 @@* — type_rep.h covers the type-representation primitives while* go_lsp.h was where the project-wide def descriptor landed first. */#include "lsp/go_lsp.h"+#include "lsp/py_lsp.h" /* cbm_py_build_cross_registry / cbm_run_py_lsp_cross_with_registry */#include "pipeline/pipeline_internal.h"#include <stdbool.h>diff --git a/src/pipeline/pass_parallel.c b/src/pipeline/pass_parallel.cindex ae22595ad..0b8d1933e 100644--- a/src/pipeline/pass_parallel.c+++ b/src/pipeline/pass_parallel.c@@ -898,8 +898,9 @@ typedef struct {struct CBMModuleDefIndex *module_def_index;/* Tier 2 full: pre-built per-language registries (project-wide,* finalized, READ-ONLY). When non-NULL for a lang, the worker uses- * cbm_run_X_lsp_cross_with_registry — skip per-file build entirely. */- struct CBMCrossLspRegistries *cross_registries;+ * cbm_run_X_lsp_cross_with_registry — skip per-file build entirely.+ * Stored as CBMCrossLspRegistries* (typedef from pass_lsp_cross.h). */+ CBMCrossLspRegistries *cross_registries;/* Counters for parallel.resolve.lsp_cross_done summary. */_Atomic int lsp_cross_processed;@@ -1781,13 +1782,22 @@ static void resolve_worker(int worker_id, void *ctx_ptr) {}CBMLanguage lang = rc->files[file_idx].language;+ /* Cross-file LSP is a per-file tree-sitter re-parse + AST walk ++ * registry lookups — ~50-150ms per file. It can ONLY find calls+ * that exist in the AST. If the per-file extract found zero calls,+ * cross-LSP will too: the AST is the same. And if every call is+ * already resolved (resolved_calls.count >= calls.count), there's+ * nothing left for cross-LSP to improve. Skip in both cases —+ * pure perf win, zero semantic loss. This is the smart-pruning+ * pre-condition that brings down kubernetes resolve time+ * dramatically (most files have no cross-file calls left to+ * resolve once per-file LSP has run). */bool cross_lsp_eligible =- (rc->all_defs && rc->def_count > 0 && cbm_pxc_has_cross_lsp(lang));+ (rc->all_defs && rc->def_count > 0 && cbm_pxc_has_cross_lsp(lang) &&+ result->calls.count > 0 &&+ result->resolved_calls.count < result->calls.count);- /* Skip files with nothing to resolve. Cross-file LSP can find- * CALLS that the per-file extract missed (the whole point of- * the LSP method), so do NOT skip an LSP-eligible file just- * because its initial extract found no calls/defs/etc. */+ /* Skip files with nothing else to resolve and no cross-LSP work. */if (result->calls.count == 0 && result->usages.count == 0 && result->throws.count == 0 &&result->rw.count == 0 && result->defs.count == 0 && result->impl_traits.count == 0 &&!cross_lsp_eligible) {@@ -1931,7 +1941,9 @@ int cbm_parallel_resolve(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t *files,int worker_count, CBMLSPDef *all_defs, int def_count,char *const *def_modules,struct CBMModuleDefIndex *module_def_index,- struct CBMCrossLspRegistries *cross_registries) {+ void *cross_registries_v) {+ /* See header: typed as void* across the TU boundary; cast back here. */+ CBMCrossLspRegistries *cross_registries = (CBMCrossLspRegistries *)cross_registries_v;if (file_count == 0) {return 0;}diff --git a/src/pipeline/pipeline_internal.h b/src/pipeline/pipeline_internal.hindex 91c4e0007..9dab24641 100644--- a/src/pipeline/pipeline_internal.h+++ b/src/pipeline/pipeline_internal.h@@ -369,8 +369,9 @@ int cbm_build_registry_from_cache(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t* pulling the pass header into every consumer of pipeline_internal.h. */struct CBMModuleDefIndex;-/* Forward-declared in pass_lsp_cross.h. */-struct CBMCrossLspRegistries;+/* cbm_parallel_resolve's cross_registries param is typed `void*` to avoid+ * pulling lsp/go_lsp.h into every TU that includes pipeline_internal.h.+ * Callers cast a CBMCrossLspRegistries* (defined in pass_lsp_cross.h). */int cbm_parallel_resolve(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t *files, int file_count,CBMFileResult **result_cache, _Atomic int64_t *shared_ids,@@ -388,8 +389,10 @@ int cbm_parallel_resolve(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t *files,* For each language with a non-NULL entry, workers use the* cbm_run_X_lsp_cross_with_registry fast path (skip per-* file registry build entirely). Falls back to the filter- * + per-file build path when entry is NULL or struct is NULL. */- struct CBMCrossLspRegistries *cross_registries);+ * + per-file build path when entry is NULL or struct is NULL.+ * Typed as void* here to dodge the typedef/tag ordering+ * problem — pass_parallel.c casts back to CBMCrossLspRegistries*. */+ void *cross_registries);/* Post-merge: create Route nodes for HTTP_CALLS/ASYNC_CALLS edges that* have url_path in properties but point to library functions instead of routes.