Skip to content
4 changes: 2 additions & 2 deletions src/domain/graph/builder/stages/detect-changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
12 changes: 10 additions & 2 deletions tests/search/embedding-strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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);

Expand All @@ -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', () => {
Expand Down
Loading