mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
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 <martin.vogel.tech@gmail.com>
This commit is contained in:
1 parent
49aab71489
commit
aff9bfbbaf
7 files changed
+20
-41
No files matched your search
@@ -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]) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"},
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user