fix: use canonical DEFINES rel IDs and remove dead code in loadExistingGraph

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
abhigyanpatwari 2026-02-17 00:49:19 +05:30
parent 9feae692a5
commit abc18da655

View file

@ -582,15 +582,16 @@ export const loadExistingGraph = async (
const fromId = str(row.fromId ?? row[0]);
const toId = str(row.toId ?? row[1]);
if (!nodeIdSet.has(fromId) || !nodeIdSet.has(toId)) continue;
// All relationships are regenerated by the incremental pipeline:
// CONTAINS (processStructure), IMPORTS/CALLS/EXTENDS/IMPLEMENTS
// (full import/call/heritage), MEMBER_OF/STEP_IN_PROCESS (communities/processes).
// Only keep DEFINES for unchanged nodes (File -> code element).
const type = str(row.type ?? row[2]);
// Only keep DEFINES (intra-file, deterministic IDs, only re-created for changed files).
// Everything else is regenerated:
// - CONTAINS: by processStructure on all files
// - IMPORTS, CALLS, EXTENDS, IMPLEMENTS: by full import/call/heritage on all files
// - MEMBER_OF, STEP_IN_PROCESS: by community/process detection
if (type !== 'DEFINES') continue;
// For DEFINES: use the canonical ID format to avoid duplicates with freshly parsed results
const canonicalId = `DEFINES:${fromId}->${toId}`;
relationships.push({
id: `${fromId}_${type}_${toId}`,
id: canonicalId,
sourceId: fromId,
targetId: toId,
type: type as any,