From 850445886cabc8be0504af8770ee031ae8ca8262 Mon Sep 17 00:00:00 2001 From: jbarol Date: Wed, 10 Jun 2026 14:49:24 -0700 Subject: [PATCH] fix(import): stamp unscoped edges 'default', matching the pages-table default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review catch: 'sourceId ?? null' fixed the scoped path but left the unscoped one (reindex --code without --source, importCodeFile callers without opts.sourceId) stranding edges at NULL while their pages land under the schema default (pages.source_id DEFAULT 'default') — so getCallersOf(sym, { sourceId: 'default' }) missed them. Same bug, other door. Fallback is now 'default'. --- src/core/import-file.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/import-file.ts b/src/core/import-file.ts index b64ac400a..39821a195 100644 --- a/src/core/import-file.ts +++ b/src/core/import-file.ts @@ -1235,8 +1235,13 @@ export async function importCodeFile( // `AND source_id = ` whenever a worktree pin / --source is // in play, and a NULL here never matches that filter — so every // scoped call-graph query silently returned 0 rows on - // multi-source brains even though the edges existed. - source_id: sourceId ?? null, + // multi-source brains even though the edges existed. The fallback + // is 'default', NOT null: an unscoped import lands its pages under + // the schema default (pages.source_id DEFAULT 'default'), so a + // NULL-stamped edge would be invisible to the matching scoped + // query getCallersOf(sym, { sourceId: 'default' }) — the same bug + // through the other door. + source_id: sourceId ?? 'default', }); }