MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / create_tests_file_edges

Function create_tests_file_edges

src/pipeline/pass_tests.c:252–283  ·  view source on GitHub ↗

Create TESTS_FILE edges from test File nodes to production File nodes. */

Source from the content-addressed store, hash-verified

250
251/* Create TESTS_FILE edges from test File nodes to production File nodes. */
252static int create_tests_file_edges(cbm_pipeline_ctx_t *ctx) {
253 int count = 0;
254 const cbm_gbuf_node_t **file_nodes = NULL;
255 int file_node_count = 0;
256 int rc = cbm_gbuf_find_by_label(ctx->gbuf, "File", &file_nodes, &file_node_count);
257 if (rc != 0) {
258 return 0;
259 }
260
261 for (int i = 0; i < file_node_count; i++) {
262 const cbm_gbuf_node_t *fnode = file_nodes[i];
263 if (!fnode->file_path || !cbm_is_test_path(fnode->file_path)) {
264 continue;
265 }
266
267 char *prod_path = test_to_prod_path(fnode->file_path);
268 if (!prod_path) {
269 continue;
270 }
271
272 char *prod_qn = cbm_pipeline_fqn_compute(ctx->project_name, prod_path, "__file__");
273 const cbm_gbuf_node_t *prod_node = cbm_gbuf_find_by_qn(ctx->gbuf, prod_qn);
274 free(prod_qn);
275 free(prod_path);
276
277 if (prod_node && fnode->id != prod_node->id) {
278 cbm_gbuf_insert_edge(ctx->gbuf, fnode->id, prod_node->id, "TESTS_FILE", "{}");
279 count++;
280 }
281 }
282 return count;
283}
284
285int cbm_pipeline_pass_tests(cbm_pipeline_ctx_t *ctx, const cbm_file_info_t *files, int file_count) {
286 cbm_log_info("pass.start", "pass", "tests");

Callers 1

cbm_pipeline_pass_testsFunction · 0.85

Calls 6

cbm_gbuf_find_by_labelFunction · 0.85
cbm_is_test_pathFunction · 0.85
test_to_prod_pathFunction · 0.85
cbm_pipeline_fqn_computeFunction · 0.85
cbm_gbuf_find_by_qnFunction · 0.85
cbm_gbuf_insert_edgeFunction · 0.85

Tested by

no test coverage detected