From 453e81a6ccfb73e3dfc2ee246a7b86a5d583d329 Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Mon, 2 Mar 2026 03:57:14 -0700 Subject: [PATCH] fix(builder): purge function_complexity table on full rebuild `--no-incremental` full rebuilds didn't clear the `function_complexity` table, causing orphaned rows to accumulate across rebuilds as node IDs get reassigned. Add `DELETE FROM function_complexity` to the full-rebuild purge sequence alongside the existing node_metrics/edges/nodes deletions. Fixes #173 Impact: 1 functions changed, 11 affected --- src/builder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builder.js b/src/builder.js index e194404f..0040e8f2 100644 --- a/src/builder.js +++ b/src/builder.js @@ -435,7 +435,7 @@ export async function buildGraph(rootDir, opts = {}) { if (isFullBuild) { const deletions = - 'PRAGMA foreign_keys = OFF; DELETE FROM node_metrics; DELETE FROM edges; DELETE FROM nodes; PRAGMA foreign_keys = ON;'; + 'PRAGMA foreign_keys = OFF; DELETE FROM node_metrics; DELETE FROM edges; DELETE FROM function_complexity; DELETE FROM nodes; PRAGMA foreign_keys = ON;'; db.exec( hasEmbeddings ? `${deletions.replace('PRAGMA foreign_keys = ON;', '')} DELETE FROM embeddings; PRAGMA foreign_keys = ON;`