diff --git a/src/domain/graph/builder/stages/detect-changes.ts b/src/domain/graph/builder/stages/detect-changes.ts index e6524cb2..d46a11ab 100644 --- a/src/domain/graph/builder/stages/detect-changes.ts +++ b/src/domain/graph/builder/stages/detect-changes.ts @@ -349,7 +349,7 @@ function findReverseDependencies( const changedArray = [...changedRelPaths]; const nativeResults = nativeDb.findReverseDependencies(changedArray); for (const dep of nativeResults) { - const absPath = path.join(rootDir, dep); + const absPath = path.isAbsolute(dep) ? dep : path.join(rootDir, dep); if (fs.existsSync(absPath)) { reverseDeps.add(dep); } @@ -366,7 +366,7 @@ function findReverseDependencies( for (const relPath of changedRelPaths) { for (const row of findReverseDepsStmt.all(relPath) as Array<{ file: string }>) { if (!changedRelPaths.has(row.file) && !reverseDeps.has(row.file)) { - const absPath = path.join(rootDir, row.file); + const absPath = path.isAbsolute(row.file) ? row.file : path.join(rootDir, row.file); if (fs.existsSync(absPath)) { reverseDeps.add(row.file); } diff --git a/tests/search/embedding-strategy.test.ts b/tests/search/embedding-strategy.test.ts index 58376569..ff0265c6 100644 --- a/tests/search/embedding-strategy.test.ts +++ b/tests/search/embedding-strategy.test.ts @@ -289,7 +289,7 @@ describe('FTS5 index built alongside embeddings', () => { }); }); -describe('absolute file paths in DB (#760)', () => { +describe('absolute file paths in DB (#752)', () => { let absDir: string, absDbPath: string; beforeAll(() => { @@ -314,7 +314,7 @@ describe('absolute file paths in DB (#760)', () => { if (absDir) fs.rmSync(absDir, { recursive: true, force: true }); }); - test('produces embeddings when DB stores absolute paths', async () => { + test('produces embeddings when DB stores absolute paths (structured)', async () => { EMBEDDED_TEXTS.length = 0; await buildEmbeddings(absDir, 'minilm', absDbPath); @@ -325,6 +325,14 @@ describe('absolute file paths in DB (#760)', () => { db.close(); expect(count).toBe(1); }); + + test('produces embeddings when DB stores absolute paths (source)', async () => { + EMBEDDED_TEXTS.length = 0; + await buildEmbeddings(absDir, 'minilm', absDbPath, { strategy: 'source' }); + + expect(EMBEDDED_TEXTS.length).toBe(1); + expect(EMBEDDED_TEXTS[0]).toContain('add'); + }); }); describe('context window overflow detection', () => {