fix(import): stamp unscoped edges 'default', matching the pages-table default

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'.
This commit is contained in:
jbarol
2026-06-10 14:49:24 -07:00
parent 9f6cb5d298
commit 850445886c
+7 -2
View File
@@ -1235,8 +1235,13 @@ export async function importCodeFile(
// `AND source_id = <scoped>` 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',
});
}