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

Function incremental_caller_delete

tests/test_pipeline.c:3834–3858  ·  view source on GitHub ↗

Deleting the only script requesting a URL leaves no Route behind -- a full * index never makes one without an edge; the Route a kept script requests * stays. `legacy`: through the full-load route, else closure repair. Returns * the Route count after the deletion, or -1; *route: the route taken. */

Source from the content-addressed store, hash-verified

3832 * stays. `legacy`: through the full-load route, else closure repair. Returns
3833 * the Route count after the deletion, or -1; *route: the route taken. */
3834static int incremental_caller_delete(bool legacy, cbm_incremental_route_t *route) {
3835 char tmp[256];
3836 snprintf(tmp, sizeof(tmp), "/tmp/cbm_routegc_XXXXXX");
3837 if (!cbm_mkdtemp(tmp)) {
3838 return -1;
3839 }
3840 write_temp_file(tmp, "hack/a.sh", "#!/bin/sh\ncurl -fsSL https://dl.example.com/a.tgz\n");
3841 write_temp_file(tmp, "hack/b.sh", "#!/bin/sh\nwget https://dl.example.com/b.tgz\n");
3842 char db_path[512];
3843 snprintf(db_path, sizeof(db_path), "%s/routegc.db", tmp);
3844 static const char routes[] = "SELECT COUNT(*) FROM nodes WHERE label='Route'";
3845 int full = k8s_inc_index(tmp, db_path) == 0 ? k8s_inc_count(db_path, routes) : -1;
3846 char path[512];
3847 snprintf(path, sizeof(path), "%s/hack/a.sh", tmp);
3848 (void)remove(path);
3849#if defined(CBM_INCREMENTAL_TEST_API) && CBM_INCREMENTAL_TEST_API
3850 if (legacy) {
3851 cbm_pipeline_incremental_test_force_legacy_partial_once();
3852 }
3853#endif
3854 int after = k8s_inc_index(tmp, db_path) == 0 ? k8s_inc_count(db_path, routes) : -1;
3855 *route = cbm_pipeline_incremental_test_last_route();
3856 th_rmtree(tmp);
3857 return full == 2 ? after : -1;
3858}
3859
3860TEST(incremental_deleted_caller_drops_its_route) {
3861 cbm_incremental_route_t route = CBM_INCREMENTAL_ROUTE_NONE;

Callers 1

test_pipeline.cFile · 0.85

Calls 8

cbm_mkdtempFunction · 0.85
write_temp_fileFunction · 0.85
k8s_inc_indexFunction · 0.85
k8s_inc_countFunction · 0.85
removeFunction · 0.85
th_rmtreeFunction · 0.85

Tested by

no test coverage detected