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
test(repro): harden assert_no_resolvable_edge against vacuous pass
Martin Vogel927dffc336ff
diff --git a/tests/repro/repro_lsp_c_cpp.c b/tests/repro/repro_lsp_c_cpp.cindex a94f2e25a..4e89f755e 100644--- a/tests/repro/repro_lsp_c_cpp.c+++ b/tests/repro/repro_lsp_c_cpp.c@@ -156,6 +156,21 @@ static int assert_no_resolvable_edge(const char *filename, const char *src,return 1;}int rc = 0;+ /* Exercised-check: the fixture MUST produce at least one callable-sourced+ * CALLS edge (its in-fixture control call). Without it the "no edge to+ * <callee>" invariant is VACUOUS — it also passes when extraction silently+ * produced nothing, so a green would not prove the unresolvable call was+ * actually processed and correctly dropped. */+ int module_sourced = -1;+ int callable_sourced = -1;+ inv_count_calls_by_source(store, lp.project, &module_sourced, &callable_sourced);+ (void)module_sourced;+ if (callable_sourced <= 0) {+ printf(" %sFAIL%s %s:%d: no callable-sourced CALLS edge — fixture not "+ "exercised; the no-edge invariant for %s is vacuous\n",+ tf_red(), tf_reset(), __FILE__, __LINE__, callee_substr);+ rc = 1;+ }if (!inv_no_calls_edge_to_qn(store, lp.project, callee_substr)) {printf(" %sFAIL%s %s:%d: a CALLS edge unexpectedly targets %s ""(expected NONE — callee is unresolvable)\n",@@ -302,12 +317,12 @@ static const char kFuncPtr[] =* (RED) — it documents that the DLL-resolution path needs an external binding* the single-file harness can't synthesize. The fixture below at least exercises* a pointer assigned from an extern declaration. */-static const char kDllResolve[] =- "extern int plugin_entry(int x);\n"- "int caller(int v) {\n"- " int (*fp)(int) = plugin_entry;\n"- " return fp(v);\n"- "}\n";+static const char kDllResolve[] = "extern int plugin_entry(int x);\n"+ "int known(int x) { return x + 1; }\n"+ "int caller(int v) {\n"+ " int (*fp)(int) = plugin_entry;\n"+ " return known(v) + fp(v);\n"+ "}\n";/* lsp_operator — overloaded binary operator+ on a custom type (c_lsp.c:3771-3789:* binary_expression, lhs is a custom type, operator+ member found). */@@ -387,10 +402,10 @@ static const char kAdl[] =* called with a NULL callee_qn; the more common unresolved path is* c_emit_unresolved_call (a different marker). This fixture exercises a call to* an undeclared function and documents whether "lsp_unresolved" surfaces. */-static const char kUnresolved[] =- "int caller(int v) {\n"- " return totally_unknown_fn(v);\n"- "}\n";+static const char kUnresolved[] = "int known(int x) { return x + 1; }\n"+ "int caller(int v) {\n"+ " return known(v) + totally_unknown_fn(v);\n"+ "}\n";/* ── Per-strategy tests ──────────────────────────────────────────────────── */diff --git a/tests/repro/repro_lsp_go_py.c b/tests/repro/repro_lsp_go_py.cindex 1d037bccf..fcb06903d 100644--- a/tests/repro/repro_lsp_go_py.c+++ b/tests/repro/repro_lsp_go_py.c@@ -201,6 +201,21 @@ static int assert_no_resolvable_edge_files(const RFile *files, int nfiles,return 1;}int rc = 0;+ /* Exercised-check: the fixture MUST produce at least one callable-sourced+ * CALLS edge (its in-fixture control call). Without it the "no edge to+ * <callee>" invariant is VACUOUS — it also passes when extraction silently+ * produced nothing, so a green would not prove the unresolvable call was+ * actually processed and correctly dropped. */+ int module_sourced = -1;+ int callable_sourced = -1;+ inv_count_calls_by_source(store, lp.project, &module_sourced, &callable_sourced);+ (void)module_sourced;+ if (callable_sourced <= 0) {+ printf(" %sFAIL%s %s:%d: no callable-sourced CALLS edge — fixture not "+ "exercised; the no-edge invariant for %s is vacuous\n",+ tf_red(), tf_reset(), __FILE__, __LINE__, callee_substr);+ rc = 1;+ }if (!inv_no_calls_edge_to_qn(store, lp.project, callee_substr)) {printf(" %sFAIL%s %s:%d: a CALLS edge unexpectedly targets %s ""(expected NONE — callee is unresolvable)\n",@@ -309,11 +324,11 @@ static const RFile kGoCrossFile[] = {* "lsp_unresolved"). NOTE: emit_unresolved_call uses confidence 0.0, so the* pipeline may not promote it into a CALLS edge with the strategy tag — this* fixture documents whether "lsp_unresolved" surfaces in the graph. */-static const char kGoUnresolved[] =- "package main\n"- "func caller(v int) int {\n"- " return totallyUnknownFn(v)\n"- "}\n";+static const char kGoUnresolved[] = "package main\n"+ "func known(x int) int { return x + 1 }\n"+ "func caller(v int) int {\n"+ " return known(v) + totallyUnknownFn(v)\n"+ "}\n";/* ── Python fixtures ───────────────────────────────────────────────────────── */@@ -386,13 +401,13 @@ static const RFile kPyModuleAttr[] = {* symbol lookup misses → best-effort "module.attr" QN, low confidence). helpers* defines nothing named missing_fn. */static const RFile kPyModuleAttrUnresolved[] = {- {"helpers.py",- "def do_work(x):\n"- " return x + 9\n"},- {"main.py",- "import helpers\n"- "def caller(v):\n"- " return helpers.missing_fn(v)\n"},+ {"helpers.py", "def do_work(x):\n"+ " return x + 9\n"},+ {"main.py", "import helpers\n"+ "def known(x):\n"+ " return x + 1\n"+ "def caller(v):\n"+ " return known(v) + helpers.missing_fn(v)\n"},};/* lsp_dict_dispatch — funcs["key"]() where funcs is a dict-literal dispatchdiff --git a/tests/repro/repro_lsp_java_cs.c b/tests/repro/repro_lsp_java_cs.cindex a898f8795..fed8a6121 100644--- a/tests/repro/repro_lsp_java_cs.c+++ b/tests/repro/repro_lsp_java_cs.c@@ -174,6 +174,21 @@ static int assert_no_resolvable_edge(const char *filename, const char *src,return 1;}int rc = 0;+ /* Exercised-check: the fixture MUST produce at least one callable-sourced+ * CALLS edge (its in-fixture control call). Without it the "no edge to+ * <callee>" invariant is VACUOUS — it also passes when extraction silently+ * produced nothing, so a green would not prove the unresolvable call was+ * actually processed and correctly dropped. */+ int module_sourced = -1;+ int callable_sourced = -1;+ inv_count_calls_by_source(store, lp.project, &module_sourced, &callable_sourced);+ (void)module_sourced;+ if (callable_sourced <= 0) {+ printf(" %sFAIL%s %s:%d: no callable-sourced CALLS edge — fixture not "+ "exercised; the no-edge invariant for %s is vacuous\n",+ tf_red(), tf_reset(), __FILE__, __LINE__, callee_substr);+ rc = 1;+ }if (!inv_no_calls_edge_to_qn(store, lp.project, callee_substr)) {printf(" %sFAIL%s %s:%d: a CALLS edge unexpectedly targets %s ""(expected NONE — callee is unresolvable)\n",@@ -245,7 +260,8 @@ static const char kJavaStaticImport[] =static const char kJavaStaticImportText[] ="import static java.lang.Math.max;\n""class Client {\n"- " int run(int a, int b) { return max(a, b); }\n"+ " int known(int x) { return x + 1; }\n"+ " int run(int a, int b) { return known(a) + max(a, b); }\n""}\n";/* lsp_super_dispatch — super.method() resolves on the superclass@@ -375,7 +391,8 @@ static const char kJavaConstructorSynth[] =* surfaces on a CALLS edge at all. */static const char kJavaUnresolved[] ="class Client {\n"- " int run(int v) { return totallyUnknownFn(v); }\n"+ " int known(int x) { return x + 1; }\n"+ " int run(int v) { return known(v) + totallyUnknownFn(v); }\n""}\n";/* ── C# fixtures ─────────────────────────────────────────────────────────────@@ -402,7 +419,7 @@ static const char kCsStaticTypedUnindexed[] =" public static int Known() { return 1; }\n""}\n""class Client {\n"- " public int Run() { return Helper.Missing(); }\n"+ " public int Run() { return Helper.Known() + Helper.Missing(); }\n""}\n";/* cs_method_typed — obj.Method() on the object's OWN declared type@@ -450,7 +467,7 @@ static const char kCsMethodTypedUnindexed[] =" public int Inc(int x) { return x + 1; }\n""}\n""class Client {\n"- " public int Run(Counter c) { return c.Missing(); }\n"+ " public int Run(Counter c) { return c.Inc(1) + c.Missing(); }\n""}\n";/* cs_self_method — a bare Method() resolved on the enclosing classdiff --git a/tests/repro/repro_lsp_ts.c b/tests/repro/repro_lsp_ts.cindex 38dee95c1..509679eb6 100644--- a/tests/repro/repro_lsp_ts.c+++ b/tests/repro/repro_lsp_ts.c@@ -193,6 +193,21 @@ static int assert_no_resolvable_edge(const char *filename, const char *src,return 1;}int rc = 0;+ /* Exercised-check: the fixture MUST produce at least one callable-sourced+ * CALLS edge (its in-fixture control call). Without it the "no edge to+ * <callee>" invariant is VACUOUS — it also passes when extraction silently+ * produced nothing, so a green would not prove the unresolvable call was+ * actually processed and correctly dropped. */+ int module_sourced = -1;+ int callable_sourced = -1;+ inv_count_calls_by_source(store, lp.project, &module_sourced, &callable_sourced);+ (void)module_sourced;+ if (callable_sourced <= 0) {+ printf(" %sFAIL%s %s:%d: no callable-sourced CALLS edge — fixture not "+ "exercised; the no-edge invariant for %s is vacuous\n",+ tf_red(), tf_reset(), __FILE__, __LINE__, callee_substr);+ rc = 1;+ }if (!inv_no_calls_edge_to_qn(store, lp.project, callee_substr)) {printf(" %sFAIL%s %s:%d: a CALLS edge unexpectedly targets %s ""(expected NONE — callee is unresolvable)\n",@@ -333,7 +348,8 @@ static const char kTsDefault[] =* is EXPECTED ABSENT (RED) — it documents whether "lsp_unresolved" surfaces in* the graph. */static const char kTsUnresolved[] =- "function caller(v: number): number { return totallyUnknownFn(v); }\n";+ "function known(x: number): number { return x + 1; }\n"+ "function caller(v: number): number { return known(v) + totallyUnknownFn(v); }\n";/* ── Per-strategy tests ──────────────────────────────────────────────────── */