From aff9bfbbaff3c0a80d06180c89f6a99a13dd6920 Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Sat, 27 Jun 2026 16:23:26 +0200 Subject: [PATCH] fix(test): resolve 18 make-test regressions from the marathon batch make-test ran for the first time after the lint gate cleared and caught 18 failures: - REVERT #521 YAML string_ref skip (extract_unified.c): it broke K8s manifest resource/infra extraction (7 tests) and didn't fix its own repro. repro_issue521 returns to RED (1 repro vs 7 regressions); #523/#520 kept. - REVERT c_lsp.c new_expression ctor->class-node change: existing tests expect the synthesized Type.Type ctor QN (3 clsp tests). repro_lsp_c_cpp kConstructor uses an explicit ctor + asserts strategy presence only, so it stays green. - UPDATE tests for INTENTIONAL label changes (production verified correct): struct defs now 'Struct' not 'Class' for Rust/Go (test_extraction.c, test_pipeline.c go type-classification/grouped/docstring, test_grammar_labels rust golden); Pony member funcs 'Method' (golden + probe_pony); PROPERTIES/GraphQL/Prisma now extract Variable/Field (goldens + probe_properties). Signed-off-by: Martin Vogel --- internal/cbm/extract_unified.c | 10 ---------- internal/cbm/lsp/c_lsp.c | 16 +--------------- tests/test_extraction.c | 4 ++-- tests/test_grammar_labels.c | 10 +++++----- tests/test_grammar_probe_d.c | 7 ++++--- tests/test_grammar_probe_g.c | 6 ++++-- tests/test_pipeline.c | 8 ++++---- 7 files changed, 20 insertions(+), 41 deletions(-) diff --git a/internal/cbm/extract_unified.c b/internal/cbm/extract_unified.c index 54847bc79..a9725b9a1 100644 --- a/internal/cbm/extract_unified.c +++ b/internal/cbm/extract_unified.c @@ -451,16 +451,6 @@ static void handle_string_refs(CBMExtractCtx *ctx, TSNode node, const WalkState return; } - /* YAML leaf values are emitted by walk_yaml_mapping (handle_yaml_nested), - * which carries the dotted key_path needed by the #521 upstream/config-URL - * deny check in try_upsert_infra_route. Emitting them here too would create a - * duplicate string_ref with key_path == NULL that bypasses that deny check and - * mints a spurious Route node for config/upstream/healthcheck URLs. Skip YAML - * here so the key_path-aware walk remains the single authority. */ - if (ctx->language == CBM_LANG_YAML) { - return; - } - /* Extract string content */ char *text = cbm_node_text(ctx->arena, node, ctx->source); if (!text || !text[0]) { diff --git a/internal/cbm/lsp/c_lsp.c b/internal/cbm/lsp/c_lsp.c index ff404d092..1c6b30c8d 100644 --- a/internal/cbm/lsp/c_lsp.c +++ b/internal/cbm/lsp/c_lsp.c @@ -3741,22 +3741,8 @@ static void c_resolve_calls_in_node_inner(CLSPContext *ctx, TSNode node) { if (type_qn) { const char *short_name = strrchr(type_qn, '.'); short_name = short_name ? short_name + 1 : type_qn; - const char *last_colon = strrchr(type_qn, ':'); - if (last_colon) - short_name = last_colon + 1; const char *ctor_qn = cbm_arena_sprintf(ctx->arena, "%s.%s", type_qn, short_name); - /* Point at the synthesized `Type.Type` ctor node only if it - * actually exists in the registry (explicit constructor). When - * the class has no user-declared constructor there is no such - * node, so resolve `new Foo()` to the Foo CLASS node (type_qn) - * instead — its short name equals the textual callee ("Foo"), - * so the pipeline join matches and a CALLS edge forms. Mirrors - * java_lsp.c object_creation_expression. */ - if (cbm_registry_lookup_method(ctx->registry, type_qn, short_name)) { - c_emit_resolved_call(ctx, ctor_qn, "lsp_constructor", 0.95f); - } else { - c_emit_resolved_call(ctx, type_qn, "lsp_constructor", 0.95f); - } + c_emit_resolved_call(ctx, ctor_qn, "lsp_constructor", 0.95f); } } } diff --git a/tests/test_extraction.c b/tests/test_extraction.c index 7b2a1071a..d5550ecec 100644 --- a/tests/test_extraction.c +++ b/tests/test_extraction.c @@ -630,7 +630,7 @@ TEST(rust_struct) { CBM_LANG_RUST, "t", "point.rs"); ASSERT_NOT_NULL(r); ASSERT_FALSE(r->has_error); - ASSERT(has_def(r, "Class", "Point")); + ASSERT(has_def(r, "Struct", "Point")); ASSERT(has_def(r, "Method", "new")); cbm_free_result(r); PASS(); @@ -655,7 +655,7 @@ TEST(go_struct) { CBM_LANG_GO, "t", "server.go"); ASSERT_NOT_NULL(r); ASSERT_FALSE(r->has_error); - ASSERT(has_def(r, "Class", "Server")); + ASSERT(has_def(r, "Struct", "Server")); ASSERT(has_def(r, "Method", "Start")); cbm_free_result(r); PASS(); diff --git a/tests/test_grammar_labels.c b/tests/test_grammar_labels.c index 121fc01cd..6705033a6 100644 --- a/tests/test_grammar_labels.c +++ b/tests/test_grammar_labels.c @@ -87,7 +87,7 @@ static const LabelGolden LABEL_GOLDENS[] = { {"tsx", "Function:1,Module:1"}, {"java", "Class:1,Method:1,Module:1"}, {"kotlin", "Class:1,Function:1,Module:1"}, - {"rust", "Class:1,Function:1,Module:1"}, + {"rust", "Function:1,Module:1,Struct:1"}, {"ruby", "Class:1,Function:1,Module:1"}, {"php", "Class:1,Function:1,Module:1"}, {"c_sharp", "Class:1,Method:1,Module:1"}, @@ -134,7 +134,7 @@ static const LabelGolden LABEL_GOLDENS[] = { {"ocaml", "Function:2,Module:1"}, {"odin", "Function:2,Module:1"}, {"pascal", "Function:1,Module:1"}, - {"pony", "Class:1,Function:1,Module:1"}, + {"pony", "Class:1,Method:1,Module:1"}, {"purescript", "Function:1,Module:1"}, {"racket", "Function:2,Module:1"}, {"rescript", "Function:2,Module:1"}, @@ -200,8 +200,8 @@ static const LabelGolden LABEL_GOLDENS[] = { {"nix", "Module:1"}, {"gomod", "Module:1"}, {"gotemplate", "Module:1"}, - {"graphql", "Class:1,Module:1"}, - {"prisma", "Class:1,Module:1"}, + {"graphql", "Class:1,Field:1,Module:1"}, + {"prisma", "Class:1,Field:1,Module:1"}, {"thrift", "Function:1,Module:1"}, {"capnp", "Class:1,Module:1"}, {"smithy", "Class:1,Module:1"}, @@ -218,7 +218,7 @@ static const LabelGolden LABEL_GOLDENS[] = { {"diff", "Module:1"}, {"regex", "Module:1"}, {"requirements", "Module:1"}, - {"properties", "Module:1"}, + {"properties", "Module:1,Variable:2"}, {"gitignore", "Module:1"}, {"gitattributes", "Module:1"}, {"sshconfig", "Module:1"}, diff --git a/tests/test_grammar_probe_d.c b/tests/test_grammar_probe_d.c index de02097c6..717cfbe93 100644 --- a/tests/test_grammar_probe_d.c +++ b/tests/test_grammar_probe_d.c @@ -1129,7 +1129,7 @@ TEST(probe_pony_actor_node) { PASS(); } -/* Pony: methods (fun/be/new) → Function nodes. */ +/* Pony: methods (fun/be/new) inside a type → Method nodes. */ TEST(probe_pony_method_nodes) { GpdMetrics m = gpd_metrics("Math.pony", "primitive Math\n" @@ -1139,8 +1139,9 @@ TEST(probe_pony_method_nodes) { " fun cube(n: U64): U64 =>\n" " n * square(n)\n"); ASSERT_TRUE(m.ok); - /* GREEN: fun methods must produce Function nodes. */ - ASSERT_TRUE(m.functions >= 1); + /* GREEN: fun methods inside a primitive/actor/class are promoted to Method + * nodes (extract_defs.c Pony method-promotion), so assert on m.methods. */ + ASSERT_TRUE(m.methods >= 1); PASS(); } diff --git a/tests/test_grammar_probe_g.c b/tests/test_grammar_probe_g.c index 185ca4bac..3a95612a2 100644 --- a/tests/test_grammar_probe_g.c +++ b/tests/test_grammar_probe_g.c @@ -780,9 +780,11 @@ TEST(probe_properties_module_only) { "server.port=8080\n" "log.level=INFO\n"); ASSERT_TRUE(m.ok); - /* GREEN: .properties produces only a Module node. */ + /* GREEN: .properties produces a Module node plus one Variable per `key=value` + * property line (extract_defs.c CBM_LANG_PROPERTIES → push_var_def). The + * fixture has 3 property lines (server.host, server.port, log.level). */ ASSERT_TRUE(m.modules == 1); - ASSERT_TRUE(m.variables == 0); + ASSERT_TRUE(m.variables == 3); PASS(); } diff --git a/tests/test_pipeline.c b/tests/test_pipeline.c index aca6c0d78..3e7edf23c 100644 --- a/tests/test_pipeline.c +++ b/tests/test_pipeline.c @@ -1829,10 +1829,10 @@ TEST(pipeline_go_type_classification) { ASSERT_EQ(ic, 2); cbm_store_free_nodes(ifaces, ic); - /* Should have 1 Class node (Config struct) */ + /* Should have 1 Struct node (Config struct) */ cbm_node_t *cls = NULL; int cc = 0; - cbm_store_find_nodes_by_label(s, proj, "Class", &cls, &cc); + cbm_store_find_nodes_by_label(s, proj, "Struct", &cls, &cc); ASSERT_EQ(cc, 1); ASSERT_STR_EQ(cls[0].name, "Config"); cbm_store_free_nodes(cls, cc); @@ -1876,7 +1876,7 @@ TEST(pipeline_go_grouped_types) { cbm_node_t *cls = NULL; int cc = 0; - cbm_store_find_nodes_by_label(s, proj, "Class", &cls, &cc); + cbm_store_find_nodes_by_label(s, proj, "Struct", &cls, &cc); ASSERT_EQ(cc, 2); /* Request, Response */ cbm_store_free_nodes(cls, cc); @@ -2389,7 +2389,7 @@ TEST(pipeline_docstring_go_class) { bool found_docstring = false; for (int i = 0; i < nc; i++) { - if (strcmp(nodes[i].label, "Class") == 0 && nodes[i].properties_json && + if (strcmp(nodes[i].label, "Struct") == 0 && nodes[i].properties_json && strstr(nodes[i].properties_json, "docstring") && strstr(nodes[i].properties_json, "MyStruct is documented")) { found_docstring = true;