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

Function observe_incremental_generation

tests/test_pipeline.c:4278–4310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4276
4277#if defined(CBM_INCREMENTAL_TEST_API) && CBM_INCREMENTAL_TEST_API
4278static void observe_incremental_generation(const char *db_path, const char *project,
4279 int generation_size, int *before_count,
4280 int *after_count) {
4281 *before_count = -1;
4282 *after_count = -1;
4283 cbm_store_t *store = cbm_store_open_path(db_path);
4284 if (!store || !project) {
4285 if (store) {
4286 cbm_store_close(store);
4287 }
4288 return;
4289 }
4290
4291 int before = 0;
4292 int after = 0;
4293 for (int i = 0; i < generation_size; i++) {
4294 char before_name[32];
4295 char after_name[32];
4296 snprintf(before_name, sizeof(before_name), "Before%02d", i);
4297 snprintf(after_name, sizeof(after_name), "After%02d", i);
4298 int before_nodes = named_node_count(store, project, before_name);
4299 int after_nodes = named_node_count(store, project, after_name);
4300 if (before_nodes < 0 || after_nodes < 0) {
4301 cbm_store_close(store);
4302 return;
4303 }
4304 before += before_nodes;
4305 after += after_nodes;
4306 }
4307 cbm_store_close(store);
4308 *before_count = before;
4309 *after_count = after;
4310}
4311
4312/* A parallel incremental run must preserve its prior database when the
4313 * per-file result cache cannot be allocated. A clean retry must then converge

Callers 1

test_pipeline.cFile · 0.85

Calls 3

cbm_store_open_pathFunction · 0.85
cbm_store_closeFunction · 0.85
named_node_countFunction · 0.85

Tested by

no test coverage detected