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

Function observe_incremental_generation

tests/test_pipeline.c:4140–4172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4138
4139#if defined(CBM_INCREMENTAL_TEST_API) && CBM_INCREMENTAL_TEST_API
4140static void observe_incremental_generation(const char *db_path, const char *project,
4141 int generation_size, int *before_count,
4142 int *after_count) {
4143 *before_count = -1;
4144 *after_count = -1;
4145 cbm_store_t *store = cbm_store_open_path(db_path);
4146 if (!store || !project) {
4147 if (store) {
4148 cbm_store_close(store);
4149 }
4150 return;
4151 }
4152
4153 int before = 0;
4154 int after = 0;
4155 for (int i = 0; i < generation_size; i++) {
4156 char before_name[32];
4157 char after_name[32];
4158 snprintf(before_name, sizeof(before_name), "Before%02d", i);
4159 snprintf(after_name, sizeof(after_name), "After%02d", i);
4160 int before_nodes = named_node_count(store, project, before_name);
4161 int after_nodes = named_node_count(store, project, after_name);
4162 if (before_nodes < 0 || after_nodes < 0) {
4163 cbm_store_close(store);
4164 return;
4165 }
4166 before += before_nodes;
4167 after += after_nodes;
4168 }
4169 cbm_store_close(store);
4170 *before_count = before;
4171 *after_count = after;
4172}
4173
4174/* A parallel incremental run must preserve its prior database when the
4175 * 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