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

Function observe_incremental_generation

tests/test_pipeline.c:7712–7744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7710
7711#if defined(CBM_INCREMENTAL_TEST_API) && CBM_INCREMENTAL_TEST_API
7712static void observe_incremental_generation(const char *db_path, const char *project,
7713 int generation_size, int *before_count,
7714 int *after_count) {
7715 *before_count = -1;
7716 *after_count = -1;
7717 cbm_store_t *store = cbm_store_open_path(db_path);
7718 if (!store || !project) {
7719 if (store) {
7720 cbm_store_close(store);
7721 }
7722 return;
7723 }
7724
7725 int before = 0;
7726 int after = 0;
7727 for (int i = 0; i < generation_size; i++) {
7728 char before_name[32];
7729 char after_name[32];
7730 snprintf(before_name, sizeof(before_name), "Before%02d", i);
7731 snprintf(after_name, sizeof(after_name), "After%02d", i);
7732 int before_nodes = named_node_count(store, project, before_name);
7733 int after_nodes = named_node_count(store, project, after_name);
7734 if (before_nodes < 0 || after_nodes < 0) {
7735 cbm_store_close(store);
7736 return;
7737 }
7738 before += before_nodes;
7739 after += after_nodes;
7740 }
7741 cbm_store_close(store);
7742 *before_count = before;
7743 *after_count = after;
7744}
7745
7746/* A parallel incremental run must preserve its prior database when the
7747 * 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